From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../async-await/track-caller/async-closure-gate.rs | 9 -- .../track-caller/async-closure-gate.stderr | 12 --- .../ui/async-await/track-caller/issue-105134.rs | 11 --- .../track-caller/panic-track-caller.nofeat.stderr | 29 ------ .../async-await/track-caller/panic-track-caller.rs | 100 --------------------- 5 files changed, 161 deletions(-) delete mode 100644 src/test/ui/async-await/track-caller/async-closure-gate.rs delete mode 100644 src/test/ui/async-await/track-caller/async-closure-gate.stderr delete mode 100644 src/test/ui/async-await/track-caller/issue-105134.rs delete mode 100644 src/test/ui/async-await/track-caller/panic-track-caller.nofeat.stderr delete mode 100644 src/test/ui/async-await/track-caller/panic-track-caller.rs (limited to 'src/test/ui/async-await/track-caller') diff --git a/src/test/ui/async-await/track-caller/async-closure-gate.rs b/src/test/ui/async-await/track-caller/async-closure-gate.rs deleted file mode 100644 index d9d556855..000000000 --- a/src/test/ui/async-await/track-caller/async-closure-gate.rs +++ /dev/null @@ -1,9 +0,0 @@ -// edition:2021 - -#![feature(async_closure, stmt_expr_attributes)] - -fn main() { - let _ = #[track_caller] async || { - //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658] - }; -} diff --git a/src/test/ui/async-await/track-caller/async-closure-gate.stderr b/src/test/ui/async-await/track-caller/async-closure-gate.stderr deleted file mode 100644 index 498f1b43b..000000000 --- a/src/test/ui/async-await/track-caller/async-closure-gate.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: `#[track_caller]` on closures is currently unstable - --> $DIR/async-closure-gate.rs:6:13 - | -LL | let _ = #[track_caller] async || { - | ^^^^^^^^^^^^^^^ - | - = note: see issue #87417 for more information - = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/async-await/track-caller/issue-105134.rs b/src/test/ui/async-await/track-caller/issue-105134.rs deleted file mode 100644 index 4e52b8e25..000000000 --- a/src/test/ui/async-await/track-caller/issue-105134.rs +++ /dev/null @@ -1,11 +0,0 @@ -// check-pass -// edition:2021 - -#[track_caller] -fn f() { - let _ = async {}; -} - -fn main() { - f(); -} diff --git a/src/test/ui/async-await/track-caller/panic-track-caller.nofeat.stderr b/src/test/ui/async-await/track-caller/panic-track-caller.nofeat.stderr deleted file mode 100644 index 51ea225f4..000000000 --- a/src/test/ui/async-await/track-caller/panic-track-caller.nofeat.stderr +++ /dev/null @@ -1,29 +0,0 @@ -warning: `#[track_caller]` on async functions is a no-op - --> $DIR/panic-track-caller.rs:50:1 - | -LL | #[track_caller] - | ^^^^^^^^^^^^^^^ -LL | / async fn bar_track_caller() { -LL | | panic!() -LL | | } - | |_- this function will not propagate the caller location - | - = note: see issue #87417 for more information - = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable - = note: `#[warn(ungated_async_fn_track_caller)]` on by default - -warning: `#[track_caller]` on async functions is a no-op - --> $DIR/panic-track-caller.rs:62:5 - | -LL | #[track_caller] - | ^^^^^^^^^^^^^^^ -LL | / async fn bar_assoc() { -LL | | panic!(); -LL | | } - | |_____- this function will not propagate the caller location - | - = note: see issue #87417 for more information - = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable - -warning: 2 warnings emitted - diff --git a/src/test/ui/async-await/track-caller/panic-track-caller.rs b/src/test/ui/async-await/track-caller/panic-track-caller.rs deleted file mode 100644 index 118361d6c..000000000 --- a/src/test/ui/async-await/track-caller/panic-track-caller.rs +++ /dev/null @@ -1,100 +0,0 @@ -// run-pass -// edition:2021 -// revisions: feat nofeat -// needs-unwind -#![feature(async_closure, stmt_expr_attributes)] -#![cfg_attr(feat, feature(closure_track_caller))] - -use std::future::Future; -use std::panic; -use std::sync::{Arc, Mutex}; -use std::task::{Context, Poll, Wake}; -use std::thread::{self, Thread}; - -/// A waker that wakes up the current thread when called. -struct ThreadWaker(Thread); - -impl Wake for ThreadWaker { - fn wake(self: Arc) { - self.0.unpark(); - } -} - -/// Run a future to completion on the current thread. -fn block_on(fut: impl Future) -> T { - // Pin the future so it can be polled. - let mut fut = Box::pin(fut); - - // Create a new context to be passed to the future. - let t = thread::current(); - let waker = Arc::new(ThreadWaker(t)).into(); - let mut cx = Context::from_waker(&waker); - - // Run the future to completion. - loop { - match fut.as_mut().poll(&mut cx) { - Poll::Ready(res) => return res, - Poll::Pending => thread::park(), - } - } -} - -async fn bar() { - panic!() -} - -async fn foo() { - bar().await -} - -#[track_caller] //[nofeat]~ WARN `#[track_caller]` on async functions is a no-op -async fn bar_track_caller() { - panic!() -} - -async fn foo_track_caller() { - bar_track_caller().await -} - -struct Foo; - -impl Foo { - #[track_caller] //[nofeat]~ WARN `#[track_caller]` on async functions is a no-op - async fn bar_assoc() { - panic!(); - } -} - -async fn foo_assoc() { - Foo::bar_assoc().await -} - -fn panicked_at(f: impl FnOnce() + panic::UnwindSafe) -> u32 { - let loc = Arc::new(Mutex::new(None)); - - let hook = panic::take_hook(); - { - let loc = loc.clone(); - panic::set_hook(Box::new(move |info| { - *loc.lock().unwrap() = info.location().map(|loc| loc.line()) - })); - } - panic::catch_unwind(f).unwrap_err(); - panic::set_hook(hook); - let x = loc.lock().unwrap().unwrap(); - x -} - -fn main() { - assert_eq!(panicked_at(|| block_on(foo())), 43); - - #[cfg(feat)] - assert_eq!(panicked_at(|| block_on(foo_track_caller())), 56); - #[cfg(nofeat)] - assert_eq!(panicked_at(|| block_on(foo_track_caller())), 52); - - #[cfg(feat)] - assert_eq!(panicked_at(|| block_on(foo_assoc())), 69); - #[cfg(nofeat)] - assert_eq!(panicked_at(|| block_on(foo_assoc())), 64); -} -- cgit v1.2.3