Allow and add track_caller to generators

This patch allows the usage of the `track_caller` annotation on
generators, as well as sets them conditionally if the parent also has
`track_caller` set.

Also add this annotation on the `GenFuture`'s `poll()` function.
This commit is contained in:
Bryan Garza 2022-11-08 23:45:55 +00:00
parent 3db41d13f0
commit fa99cb8269
3 changed files with 42 additions and 27 deletions

View file

@ -70,6 +70,6 @@ fn panicked_at(f: impl FnOnce() + panic::UnwindSafe) -> u32 {
}
fn main() {
assert_eq!(panicked_at(|| block_on(foo())), 39);
assert_eq!(panicked_at(|| block_on(foo_track_caller())), 52);
assert_eq!(panicked_at(|| block_on(foo())), 40);
assert_eq!(panicked_at(|| block_on(foo_track_caller())), 53);
}