-
Notifications
You must be signed in to change notification settings - Fork 13.4k
async unsafe fn
tests
#62608
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
Merged
async unsafe fn
tests
#62608
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1574c2d
align async-await.rs and await-macro.rs with one another
delan 0f66ce6
test E0133 when calling free/impl `async unsafe fn` in safe code
delan beb2435
test `unsafe fn` and `async unsafe fn` calls in `async` in `unsafe`
delan e65c1c4
remove unused #![feature(async_closure)]
delan 60f480d
test E0133 when calling free/impl `async unsafe fn` in `async fn`
delan d023e47
remove redundant async_closure test in async-await.rs
delan 5f8d0a1
test `unsafe fn` and `async unsafe fn` calls in `unsafe { async || }`
delan 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// edition:2018 | ||
|
||
#![feature(async_await)] | ||
|
||
struct S; | ||
|
||
impl S { | ||
async unsafe fn f() {} | ||
} | ||
|
||
async unsafe fn f() {} | ||
|
||
async fn g() { | ||
S::f(); //~ ERROR call to unsafe function is unsafe | ||
f(); //~ ERROR call to unsafe function is unsafe | ||
} | ||
|
||
fn main() { | ||
S::f(); //~ ERROR call to unsafe function is unsafe | ||
f(); //~ ERROR call to unsafe function is unsafe | ||
} |
35 changes: 35 additions & 0 deletions
35
src/test/ui/async-await/async-unsafe-fn-call-in-safe.stderr
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,35 @@ | ||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block | ||
--> $DIR/async-unsafe-fn-call-in-safe.rs:14:5 | ||
| | ||
LL | S::f(); | ||
| ^^^^^^ call to unsafe function | ||
| | ||
= note: consult the function's documentation for information on how to avoid undefined behavior | ||
|
||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block | ||
--> $DIR/async-unsafe-fn-call-in-safe.rs:15:5 | ||
| | ||
LL | f(); | ||
| ^^^ call to unsafe function | ||
| | ||
= note: consult the function's documentation for information on how to avoid undefined behavior | ||
|
||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block | ||
--> $DIR/async-unsafe-fn-call-in-safe.rs:19:5 | ||
| | ||
LL | S::f(); | ||
| ^^^^^^ call to unsafe function | ||
| | ||
= note: consult the function's documentation for information on how to avoid undefined behavior | ||
|
||
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block | ||
--> $DIR/async-unsafe-fn-call-in-safe.rs:20:5 | ||
| | ||
LL | f(); | ||
| ^^^ call to unsafe function | ||
| | ||
= note: consult the function's documentation for information on how to avoid undefined behavior | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0133`. |
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
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.