Skip to content

Commit 2116481

Browse files
committed
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.
1 parent 77507f5 commit 2116481

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

core/src/future/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ where
8282

8383
impl<T: Generator<ResumeTy, Yield = ()>> Future for GenFuture<T> {
8484
type Output = T::Return;
85+
#[track_caller]
8586
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
8687
// SAFETY: Safe because we're !Unpin + !Drop, and this is just a field projection.
8788
let gen = unsafe { Pin::map_unchecked_mut(self, |s| &mut s.0) };

0 commit comments

Comments
 (0)