Skip to content

Commit e83dceb

Browse files
authored
Rollup merge of #61523 - Nemo157:hide-gen-future, r=cramertj
Hide gen_future API from documentation This is internal rustc only API which should never be used outside code created by the current `async` transform, if it is used then the panic messages don't make sense as they're written from the perspective of that meaning there is a bug in the `async` transform (e.g. #61482).
2 parents 4634412 + 7980bc4 commit e83dceb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/libstd/future.rs

+6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ pub use core::future::*;
1616
///
1717
/// This function returns a `GenFuture` underneath, but hides it in `impl Trait` to give
1818
/// better error messages (`impl Future` rather than `GenFuture<[closure.....]>`).
19+
#[doc(hidden)]
1920
#[unstable(feature = "gen_future", issue = "50547")]
2021
pub fn from_generator<T: Generator<Yield = ()>>(x: T) -> impl Future<Output = T::Return> {
2122
GenFuture(x)
2223
}
2324

2425
/// A wrapper around generators used to implement `Future` for `async`/`await` code.
26+
#[doc(hidden)]
2527
#[unstable(feature = "gen_future", issue = "50547")]
2628
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
2729
struct GenFuture<T: Generator<Yield = ()>>(T);
@@ -30,6 +32,7 @@ struct GenFuture<T: Generator<Yield = ()>>(T);
3032
// self-referential borrows in the underlying generator.
3133
impl<T: Generator<Yield = ()>> !Unpin for GenFuture<T> {}
3234

35+
#[doc(hidden)]
3336
#[unstable(feature = "gen_future", issue = "50547")]
3437
impl<T: Generator<Yield = ()>> Future for GenFuture<T> {
3538
type Output = T::Return;
@@ -57,6 +60,7 @@ impl Drop for SetOnDrop {
5760
}
5861
}
5962

63+
#[doc(hidden)]
6064
#[unstable(feature = "gen_future", issue = "50547")]
6165
/// Sets the thread-local task context used by async/await futures.
6266
pub fn set_task_context<F, R>(cx: &mut Context<'_>, f: F) -> R
@@ -74,6 +78,7 @@ where
7478
f()
7579
}
7680

81+
#[doc(hidden)]
7782
#[unstable(feature = "gen_future", issue = "50547")]
7883
/// Retrieves the thread-local task context used by async/await futures.
7984
///
@@ -105,6 +110,7 @@ where
105110
unsafe { f(cx_ptr.as_mut()) }
106111
}
107112

113+
#[doc(hidden)]
108114
#[unstable(feature = "gen_future", issue = "50547")]
109115
/// Polls a future in the current thread-local task waker.
110116
pub fn poll_with_tls_context<F>(f: Pin<&mut F>) -> Poll<F::Output>

0 commit comments

Comments
 (0)