Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[E0658] Use of mutable reference in constant functions. #2536

Merged
merged 1 commit into from
Aug 9, 2023

Conversation

MahadMuhammad
Copy link
Contributor

@MahadMuhammad MahadMuhammad commented Aug 8, 2023

Use of mutable reference in constant functions. E0658

Running cases:

For changed_intrinsics:

For internal implementation detail:

/home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/const10.rs:1:18: error: mutable references are not allowed in constant functions [E0658]
    1 | const fn foo (a: &mut i32) { // { dg-error "mutable references are not allowed in constant functions" }
      |                  ^

gcc/rust/ChangeLog:

* checks/errors/rust-const-checker.cc (ConstChecker::visit): added error code.

gcc/rust/ChangeLog:

	* checks/errors/rust-const-checker.cc (ConstChecker::visit):
	Use of mutable reference in constant functions.
	* checks/errors/rust-feature-gate.cc (FeatureGate::gate):
	ErrorCode for intrinsics are subject to change.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
@philberty philberty added this to the GCC 14 Stage 3 milestone Aug 9, 2023
@philberty philberty added this pull request to the merge queue Aug 9, 2023
Merged via the queue into Rust-GCC:master with commit be04efc Aug 9, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostic diagnostic static analysis enhancement
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants