File tree 4 files changed +16
-0
lines changed
4 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -798,6 +798,9 @@ passes_unused_duplicate =
798
798
passes_unused_empty_lints_note =
799
799
attribute `{ $name } ` with an empty list has no effect
800
800
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
+
801
804
passes_unused_multiple =
802
805
multiple `{ $name } ` attributes
803
806
.suggestion = remove this attribute
Original file line number Diff line number Diff line change @@ -2271,6 +2271,16 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
2271
2271
&& item. path == sym:: reason
2272
2272
{
2273
2273
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
2274
2284
} else if attr. name_or_empty ( ) == sym:: default_method_body_is_const {
2275
2285
errors:: UnusedNote :: DefaultMethodBodyConst
2276
2286
} else {
Original file line number Diff line number Diff line change @@ -762,6 +762,8 @@ pub(crate) enum UnusedNote {
762
762
NoLints { name : Symbol } ,
763
763
#[ note( passes_unused_default_method_body_const_note) ]
764
764
DefaultMethodBodyConst ,
765
+ #[ note( passes_unused_linker_warnings_note) ]
766
+ LinkerWarningsBinaryCrateOnly ,
765
767
}
766
768
767
769
#[ derive( LintDiagnostic ) ]
Original file line number Diff line number Diff line change @@ -1153,6 +1153,7 @@ symbols! {
1153
1153
link_section,
1154
1154
linkage,
1155
1155
linker,
1156
+ linker_messages,
1156
1157
lint_reasons,
1157
1158
literal,
1158
1159
load,
You can’t perform that action at this time.
0 commit comments