-
Notifications
You must be signed in to change notification settings - Fork 12.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only allow immutable statics with #[linkage] #125046
Conversation
This comment has been minimized.
This comment has been minimized.
e4a404a
to
88b27eb
Compare
@@ -327,6 +327,10 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { | |||
} else { | |||
codegen_fn_attrs.linkage = linkage; | |||
} | |||
if tcx.is_mutable_static(did.into()) { | |||
tcx.dcx() | |||
.span_err(attr.span, "mutable statics are not allowed with #[linkage]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.span_err(attr.span, "mutable statics are not allowed with #[linkage]"); | |
.span_err(attr.span, "mutable statics are not allowed with `#[linkage]`"); |
Also maybe worth while explaining why in a note
, or linking to something that explains why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
88b27eb
to
715d72f
Compare
This comment has been minimized.
This comment has been minimized.
715d72f
to
531dae1
Compare
@rustbot ready |
Should this be considered as a breaking change that requires t-lang signoff, or as something that has never worked ever? |
|
Indeed. |
…r=cjgillot Only allow immutable statics with #[linkage]
…kingjubilee Rollup of 10 pull requests Successful merges: - rust-lang#125046 (Only allow immutable statics with #[linkage]) - rust-lang#125466 (Don't continue probing for method if in suggestion and autoderef hits ambiguity) - rust-lang#125469 (Don't skip out of inner const when looking for body for suggestion) - rust-lang#125530 (cleanup dependence of `ExtCtxt` in transcribe when macro expansion) - rust-lang#125535 (clean-up: remove deprecated field `dist.missing-tools`) - rust-lang#125539 (crashes: increment the number of tracked ones) - rust-lang#125544 (Also mention my-self for other check-cfg docs changes) - rust-lang#125559 (Simplify the `unchecked_sh[lr]` ub-checks a bit) - rust-lang#125566 (Notify T-rustdoc for beta-accepted and stable-accepted too) - rust-lang#125582 (Avoid a `FieldIdx::from_usize` in InstSimplify) r? `@ghost` `@rustbot` modify labels: rollup
…kingjubilee Rollup of 10 pull requests Successful merges: - rust-lang#125046 (Only allow immutable statics with #[linkage]) - rust-lang#125466 (Don't continue probing for method if in suggestion and autoderef hits ambiguity) - rust-lang#125469 (Don't skip out of inner const when looking for body for suggestion) - rust-lang#125530 (cleanup dependence of `ExtCtxt` in transcribe when macro expansion) - rust-lang#125535 (clean-up: remove deprecated field `dist.missing-tools`) - rust-lang#125539 (crashes: increment the number of tracked ones) - rust-lang#125544 (Also mention my-self for other check-cfg docs changes) - rust-lang#125559 (Simplify the `unchecked_sh[lr]` ub-checks a bit) - rust-lang#125566 (Notify T-rustdoc for beta-accepted and stable-accepted too) - rust-lang#125582 (Avoid a `FieldIdx::from_usize` in InstSimplify) r? `@ghost` `@rustbot` modify labels: rollup
…r=cjgillot Only allow immutable statics with #[linkage]
…r=cjgillot Only allow immutable statics with #[linkage]
…kingjubilee Rollup of 8 pull requests Successful merges: - rust-lang#124048 (Support C23's Variadics Without a Named Parameter) - rust-lang#125046 (Only allow immutable statics with #[linkage]) - rust-lang#125466 (Don't continue probing for method if in suggestion and autoderef hits ambiguity) - rust-lang#125469 (Don't skip out of inner const when looking for body for suggestion) - rust-lang#125544 (Also mention my-self for other check-cfg docs changes) - rust-lang#125559 (Simplify the `unchecked_sh[lr]` ub-checks a bit) - rust-lang#125566 (Notify T-rustdoc for beta-accepted and stable-accepted too) - rust-lang#125582 (Avoid a `FieldIdx::from_usize` in InstSimplify) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#125046 - bjorn3:no_mutable_static_linkage, r=cjgillot Only allow immutable statics with #[linkage]
No description provided.