File tree Expand file tree Collapse file tree 3 files changed +13
-13
lines changed Expand file tree Collapse file tree 3 files changed +13
-13
lines changed Original file line number Diff line number Diff line change 1
- //@ add-core-stubs
2
- //@ compile-flags: --crate-type=lib --target x86_64-unknown-none
3
- //@ needs-llvm-components: x86
1
+ // Check we error before unsupported ABIs reach codegen stages.
2
+
4
3
//@ edition: 2018
5
- #![ no_core]
6
- #![ feature( no_core, lang_items) ]
7
- extern crate minicore;
8
- use minicore:: * ;
4
+ //@ compile-flags: --crate-type=lib
5
+ #![ feature( rustc_attrs) ]
9
6
10
- // Check we error before unsupported ABIs reach codegen stages.
7
+ use core :: mem ;
11
8
12
9
fn anything ( ) {
13
- let a = unsafe { mem:: transmute :: < usize , extern "thiscall " fn ( i32 ) > ( 4 ) } ( 2 ) ;
10
+ let a = unsafe { mem:: transmute :: < usize , extern "rust-invalid " fn ( i32 ) > ( 4 ) } ( 2 ) ;
14
11
//~^ ERROR: is not a supported ABI for the current target [E0570]
15
12
}
Original file line number Diff line number Diff line change 1
- error[E0570]: "thiscall " is not a supported ABI for the current target
2
- --> $DIR/unsupported-abi-transmute.rs:13 :53
1
+ error[E0570]: "invalid " is not a supported ABI for the current target
2
+ --> $DIR/unsupported-abi-transmute.rs:10 :53
3
3
|
4
- LL | let a = unsafe { mem::transmute::<usize, extern "thiscall " fn(i32)>(4) }(2);
5
- | ^^^^^^^^^^
4
+ LL | let a = unsafe { mem::transmute::<usize, extern "invalid " fn(i32)>(4) }(2);
5
+ | ^^^^^^^^^
6
6
7
7
error: aborting due to 1 previous error
8
8
Original file line number Diff line number Diff line change 1
1
// Test for https://github.com/rust-lang/rust/issues/86232
2
2
// Due to AST-to-HIR lowering nuances, we used to allow unsupported ABIs to "leak" into the HIR
3
3
// without being checked, as we would check after generating the ExternAbi.
4
+ // Checking afterwards only works if we examine every HIR construct that contains an ExternAbi,
5
+ // and those may be very different in HIR, even if they read the same in source.
6
+ // This made it very easy to make mistakes.
4
7
//
5
8
// Here we test that an unsupported ABI in various impl-related positions will be rejected,
6
9
// both in the original declarations and the actual implementations.
You can’t perform that action at this time.
0 commit comments