diff options
| author | Gary Guo <gary@garyguo.net> | 2022-12-02 16:41:25 +0000 |
|---|---|---|
| committer | Gary Guo <gary@garyguo.net> | 2022-12-02 16:47:57 +0000 |
| commit | ec4080b23699d096561e2e6163f3f74f6f9e8b4d (patch) | |
| tree | 240f0d8eabe615c0ec0ae587abec138bc6aefe08 /src/test | |
| parent | 4c73b646328d4adeb66fe67bae57c8206803eef8 (diff) | |
| download | rust-ec4080b23699d096561e2e6163f3f74f6f9e8b4d.tar.gz rust-ec4080b23699d096561e2e6163f3f74f6f9e8b4d.zip | |
Fix async track caller for assoc fn and trait impl fn
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/async-await/track-caller/panic-track-caller.rs | 14 |
1 files changed, 14 insertions, 0 deletions
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 index b113c56412f..5ebfeb3f36a 100644 --- a/src/test/ui/async-await/track-caller/panic-track-caller.rs +++ b/src/test/ui/async-await/track-caller/panic-track-caller.rs @@ -54,6 +54,19 @@ async fn foo_track_caller() { bar_track_caller().await } +struct Foo; + +impl Foo { + #[track_caller] + 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)); @@ -73,4 +86,5 @@ fn panicked_at(f: impl FnOnce() + panic::UnwindSafe) -> u32 { fn main() { assert_eq!(panicked_at(|| block_on(foo())), 41); assert_eq!(panicked_at(|| block_on(foo_track_caller())), 54); + assert_eq!(panicked_at(|| block_on(foo_assoc())), 67); } |
