diff options
| author | bors <bors@rust-lang.org> | 2024-09-20 17:25:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-09-20 17:25:34 +0000 |
| commit | 5ba6db1b648d93fbbab4ae0466e40db682fa45fc (patch) | |
| tree | c9c5732d1f0b4eee1f04aa23d4ff945545d2a698 /compiler/rustc_error_codes | |
| parent | fb46739014564a3c709c43e1429a6a5d71c97e26 (diff) | |
| parent | 3b0ce1bc33d30d7d116ee9af60df873e04bd74dc (diff) | |
| download | rust-5ba6db1b648d93fbbab4ae0466e40db682fa45fc.tar.gz rust-5ba6db1b648d93fbbab4ae0466e40db682fa45fc.zip | |
Auto merge of #124895 - obeis:static-mut-hidden-ref, r=compiler-errors
Disallow hidden references to mutable static Closes #123060 Tracking: - https://github.com/rust-lang/rust/issues/123758
Diffstat (limited to 'compiler/rustc_error_codes')
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0796.md | 6 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/lib.rs | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0796.md b/compiler/rustc_error_codes/src/error_codes/E0796.md index 7ac429e5215..ced163e98f7 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0796.md +++ b/compiler/rustc_error_codes/src/error_codes/E0796.md @@ -1,14 +1,14 @@ +#### Note: this error code is no longer emitted by the compiler. + You have created a reference to a mutable static. Erroneous code example: -```compile_fail,edition2024,E0796 +``` static mut X: i32 = 23; - fn work() { let _val = unsafe { X }; } - let x_ref = unsafe { &mut X }; work(); // The next line has Undefined Behavior! diff --git a/compiler/rustc_error_codes/src/lib.rs b/compiler/rustc_error_codes/src/lib.rs index d6f0206b0de..11cad0b8f97 100644 --- a/compiler/rustc_error_codes/src/lib.rs +++ b/compiler/rustc_error_codes/src/lib.rs @@ -681,3 +681,4 @@ E0800: 0800, // E0723, // unstable feature in `const` context // E0738, // Removed; errored on `#[track_caller] fn`s in `extern "Rust" { ... }`. // E0744, // merged into E0728 +// E0796, // unused error code. We use `static_mut_refs` lint instead. |
