diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/async-await/track-caller | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/ui/async-await/track-caller/async-block.rs | 9 | ||||
-rw-r--r-- | tests/ui/async-await/track-caller/async-block.stderr | 12 | ||||
-rw-r--r-- | tests/ui/async-await/track-caller/async-closure-gate.rs (renamed from src/test/ui/async-await/track-caller/async-closure-gate.rs) | 0 | ||||
-rw-r--r-- | tests/ui/async-await/track-caller/async-closure-gate.stderr (renamed from src/test/ui/async-await/track-caller/async-closure-gate.stderr) | 0 | ||||
-rw-r--r-- | tests/ui/async-await/track-caller/issue-105134.rs (renamed from src/test/ui/async-await/track-caller/issue-105134.rs) | 0 | ||||
-rw-r--r-- | tests/ui/async-await/track-caller/panic-track-caller.nofeat.stderr (renamed from src/test/ui/async-await/track-caller/panic-track-caller.nofeat.stderr) | 0 | ||||
-rw-r--r-- | tests/ui/async-await/track-caller/panic-track-caller.rs (renamed from src/test/ui/async-await/track-caller/panic-track-caller.rs) | 13 |
7 files changed, 34 insertions, 0 deletions
diff --git a/tests/ui/async-await/track-caller/async-block.rs b/tests/ui/async-await/track-caller/async-block.rs new file mode 100644 index 000000000..8e81387c3 --- /dev/null +++ b/tests/ui/async-await/track-caller/async-block.rs @@ -0,0 +1,9 @@ +// edition:2021 + +#![feature(closure_track_caller, stmt_expr_attributes)] + +fn main() { + let _ = #[track_caller] async { + //~^ ERROR attribute should be applied to a function definition [E0739] + }; +} diff --git a/tests/ui/async-await/track-caller/async-block.stderr b/tests/ui/async-await/track-caller/async-block.stderr new file mode 100644 index 000000000..407439921 --- /dev/null +++ b/tests/ui/async-await/track-caller/async-block.stderr @@ -0,0 +1,12 @@ +error[E0739]: attribute should be applied to a function definition + --> $DIR/async-block.rs:6:13 + | +LL | let _ = #[track_caller] async { + | _____________^^^^^^^^^^^^^^^_- +LL | | +LL | | }; + | |_____- not a function definition + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0739`. diff --git a/src/test/ui/async-await/track-caller/async-closure-gate.rs b/tests/ui/async-await/track-caller/async-closure-gate.rs index d9d556855..d9d556855 100644 --- a/src/test/ui/async-await/track-caller/async-closure-gate.rs +++ b/tests/ui/async-await/track-caller/async-closure-gate.rs diff --git a/src/test/ui/async-await/track-caller/async-closure-gate.stderr b/tests/ui/async-await/track-caller/async-closure-gate.stderr index 498f1b43b..498f1b43b 100644 --- a/src/test/ui/async-await/track-caller/async-closure-gate.stderr +++ b/tests/ui/async-await/track-caller/async-closure-gate.stderr diff --git a/src/test/ui/async-await/track-caller/issue-105134.rs b/tests/ui/async-await/track-caller/issue-105134.rs index 4e52b8e25..4e52b8e25 100644 --- a/src/test/ui/async-await/track-caller/issue-105134.rs +++ b/tests/ui/async-await/track-caller/issue-105134.rs diff --git a/src/test/ui/async-await/track-caller/panic-track-caller.nofeat.stderr b/tests/ui/async-await/track-caller/panic-track-caller.nofeat.stderr index 51ea225f4..51ea225f4 100644 --- a/src/test/ui/async-await/track-caller/panic-track-caller.nofeat.stderr +++ b/tests/ui/async-await/track-caller/panic-track-caller.nofeat.stderr diff --git a/src/test/ui/async-await/track-caller/panic-track-caller.rs b/tests/ui/async-await/track-caller/panic-track-caller.rs index 118361d6c..f45243b0e 100644 --- a/src/test/ui/async-await/track-caller/panic-track-caller.rs +++ b/tests/ui/async-await/track-caller/panic-track-caller.rs @@ -69,6 +69,16 @@ async fn foo_assoc() { Foo::bar_assoc().await } +// Since compilation is expected to fail for this fn when using +// `nofeat`, we test that separately in `async-closure-gate.rs` +#[cfg(feat)] +async fn foo_closure() { + let c = #[track_caller] async || { + panic!(); + }; + c().await +} + fn panicked_at(f: impl FnOnce() + panic::UnwindSafe) -> u32 { let loc = Arc::new(Mutex::new(None)); @@ -97,4 +107,7 @@ fn main() { assert_eq!(panicked_at(|| block_on(foo_assoc())), 69); #[cfg(nofeat)] assert_eq!(panicked_at(|| block_on(foo_assoc())), 64); + + #[cfg(feat)] + assert_eq!(panicked_at(|| block_on(foo_closure())), 79); } |