This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +16
-0
lines changed Expand file tree Collapse file tree 4 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -798,6 +798,9 @@ passes_unused_duplicate =
798798passes_unused_empty_lints_note =
799799 attribute `{ $name } ` with an empty list has no effect
800800
801+ passes_unused_linker_warnings_note =
802+ the `linker_warnings` lint can only be controlled at the root of a crate with `--crate-type bin`
803+
801804passes_unused_multiple =
802805 multiple `{ $name } ` attributes
803806 .suggestion = remove this attribute
Original file line number Diff line number Diff line change @@ -2271,6 +2271,16 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
22712271 && item. path == sym:: reason
22722272 {
22732273 errors:: UnusedNote :: NoLints { name : attr. name_or_empty ( ) }
2274+ } else if matches ! (
2275+ attr. name_or_empty( ) ,
2276+ sym:: allow | sym:: warn | sym:: deny | sym:: forbid | sym:: expect
2277+ ) && let Some ( meta) = attr. meta_item_list ( )
2278+ && meta. iter ( ) . any ( |meta| {
2279+ meta. meta_item ( ) . map_or ( false , |item| item. path == sym:: linker_messages)
2280+ } )
2281+ && hir_id != CRATE_HIR_ID
2282+ {
2283+ errors:: UnusedNote :: LinkerWarningsBinaryCrateOnly
22742284 } else if attr. name_or_empty ( ) == sym:: default_method_body_is_const {
22752285 errors:: UnusedNote :: DefaultMethodBodyConst
22762286 } else {
Original file line number Diff line number Diff line change @@ -762,6 +762,8 @@ pub(crate) enum UnusedNote {
762762 NoLints { name : Symbol } ,
763763 #[ note( passes_unused_default_method_body_const_note) ]
764764 DefaultMethodBodyConst ,
765+ #[ note( passes_unused_linker_warnings_note) ]
766+ LinkerWarningsBinaryCrateOnly ,
765767}
766768
767769#[ derive( LintDiagnostic ) ]
Original file line number Diff line number Diff line change @@ -1153,6 +1153,7 @@ symbols! {
11531153 link_section,
11541154 linkage,
11551155 linker,
1156+ linker_messages,
11561157 lint_reasons,
11571158 literal,
11581159 load,
You can’t perform that action at this time.
0 commit comments