@@ -1146,39 +1146,46 @@ fn check_attrs_usage(cx: &Context, attrs: &[ast::Attribute]) {
1146
1146
}
1147
1147
1148
1148
fn check_unused_attribute ( cx : & Context , attrs : & [ ast:: Attribute ] ) {
1149
- for attr in attrs . iter ( ) {
1150
- // whitelist docs since rustdoc looks at them
1151
- attr . check_name ( "automatically_derived" ) ;
1152
- attr . check_name ( "doc" ) ;
1153
-
1154
- // these are processed in trans, which happens after the lint pass
1155
- attr . check_name ( "address_insignificant" ) ;
1156
- attr . check_name ( "cold" ) ;
1157
- attr . check_name ( "inline" ) ;
1158
- attr . check_name ( "link" ) ;
1159
- attr . check_name ( "link_name" ) ;
1160
- attr . check_name ( "link_section" ) ;
1161
- attr . check_name ( "no_builtins" ) ;
1162
- attr . check_name ( "no_mangle" ) ;
1163
- attr . check_name ( "no_split_stack" ) ;
1164
- attr . check_name ( "packed" ) ;
1165
- attr . check_name ( "static_assert" ) ;
1166
- attr . check_name ( "thread_local" ) ;
1149
+ static ATTRIBUTE_WHITELIST : & ' static [ & ' static str ] = & ' static [
1150
+ // FIXME: #14408 whitelist docs since rustdoc looks at them
1151
+ "doc" ,
1152
+
1153
+ // FIXME: #14406 these are processed in trans, which happens after the
1154
+ // lint pass
1155
+ "address_insignificant" ,
1156
+ "cold" ,
1157
+ "inline" ,
1158
+ "link" ,
1159
+ "link_name" ,
1160
+ "link_section" ,
1161
+ "no_builtins" ,
1162
+ "no_mangle" ,
1163
+ "no_split_stack" ,
1164
+ "packed" ,
1165
+ "static_assert" ,
1166
+ "thread_local" ,
1167
1167
1168
1168
// not used anywhere (!?) but apparently we want to keep them around
1169
- attr. check_name ( "comment" ) ;
1170
- attr. check_name ( "desc" ) ;
1171
- attr. check_name ( "license" ) ;
1172
-
1173
- // these are only looked at on-demand so we can't guarantee they'll have
1174
- // already been checked
1175
- attr. check_name ( "deprecated" ) ;
1176
- attr. check_name ( "experimental" ) ;
1177
- attr. check_name ( "frozen" ) ;
1178
- attr. check_name ( "locked" ) ;
1179
- attr. check_name ( "must_use" ) ;
1180
- attr. check_name ( "stable" ) ;
1181
- attr. check_name ( "unstable" ) ;
1169
+ "comment" ,
1170
+ "desc" ,
1171
+ "license" ,
1172
+
1173
+ // FIXME: #14407 these are only looked at on-demand so we can't
1174
+ // guarantee they'll have already been checked
1175
+ "deprecated" ,
1176
+ "experimental" ,
1177
+ "frozen" ,
1178
+ "locked" ,
1179
+ "must_use" ,
1180
+ "stable" ,
1181
+ "unstable" ,
1182
+ ] ;
1183
+ for attr in attrs. iter ( ) {
1184
+ for & name in ATTRIBUTE_WHITELIST . iter ( ) {
1185
+ if attr. check_name ( name) {
1186
+ break ;
1187
+ }
1188
+ }
1182
1189
1183
1190
if !attr:: is_used ( attr) {
1184
1191
cx. span_lint ( UnusedAttribute , attr. span , "unused attribute" ) ;
0 commit comments