-
Notifications
You must be signed in to change notification settings - Fork 13k
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
nounwind tests and cleanup #65346
Merged
Merged
nounwind tests and cleanup #65346
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9a0b9c6
remove old branch of unwind logic
RalfJung a1a8f33
update test for nounwind on FFI imports
RalfJung 63af27f
also (properly) test nounwind on function definitions
RalfJung 79c623f
some typography
RalfJung 09d7be3
make tests more robust
RalfJung 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 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 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,19 @@ | ||
// compile-flags: -C opt-level=0 | ||
|
||
#![crate_type = "lib"] | ||
#![feature(unwind_attributes)] | ||
|
||
// Make sure these all do *not* get the attribute. | ||
// We disable optimizations to prevent LLVM from infering the attribute. | ||
// CHECK-NOT: nounwind | ||
|
||
// "C" ABI | ||
// pub extern fn foo() {} // FIXME right now we don't abort-on-panic but add `nounwind` nevertheless | ||
#[unwind(allowed)] | ||
pub extern fn foo_allowed() {} | ||
|
||
// "Rust" | ||
// (`extern "Rust"` could be removed as all `fn` get it implicitly; we leave it in for clarity.) | ||
pub extern "Rust" fn bar() {} | ||
#[unwind(allowed)] | ||
pub extern "Rust" fn bar_allowed() {} |
This file contains 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,41 @@ | ||
// compile-flags: -C no-prepopulate-passes | ||
|
||
#![crate_type = "lib"] | ||
#![feature(unwind_attributes)] | ||
|
||
extern { | ||
// CHECK: Function Attrs: nounwind | ||
RalfJung marked this conversation as resolved.
Show resolved
Hide resolved
RalfJung marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// CHECK-NEXT: declare void @extern_fn | ||
fn extern_fn(); | ||
// CHECK-NOT: Function Attrs: nounwind | ||
// CHECK: declare void @unwinding_extern_fn | ||
#[unwind(allowed)] | ||
fn unwinding_extern_fn(); | ||
// CHECK-NOT: nounwind | ||
// CHECK: declare void @aborting_extern_fn | ||
#[unwind(aborts)] | ||
fn aborting_extern_fn(); // FIXME: we want to have the attribute here | ||
} | ||
|
||
extern "Rust" { | ||
// CHECK-NOT: nounwind | ||
// CHECK: declare void @rust_extern_fn | ||
fn rust_extern_fn(); | ||
// CHECK-NOT: nounwind | ||
// CHECK: declare void @rust_unwinding_extern_fn | ||
#[unwind(allowed)] | ||
fn rust_unwinding_extern_fn(); | ||
// CHECK-NOT: nounwind | ||
// CHECK: declare void @rust_aborting_extern_fn | ||
#[unwind(aborts)] | ||
fn rust_aborting_extern_fn(); // FIXME: we want to have the attribute here | ||
} | ||
|
||
pub unsafe fn force_declare() { | ||
extern_fn(); | ||
unwinding_extern_fn(); | ||
aborting_extern_fn(); | ||
rust_extern_fn(); | ||
rust_unwinding_extern_fn(); | ||
rust_aborting_extern_fn(); | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In #65020 nobody knew why this branch should be needed. And all the tests behave as expected without it. So I think we should remove it.