Skip to content

Commit 88f0c72

Browse files
authored
Rollup merge of #79611 - poliorcetics:use-std-in-docs, r=jyn514
Use more std:: instead of core:: in docs for consistency ``@rustbot`` label T-doc Some cleanup work to use `std::` instead of `core::` in docs as much as possible. This helps with terminology and consistency, especially for newcomers from other languages that have often heard of `std` to describe the standard library but not of `core`. Edit: I also added more intra doc links when I saw the opportunity.
2 parents 6b42900 + 4eb76fc commit 88f0c72

File tree

7 files changed

+20
-17
lines changed

7 files changed

+20
-17
lines changed

library/core/src/fmt/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ impl<'a> Arguments<'a> {
403403
/// ```rust
404404
/// #![feature(fmt_as_str)]
405405
///
406-
/// use core::fmt::Arguments;
406+
/// use std::fmt::Arguments;
407407
///
408408
/// fn write_str(_: &str) { /* ... */ }
409409
///

library/core/src/future/pending.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct Pending<T> {
2121
/// # Examples
2222
///
2323
/// ```no_run
24-
/// use core::future;
24+
/// use std::future;
2525
///
2626
/// # async fn run() {
2727
/// let future = future::pending();

library/core/src/future/poll_fn.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::future::Future;
33
use crate::pin::Pin;
44
use crate::task::{Context, Poll};
55

6-
/// Creates a future that wraps a function returning `Poll`.
6+
/// Creates a future that wraps a function returning [`Poll`].
77
///
88
/// Polling the future delegates to the wrapped function.
99
///
@@ -13,7 +13,7 @@ use crate::task::{Context, Poll};
1313
/// #![feature(future_poll_fn)]
1414
/// # async fn run() {
1515
/// use core::future::poll_fn;
16-
/// use core::task::{Context, Poll};
16+
/// use std::task::{Context, Poll};
1717
///
1818
/// fn read_line(_cx: &mut Context<'_>) -> Poll<String> {
1919
/// Poll::Ready("Hello, World!".into())
@@ -31,7 +31,7 @@ where
3131
PollFn { f }
3232
}
3333

34-
/// A Future that wraps a function returning `Poll`.
34+
/// A Future that wraps a function returning [`Poll`].
3535
///
3636
/// This `struct` is created by [`poll_fn()`]. See its
3737
/// documentation for more.

library/core/src/future/ready.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<T> Future for Ready<T> {
3333
/// # Examples
3434
///
3535
/// ```
36-
/// use core::future;
36+
/// use std::future;
3737
///
3838
/// # async fn run() {
3939
/// let a = future::ready(1);

library/core/src/panic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ impl<'a> Location<'a> {
189189
/// # Examples
190190
///
191191
/// ```
192-
/// use core::panic::Location;
192+
/// use std::panic::Location;
193193
///
194194
/// /// Returns the [`Location`] at which it is called.
195195
/// #[track_caller]

library/core/src/task/ready.rs

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
/// Extracts the successful type of a `Poll<T>`.
1+
/// Extracts the successful type of a [`Poll<T>`].
22
///
3-
/// This macro bakes in propagation of `Pending` signals by returning early.
3+
/// This macro bakes in propagation of [`Pending`] signals by returning early.
4+
///
5+
/// [`Poll<T>`]: crate::task::Poll
6+
/// [`Pending`]: crate::task::Poll::Pending
47
///
58
/// # Examples
69
///
710
/// ```
811
/// #![feature(ready_macro)]
912
///
10-
/// use core::task::{ready, Context, Poll};
11-
/// use core::future::{self, Future};
12-
/// use core::pin::Pin;
13+
/// use std::task::{ready, Context, Poll};
14+
/// use std::future::{self, Future};
15+
/// use std::pin::Pin;
1316
///
1417
/// pub fn do_poll(cx: &mut Context<'_>) -> Poll<()> {
1518
/// let mut fut = future::ready(42);
@@ -28,9 +31,9 @@
2831
/// ```
2932
/// # #![feature(ready_macro)]
3033
/// #
31-
/// # use core::task::{Context, Poll};
32-
/// # use core::future::{self, Future};
33-
/// # use core::pin::Pin;
34+
/// # use std::task::{Context, Poll};
35+
/// # use std::future::{self, Future};
36+
/// # use std::pin::Pin;
3437
/// #
3538
/// # pub fn do_poll(cx: &mut Context<'_>) -> Poll<()> {
3639
/// # let mut fut = future::ready(42);

library/std/src/primitive_docs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ mod prim_bool {}
198198
/// words, they can't return `!` from every code path. As an example, this code doesn't compile:
199199
///
200200
/// ```compile_fail
201-
/// use core::ops::Add;
201+
/// use std::ops::Add;
202202
///
203203
/// fn foo() -> impl Add<u32> {
204204
/// unimplemented!()
@@ -208,7 +208,7 @@ mod prim_bool {}
208208
/// But this code does:
209209
///
210210
/// ```
211-
/// use core::ops::Add;
211+
/// use std::ops::Add;
212212
///
213213
/// fn foo() -> impl Add<u32> {
214214
/// if true {

0 commit comments

Comments
 (0)