Skip to content

Commit fc8df9b

Browse files
authored
Rollup merge of #90241 - DrMeepster:thiscall_lint_upgrade, r=petrochenkov
Make thiscall abi on unsupported platforms a hard error As suggested in #42202 (comment), this PR makes use of the `thiscall` abi on unsupported a hard error instead of a lint.
2 parents b0df3af + a46daf0 commit fc8df9b

File tree

5 files changed

+32
-45
lines changed

5 files changed

+32
-45
lines changed

compiler/rustc_target/src/spec/mod.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,7 @@ impl Target {
15221522
AmdGpuKernel => self.arch == "amdgcn",
15231523
AvrInterrupt | AvrNonBlockingInterrupt => self.arch == "avr",
15241524
Wasm => ["wasm32", "wasm64"].contains(&&self.arch[..]),
1525+
Thiscall { .. } => self.arch == "x86",
15251526
// On windows these fall-back to platform native calling convention (C) when the
15261527
// architecture is not supported.
15271528
//
@@ -1552,15 +1553,13 @@ impl Target {
15521553
// > convention is used.
15531554
//
15541555
// -- https://docs.microsoft.com/en-us/cpp/cpp/argument-passing-and-naming-conventions
1555-
Stdcall { .. } | Fastcall | Thiscall { .. } | Vectorcall if self.is_like_windows => {
1556-
true
1557-
}
1556+
Stdcall { .. } | Fastcall | Vectorcall if self.is_like_windows => true,
15581557
// Outside of Windows we want to only support these calling conventions for the
15591558
// architectures for which these calling conventions are actually well defined.
1560-
Stdcall { .. } | Fastcall | Thiscall { .. } if self.arch == "x86" => true,
1559+
Stdcall { .. } | Fastcall if self.arch == "x86" => true,
15611560
Vectorcall if ["x86", "x86_64"].contains(&&self.arch[..]) => true,
15621561
// Return a `None` for other cases so that we know to emit a future compat lint.
1563-
Stdcall { .. } | Fastcall | Thiscall { .. } | Vectorcall => return None,
1562+
Stdcall { .. } | Fastcall | Vectorcall => return None,
15641563
})
15651564
}
15661565

src/test/ui/abi/unsupported.aarch64.stderr

+8-11
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,22 @@ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
4040
LL | extern "x86-interrupt" fn x86() {}
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4242

43-
warning: use of calling convention not supported on this target
43+
error[E0570]: `"thiscall"` is not a supported ABI for the current target
4444
--> $DIR/unsupported.rs:43:1
4545
|
46-
LL | extern "stdcall" fn stdcall() {}
47-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48-
|
49-
= note: `#[warn(unsupported_calling_conventions)]` on by default
50-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
51-
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
46+
LL | extern "thiscall" fn thiscall() {}
47+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5248

5349
warning: use of calling convention not supported on this target
54-
--> $DIR/unsupported.rs:50:1
50+
--> $DIR/unsupported.rs:47:1
5551
|
56-
LL | extern "thiscall" fn thiscall() {}
57-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52+
LL | extern "stdcall" fn stdcall() {}
53+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5854
|
55+
= note: `#[warn(unsupported_calling_conventions)]` on by default
5956
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
6057
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
6158

62-
error: aborting due to 7 previous errors; 2 warnings emitted
59+
error: aborting due to 8 previous errors; 1 warning emitted
6360

6461
For more information about this error, try `rustc --explain E0570`.

src/test/ui/abi/unsupported.arm.stderr

+8-11
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,22 @@ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
3434
LL | extern "x86-interrupt" fn x86() {}
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3636

37-
warning: use of calling convention not supported on this target
37+
error[E0570]: `"thiscall"` is not a supported ABI for the current target
3838
--> $DIR/unsupported.rs:43:1
3939
|
40-
LL | extern "stdcall" fn stdcall() {}
41-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42-
|
43-
= note: `#[warn(unsupported_calling_conventions)]` on by default
44-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
45-
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
40+
LL | extern "thiscall" fn thiscall() {}
41+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4642

4743
warning: use of calling convention not supported on this target
48-
--> $DIR/unsupported.rs:50:1
44+
--> $DIR/unsupported.rs:47:1
4945
|
50-
LL | extern "thiscall" fn thiscall() {}
51-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46+
LL | extern "stdcall" fn stdcall() {}
47+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5248
|
49+
= note: `#[warn(unsupported_calling_conventions)]` on by default
5350
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5451
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
5552

56-
error: aborting due to 6 previous errors; 2 warnings emitted
53+
error: aborting due to 7 previous errors; 1 warning emitted
5754

5855
For more information about this error, try `rustc --explain E0570`.

src/test/ui/abi/unsupported.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,11 @@ extern "avr-interrupt" fn avr() {}
4040
extern "x86-interrupt" fn x86() {}
4141
//[aarch64]~^ ERROR is not a supported ABI
4242
//[arm]~^^ ERROR is not a supported ABI
43-
extern "stdcall" fn stdcall() {}
44-
//[x64]~^ WARN use of calling convention not supported
45-
//[x64]~^^ WARN this was previously accepted
46-
//[aarch64]~^^^ WARN use of calling convention not supported
47-
//[aarch64]~^^^^ WARN this was previously accepted
48-
//[arm]~^^^^^ WARN use of calling convention not supported
49-
//[arm]~^^^^^^ WARN this was previously accepted
5043
extern "thiscall" fn thiscall() {}
44+
//[x64]~^ ERROR is not a supported ABI
45+
//[aarch64]~^^ ERROR is not a supported ABI
46+
//[arm]~^^^ ERROR is not a supported ABI
47+
extern "stdcall" fn stdcall() {}
5148
//[x64]~^ WARN use of calling convention not supported
5249
//[x64]~^^ WARN this was previously accepted
5350
//[aarch64]~^^^ WARN use of calling convention not supported

src/test/ui/abi/unsupported.x64.stderr

+8-11
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,22 @@ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
3434
LL | extern "avr-interrupt" fn avr() {}
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3636

37-
warning: use of calling convention not supported on this target
37+
error[E0570]: `"thiscall"` is not a supported ABI for the current target
3838
--> $DIR/unsupported.rs:43:1
3939
|
40-
LL | extern "stdcall" fn stdcall() {}
41-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42-
|
43-
= note: `#[warn(unsupported_calling_conventions)]` on by default
44-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
45-
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
40+
LL | extern "thiscall" fn thiscall() {}
41+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4642

4743
warning: use of calling convention not supported on this target
48-
--> $DIR/unsupported.rs:50:1
44+
--> $DIR/unsupported.rs:47:1
4945
|
50-
LL | extern "thiscall" fn thiscall() {}
51-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46+
LL | extern "stdcall" fn stdcall() {}
47+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5248
|
49+
= note: `#[warn(unsupported_calling_conventions)]` on by default
5350
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5451
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
5552

56-
error: aborting due to 6 previous errors; 2 warnings emitted
53+
error: aborting due to 7 previous errors; 1 warning emitted
5754

5855
For more information about this error, try `rustc --explain E0570`.

0 commit comments

Comments
 (0)