File tree Expand file tree Collapse file tree 4 files changed +49
-2
lines changed Expand file tree Collapse file tree 4 files changed +49
-2
lines changed Original file line number Diff line number Diff line change 44extern "C" fn f ( ) { }
55//~^^ ERROR `#[track_caller]` requires Rust ABI
66
7+ extern "C" {
8+ #[ track_caller]
9+ fn g ( ) ;
10+ //~^^ ERROR `#[track_caller]` requires Rust ABI
11+ }
12+
713fn main ( ) { }
Original file line number Diff line number Diff line change @@ -4,6 +4,12 @@ error[E0737]: `#[track_caller]` requires Rust ABI
44LL | #[track_caller]
55 | ^^^^^^^^^^^^^^^
66
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
814
915For 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 { }
6565#[ target_feature( enable = "sse2" ) ]
6666unsafe fn test ( ) { }
6767
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+
6880fn main ( ) {
6981 unsafe {
7082 foo ( ) ;
7183 bar ( ) ;
7284 }
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
7390}
Original file line number Diff line number Diff line change @@ -91,5 +91,23 @@ error: cannot use `#[inline(always)]` with `#[target_feature]`
9191LL | #[inline(always)]
9292 | ^^^^^^^^^^^^^^^^^
9393
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
95113
You can’t perform that action at this time.
0 commit comments