Skip to content

Commit 31c9479

Browse files
committedJul 23, 2024
Auto merge of #128117 - matthiaskrgr:rollup-7z2pp6o, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #124895 (Disallow hidden references to mutable static) - #128043 (Docs for core::primitive: mention that "core" can be shadowed, too, so we should write "::core") - #128092 (Remove wrapper functions from c.rs) - #128100 (Allow to pass a full path for `run-make` tests) - #128106 (Fix return type of FileAttr methods on AIX target) - #128108 (ensure std step before preparing sysroot) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8bfcae7 + b4a0ce6 commit 31c9479

File tree

109 files changed

+1411
-672
lines changed

Some content is hidden

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

109 files changed

+1411
-672
lines changed
 

‎compiler/rustc_driver_impl/src/signal_handler.rs

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ macro raw_errln($tokens:tt) {
3434
}
3535

3636
/// Signal handler installed for SIGSEGV
37+
// FIXME(obeis): Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
38+
#[allow(static_mut_refs)]
3739
extern "C" fn print_stack_trace(_: libc::c_int) {
3840
const MAX_FRAMES: usize = 256;
3941
// Reserve data segment so we don't have to malloc in a signal handler, which might fail

‎compiler/rustc_hir_analysis/messages.ftl

+8-12
Original file line numberDiff line numberDiff line change
@@ -463,24 +463,20 @@ hir_analysis_start_not_target_feature = `#[start]` function is not allowed to ha
463463
hir_analysis_start_not_track_caller = `#[start]` function is not allowed to be `#[track_caller]`
464464
.label = `#[start]` function is not allowed to be `#[track_caller]`
465465
466-
hir_analysis_static_mut_ref = creating a {$shared} reference to a mutable static
467-
.label = {$shared} reference to mutable static
468-
.note = {$shared ->
469-
[shared] this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
470-
*[mutable] this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
471-
}
466+
hir_analysis_static_mut_ref = creating a {$shared_label}reference to a mutable static
467+
.label = {$shared_label}reference to mutable static
468+
.shared_note = shared references to mutable statics are dangerous since if there's any kind of mutation of, or mutable reference created for, that static while the reference lives, that's undefined behavior
469+
.mut_note = mutable references to mutable statics are dangerous since if there's any other pointer used or reference created for that static while the reference lives, that's undefined behavior
472470
.suggestion = use `addr_of!` instead to create a raw pointer
473471
.suggestion_mut = use `addr_of_mut!` instead to create a raw pointer
474472
475-
hir_analysis_static_mut_refs_lint = creating a {$shared} reference to mutable static is discouraged
476-
.label = {$shared} reference to mutable static
473+
hir_analysis_static_mut_refs_lint = creating a {$shared_label}reference to mutable static is discouraged
474+
.label = {$shared_label}reference to mutable static
477475
.suggestion = use `addr_of!` instead to create a raw pointer
478476
.suggestion_mut = use `addr_of_mut!` instead to create a raw pointer
479477
.note = this will be a hard error in the 2024 edition
480-
.why_note = {$shared ->
481-
[shared] this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
482-
*[mutable] this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
483-
}
478+
.shared_note = shared references to mutable statics are dangerous since if there's any kind of mutation of, or mutable reference created for, that static while the reference lives, that's undefined behavior
479+
.mut_note = mutable references to mutable statics are dangerous since if there's any other pointer used or reference created for that static while the reference lives, that's undefined behavior
484480
485481
hir_analysis_static_specialize = cannot specialize on `'static` lifetime
486482

0 commit comments

Comments
 (0)