-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Reject unsupported extern "{abi}"
s consistently in all positions
#142134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
workingjubilee
wants to merge
11
commits into
rust-lang:master
Choose a base branch
from
workingjubilee:reject-unsupported-abi
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,256
−1,984
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3530af7
compiler: plug unsupported ABI leakage from the AST
workingjubilee 15d988b
hir_analysis: Avoid repeating unsupported ABI errors
workingjubilee ff681a1
compiler: Remove unsupported_fn_ptr_calling_conventions lint
workingjubilee 2b74d26
Clarify note in rustc_ast_lowering still applies
workingjubilee c7a1c7f
unsupported_calling_conventions: print which ABI this is about
RalfJung 67f1159
tests: Bless abi_gpu_kernel feature gate test
workingjubilee ce25f27
tests: Enhance unsupported ABI tests
workingjubilee 78d2f1f
tests: Update raw-dylib unsupported ABI test
workingjubilee 56c28f4
tests: Update and bless cmse-nonsecure ABI tests
workingjubilee 2ca5792
tests: Adopt ABI transmute tests from crashtests
workingjubilee e513de7
tests: Verify varargs with unsupported fn ptr ABIs must error
workingjubilee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//@ add-core-stubs | ||
//@ compile-flags: --crate-type=lib --target x86_64-unknown-none | ||
//@ needs-llvm-components: x86 | ||
//@ edition: 2018 | ||
#![no_core] | ||
#![feature(no_core, lang_items)] | ||
extern crate minicore; | ||
use minicore::*; | ||
|
||
// Check we error before unsupported ABIs reach codegen stages. | ||
|
||
fn anything() { | ||
let a = unsafe { mem::transmute::<usize, extern "thiscall" fn(i32)>(4) }(2); | ||
//~^ ERROR: is not a supported ABI for the current target [E0570] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0570]: "thiscall" is not a supported ABI for the current target | ||
--> $DIR/unsupported-abi-transmute.rs:13:53 | ||
| | ||
LL | let a = unsafe { mem::transmute::<usize, extern "thiscall" fn(i32)>(4) }(2); | ||
| ^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0570`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// FIXME(workingjubilee): add revisions and generalize to other platform-specific varargs ABIs, | ||
// preferably after the only-arch directive is enhanced with an "or pattern" syntax | ||
//@ only-x86_64 | ||
|
||
// We have to use this flag to force ABI computation of an invalid ABI | ||
//@ compile-flags: -Clink-dead-code | ||
|
||
#![feature(extended_varargs_abi_support)] | ||
|
||
// sometimes fn ptrs with varargs make layout and ABI computation ICE | ||
// as found in https://github.com/rust-lang/rust/issues/142107 | ||
|
||
fn aapcs(f: extern "aapcs" fn(usize, ...)) { | ||
//~^ ERROR [E0570] | ||
// Note we DO NOT have to actually make a call to trigger the ICE! | ||
} | ||
|
||
fn main() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0570]: "aapcs" is not a supported ABI for the current target | ||
--> $DIR/unsupported-varargs-fnptr.rs:13:20 | ||
| | ||
LL | fn aapcs(f: extern "aapcs" fn(usize, ...)) { | ||
| ^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0570`. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.