Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5ba6db1

Browse files
committedSep 20, 2024
Auto merge of #124895 - obeis:static-mut-hidden-ref, r=compiler-errors
Disallow hidden references to mutable static Closes #123060 Tracking: - #123758
2 parents fb46739 + 3b0ce1b commit 5ba6db1

File tree

124 files changed

+1006
-877
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+1006
-877
lines changed
 

‎compiler/rustc_driver_impl/src/signal_handler.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ macro raw_errln($tokens:tt) {
3535
}
3636

3737
/// Signal handler installed for SIGSEGV
38+
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
39+
#[allow(static_mut_refs)]
3840
extern "C" fn print_stack_trace(_: libc::c_int) {
3941
const MAX_FRAMES: usize = 256;
4042
// Reserve data segment so we don't have to malloc in a signal handler, which might fail

‎compiler/rustc_error_codes/src/error_codes/E0796.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
13
You have created a reference to a mutable static.
24

35
Erroneous code example:
46

5-
```compile_fail,edition2024,E0796
7+
```
68
static mut X: i32 = 23;
7-
89
fn work() {
910
let _val = unsafe { X };
1011
}
11-
1212
let x_ref = unsafe { &mut X };
1313
work();
1414
// The next line has Undefined Behavior!

0 commit comments

Comments
 (0)
Please sign in to comment.