File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
compiler/rustc_passes/src Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -368,11 +368,17 @@ impl CheckAttrVisitor<'tcx> {
368
368
match target {
369
369
Target :: Fn
370
370
| Target :: Method ( MethodKind :: Trait { body : true } | MethodKind :: Inherent ) => true ,
371
+
372
+ // Allow foreign items for SIMD FFI.
373
+ Target :: ForeignFn | Target :: ForeignMod | Target :: ForeignTy | Target :: ForeignStatic => {
374
+ true
375
+ }
376
+
371
377
// FIXME: #[target_feature] was previously erroneously allowed on statements and some
372
378
// crates used this, so only emit a warning.
373
379
Target :: Statement => {
374
380
self . tcx . struct_span_lint_hir ( UNUSED_ATTRIBUTES , hir_id, attr. span , |lint| {
375
- lint. build ( "attribute should be applied to a function" )
381
+ lint. build ( "`#[target_feature]` attribute should be applied to a function" )
376
382
. warn (
377
383
"this was previously accepted by the compiler but is \
378
384
being phased out; it will become a hard error in \
@@ -394,7 +400,10 @@ impl CheckAttrVisitor<'tcx> {
394
400
_ => {
395
401
self . tcx
396
402
. sess
397
- . struct_span_err ( attr. span , "attribute should be applied to a function" )
403
+ . struct_span_err (
404
+ attr. span ,
405
+ "`#[target_feature]` attribute should be applied to a function" ,
406
+ )
398
407
. span_label ( * span, "not a function" )
399
408
. emit ( ) ;
400
409
false
You can’t perform that action at this time.
0 commit comments