diff options
| author | Obei Sideg <obei.sideg@gmail.com> | 2024-08-24 06:47:43 +0300 |
|---|---|---|
| committer | Obei Sideg <obei.sideg@gmail.com> | 2024-09-13 13:33:43 +0300 |
| commit | 74cab947f79045e34eb973199274ee5f3c132bd8 (patch) | |
| tree | c785fec733ea83de04284bc2414ff95abe765ca4 /compiler/rustc_error_codes | |
| parent | d0985bb5240317daaf7c7f8790479e5f08ac0dd5 (diff) | |
| download | rust-74cab947f79045e34eb973199274ee5f3c132bd8.tar.gz rust-74cab947f79045e34eb973199274ee5f3c132bd8.zip | |
Disallow hidden references to mutable static
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 150f99a3ee7..6c887e31924 100644 --- a/compiler/rustc_error_codes/src/lib.rs +++ b/compiler/rustc_error_codes/src/lib.rs @@ -679,3 +679,4 @@ E0798: 0798, // 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. |
