Skip to content

Commit ccb9dac

Browse files
committed
Fix intra-doc link resolution failure on re-exporting libstd
1 parent ef9a876 commit ccb9dac

File tree

13 files changed

+94
-2
lines changed

13 files changed

+94
-2
lines changed

src/liballoc/alloc.rs

+18
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ extern "Rust" {
3737
///
3838
/// Note: while this type is unstable, the functionality it provides can be
3939
/// accessed through the [free functions in `alloc`](index.html#functions).
40+
///
41+
/// [`Alloc`]: trait.Alloc.html
4042
#[unstable(feature = "allocator_api", issue = "32838")]
4143
#[derive(Copy, Clone, Default, Debug)]
4244
pub struct Global;
@@ -54,6 +56,10 @@ pub struct Global;
5456
///
5557
/// See [`GlobalAlloc::alloc`].
5658
///
59+
/// [`Global`]: struct.Global.html
60+
/// [`Alloc`]: trait.Alloc.html
61+
/// [`GlobalAlloc::alloc`]: trait.GlobalAlloc.html#tymethod.alloc
62+
///
5763
/// # Examples
5864
///
5965
/// ```
@@ -87,6 +93,10 @@ pub unsafe fn alloc(layout: Layout) -> *mut u8 {
8793
/// # Safety
8894
///
8995
/// See [`GlobalAlloc::dealloc`].
96+
///
97+
/// [`Global`]: struct.Global.html
98+
/// [`Alloc`]: trait.Alloc.html
99+
/// [`GlobalAlloc::dealloc`]: trait.GlobalAlloc.html#tymethod.dealloc
90100
#[stable(feature = "global_alloc", since = "1.28.0")]
91101
#[inline]
92102
pub unsafe fn dealloc(ptr: *mut u8, layout: Layout) {
@@ -105,6 +115,10 @@ pub unsafe fn dealloc(ptr: *mut u8, layout: Layout) {
105115
/// # Safety
106116
///
107117
/// See [`GlobalAlloc::realloc`].
118+
///
119+
/// [`Global`]: struct.Global.html
120+
/// [`Alloc`]: trait.Alloc.html
121+
/// [`GlobalAlloc::realloc`]: trait.GlobalAlloc.html#method.realloc
108122
#[stable(feature = "global_alloc", since = "1.28.0")]
109123
#[inline]
110124
pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
@@ -124,6 +138,10 @@ pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8
124138
///
125139
/// See [`GlobalAlloc::alloc_zeroed`].
126140
///
141+
/// [`Global`]: struct.Global.html
142+
/// [`Alloc`]: trait.Alloc.html
143+
/// [`GlobalAlloc::alloc_zeroed`]: trait.GlobalAlloc.html#method.alloc_zeroed
144+
///
127145
/// # Examples
128146
///
129147
/// ```

src/libcore/task/wake.rs

+23
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ use crate::marker::{PhantomData, Unpin};
1010
///
1111
/// It consists of a data pointer and a [virtual function pointer table (vtable)][vtable] that
1212
/// customizes the behavior of the `RawWaker`.
13+
///
14+
/// [`Waker`]: struct.Waker.html
1315
#[derive(PartialEq, Debug)]
1416
#[stable(feature = "futures_api", since = "1.36.0")]
1517
pub struct RawWaker {
@@ -55,6 +57,8 @@ impl RawWaker {
5557
/// pointer of a properly constructed [`RawWaker`] object from inside the
5658
/// [`RawWaker`] implementation. Calling one of the contained functions using
5759
/// any other `data` pointer will cause undefined behavior.
60+
///
61+
/// [`RawWaker`]: struct.RawWaker.html
5862
#[stable(feature = "futures_api", since = "1.36.0")]
5963
#[derive(PartialEq, Copy, Clone, Debug)]
6064
pub struct RawWakerVTable {
@@ -65,6 +69,9 @@ pub struct RawWakerVTable {
6569
/// required for this additional instance of a [`RawWaker`] and associated
6670
/// task. Calling `wake` on the resulting [`RawWaker`] should result in a wakeup
6771
/// of the same task that would have been awoken by the original [`RawWaker`].
72+
///
73+
/// [`Waker`]: struct.Waker.html
74+
/// [`RawWaker`]: struct.RawWaker.html
6875
clone: unsafe fn(*const ()) -> RawWaker,
6976

7077
/// This function will be called when `wake` is called on the [`Waker`].
@@ -73,20 +80,28 @@ pub struct RawWakerVTable {
7380
/// The implementation of this function must make sure to release any
7481
/// resources that are associated with this instance of a [`RawWaker`] and
7582
/// associated task.
83+
///
84+
/// [`Waker`]: struct.Waker.html
85+
/// [`RawWaker`]: struct.RawWaker.html
7686
wake: unsafe fn(*const ()),
7787

7888
/// This function will be called when `wake_by_ref` is called on the [`Waker`].
7989
/// It must wake up the task associated with this [`RawWaker`].
8090
///
8191
/// This function is similar to `wake`, but must not consume the provided data
8292
/// pointer.
93+
///
94+
/// [`Waker`]: struct.Waker.html
95+
/// [`RawWaker`]: struct.RawWaker.html
8396
wake_by_ref: unsafe fn(*const ()),
8497

8598
/// This function gets called when a [`RawWaker`] gets dropped.
8699
///
87100
/// The implementation of this function must make sure to release any
88101
/// resources that are associated with this instance of a [`RawWaker`] and
89102
/// associated task.
103+
///
104+
/// [`RawWaker`]: struct.RawWaker.html
90105
drop: unsafe fn(*const ()),
91106
}
92107

@@ -128,6 +143,9 @@ impl RawWakerVTable {
128143
/// The implementation of this function must make sure to release any
129144
/// resources that are associated with this instance of a [`RawWaker`] and
130145
/// associated task.
146+
///
147+
/// [`Waker`]: struct.Waker.html
148+
/// [`RawWaker`]: struct.RawWaker.html
131149
#[rustc_promotable]
132150
#[cfg_attr(stage0, unstable(feature = "futures_api_const_fn_ptr", issue = "50547"))]
133151
#[cfg_attr(not(stage0), stable(feature = "futures_api", since = "1.36.0"))]
@@ -201,6 +219,8 @@ impl fmt::Debug for Context<'_> {
201219
/// executor-specific wakeup behavior.
202220
///
203221
/// Implements [`Clone`], [`Send`], and [`Sync`].
222+
///
223+
/// [`RawWaker`]: struct.RawWaker.html
204224
#[repr(transparent)]
205225
#[stable(feature = "futures_api", since = "1.36.0")]
206226
pub struct Waker {
@@ -266,6 +286,9 @@ impl Waker {
266286
/// The behavior of the returned `Waker` is undefined if the contract defined
267287
/// in [`RawWaker`]'s and [`RawWakerVTable`]'s documentation is not upheld.
268288
/// Therefore this method is unsafe.
289+
///
290+
/// [`RawWaker`]: struct.RawWaker.html
291+
/// [`RawWakerVTable`]: struct.RawWakerVTable.html
269292
#[inline]
270293
#[stable(feature = "futures_api", since = "1.36.0")]
271294
pub unsafe fn from_raw(waker: RawWaker) -> Waker {

src/libstd/alloc.rs

+5
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ static HOOK: AtomicPtr<()> = AtomicPtr::new(ptr::null_mut());
173173
/// about the allocation that failed.
174174
///
175175
/// The allocation error hook is a global resource.
176+
///
177+
/// [`set_alloc_error_hook`]: fn.set_alloc_error_hook.html
178+
/// [`take_alloc_error_hook`]: fn.take_alloc_error_hook.html
176179
#[unstable(feature = "alloc_error_hook", issue = "51245")]
177180
pub fn set_alloc_error_hook(hook: fn(Layout)) {
178181
HOOK.store(hook as *mut (), Ordering::SeqCst);
@@ -183,6 +186,8 @@ pub fn set_alloc_error_hook(hook: fn(Layout)) {
183186
/// *See also the function [`set_alloc_error_hook`].*
184187
///
185188
/// If no custom hook is registered, the default hook will be returned.
189+
///
190+
/// [`set_alloc_error_hook`]: fn.set_alloc_error_hook.html
186191
#[unstable(feature = "alloc_error_hook", issue = "51245")]
187192
pub fn take_alloc_error_hook() -> fn(Layout) {
188193
let hook = HOOK.swap(ptr::null_mut(), Ordering::SeqCst);

src/libstd/collections/hash/map.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -2492,7 +2492,10 @@ impl DefaultHasher {
24922492

24932493
#[stable(feature = "hashmap_default_hasher", since = "1.13.0")]
24942494
impl Default for DefaultHasher {
2495-
/// Creates a new `DefaultHasher` using [`new`][DefaultHasher::new].
2495+
// FIXME: here should link `new` to [DefaultHasher::new], but it occurs intra-doc link
2496+
// resolution failure when re-exporting libstd items. When #56922 fixed,
2497+
// link `new` to [DefaultHasher::new] again.
2498+
/// Creates a new `DefaultHasher` using `new`.
24962499
/// See its documentation for more.
24972500
fn default() -> DefaultHasher {
24982501
DefaultHasher::new()

src/libstd/error.rs

+18
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ pub trait Error: Debug + Display {
207207
impl<'a, E: Error + 'a> From<E> for Box<dyn Error + 'a> {
208208
/// Converts a type of [`Error`] into a box of dyn [`Error`].
209209
///
210+
/// [`Error`]: ../error/trait.Error.html
211+
///
210212
/// # Examples
211213
///
212214
/// ```
@@ -244,6 +246,8 @@ impl<'a, E: Error + Send + Sync + 'a> From<E> for Box<dyn Error + Send + Sync +
244246
/// Converts a type of [`Error`] + [`Send`] + [`Sync`] into a box of dyn [`Error`] +
245247
/// [`Send`] + [`Sync`].
246248
///
249+
/// [`Error`]: ../error/trait.Error.html
250+
///
247251
/// # Examples
248252
///
249253
/// ```
@@ -285,6 +289,8 @@ impl<'a, E: Error + Send + Sync + 'a> From<E> for Box<dyn Error + Send + Sync +
285289
impl From<String> for Box<dyn Error + Send + Sync> {
286290
/// Converts a [`String`] into a box of dyn [`Error`] + [`Send`] + [`Sync`].
287291
///
292+
/// [`Error`]: ../error/trait.Error.html
293+
///
288294
/// # Examples
289295
///
290296
/// ```
@@ -318,6 +324,8 @@ impl From<String> for Box<dyn Error + Send + Sync> {
318324
impl From<String> for Box<dyn Error> {
319325
/// Converts a [`String`] into a box of dyn [`Error`].
320326
///
327+
/// [`Error`]: ../error/trait.Error.html
328+
///
321329
/// # Examples
322330
///
323331
/// ```
@@ -339,6 +347,8 @@ impl From<String> for Box<dyn Error> {
339347
impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> {
340348
/// Converts a [`str`] into a box of dyn [`Error`] + [`Send`] + [`Sync`].
341349
///
350+
/// [`Error`]: ../error/trait.Error.html
351+
///
342352
/// # Examples
343353
///
344354
/// ```
@@ -359,6 +369,8 @@ impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> {
359369
impl From<&str> for Box<dyn Error> {
360370
/// Converts a [`str`] into a box of dyn [`Error`].
361371
///
372+
/// [`Error`]: ../error/trait.Error.html
373+
///
362374
/// # Examples
363375
///
364376
/// ```
@@ -378,6 +390,9 @@ impl From<&str> for Box<dyn Error> {
378390
impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + Send + Sync + 'a> {
379391
/// Converts a [`Cow`] into a box of dyn [`Error`] + [`Send`] + [`Sync`].
380392
///
393+
/// [`Cow`]: ../borrow/enum.Cow.html
394+
/// [`Error`]: ../error/trait.Error.html
395+
///
381396
/// # Examples
382397
///
383398
/// ```
@@ -399,6 +414,9 @@ impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + Send + Sync + 'a> {
399414
impl<'a> From<Cow<'a, str>> for Box<dyn Error> {
400415
/// Converts a [`Cow`] into a box of dyn [`Error`].
401416
///
417+
/// [`Cow`]: ../borrow/enum.Cow.html
418+
/// [`Error`]: ../error/trait.Error.html
419+
///
402420
/// # Examples
403421
///
404422
/// ```

src/libstd/ffi/os_str.rs

+2
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ impl From<String> for OsString {
351351
/// Converts a [`String`] into a [`OsString`].
352352
///
353353
/// The conversion copies the data, and includes an allocation on the heap.
354+
///
355+
/// [`OsString`]: ../../std/ffi/struct.OsString.html
354356
fn from(s: String) -> OsString {
355357
OsString { inner: Buf::from_string(s) }
356358
}

src/libstd/fs.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1812,6 +1812,8 @@ pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
18121812
/// function.)
18131813
/// * `path` already exists.
18141814
///
1815+
/// [`create_dir_all`]: fn.create_dir_all.html
1816+
///
18151817
/// # Examples
18161818
///
18171819
/// ```no_run

src/libstd/io/buffered.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ impl<W> fmt::Display for IntoInnerError<W> {
754754
/// completed, rather than the entire buffer at once. Enter `LineWriter`. It
755755
/// does exactly that.
756756
///
757-
/// Like [`BufWriter`], a `LineWriter`’s buffer will also be flushed when the
757+
/// Like [`BufWriter`][bufwriter], a `LineWriter`’s buffer will also be flushed when the
758758
/// `LineWriter` goes out of scope or when its internal buffer is full.
759759
///
760760
/// [bufwriter]: struct.BufWriter.html

src/libstd/net/addr.rs

+13
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,9 @@ impl FromInner<c::sockaddr_in6> for SocketAddrV6 {
546546
#[stable(feature = "ip_from_ip", since = "1.16.0")]
547547
impl From<SocketAddrV4> for SocketAddr {
548548
/// Converts a [`SocketAddrV4`] into a [`SocketAddr::V4`].
549+
///
550+
/// [`SocketAddrV4`]: ../../std/net/struct.SocketAddrV4.html
551+
/// [`SocketAddr::V4`]: ../../std/net/enum.SocketAddr.html#variant.V4
549552
fn from(sock4: SocketAddrV4) -> SocketAddr {
550553
SocketAddr::V4(sock4)
551554
}
@@ -554,6 +557,9 @@ impl From<SocketAddrV4> for SocketAddr {
554557
#[stable(feature = "ip_from_ip", since = "1.16.0")]
555558
impl From<SocketAddrV6> for SocketAddr {
556559
/// Converts a [`SocketAddrV6`] into a [`SocketAddr::V6`].
560+
///
561+
/// [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html
562+
/// [`SocketAddr::V6`]: ../../std/net/enum.SocketAddr.html#variant.V6
557563
fn from(sock6: SocketAddrV6) -> SocketAddr {
558564
SocketAddr::V6(sock6)
559565
}
@@ -567,6 +573,13 @@ impl<I: Into<IpAddr>> From<(I, u16)> for SocketAddr {
567573
/// and creates a [`SocketAddr::V6`] for a [`IpAddr::V6`].
568574
///
569575
/// `u16` is treated as port of the newly created [`SocketAddr`].
576+
///
577+
/// [`IpAddr`]: ../../std/net/enum.IpAddr.html
578+
/// [`IpAddr::V4`]: ../../std/net/enum.IpAddr.html#variant.V4
579+
/// [`IpAddr::V6`]: ../../std/net/enum.IpAddr.html#variant.V6
580+
/// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html
581+
/// [`SocketAddr::V4`]: ../../std/net/enum.SocketAddr.html#variant.V4
582+
/// [`SocketAddr::V6`]: ../../std/net/enum.SocketAddr.html#variant.V6
570583
fn from(pieces: (I, u16)) -> SocketAddr {
571584
SocketAddr::new(pieces.0.into(), pieces.1)
572585
}

src/libstd/sync/mutex.rs

+2
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,8 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Mutex<T> {
376376
impl<T> From<T> for Mutex<T> {
377377
/// Creates a new mutex in an unlocked state ready for use.
378378
/// This is equivalent to [`Mutex::new`].
379+
///
380+
/// [`Mutex::new`]: ../../std/sync/struct.Mutex.html#method.new
379381
fn from(t: T) -> Self {
380382
Mutex::new(t)
381383
}

src/libstd/sync/rwlock.rs

+2
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,8 @@ impl<T: Default> Default for RwLock<T> {
453453
impl<T> From<T> for RwLock<T> {
454454
/// Creates a new instance of an `RwLock<T>` which is unlocked.
455455
/// This is equivalent to [`RwLock::new`].
456+
///
457+
/// [`RwLock::new`]: ../../std/sync/struct.RwLock.html#method.new
456458
fn from(t: T) -> Self {
457459
RwLock::new(t)
458460
}

src/libstd/thread/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ impl Builder {
443443
/// [`Builder::spawn`]: ../../std/thread/struct.Builder.html#method.spawn
444444
/// [`io::Result`]: ../../std/io/type.Result.html
445445
/// [`JoinHandle`]: ../../std/thread/struct.JoinHandle.html
446+
/// [`JoinHandle::join`]: ../../std/thread/struct.JoinHandle.html#method.join
446447
#[unstable(feature = "thread_spawn_unchecked", issue = "55132")]
447448
pub unsafe fn spawn_unchecked<'a, F, T>(self, f: F) -> io::Result<JoinHandle<T>> where
448449
F: FnOnce() -> T, F: Send + 'a, T: Send + 'a
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#![deny(intra_doc_link_resolution_failure)]
2+
3+
pub use std::*;

0 commit comments

Comments
 (0)