@@ -121,12 +121,12 @@ impl CheckAttrVisitor<'tcx> {
121
121
lint. build ( "`#[inline]` is ignored on constants" )
122
122
. warn (
123
123
"this was previously accepted by the compiler but is \
124
- being phased out; it will become a hard error in \
125
- a future release!",
124
+ being phased out; it will become a hard error in \
125
+ a future release!",
126
126
)
127
127
. note (
128
128
"see issue #65833 <https://github.com/rust-lang/rust/issues/65833> \
129
- for more information",
129
+ for more information",
130
130
)
131
131
. emit ( ) ;
132
132
} ) ;
@@ -165,7 +165,7 @@ impl CheckAttrVisitor<'tcx> {
165
165
. emit ( ) ;
166
166
false
167
167
}
168
- Target :: Fn | Target :: Method ( ..) | Target :: ForeignFn => true ,
168
+ Target :: Fn | Target :: Method ( ..) | Target :: ForeignFn | Target :: Closure => true ,
169
169
_ => {
170
170
struct_span_err ! (
171
171
self . tcx. sess,
@@ -231,8 +231,8 @@ impl CheckAttrVisitor<'tcx> {
231
231
lint. build ( "attribute should be applied to a function" )
232
232
. warn (
233
233
"this was previously accepted by the compiler but is \
234
- being phased out; it will become a hard error in \
235
- a future release!",
234
+ being phased out; it will become a hard error in \
235
+ a future release!",
236
236
)
237
237
. span_label ( * span, "not a function" )
238
238
. emit ( ) ;
@@ -313,16 +313,16 @@ impl CheckAttrVisitor<'tcx> {
313
313
/// Checks if `#[cold]` is applied to a non-function. Returns `true` if valid.
314
314
fn check_cold ( & self , hir_id : HirId , attr : & Attribute , span : & Span , target : Target ) {
315
315
match target {
316
- Target :: Fn | Target :: Method ( ..) | Target :: ForeignFn => { }
316
+ Target :: Fn | Target :: Method ( ..) | Target :: ForeignFn | Target :: Closure => { }
317
317
_ => {
318
318
// FIXME: #[cold] was previously allowed on non-functions and some crates used
319
319
// this, so only emit a warning.
320
320
self . tcx . struct_span_lint_hir ( UNUSED_ATTRIBUTES , hir_id, attr. span , |lint| {
321
321
lint. build ( "attribute should be applied to a function" )
322
322
. warn (
323
323
"this was previously accepted by the compiler but is \
324
- being phased out; it will become a hard error in \
325
- a future release!",
324
+ being phased out; it will become a hard error in \
325
+ a future release!",
326
326
)
327
327
. span_label ( * span, "not a function" )
328
328
. emit ( ) ;
@@ -343,8 +343,8 @@ impl CheckAttrVisitor<'tcx> {
343
343
lint. build ( "attribute should be applied to a foreign function or static" ) ;
344
344
diag. warn (
345
345
"this was previously accepted by the compiler but is \
346
- being phased out; it will become a hard error in \
347
- a future release!",
346
+ being phased out; it will become a hard error in \
347
+ a future release!",
348
348
) ;
349
349
350
350
// See issue #47725
@@ -409,8 +409,8 @@ impl CheckAttrVisitor<'tcx> {
409
409
lint. build ( "attribute should be applied to a function or static" )
410
410
. warn (
411
411
"this was previously accepted by the compiler but is \
412
- being phased out; it will become a hard error in \
413
- a future release!",
412
+ being phased out; it will become a hard error in \
413
+ a future release!",
414
414
)
415
415
. span_label ( * span, "not a function or static" )
416
416
. emit ( ) ;
0 commit comments