diff options
| author | bors <bors@rust-lang.org> | 2024-05-27 00:17:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-05-27 00:17:11 +0000 |
| commit | 529bb2573a2a07d29329db8ff1bac8a7c6a4757f (patch) | |
| tree | f485d74737c7bfd277fa390e44cf915f8b77bd9c /compiler/rustc_codegen_ssa/src | |
| parent | 0aad3f64e29debcb087bdfc2d14e07a12fb3b703 (diff) | |
| parent | 4ff78692db1d213e44d4fe51f59d79cea47c9b77 (diff) | |
| download | rust-529bb2573a2a07d29329db8ff1bac8a7c6a4757f.tar.gz rust-529bb2573a2a07d29329db8ff1bac8a7c6a4757f.zip | |
Auto merge of #125593 - workingjubilee:rollup-67qk7di, r=workingjubilee
Rollup of 8 pull requests Successful merges: - #124048 (Support C23's Variadics Without a Named Parameter) - #125046 (Only allow immutable statics with #[linkage]) - #125466 (Don't continue probing for method if in suggestion and autoderef hits ambiguity) - #125469 (Don't skip out of inner const when looking for body for suggestion) - #125544 (Also mention my-self for other check-cfg docs changes) - #125559 (Simplify the `unchecked_sh[lr]` ub-checks a bit) - #125566 (Notify T-rustdoc for beta-accepted and stable-accepted too) - #125582 (Avoid a `FieldIdx::from_usize` in InstSimplify) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/codegen_attrs.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs index 9bf055b1739..e3e513084ea 100644 --- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs +++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs @@ -327,6 +327,18 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { } else { codegen_fn_attrs.linkage = linkage; } + if tcx.is_mutable_static(did.into()) { + let mut diag = tcx.dcx().struct_span_err( + attr.span, + "mutable statics are not allowed with `#[linkage]`", + ); + diag.note( + "making the static mutable would allow changing which symbol the \ + static references rather than make the target of the symbol \ + mutable", + ); + diag.emit(); + } } } sym::link_section => { |
