Skip to content

Commit 507e0de

Browse files
committed
Auto merge of #104219 - bryangarza:async-track-caller-dup, r=eholk
Support `#[track_caller]` on async fns Adds `#[track_caller]` to the generator that is created when we desugar the async fn. Fixes #78840 Open questions: - What is the performance impact of adding `#[track_caller]` to every `GenFuture`'s `poll(...)` function, even if it's unused (i.e., the parent span does not set `#[track_caller]`)? We might need to set it only conditionally, if the indirection causes overhead we don't want.
2 parents b174693 + ef648e8 commit 507e0de

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)