Skip to content

Commit

Permalink
Downgrade linker-warnings to allow-by-default
Browse files Browse the repository at this point in the history
This needs more time to bake before we turn it on. Turning it on early risks people silencing the warning indefinitely, before we have the chance to make it less noisy.
  • Loading branch information
jyn514 committed Jan 26, 2025
1 parent 15c6f7e commit e2c47a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4091,6 +4091,7 @@ declare_lint! {
/// ### Example
///
/// ```rust,ignore (needs CLI args, platform-specific)
/// #[warn(linker_messages)]
/// extern "C" {
/// fn foo();
/// }
Expand All @@ -4104,17 +4105,20 @@ declare_lint! {
/// >>> referenced by rust_out.69edbd30df4ae57d-cgu.0
/// >>> rust_out.rust_out.69edbd30df4ae57d-cgu.0.rcgu.o:(rust_out::main::h3a90094b06757803)
/// |
/// = note: `#[warn(linker_messages)]` on by default
///
/// note: the lint level is defined here
/// --> warn.rs:1:9
/// |
/// 1 | #![warn(linker_messages)]
/// | ^^^^^^^^^^^^^^^
/// warning: 1 warning emitted
/// ```
///
/// ### Explanation
///
/// Linkers emit platform-specific and program-specific warnings that cannot be predicted in advance by the rust compiler.
/// They are forwarded by default, but can be disabled by adding `#![allow(linker_messages)]` at the crate root.
/// They are forwarded by default, but can be disabled by adding `#![allow(linker_messages)]` at the root of a crate that requires linking.
pub LINKER_MESSAGES,
Warn,
Allow,
"warnings emitted at runtime by the target-specific linker program"
}

Expand Down
1 change: 1 addition & 0 deletions tests/run-make/linker-warning/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fn run_rustc() -> Rustc {
// Make sure we use a consistent value.
.arg("-Clink-self-contained=-linker")
.arg("-Zunstable-options")
.arg("-Wlinker-messages")
.output("main")
.linker("./fake-linker");
if run_make_support::target() == "x86_64-unknown-linux-gnu" {
Expand Down

0 comments on commit e2c47a0

Please sign in to comment.