File tree 4 files changed +49
-2
lines changed
4 files changed +49
-2
lines changed Original file line number Diff line number Diff line change 4
4
extern "C" fn f ( ) { }
5
5
//~^^ ERROR `#[track_caller]` requires Rust ABI
6
6
7
+ extern "C" {
8
+ #[ track_caller]
9
+ fn g ( ) ;
10
+ //~^^ ERROR `#[track_caller]` requires Rust ABI
11
+ }
12
+
7
13
fn main ( ) { }
Original file line number Diff line number Diff line change @@ -4,6 +4,12 @@ error[E0737]: `#[track_caller]` requires Rust ABI
4
4
LL | #[track_caller]
5
5
| ^^^^^^^^^^^^^^^
6
6
7
- error: aborting due to previous error
7
+ error[E0737]: `#[track_caller]` requires Rust ABI
8
+ --> $DIR/error-with-invalid-abi.rs:8:5
9
+ |
10
+ LL | #[track_caller]
11
+ | ^^^^^^^^^^^^^^^
12
+
13
+ error: aborting due to 2 previous errors
8
14
9
15
For more information about this error, try `rustc --explain E0737`.
Original file line number Diff line number Diff line change @@ -65,9 +65,26 @@ trait Baz { }
65
65
#[ target_feature( enable = "sse2" ) ]
66
66
unsafe fn test ( ) { }
67
67
68
+ trait Quux {
69
+ fn foo ( ) ;
70
+ }
71
+
72
+ impl Quux for Foo {
73
+ #[ target_feature( enable = "sse2" ) ]
74
+ //~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions
75
+ //~| NOTE can only be applied to `unsafe` functions
76
+ fn foo ( ) { }
77
+ //~^ NOTE not an `unsafe` function
78
+ }
79
+
68
80
fn main ( ) {
69
81
unsafe {
70
82
foo ( ) ;
71
83
bar ( ) ;
72
84
}
85
+ #[ target_feature( enable = "sse2" ) ]
86
+ //~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions
87
+ //~| NOTE can only be applied to `unsafe` functions
88
+ || { } ;
89
+ //~^ NOTE not an `unsafe` function
73
90
}
Original file line number Diff line number Diff line change @@ -91,5 +91,23 @@ error: cannot use `#[inline(always)]` with `#[target_feature]`
91
91
LL | #[inline(always)]
92
92
| ^^^^^^^^^^^^^^^^^
93
93
94
- error: aborting due to 12 previous errors
94
+ error: `#[target_feature(..)]` can only be applied to `unsafe` functions
95
+ --> $DIR/invalid-attribute.rs:85:5
96
+ |
97
+ LL | #[target_feature(enable = "sse2")]
98
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can only be applied to `unsafe` functions
99
+ ...
100
+ LL | || {};
101
+ | ----- not an `unsafe` function
102
+
103
+ error: `#[target_feature(..)]` can only be applied to `unsafe` functions
104
+ --> $DIR/invalid-attribute.rs:73:5
105
+ |
106
+ LL | #[target_feature(enable = "sse2")]
107
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can only be applied to `unsafe` functions
108
+ ...
109
+ LL | fn foo() {}
110
+ | ----------- not an `unsafe` function
111
+
112
+ error: aborting due to 14 previous errors
95
113
You can’t perform that action at this time.
0 commit comments