Skip to content

Commit 6cea550

Browse files
tests: Minicore extern "gpu-kernel" feature test
Explicitly cross-build it for GPU targets and check it errors on hosts.
1 parent d13a431 commit 6cea550

File tree

4 files changed

+172
-21
lines changed

4 files changed

+172
-21
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
2+
--> $DIR/feature-gate-abi_gpu_kernel.rs:16:8
3+
|
4+
LL | extern "gpu-kernel" fn f1(_: ()) {}
5+
| ^^^^^^^^^^^^
6+
|
7+
= note: see issue #135467 <https://github.com/rust-lang/rust/issues/135467> for more information
8+
= help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10+
11+
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
12+
--> $DIR/feature-gate-abi_gpu_kernel.rs:21:12
13+
|
14+
LL | extern "gpu-kernel" fn m1(_: ());
15+
| ^^^^^^^^^^^^
16+
|
17+
= note: see issue #135467 <https://github.com/rust-lang/rust/issues/135467> for more information
18+
= help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable
19+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
20+
21+
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
22+
--> $DIR/feature-gate-abi_gpu_kernel.rs:23:12
23+
|
24+
LL | extern "gpu-kernel" fn dm1(_: ()) {}
25+
| ^^^^^^^^^^^^
26+
|
27+
= note: see issue #135467 <https://github.com/rust-lang/rust/issues/135467> for more information
28+
= help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable
29+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
30+
31+
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
32+
--> $DIR/feature-gate-abi_gpu_kernel.rs:31:12
33+
|
34+
LL | extern "gpu-kernel" fn m1(_: ()) {}
35+
| ^^^^^^^^^^^^
36+
|
37+
= note: see issue #135467 <https://github.com/rust-lang/rust/issues/135467> for more information
38+
= help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable
39+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
40+
41+
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
42+
--> $DIR/feature-gate-abi_gpu_kernel.rs:37:12
43+
|
44+
LL | extern "gpu-kernel" fn im1(_: ()) {}
45+
| ^^^^^^^^^^^^
46+
|
47+
= note: see issue #135467 <https://github.com/rust-lang/rust/issues/135467> for more information
48+
= help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable
49+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
50+
51+
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
52+
--> $DIR/feature-gate-abi_gpu_kernel.rs:42:18
53+
|
54+
LL | type A1 = extern "gpu-kernel" fn(_: ());
55+
| ^^^^^^^^^^^^
56+
|
57+
= note: see issue #135467 <https://github.com/rust-lang/rust/issues/135467> for more information
58+
= help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable
59+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
60+
61+
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
62+
--> $DIR/feature-gate-abi_gpu_kernel.rs:47:8
63+
|
64+
LL | extern "gpu-kernel" {}
65+
| ^^^^^^^^^^^^
66+
|
67+
= note: see issue #135467 <https://github.com/rust-lang/rust/issues/135467> for more information
68+
= help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable
69+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
70+
71+
error: aborting due to 7 previous errors
72+
73+
For more information about this error, try `rustc --explain E0658`.

tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr renamed to tests/ui/feature-gates/feature-gate-abi_gpu_kernel.HOST.stderr

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
2-
--> $DIR/feature-gate-abi_gpu_kernel.rs:11:8
2+
--> $DIR/feature-gate-abi_gpu_kernel.rs:16:8
33
|
44
LL | extern "gpu-kernel" fn f1(_: ()) {}
55
| ^^^^^^^^^^^^
@@ -9,7 +9,7 @@ LL | extern "gpu-kernel" fn f1(_: ()) {}
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

1111
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
12-
--> $DIR/feature-gate-abi_gpu_kernel.rs:16:12
12+
--> $DIR/feature-gate-abi_gpu_kernel.rs:21:12
1313
|
1414
LL | extern "gpu-kernel" fn m1(_: ());
1515
| ^^^^^^^^^^^^
@@ -19,7 +19,7 @@ LL | extern "gpu-kernel" fn m1(_: ());
1919
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2020

2121
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
22-
--> $DIR/feature-gate-abi_gpu_kernel.rs:18:12
22+
--> $DIR/feature-gate-abi_gpu_kernel.rs:23:12
2323
|
2424
LL | extern "gpu-kernel" fn dm1(_: ()) {}
2525
| ^^^^^^^^^^^^
@@ -29,7 +29,7 @@ LL | extern "gpu-kernel" fn dm1(_: ()) {}
2929
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3030

3131
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
32-
--> $DIR/feature-gate-abi_gpu_kernel.rs:26:12
32+
--> $DIR/feature-gate-abi_gpu_kernel.rs:31:12
3333
|
3434
LL | extern "gpu-kernel" fn m1(_: ()) {}
3535
| ^^^^^^^^^^^^
@@ -39,7 +39,7 @@ LL | extern "gpu-kernel" fn m1(_: ()) {}
3939
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4040

4141
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
42-
--> $DIR/feature-gate-abi_gpu_kernel.rs:32:12
42+
--> $DIR/feature-gate-abi_gpu_kernel.rs:37:12
4343
|
4444
LL | extern "gpu-kernel" fn im1(_: ()) {}
4545
| ^^^^^^^^^^^^
@@ -49,7 +49,7 @@ LL | extern "gpu-kernel" fn im1(_: ()) {}
4949
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
5050

5151
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
52-
--> $DIR/feature-gate-abi_gpu_kernel.rs:37:18
52+
--> $DIR/feature-gate-abi_gpu_kernel.rs:42:18
5353
|
5454
LL | type A1 = extern "gpu-kernel" fn(_: ());
5555
| ^^^^^^^^^^^^
@@ -59,7 +59,7 @@ LL | type A1 = extern "gpu-kernel" fn(_: ());
5959
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
6060

6161
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
62-
--> $DIR/feature-gate-abi_gpu_kernel.rs:42:8
62+
--> $DIR/feature-gate-abi_gpu_kernel.rs:47:8
6363
|
6464
LL | extern "gpu-kernel" {}
6565
| ^^^^^^^^^^^^
@@ -69,7 +69,7 @@ LL | extern "gpu-kernel" {}
6969
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
7070

7171
warning: the calling convention "gpu-kernel" is not supported on this target
72-
--> $DIR/feature-gate-abi_gpu_kernel.rs:37:11
72+
--> $DIR/feature-gate-abi_gpu_kernel.rs:42:11
7373
|
7474
LL | type A1 = extern "gpu-kernel" fn(_: ());
7575
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -79,31 +79,31 @@ LL | type A1 = extern "gpu-kernel" fn(_: ());
7979
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
8080

8181
error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target
82-
--> $DIR/feature-gate-abi_gpu_kernel.rs:42:1
82+
--> $DIR/feature-gate-abi_gpu_kernel.rs:47:1
8383
|
8484
LL | extern "gpu-kernel" {}
8585
| ^^^^^^^^^^^^^^^^^^^^^^
8686

8787
error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target
88-
--> $DIR/feature-gate-abi_gpu_kernel.rs:11:1
88+
--> $DIR/feature-gate-abi_gpu_kernel.rs:16:1
8989
|
9090
LL | extern "gpu-kernel" fn f1(_: ()) {}
9191
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9292

9393
error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target
94-
--> $DIR/feature-gate-abi_gpu_kernel.rs:18:5
94+
--> $DIR/feature-gate-abi_gpu_kernel.rs:23:5
9595
|
9696
LL | extern "gpu-kernel" fn dm1(_: ()) {}
9797
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9898

9999
error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target
100-
--> $DIR/feature-gate-abi_gpu_kernel.rs:26:5
100+
--> $DIR/feature-gate-abi_gpu_kernel.rs:31:5
101101
|
102102
LL | extern "gpu-kernel" fn m1(_: ()) {}
103103
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104104

105105
error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target
106-
--> $DIR/feature-gate-abi_gpu_kernel.rs:32:5
106+
--> $DIR/feature-gate-abi_gpu_kernel.rs:37:5
107107
|
108108
LL | extern "gpu-kernel" fn im1(_: ()) {}
109109
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -114,7 +114,7 @@ Some errors have detailed explanations: E0570, E0658.
114114
For more information about an error, try `rustc --explain E0570`.
115115
Future incompatibility report: Future breakage diagnostic:
116116
warning: the calling convention "gpu-kernel" is not supported on this target
117-
--> $DIR/feature-gate-abi_gpu_kernel.rs:37:11
117+
--> $DIR/feature-gate-abi_gpu_kernel.rs:42:11
118118
|
119119
LL | type A1 = extern "gpu-kernel" fn(_: ());
120120
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
2+
--> $DIR/feature-gate-abi_gpu_kernel.rs:16:8
3+
|
4+
LL | extern "gpu-kernel" fn f1(_: ()) {}
5+
| ^^^^^^^^^^^^
6+
|
7+
= note: see issue #135467 <https://github.com/rust-lang/rust/issues/135467> for more information
8+
= help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10+
11+
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
12+
--> $DIR/feature-gate-abi_gpu_kernel.rs:21:12
13+
|
14+
LL | extern "gpu-kernel" fn m1(_: ());
15+
| ^^^^^^^^^^^^
16+
|
17+
= note: see issue #135467 <https://github.com/rust-lang/rust/issues/135467> for more information
18+
= help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable
19+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
20+
21+
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
22+
--> $DIR/feature-gate-abi_gpu_kernel.rs:23:12
23+
|
24+
LL | extern "gpu-kernel" fn dm1(_: ()) {}
25+
| ^^^^^^^^^^^^
26+
|
27+
= note: see issue #135467 <https://github.com/rust-lang/rust/issues/135467> for more information
28+
= help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable
29+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
30+
31+
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
32+
--> $DIR/feature-gate-abi_gpu_kernel.rs:31:12
33+
|
34+
LL | extern "gpu-kernel" fn m1(_: ()) {}
35+
| ^^^^^^^^^^^^
36+
|
37+
= note: see issue #135467 <https://github.com/rust-lang/rust/issues/135467> for more information
38+
= help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable
39+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
40+
41+
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
42+
--> $DIR/feature-gate-abi_gpu_kernel.rs:37:12
43+
|
44+
LL | extern "gpu-kernel" fn im1(_: ()) {}
45+
| ^^^^^^^^^^^^
46+
|
47+
= note: see issue #135467 <https://github.com/rust-lang/rust/issues/135467> for more information
48+
= help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable
49+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
50+
51+
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
52+
--> $DIR/feature-gate-abi_gpu_kernel.rs:42:18
53+
|
54+
LL | type A1 = extern "gpu-kernel" fn(_: ());
55+
| ^^^^^^^^^^^^
56+
|
57+
= note: see issue #135467 <https://github.com/rust-lang/rust/issues/135467> for more information
58+
= help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable
59+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
60+
61+
error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change
62+
--> $DIR/feature-gate-abi_gpu_kernel.rs:47:8
63+
|
64+
LL | extern "gpu-kernel" {}
65+
| ^^^^^^^^^^^^
66+
|
67+
= note: see issue #135467 <https://github.com/rust-lang/rust/issues/135467> for more information
68+
= help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable
69+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
70+
71+
error: aborting due to 7 previous errors
72+
73+
For more information about this error, try `rustc --explain E0658`.
Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
//@ revisions: HOST AMDGPU NVPTX
12
//@ add-core-stubs
23
//@ compile-flags: --crate-type=rlib
4+
//@[AMDGPU] compile-flags: --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx1100
5+
//@[AMDGPU] needs-llvm-components: amdgpu
6+
//@[NVPTX] compile-flags: --target nvptx64-nvidia-cuda
7+
//@[NVPTX] needs-llvm-components: nvptx
38

49
#![feature(no_core, lang_items)]
510
#![no_core]
@@ -9,35 +14,35 @@ use minicore::*;
914

1015
// Functions
1116
extern "gpu-kernel" fn f1(_: ()) {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change
12-
//~^ ERROR is not a supported ABI
17+
//[HOST]~^ ERROR is not a supported ABI
1318

1419
// Methods in trait definition
1520
trait Tr {
1621
extern "gpu-kernel" fn m1(_: ()); //~ ERROR "gpu-kernel" ABI is experimental and subject to change
1722

1823
extern "gpu-kernel" fn dm1(_: ()) {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change
19-
//~^ ERROR is not a supported ABI
24+
//[HOST]~^ ERROR is not a supported ABI
2025
}
2126

2227
struct S;
2328

2429
// Methods in trait impl
2530
impl Tr for S {
2631
extern "gpu-kernel" fn m1(_: ()) {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change
27-
//~^ ERROR is not a supported ABI
32+
//[HOST]~^ ERROR is not a supported ABI
2833
}
2934

3035
// Methods in inherent impl
3136
impl S {
3237
extern "gpu-kernel" fn im1(_: ()) {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change
33-
//~^ ERROR is not a supported ABI
38+
//[HOST]~^ ERROR is not a supported ABI
3439
}
3540

3641
// Function pointer types
3742
type A1 = extern "gpu-kernel" fn(_: ()); //~ ERROR "gpu-kernel" ABI is experimental and subject to change
38-
//~^ WARN the calling convention "gpu-kernel" is not supported on this target
39-
//~^^ WARN this was previously accepted by the compiler but is being phased out
43+
//[HOST]~^ WARNING the calling convention "gpu-kernel" is not supported on this target [unsupported_fn_ptr_calling_conventions]
44+
//[HOST]~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
4045

4146
// Foreign modules
4247
extern "gpu-kernel" {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change
43-
//~^ ERROR is not a supported ABI
48+
//[HOST]~^ ERROR is not a supported ABI

0 commit comments

Comments
 (0)