about summary refs log tree commit diff
path: root/library/core
diff options
context:
space:
mode:
authorBryan Garza <1396101+bryangarza@users.noreply.github.com>2022-11-08 23:45:55 +0000
committerBryan Garza <1396101+bryangarza@users.noreply.github.com>2022-11-09 23:27:14 +0000
commitfa99cb82690d99c0df2018d37aedaed29e40e131 (patch)
tree9310734b5f13537a4a3ef7fdf817d808be5cbe4a /library/core
parent3db41d13f08db377c9bc516d8f285f61ed668edd (diff)
downloadrust-fa99cb82690d99c0df2018d37aedaed29e40e131.tar.gz
rust-fa99cb82690d99c0df2018d37aedaed29e40e131.zip
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.
Diffstat (limited to 'library/core')
-rw-r--r--library/core/src/future/mod.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/core/src/future/mod.rs b/library/core/src/future/mod.rs
index 6487aa08859..107cf92c1c0 100644
--- a/library/core/src/future/mod.rs
+++ b/library/core/src/future/mod.rs
@@ -82,6 +82,7 @@ where
 
     impl<T: Generator<ResumeTy, Yield = ()>> Future for GenFuture<T> {
         type Output = T::Return;
+        #[track_caller]
         fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
             // SAFETY: Safe because we're !Unpin + !Drop, and this is just a field projection.
             let gen = unsafe { Pin::map_unchecked_mut(self, |s| &mut s.0) };