diff options
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/alloc.rs | 173 | ||||
| -rw-r--r-- | library/std/src/ascii.rs | 23 | ||||
| -rw-r--r-- | library/std/src/env.rs | 41 | ||||
| -rw-r--r-- | library/std/src/error.rs | 28 | ||||
| -rw-r--r-- | library/std/src/fs.rs | 191 | ||||
| -rw-r--r-- | library/std/src/keyword_docs.rs | 20 | ||||
| -rw-r--r-- | library/std/src/net/addr.rs | 80 | ||||
| -rw-r--r-- | library/std/src/net/ip.rs | 139 | ||||
| -rw-r--r-- | library/std/src/net/mod.rs | 30 | ||||
| -rw-r--r-- | library/std/src/net/parser.rs | 8 | ||||
| -rw-r--r-- | library/std/src/net/tcp.rs | 84 | ||||
| -rw-r--r-- | library/std/src/net/udp.rs | 94 | ||||
| -rw-r--r-- | library/std/src/panic.rs | 17 | ||||
| -rw-r--r-- | library/std/src/sys/unix/ext/fs.rs | 45 | ||||
| -rw-r--r-- | library/std/src/sys/unix/ext/net.rs | 45 | ||||
| -rw-r--r-- | library/std/src/sys/unix/ext/process.rs | 8 | ||||
| -rw-r--r-- | library/std/src/sys/unix/ext/thread.rs | 4 | ||||
| -rw-r--r-- | library/std/src/sys/windows/ext/ffi.rs | 27 | ||||
| -rw-r--r-- | library/std/src/sys/windows/ext/fs.rs | 11 | ||||
| -rw-r--r-- | library/std/src/sys/windows/ext/process.rs | 4 |
20 files changed, 343 insertions, 729 deletions
diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs index 4712cc95b4a..b4009c86419 100644 --- a/library/std/src/alloc.rs +++ b/library/std/src/alloc.rs @@ -7,8 +7,6 @@ //! like `cdylib`s and `staticlib`s are guaranteed to use the [`System`] by //! default. //! -//! [`System`]: struct.System.html -//! //! # The `#[global_allocator]` attribute //! //! This attribute allows configuring the choice of global allocator. @@ -43,8 +41,6 @@ //! The attribute is used on a `static` item whose type implements the //! [`GlobalAlloc`] trait. This type can be provided by an external library: //! -//! [`GlobalAlloc`]: ../../core/alloc/trait.GlobalAlloc.html -//! //! ```rust,ignore (demonstrates crates.io usage) //! extern crate jemallocator; //! @@ -135,32 +131,75 @@ pub use alloc_crate::alloc::*; #[derive(Debug, Default, Copy, Clone)] pub struct System; +impl System { + #[inline] + fn alloc_impl(&mut self, layout: Layout, zeroed: bool) -> Result<NonNull<[u8]>, AllocErr> { + match layout.size() { + 0 => Ok(NonNull::slice_from_raw_parts(layout.dangling(), 0)), + // SAFETY: `layout` is non-zero in size, + size => unsafe { + let raw_ptr = if zeroed { + GlobalAlloc::alloc_zeroed(self, layout) + } else { + GlobalAlloc::alloc(self, layout) + }; + let ptr = NonNull::new(raw_ptr).ok_or(AllocErr)?; + Ok(NonNull::slice_from_raw_parts(ptr, size)) + }, + } + } + + // Safety: Same as `AllocRef::grow` + #[inline] + unsafe fn grow_impl( + &mut self, + ptr: NonNull<u8>, + layout: Layout, + new_size: usize, + zeroed: bool, + ) -> Result<NonNull<[u8]>, AllocErr> { + debug_assert!( + new_size >= layout.size(), + "`new_size` must be greater than or equal to `layout.size()`" + ); + + match layout.size() { + // SAFETY: the caller must ensure that the `new_size` does not overflow. + // `layout.align()` comes from a `Layout` and is thus guaranteed to be valid for a Layout. + 0 => unsafe { + let new_layout = Layout::from_size_align_unchecked(new_size, layout.align()); + self.alloc_impl(new_layout, zeroed) + }, + + // SAFETY: `new_size` is non-zero as `old_size` is greater than or equal to `new_size` + // as required by safety conditions. Other conditions must be upheld by the caller + old_size => unsafe { + // `realloc` probably checks for `new_size >= size` or something similar. + intrinsics::assume(new_size >= layout.size()); + + let raw_ptr = GlobalAlloc::realloc(self, ptr.as_ptr(), layout, new_size); + let ptr = NonNull::new(raw_ptr).ok_or(AllocErr)?; + if zeroed { + raw_ptr.add(old_size).write_bytes(0, new_size - old_size); + } + Ok(NonNull::slice_from_raw_parts(ptr, new_size)) + }, + } + } +} + // The AllocRef impl checks the layout size to be non-zero and forwards to the GlobalAlloc impl, // which is in `std::sys::*::alloc`. #[unstable(feature = "allocator_api", issue = "32838")] unsafe impl AllocRef for System { #[inline] fn alloc(&mut self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr> { - let size = layout.size(); - let ptr = if size == 0 { - layout.dangling() - } else { - // SAFETY: `layout` is non-zero in size, - unsafe { NonNull::new(GlobalAlloc::alloc(&System, layout)).ok_or(AllocErr)? } - }; - Ok(NonNull::slice_from_raw_parts(ptr, size)) + self.alloc_impl(layout, false) } #[inline] fn alloc_zeroed(&mut self, layout: Layout) -> Result<NonNull<[u8]>, AllocErr> { - let size = layout.size(); - let ptr = if size == 0 { - layout.dangling() - } else { - // SAFETY: `layout` is non-zero in size, - unsafe { NonNull::new(GlobalAlloc::alloc_zeroed(&System, layout)).ok_or(AllocErr)? } - }; - Ok(NonNull::slice_from_raw_parts(ptr, size)) + self.alloc_impl(layout, true) } #[inline] @@ -168,7 +207,7 @@ unsafe impl AllocRef for System { if layout.size() != 0 { // SAFETY: `layout` is non-zero in size, // other conditions must be upheld by the caller - unsafe { GlobalAlloc::dealloc(&System, ptr.as_ptr(), layout) } + unsafe { GlobalAlloc::dealloc(self, ptr.as_ptr(), layout) } } } @@ -179,28 +218,8 @@ unsafe impl AllocRef for System { layout: Layout, new_size: usize, ) -> Result<NonNull<[u8]>, AllocErr> { - debug_assert!( - new_size >= layout.size(), - "`new_size` must be greater than or equal to `layout.size()`" - ); - - // SAFETY: `new_size` must be non-zero, which is checked in the match expression. - // Other conditions must be upheld by the caller - unsafe { - match layout.size() { - old_size if old_size == new_size => { - Ok(NonNull::slice_from_raw_parts(ptr, new_size)) - } - 0 => self.alloc(Layout::from_size_align_unchecked(new_size, layout.align())), - old_size => { - // `realloc` probably checks for `new_size > size` or something similar. - intrinsics::assume(new_size > old_size); - let raw_ptr = GlobalAlloc::realloc(&System, ptr.as_ptr(), layout, new_size); - let ptr = NonNull::new(raw_ptr).ok_or(AllocErr)?; - Ok(NonNull::slice_from_raw_parts(ptr, new_size)) - } - } - } + // SAFETY: all conditions must be upheld by the caller + unsafe { self.grow_impl(ptr, layout, new_size, false) } } #[inline] @@ -210,29 +229,8 @@ unsafe impl AllocRef for System { layout: Layout, new_size: usize, ) -> Result<NonNull<[u8]>, AllocErr> { - debug_assert!( - new_size >= layout.size(), - "`new_size` must be greater than or equal to `layout.size()`" - ); - - // SAFETY: `new_size` must be non-zero, which is checked in the match expression. - // Other conditions must be upheld by the caller - unsafe { - match layout.size() { - old_size if old_size == new_size => { - Ok(NonNull::slice_from_raw_parts(ptr, new_size)) - } - 0 => self.alloc_zeroed(Layout::from_size_align_unchecked(new_size, layout.align())), - old_size => { - // `realloc` probably checks for `new_size > size` or something similar. - intrinsics::assume(new_size > old_size); - let raw_ptr = GlobalAlloc::realloc(&System, ptr.as_ptr(), layout, new_size); - raw_ptr.add(old_size).write_bytes(0, new_size - old_size); - let ptr = NonNull::new(raw_ptr).ok_or(AllocErr)?; - Ok(NonNull::slice_from_raw_parts(ptr, new_size)) - } - } - } + // SAFETY: all conditions must be upheld by the caller + unsafe { self.grow_impl(ptr, layout, new_size, true) } } #[inline] @@ -242,35 +240,31 @@ unsafe impl AllocRef for System { layout: Layout, new_size: usize, ) -> Result<NonNull<[u8]>, AllocErr> { - let old_size = layout.size(); debug_assert!( - new_size <= old_size, + new_size <= layout.size(), "`new_size` must be smaller than or equal to `layout.size()`" ); - let ptr = if new_size == old_size { - ptr - } else if new_size == 0 { - // SAFETY: `layout` is non-zero in size as `old_size` != `new_size` - // Other conditions must be upheld by the caller - unsafe { + match new_size { + // SAFETY: conditions must be upheld by the caller + 0 => unsafe { self.dealloc(ptr, layout); - } - layout.dangling() - } else { - // SAFETY: new_size is not zero, - // Other conditions must be upheld by the caller - let raw_ptr = unsafe { - // `realloc` probably checks for `new_size < old_size` or something similar. - intrinsics::assume(new_size < old_size); - GlobalAlloc::realloc(&System, ptr.as_ptr(), layout, new_size) - }; - NonNull::new(raw_ptr).ok_or(AllocErr)? - }; + Ok(NonNull::slice_from_raw_parts(layout.dangling(), 0)) + }, + + // SAFETY: `new_size` is non-zero. Other conditions must be upheld by the caller + new_size => unsafe { + // `realloc` probably checks for `new_size <= size` or something similar. + intrinsics::assume(new_size <= layout.size()); - Ok(NonNull::slice_from_raw_parts(ptr, new_size)) + let raw_ptr = GlobalAlloc::realloc(self, ptr.as_ptr(), layout, new_size); + let ptr = NonNull::new(raw_ptr).ok_or(AllocErr)?; + Ok(NonNull::slice_from_raw_parts(ptr, new_size)) + }, + } } } + static HOOK: AtomicPtr<()> = AtomicPtr::new(ptr::null_mut()); /// Registers a custom allocation error hook, replacing any that was previously registered. @@ -284,9 +278,6 @@ static HOOK: AtomicPtr<()> = AtomicPtr::new(ptr::null_mut()); /// about the allocation that failed. /// /// The allocation error hook is a global resource. -/// -/// [`set_alloc_error_hook`]: fn.set_alloc_error_hook.html -/// [`take_alloc_error_hook`]: fn.take_alloc_error_hook.html #[unstable(feature = "alloc_error_hook", issue = "51245")] pub fn set_alloc_error_hook(hook: fn(Layout)) { HOOK.store(hook as *mut (), Ordering::SeqCst); @@ -297,8 +288,6 @@ pub fn set_alloc_error_hook(hook: fn(Layout)) { /// *See also the function [`set_alloc_error_hook`].* /// /// If no custom hook is registered, the default hook will be returned. -/// -/// [`set_alloc_error_hook`]: fn.set_alloc_error_hook.html #[unstable(feature = "alloc_error_hook", issue = "51245")] pub fn take_alloc_error_hook() -> fn(Layout) { let hook = HOOK.swap(ptr::null_mut(), Ordering::SeqCst); diff --git a/library/std/src/ascii.rs b/library/std/src/ascii.rs index 5cd2a25b117..c9106136d34 100644 --- a/library/std/src/ascii.rs +++ b/library/std/src/ascii.rs @@ -10,9 +10,6 @@ //! //! The [`escape_default`] function provides an iterator over the bytes of an //! escaped version of the character given. -//! -//! [`AsciiExt`]: trait.AsciiExt.html -//! [`escape_default`]: fn.escape_default.html #![stable(feature = "rust1", since = "1.0.0")] @@ -52,7 +49,7 @@ pub trait AsciiExt { /// /// # Note /// - /// This method will be deprecated in favor of the identically-named + /// This method is deprecated in favor of the identically-named /// inherent methods on `u8`, `char`, `[u8]` and `str`. #[stable(feature = "rust1", since = "1.0.0")] fn is_ascii(&self) -> bool; @@ -69,10 +66,10 @@ pub trait AsciiExt { /// /// # Note /// - /// This method will be deprecated in favor of the identically-named + /// This method is deprecated in favor of the identically-named /// inherent methods on `u8`, `char`, `[u8]` and `str`. /// - /// [`make_ascii_uppercase`]: #tymethod.make_ascii_uppercase + /// [`make_ascii_uppercase`]: AsciiExt::make_ascii_uppercase /// [`str::to_uppercase`]: ../primitive.str.html#method.to_uppercase #[stable(feature = "rust1", since = "1.0.0")] #[allow(deprecated)] @@ -90,10 +87,10 @@ pub trait AsciiExt { /// /// # Note /// - /// This method will be deprecated in favor of the identically-named + /// This method is deprecated in favor of the identically-named /// inherent methods on `u8`, `char`, `[u8]` and `str`. /// - /// [`make_ascii_lowercase`]: #tymethod.make_ascii_lowercase + /// [`make_ascii_lowercase`]: AsciiExt::make_ascii_lowercase /// [`str::to_lowercase`]: ../primitive.str.html#method.to_lowercase #[stable(feature = "rust1", since = "1.0.0")] #[allow(deprecated)] @@ -106,7 +103,7 @@ pub trait AsciiExt { /// /// # Note /// - /// This method will be deprecated in favor of the identically-named + /// This method is deprecated in favor of the identically-named /// inherent methods on `u8`, `char`, `[u8]` and `str`. #[stable(feature = "rust1", since = "1.0.0")] fn eq_ignore_ascii_case(&self, other: &Self) -> bool; @@ -121,10 +118,10 @@ pub trait AsciiExt { /// /// # Note /// - /// This method will be deprecated in favor of the identically-named + /// This method is deprecated in favor of the identically-named /// inherent methods on `u8`, `char`, `[u8]` and `str`. /// - /// [`to_ascii_uppercase`]: #tymethod.to_ascii_uppercase + /// [`to_ascii_uppercase`]: AsciiExt::to_ascii_uppercase #[stable(feature = "ascii", since = "1.9.0")] fn make_ascii_uppercase(&mut self); @@ -138,10 +135,10 @@ pub trait AsciiExt { /// /// # Note /// - /// This method will be deprecated in favor of the identically-named + /// This method is deprecated in favor of the identically-named /// inherent methods on `u8`, `char`, `[u8]` and `str`. /// - /// [`to_ascii_lowercase`]: #tymethod.to_ascii_lowercase + /// [`to_ascii_lowercase`]: AsciiExt::to_ascii_lowercase #[stable(feature = "ascii", since = "1.9.0")] fn make_ascii_lowercase(&mut self); } diff --git a/library/std/src/env.rs b/library/std/src/env.rs index 6489e0709cb..387c588f4a0 100644 --- a/library/std/src/env.rs +++ b/library/std/src/env.rs @@ -7,9 +7,6 @@ //! There are several functions and structs in this module that have a //! counterpart ending in `os`. Those ending in `os` will return an [`OsString`] //! and those without will return a [`String`]. -//! -//! [`OsString`]: ../../std/ffi/struct.OsString.html -//! [`String`]: ../string/struct.String.html #![stable(feature = "env", since = "1.0.0")] @@ -31,9 +28,6 @@ use crate::sys::os as os_imp; /// * Current directory does not exist. /// * There are insufficient permissions to access the current directory. /// -/// [`PathBuf`]: ../../std/path/struct.PathBuf.html -/// [`Err`]: ../../std/result/enum.Result.html#method.err -/// /// # Examples /// /// ``` @@ -54,8 +48,6 @@ pub fn current_dir() -> io::Result<PathBuf> { /// /// Returns an [`Err`] if the operation fails. /// -/// [`Err`]: ../../std/result/enum.Result.html#method.err -/// /// # Examples /// /// ``` @@ -76,7 +68,7 @@ pub fn set_current_dir<P: AsRef<Path>>(path: P) -> io::Result<()> { /// This structure is created by the [`std::env::vars`] function. See its /// documentation for more. /// -/// [`std::env::vars`]: fn.vars.html +/// [`std::env::vars`]: vars #[stable(feature = "env", since = "1.0.0")] pub struct Vars { inner: VarsOs, @@ -87,7 +79,7 @@ pub struct Vars { /// This structure is created by the [`std::env::vars_os`] function. See /// its documentation for more. /// -/// [`std::env::vars_os`]: fn.vars_os.html +/// [`std::env::vars_os`]: vars_os #[stable(feature = "env", since = "1.0.0")] pub struct VarsOs { inner: os_imp::Env, @@ -106,7 +98,7 @@ pub struct VarsOs { /// environment is not valid unicode. If this is not desired, consider using the /// [`env::vars_os`] function. /// -/// [`env::vars_os`]: fn.vars_os.html +/// [`env::vars_os`]: vars_os /// /// # Examples /// @@ -222,8 +214,6 @@ fn _var(key: &OsStr) -> Result<String, VarError> { /// Fetches the environment variable `key` from the current process, returning /// [`None`] if the variable isn't set. /// -/// [`None`]: ../option/enum.Option.html#variant.None -/// /// # Panics /// /// This function may panic if `key` is empty, contains an ASCII equals sign @@ -254,7 +244,7 @@ fn _var_os(key: &OsStr) -> Option<OsString> { /// The error type for operations interacting with environment variables. /// Possibly returned from the [`env::var`] function. /// -/// [`env::var`]: fn.var.html +/// [`env::var`]: var #[derive(Debug, PartialEq, Eq, Clone)] #[stable(feature = "env", since = "1.0.0")] pub enum VarError { @@ -382,8 +372,7 @@ fn _remove_var(k: &OsStr) { /// This structure is created by the [`std::env::split_paths`] function. See its /// documentation for more. /// -/// [`PathBuf`]: ../../std/path/struct.PathBuf.html -/// [`std::env::split_paths`]: fn.split_paths.html +/// [`std::env::split_paths`]: split_paths #[stable(feature = "env", since = "1.0.0")] pub struct SplitPaths<'a> { inner: os_imp::SplitPaths<'a>, @@ -410,8 +399,6 @@ pub struct SplitPaths<'a> { /// None => println!("{} is not defined in the environment.", key) /// } /// ``` -/// -/// [`PathBuf`]: ../../std/path/struct.PathBuf.html #[stable(feature = "env", since = "1.0.0")] pub fn split_paths<T: AsRef<OsStr> + ?Sized>(unparsed: &T) -> SplitPaths<'_> { SplitPaths { inner: os_imp::split_paths(unparsed.as_ref()) } @@ -438,7 +425,7 @@ impl fmt::Debug for SplitPaths<'_> { /// The error type for operations on the `PATH` variable. Possibly returned from /// the [`env::join_paths`] function. /// -/// [`env::join_paths`]: fn.join_paths.html +/// [`env::join_paths`]: join_paths #[derive(Debug)] #[stable(feature = "env", since = "1.0.0")] pub struct JoinPathsError { @@ -450,14 +437,10 @@ pub struct JoinPathsError { /// /// # Errors /// -/// Returns an [`Err`][err] (containing an error message) if one of the input +/// Returns an [`Err`] (containing an error message) if one of the input /// [`Path`]s contains an invalid character for constructing the `PATH` /// variable (a double quote on Windows or a colon on Unix). /// -/// [`Path`]: ../../std/path/struct.Path.html -/// [`OsString`]: ../../std/ffi/struct.OsString.html -/// [err]: ../../std/result/enum.Result.html#variant.Err -/// /// # Examples /// /// Joining paths on a Unix-like platform: @@ -508,7 +491,7 @@ pub struct JoinPathsError { /// } /// ``` /// -/// [`env::split_paths`]: fn.split_paths.html +/// [`env::split_paths`]: split_paths #[stable(feature = "env", since = "1.0.0")] pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError> where @@ -688,8 +671,7 @@ pub fn current_exe() -> io::Result<PathBuf> { /// set to arbitrary text, and may not even exist. This means this property /// should not be relied upon for security purposes. /// -/// [`String`]: ../string/struct.String.html -/// [`std::env::args`]: ./fn.args.html +/// [`std::env::args`]: args #[stable(feature = "env", since = "1.0.0")] pub struct Args { inner: ArgsOs, @@ -705,8 +687,7 @@ pub struct Args { /// set to arbitrary text, and may not even exist. This means this property /// should not be relied upon for security purposes. /// -/// [`OsString`]: ../ffi/struct.OsString.html -/// [`std::env::args_os`]: ./fn.args_os.html +/// [`std::env::args_os`]: args_os #[stable(feature = "env", since = "1.0.0")] pub struct ArgsOs { inner: sys::args::Args, @@ -744,8 +725,6 @@ pub struct ArgsOs { /// println!("{}", argument); /// } /// ``` -/// -/// [`args_os`]: ./fn.args_os.html #[stable(feature = "env", since = "1.0.0")] pub fn args() -> Args { Args { inner: args_os() } diff --git a/library/std/src/error.rs b/library/std/src/error.rs index 3b4cb859dd4..1b7681bd4bb 100644 --- a/library/std/src/error.rs +++ b/library/std/src/error.rs @@ -40,10 +40,8 @@ use crate::string; /// provide its own errors while also revealing some of the implementation for /// debugging via [`source`] chains. /// -/// [`Result<T, E>`]: ../result/enum.Result.html -/// [`Display`]: ../fmt/trait.Display.html -/// [`Debug`]: ../fmt/trait.Debug.html -/// [`source`]: trait.Error.html#method.source +/// [`Result<T, E>`]: Result +/// [`source`]: Error::source #[stable(feature = "rust1", since = "1.0.0")] pub trait Error: Debug + Display { /// The lower-level source of this error, if any. @@ -164,8 +162,6 @@ mod private { impl<'a, E: Error + 'a> From<E> for Box<dyn Error + 'a> { /// Converts a type of [`Error`] into a box of dyn [`Error`]. /// - /// [`Error`]: ../error/trait.Error.html - /// /// # Examples /// /// ``` @@ -199,8 +195,6 @@ impl<'a, E: Error + Send + Sync + 'a> From<E> for Box<dyn Error + Send + Sync + /// Converts a type of [`Error`] + [`Send`] + [`Sync`] into a box of /// dyn [`Error`] + [`Send`] + [`Sync`]. /// - /// [`Error`]: ../error/trait.Error.html - /// /// # Examples /// /// ``` @@ -238,8 +232,6 @@ impl<'a, E: Error + Send + Sync + 'a> From<E> for Box<dyn Error + Send + Sync + impl From<String> for Box<dyn Error + Send + Sync> { /// Converts a [`String`] into a box of dyn [`Error`] + [`Send`] + [`Sync`]. /// - /// [`Error`]: ../error/trait.Error.html - /// /// # Examples /// /// ``` @@ -283,8 +275,6 @@ impl From<String> for Box<dyn Error + Send + Sync> { impl From<String> for Box<dyn Error> { /// Converts a [`String`] into a box of dyn [`Error`]. /// - /// [`Error`]: ../error/trait.Error.html - /// /// # Examples /// /// ``` @@ -306,8 +296,6 @@ impl From<String> for Box<dyn Error> { impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> { /// Converts a [`str`] into a box of dyn [`Error`] + [`Send`] + [`Sync`]. /// - /// [`Error`]: ../error/trait.Error.html - /// /// # Examples /// /// ``` @@ -329,8 +317,6 @@ impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> { impl From<&str> for Box<dyn Error> { /// Converts a [`str`] into a box of dyn [`Error`]. /// - /// [`Error`]: ../error/trait.Error.html - /// /// # Examples /// /// ``` @@ -350,9 +336,6 @@ impl From<&str> for Box<dyn Error> { impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + Send + Sync + 'a> { /// Converts a [`Cow`] into a box of dyn [`Error`] + [`Send`] + [`Sync`]. /// - /// [`Cow`]: ../borrow/enum.Cow.html - /// [`Error`]: ../error/trait.Error.html - /// /// # Examples /// /// ``` @@ -374,9 +357,6 @@ impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + Send + Sync + 'a> { impl<'a> From<Cow<'a, str>> for Box<dyn Error> { /// Converts a [`Cow`] into a box of dyn [`Error`]. /// - /// [`Cow`]: ../borrow/enum.Cow.html - /// [`Error`]: ../error/trait.Error.html - /// /// # Examples /// /// ``` @@ -703,7 +683,7 @@ impl dyn Error { /// assert!(iter.next().is_none()); /// ``` /// - /// [`source`]: trait.Error.html#method.source + /// [`source`]: Error::source #[unstable(feature = "error_iter", issue = "58520")] #[inline] pub fn chain(&self) -> Chain<'_> { @@ -715,8 +695,6 @@ impl dyn Error { /// /// If you want to omit the initial error and only process /// its sources, use `skip(1)`. -/// -/// [`Error`]: trait.Error.html #[unstable(feature = "error_iter", issue = "58520")] #[derive(Clone, Debug)] pub struct Chain<'a> { diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 047478fcc85..2767675ff92 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -30,7 +30,7 @@ use crate::time::SystemTime; /// /// # Examples /// -/// Creates a new file and write bytes to it (you can also use [`write`]): +/// Creates a new file and write bytes to it (you can also use [`write()`]): /// /// ```no_run /// use std::fs::File; @@ -84,14 +84,8 @@ use crate::time::SystemTime; /// by different processes. Avoid assuming that holding a `&File` means that the /// file will not change. /// -/// [`Seek`]: ../io/trait.Seek.html -/// [`String`]: ../string/struct.String.html -/// [`Read`]: ../io/trait.Read.html -/// [`Write`]: ../io/trait.Write.html -/// [`BufReader<R>`]: ../io/struct.BufReader.html -/// [`sync_all`]: struct.File.html#method.sync_all -/// [`read`]: fn.read.html -/// [`write`]: fn.write.html +/// [`BufReader<R>`]: io::BufReader +/// [`sync_all`]: File::sync_all #[stable(feature = "rust1", since = "1.0.0")] pub struct File { inner: fs_imp::File, @@ -103,9 +97,6 @@ pub struct File { /// [`symlink_metadata`] function or method and represents known /// metadata about a file such as its permissions, size, modification /// times, etc. -/// -/// [`metadata`]: fn.metadata.html -/// [`symlink_metadata`]: fn.symlink_metadata.html #[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone)] pub struct Metadata(fs_imp::FileAttr); @@ -124,19 +115,12 @@ pub struct Metadata(fs_imp::FileAttr); /// /// This [`io::Result`] will be an [`Err`] if there's some sort of intermittent /// IO error during iteration. -/// -/// [`read_dir`]: fn.read_dir.html -/// [`DirEntry`]: struct.DirEntry.html -/// [`io::Result`]: ../io/type.Result.html -/// [`Err`]: ../result/enum.Result.html#variant.Err #[stable(feature = "rust1", since = "1.0.0")] #[derive(Debug)] pub struct ReadDir(fs_imp::ReadDir); /// Entries returned by the [`ReadDir`] iterator. /// -/// [`ReadDir`]: struct.ReadDir.html -/// /// An instance of `DirEntry` represents an entry inside of a directory on the /// filesystem. Each entry can be inspected via methods to learn about the full /// path or possibly other metadata through per-platform extension traits. @@ -150,20 +134,11 @@ pub struct DirEntry(fs_imp::DirEntry); /// [`File::create`] methods are aliases for commonly used options using this /// builder. /// -/// [`File`]: struct.File.html -/// [`File::open`]: struct.File.html#method.open -/// [`File::create`]: struct.File.html#method.create -/// -/// Generally speaking, when using `OpenOptions`, you'll first call [`new`], -/// then chain calls to methods to set each option, then call [`open`], -/// passing the path of the file you're trying to open. This will give you a -/// [`io::Result`][result] with a [`File`][file] inside that you can further -/// operate on. -/// -/// [`new`]: struct.OpenOptions.html#method.new -/// [`open`]: struct.OpenOptions.html#method.open -/// [result]: ../io/type.Result.html -/// [file]: struct.File.html +/// Generally speaking, when using `OpenOptions`, you'll first call +/// [`OpenOptions::new`], then chain calls to methods to set each option, then +/// call [`OpenOptions::open`], passing the path of the file you're trying to +/// open. This will give you a [`io::Result`] with a [`File`] inside that you +/// can further operate on. /// /// # Examples /// @@ -193,21 +168,18 @@ pub struct OpenOptions(fs_imp::OpenOptions); /// Representation of the various permissions on a file. /// -/// This module only currently provides one bit of information, [`readonly`], -/// which is exposed on all currently supported platforms. Unix-specific -/// functionality, such as mode bits, is available through the -/// [`PermissionsExt`] trait. +/// This module only currently provides one bit of information, +/// [`Permissions::readonly`], which is exposed on all currently supported +/// platforms. Unix-specific functionality, such as mode bits, is available +/// through the [`PermissionsExt`] trait. /// -/// [`readonly`]: struct.Permissions.html#method.readonly -/// [`PermissionsExt`]: ../os/unix/fs/trait.PermissionsExt.html +/// [`PermissionsExt`]: crate::os::unix::fs::PermissionsExt #[derive(Clone, PartialEq, Eq, Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub struct Permissions(fs_imp::FilePermissions); /// A structure representing a type of file with accessors for each file type. /// It is returned by [`Metadata::file_type`] method. -/// -/// [`Metadata::file_type`]: struct.Metadata.html#method.file_type #[stable(feature = "file_type", since = "1.1.0")] #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] pub struct FileType(fs_imp::FileType); @@ -235,22 +207,17 @@ fn initial_buffer_size(file: &File) -> usize { /// This is a convenience function for using [`File::open`] and [`read_to_end`] /// with fewer imports and without an intermediate variable. It pre-allocates a /// buffer based on the file size when available, so it is generally faster than -/// reading into a vector created with `Vec::new()`. +/// reading into a vector created with [`Vec::new()`]. /// -/// [`File::open`]: struct.File.html#method.open -/// [`read_to_end`]: ../io/trait.Read.html#method.read_to_end +/// [`read_to_end`]: Read::read_to_end /// /// # Errors /// /// This function will return an error if `path` does not already exist. /// Other errors may also be returned according to [`OpenOptions::open`]. /// -/// [`OpenOptions::open`]: struct.OpenOptions.html#method.open -/// /// It will also return an error if it encounters while reading an error -/// of a kind other than [`ErrorKind::Interrupted`]. -/// -/// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted +/// of a kind other than [`io::ErrorKind::Interrupted`]. /// /// # Examples /// @@ -279,24 +246,19 @@ pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> { /// This is a convenience function for using [`File::open`] and [`read_to_string`] /// with fewer imports and without an intermediate variable. It pre-allocates a /// buffer based on the file size when available, so it is generally faster than -/// reading into a string created with `String::new()`. +/// reading into a string created with [`String::new()`]. /// -/// [`File::open`]: struct.File.html#method.open -/// [`read_to_string`]: ../io/trait.Read.html#method.read_to_string +/// [`read_to_string`]: Read::read_to_string /// /// # Errors /// /// This function will return an error if `path` does not already exist. /// Other errors may also be returned according to [`OpenOptions::open`]. /// -/// [`OpenOptions::open`]: struct.OpenOptions.html#method.open -/// /// It will also return an error if it encounters while reading an error -/// of a kind other than [`ErrorKind::Interrupted`], +/// of a kind other than [`io::ErrorKind::Interrupted`], /// or if the contents of the file are not valid UTF-8. /// -/// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted -/// /// # Examples /// /// ```no_run @@ -327,8 +289,7 @@ pub fn read_to_string<P: AsRef<Path>>(path: P) -> io::Result<String> { /// This is a convenience function for using [`File::create`] and [`write_all`] /// with fewer imports. /// -/// [`File::create`]: struct.File.html#method.create -/// [`write_all`]: ../io/trait.Write.html#method.write_all +/// [`write_all`]: Write::write_all /// /// # Examples /// @@ -359,8 +320,6 @@ impl File { /// This function will return an error if `path` does not already exist. /// Other errors may also be returned according to [`OpenOptions::open`]. /// - /// [`OpenOptions::open`]: struct.OpenOptions.html#method.open - /// /// # Examples /// /// ```no_run @@ -383,8 +342,6 @@ impl File { /// /// See the [`OpenOptions::open`] function for more details. /// - /// [`OpenOptions::open`]: struct.OpenOptions.html#method.open - /// /// # Examples /// /// ```no_run @@ -413,8 +370,6 @@ impl File { /// /// See the [`OpenOptions::new`] function for more details. /// - /// [`OpenOptions::new`]: struct.OpenOptions.html#method.new - /// /// # Examples /// /// ```no_run @@ -469,7 +424,7 @@ impl File { /// Note that some platforms may simply implement this in terms of /// [`sync_all`]. /// - /// [`sync_all`]: struct.File.html#method.sync_all + /// [`sync_all`]: File::sync_all /// /// # Examples /// @@ -824,15 +779,13 @@ impl OpenOptions { /// /// ## Note /// - /// This function doesn't create the file if it doesn't exist. Use the [`create`] - /// method to do so. + /// This function doesn't create the file if it doesn't exist. Use the + /// [`OpenOptions::create`] method to do so. /// - /// [`write()`]: ../../std/fs/struct.File.html#method.write - /// [`flush()`]: ../../std/fs/struct.File.html#method.flush - /// [`seek`]: ../../std/fs/struct.File.html#method.seek - /// [`SeekFrom`]: ../../std/io/enum.SeekFrom.html - /// [`Current`]: ../../std/io/enum.SeekFrom.html#variant.Current - /// [`create`]: #method.create + /// [`write()`]: Write::write + /// [`flush()`]: Write::flush + /// [`seek`]: Seek::seek + /// [`Current`]: SeekFrom::Current /// /// # Examples /// @@ -869,11 +822,8 @@ impl OpenOptions { /// Sets the option to create a new file, or open it if it already exists. /// - /// In order for the file to be created, [`write`] or [`append`] access must - /// be used. - /// - /// [`write`]: #method.write - /// [`append`]: #method.append + /// In order for the file to be created, [`OpenOptions::write`] or + /// [`OpenOptions::append`] access must be used. /// /// # Examples /// @@ -903,8 +853,8 @@ impl OpenOptions { /// The file must be opened with write or append access in order to create /// a new file. /// - /// [`.create()`]: #method.create - /// [`.truncate()`]: #method.truncate + /// [`.create()`]: OpenOptions::create + /// [`.truncate()`]: OpenOptions::truncate /// /// # Examples /// @@ -927,9 +877,9 @@ impl OpenOptions { /// /// This function will return an error under a number of different /// circumstances. Some of these error conditions are listed here, together - /// with their [`ErrorKind`]. The mapping to [`ErrorKind`]s is not part of - /// the compatibility contract of the function, especially the `Other` kind - /// might change to more specific kinds in the future. + /// with their [`io::ErrorKind`]. The mapping to [`io::ErrorKind`]s is not + /// part of the compatibility contract of the function, especially the + /// [`Other`] kind might change to more specific kinds in the future. /// /// * [`NotFound`]: The specified file does not exist and neither `create` /// or `create_new` is set. @@ -958,12 +908,11 @@ impl OpenOptions { /// let file = OpenOptions::new().read(true).open("foo.txt"); /// ``` /// - /// [`ErrorKind`]: ../io/enum.ErrorKind.html - /// [`AlreadyExists`]: ../io/enum.ErrorKind.html#variant.AlreadyExists - /// [`InvalidInput`]: ../io/enum.ErrorKind.html#variant.InvalidInput - /// [`NotFound`]: ../io/enum.ErrorKind.html#variant.NotFound - /// [`Other`]: ../io/enum.ErrorKind.html#variant.Other - /// [`PermissionDenied`]: ../io/enum.ErrorKind.html#variant.PermissionDenied + /// [`AlreadyExists`]: io::ErrorKind::AlreadyExists + /// [`InvalidInput`]: io::ErrorKind::InvalidInput + /// [`NotFound`]: io::ErrorKind::NotFound + /// [`Other`]: io::ErrorKind::Other + /// [`PermissionDenied`]: io::ErrorKind::PermissionDenied #[stable(feature = "rust1", since = "1.0.0")] pub fn open<P: AsRef<Path>>(&self, path: P) -> io::Result<File> { self._open(path.as_ref()) @@ -1008,12 +957,9 @@ impl Metadata { /// Returns `true` if this metadata is for a directory. The /// result is mutually exclusive to the result of - /// [`is_file`], and will be false for symlink metadata + /// [`Metadata::is_file`], and will be false for symlink metadata /// obtained from [`symlink_metadata`]. /// - /// [`is_file`]: struct.Metadata.html#method.is_file - /// [`symlink_metadata`]: fn.symlink_metadata.html - /// /// # Examples /// /// ```no_run @@ -1033,7 +979,7 @@ impl Metadata { /// Returns `true` if this metadata is for a regular file. The /// result is mutually exclusive to the result of - /// [`is_dir`], and will be false for symlink metadata + /// [`Metadata::is_dir`], and will be false for symlink metadata /// obtained from [`symlink_metadata`]. /// /// When the goal is simply to read from (or write to) the source, the most @@ -1042,11 +988,6 @@ impl Metadata { /// a Unix-like system for example. See [`File::open`] or /// [`OpenOptions::open`] for more information. /// - /// [`is_dir`]: struct.Metadata.html#method.is_dir - /// [`symlink_metadata`]: fn.symlink_metadata.html - /// [`File::open`]: struct.File.html#method.open - /// [`OpenOptions::open`]: struct.OpenOptions.html#method.open - /// /// # Examples /// /// ```no_run @@ -1256,9 +1197,7 @@ impl Permissions { /// writing. /// /// This operation does **not** modify the filesystem. To modify the - /// filesystem use the [`fs::set_permissions`] function. - /// - /// [`fs::set_permissions`]: fn.set_permissions.html + /// filesystem use the [`set_permissions`] function. /// /// # Examples /// @@ -1292,8 +1231,8 @@ impl FileType { /// [`is_file`] and [`is_symlink`]; only zero or one of these /// tests may pass. /// - /// [`is_file`]: struct.FileType.html#method.is_file - /// [`is_symlink`]: struct.FileType.html#method.is_symlink + /// [`is_file`]: FileType::is_file + /// [`is_symlink`]: FileType::is_symlink /// /// # Examples /// @@ -1324,10 +1263,8 @@ impl FileType { /// a Unix-like system for example. See [`File::open`] or /// [`OpenOptions::open`] for more information. /// - /// [`is_dir`]: struct.FileType.html#method.is_dir - /// [`is_symlink`]: struct.FileType.html#method.is_symlink - /// [`File::open`]: struct.File.html#method.open - /// [`OpenOptions::open`]: struct.OpenOptions.html#method.open + /// [`is_dir`]: FileType::is_dir + /// [`is_symlink`]: FileType::is_symlink /// /// # Examples /// @@ -1358,12 +1295,11 @@ impl FileType { /// follows symbolic links, so [`is_symlink`] would always /// return `false` for the target file. /// - /// [`Metadata`]: struct.Metadata.html - /// [`fs::metadata`]: fn.metadata.html - /// [`fs::symlink_metadata`]: fn.symlink_metadata.html - /// [`is_dir`]: struct.FileType.html#method.is_dir - /// [`is_file`]: struct.FileType.html#method.is_file - /// [`is_symlink`]: struct.FileType.html#method.is_symlink + /// [`fs::metadata`]: metadata + /// [`fs::symlink_metadata`]: symlink_metadata + /// [`is_dir`]: FileType::is_dir + /// [`is_file`]: FileType::is_file + /// [`is_symlink`]: FileType::is_symlink /// /// # Examples /// @@ -1450,8 +1386,8 @@ impl DirEntry { /// This function will not traverse symlinks if this entry points at a /// symlink. To traverse symlinks use [`fs::metadata`] or [`fs::File::metadata`]. /// - /// [`fs::metadata`]: fn.metadata.html - /// [`fs::File::metadata`]: struct.File.html#method.metadata + /// [`fs::metadata`]: metadata + /// [`fs::File::metadata`]: File::metadata /// /// # Platform-specific behavior /// @@ -1721,9 +1657,6 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()> /// If you’re wanting to copy the contents of one file to another and you’re /// working with [`File`]s, see the [`io::copy`] function. /// -/// [`io::copy`]: ../io/fn.copy.html -/// [`File`]: ./struct.File.html -/// /// # Platform-specific behavior /// /// This function currently corresponds to the `open` function in Unix @@ -1805,10 +1738,9 @@ pub fn hard_link<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<( /// and [`std::os::windows::fs::symlink_file`] or [`symlink_dir`] should be /// used instead to make the intent explicit. /// -/// [`std::os::unix::fs::symlink`]: ../os/unix/fs/fn.symlink.html -/// [`std::os::windows::fs::symlink_file`]: ../os/windows/fs/fn.symlink_file.html -/// [`symlink_dir`]: ../os/windows/fs/fn.symlink_dir.html -/// +/// [`std::os::unix::fs::symlink`]: crate::os::unix::fs::symlink +/// [`std::os::windows::fs::symlink_file`]: crate::os::windows::fs::symlink_file +/// [`symlink_dir`]: crate::os::windows::fs::symlink_dir /// /// # Examples /// @@ -1930,8 +1862,6 @@ pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> { /// function.) /// * `path` already exists. /// -/// [`create_dir_all`]: fn.create_dir_all.html -/// /// # Examples /// /// ```no_run @@ -1974,7 +1904,7 @@ pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> { /// concurrently from multiple threads or processes is guaranteed not to fail /// due to a race condition with itself. /// -/// [`fs::create_dir`]: fn.create_dir.html +/// [`fs::create_dir`]: create_dir /// /// # Examples /// @@ -2043,8 +1973,8 @@ pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> { /// /// See [`fs::remove_file`] and [`fs::remove_dir`]. /// -/// [`fs::remove_file`]: fn.remove_file.html -/// [`fs::remove_dir`]: fn.remove_dir.html +/// [`fs::remove_file`]: remove_file +/// [`fs::remove_dir`]: remove_dir /// /// # Examples /// @@ -2066,9 +1996,6 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> { /// The iterator will yield instances of [`io::Result`]`<`[`DirEntry`]`>`. /// New errors may be encountered after an iterator is initially constructed. /// -/// [`io::Result`]: ../io/type.Result.html -/// [`DirEntry`]: struct.DirEntry.html -/// /// # Platform-specific behavior /// /// This function currently corresponds to the `opendir` function on Unix diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs index c39989a60c9..af25c39fccf 100644 --- a/library/std/src/keyword_docs.rs +++ b/library/std/src/keyword_docs.rs @@ -98,7 +98,6 @@ mod as_keyword {} /// [Reference on "break expression"]: ../reference/expressions/loop-expr.html#break-expressions /// [Reference on "break and loop values"]: /// ../reference/expressions/loop-expr.html#break-and-loop-values -/// mod break_keyword {} #[doc(keyword = "const")] @@ -336,7 +335,6 @@ mod else_keyword {} /// For more information, take a look at the [Rust Book] or the [Reference] /// /// [ADT]: https://en.wikipedia.org/wiki/Algebraic_data_type -/// [`Option`]: option/enum.Option.html /// [Rust Book]: ../book/ch06-01-defining-an-enum.html /// [Reference]: ../reference/items/enumerations.html mod enum_keyword {} @@ -534,7 +532,6 @@ mod fn_keyword {} /// [`in`]: keyword.in.html /// [`impl`]: keyword.impl.html /// [higher-ranked trait bounds]: ../reference/trait-bounds.html#higher-ranked-trait-bounds -/// [`IntoIterator`]: iter/trait.IntoIterator.html /// [Rust book]: /// ../book/ch03-05-control-flow.html#looping-through-a-collection-with-for /// [Reference]: ../reference/expressions/loop-expr.html#iterator-loops @@ -993,7 +990,6 @@ mod mod_keyword {} /// For more information on the `move` keyword, see the [closure]'s section /// of the Rust book or the [threads] section /// -/// [`Fn` trait]: ../std/ops/trait.Fn.html /// [closure]: ../book/ch13-01-closures.html /// [threads]: ../book/ch16-01-threads.html#using-move-closures-with-threads mod move_keyword {} @@ -1413,9 +1409,7 @@ mod self_upper_keyword {} /// [`extern`]: keyword.extern.html /// [`mut`]: keyword.mut.html /// [`unsafe`]: keyword.unsafe.html -/// [`drop`]: mem/fn.drop.html -/// [`Sync`]: marker/trait.Sync.html -/// [`RefCell`]: cell/struct.RefCell.html +/// [`RefCell`]: cell::RefCell /// [Reference]: ../reference/items/static-items.html mod static_keyword {} @@ -1522,7 +1516,7 @@ mod static_keyword {} /// For more information on structs, take a look at the [Rust Book][book] or the /// [Reference][reference]. /// -/// [`PhantomData`]: marker/struct.PhantomData.html +/// [`PhantomData`]: marker::PhantomData /// [book]: ../book/ch05-01-defining-structs.html /// [reference]: ../reference/items/structs.html mod struct_keyword {} @@ -1733,8 +1727,6 @@ mod super_keyword {} /// [`for`]: keyword.for.html /// [`impl`]: keyword.impl.html /// [`unsafe`]: keyword.unsafe.html -/// [`Send`]: marker/trait.Send.html -/// [`Sync`]: marker/trait.Sync.html /// [Ref-Traits]: ../reference/items/traits.html /// [Ref-Trait-Objects]: ../reference/types/trait-object.html mod trait_keyword {} @@ -1764,7 +1756,6 @@ mod trait_keyword {} /// [`while`]: keyword.while.html /// [`match`]: ../reference/expressions/match-expr.html#match-guards /// [`false`]: keyword.false.html -/// [`bool`]: primitive.bool.html mod true_keyword {} #[doc(keyword = "type")] @@ -1986,9 +1977,6 @@ mod type_keyword {} /// [`static`]: keyword.static.html /// [`union`]: keyword.union.html /// [`impl`]: keyword.impl.html -/// [Send]: marker/trait.Send.html -/// [Sync]: marker/trait.Sync.html -/// [`Vec::set_len`]: vec/struct.Vec.html#method.set_len /// [raw pointers]: ../reference/types/pointer.html /// [memory safety]: ../book/ch19-01-unsafe-rust.html /// [Rustnomicon]: ../nomicon/index.html @@ -2178,7 +2166,7 @@ mod where_keyword {} /// /// It is available for use in stable rust from version 1.39 onwards. /// -/// [`Future`]: ./future/trait.Future.html +/// [`Future`]: future::Future /// [async book]: https://rust-lang.github.io/async-book/ mod async_keyword {} @@ -2197,7 +2185,7 @@ mod async_keyword {} /// /// It is available for use in stable rust from version 1.39 onwards. /// -/// [`Future`]: ./future/trait.Future.html +/// [`Future`]: future::Future /// [async book]: https://rust-lang.github.io/async-book/ mod await_keyword {} diff --git a/library/std/src/net/addr.rs b/library/std/src/net/addr.rs index 4f751656e09..c11049fb981 100644 --- a/library/std/src/net/addr.rs +++ b/library/std/src/net/addr.rs @@ -22,9 +22,7 @@ use crate::vec; /// The size of a `SocketAddr` instance may vary depending on the target operating /// system. /// -/// [IP address]: ../../std/net/enum.IpAddr.html -/// [`SocketAddrV4`]: ../../std/net/struct.SocketAddrV4.html -/// [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html +/// [IP address]: IpAddr /// /// # Examples /// @@ -50,7 +48,7 @@ pub enum SocketAddr { /// An IPv4 socket address. /// -/// IPv4 socket addresses consist of an [IPv4 address] and a 16-bit port number, as +/// IPv4 socket addresses consist of an [`IPv4` address] and a 16-bit port number, as /// stated in [IETF RFC 793]. /// /// See [`SocketAddr`] for a type encompassing both IPv4 and IPv6 socket addresses. @@ -59,8 +57,7 @@ pub enum SocketAddr { /// system. /// /// [IETF RFC 793]: https://tools.ietf.org/html/rfc793 -/// [IPv4 address]: ../../std/net/struct.Ipv4Addr.html -/// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html +/// [`IPv4` address]: Ipv4Addr /// /// # Examples /// @@ -81,7 +78,7 @@ pub struct SocketAddrV4 { /// An IPv6 socket address. /// -/// IPv6 socket addresses consist of an [Ipv6 address], a 16-bit port number, as well +/// IPv6 socket addresses consist of an [`IPv6` address], a 16-bit port number, as well /// as fields containing the traffic class, the flow label, and a scope identifier /// (see [IETF RFC 2553, Section 3.3] for more details). /// @@ -91,8 +88,7 @@ pub struct SocketAddrV4 { /// system. /// /// [IETF RFC 2553, Section 3.3]: https://tools.ietf.org/html/rfc2553#section-3.3 -/// [IPv6 address]: ../../std/net/struct.Ipv6Addr.html -/// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html +/// [`IPv6` address]: Ipv6Addr /// /// # Examples /// @@ -114,7 +110,7 @@ pub struct SocketAddrV6 { impl SocketAddr { /// Creates a new socket address from an [IP address] and a port number. /// - /// [IP address]: ../../std/net/enum.IpAddr.html + /// [IP address]: IpAddr /// /// # Examples /// @@ -210,12 +206,12 @@ impl SocketAddr { } /// Returns [`true`] if the [IP address] in this `SocketAddr` is an - /// [IPv4 address], and [`false`] otherwise. + /// [`IPv4` address], and [`false`] otherwise. /// - /// [`true`]: ../../std/primitive.bool.html + /// [IP address]: IpAddr + /// [`IPv4` address]: IpAddr::V4 /// [`false`]: ../../std/primitive.bool.html - /// [IP address]: ../../std/net/enum.IpAddr.html - /// [IPv4 address]: ../../std/net/enum.IpAddr.html#variant.V4 + /// [`true`]: ../../std/primitive.bool.html /// /// # Examples /// @@ -232,12 +228,12 @@ impl SocketAddr { } /// Returns [`true`] if the [IP address] in this `SocketAddr` is an - /// [IPv6 address], and [`false`] otherwise. + /// [`IPv6` address], and [`false`] otherwise. /// - /// [`true`]: ../../std/primitive.bool.html + /// [IP address]: IpAddr + /// [`IPv6` address]: IpAddr::V6 /// [`false`]: ../../std/primitive.bool.html - /// [IP address]: ../../std/net/enum.IpAddr.html - /// [IPv6 address]: ../../std/net/enum.IpAddr.html#variant.V6 + /// [`true`]: ../../std/primitive.bool.html /// /// # Examples /// @@ -255,9 +251,9 @@ impl SocketAddr { } impl SocketAddrV4 { - /// Creates a new socket address from an [IPv4 address] and a port number. + /// Creates a new socket address from an [`IPv4` address] and a port number. /// - /// [IPv4 address]: ../../std/net/struct.Ipv4Addr.html + /// [`IPv4` address]: Ipv4Addr /// /// # Examples /// @@ -342,14 +338,14 @@ impl SocketAddrV4 { } impl SocketAddrV6 { - /// Creates a new socket address from an [IPv6 address], a 16-bit port number, + /// Creates a new socket address from an [`IPv6` address], a 16-bit port number, /// and the `flowinfo` and `scope_id` fields. /// /// For more information on the meaning and layout of the `flowinfo` and `scope_id` /// parameters, see [IETF RFC 2553, Section 3.3]. /// /// [IETF RFC 2553, Section 3.3]: https://tools.ietf.org/html/rfc2553#section-3.3 - /// [IPv6 address]: ../../std/net/struct.Ipv6Addr.html + /// [`IPv6` address]: Ipv6Addr /// /// # Examples /// @@ -461,9 +457,7 @@ impl SocketAddrV6 { /// Changes the flow information associated with this socket address. /// - /// See the [`flowinfo`] method's documentation for more details. - /// - /// [`flowinfo`]: #method.flowinfo + /// See [`SocketAddrV6::flowinfo`]'s documentation for more details. /// /// # Examples /// @@ -501,9 +495,7 @@ impl SocketAddrV6 { /// Changes the scope ID associated with this socket address. /// - /// See the [`scope_id`] method's documentation for more details. - /// - /// [`scope_id`]: #method.scope_id + /// See [`SocketAddrV6::scope_id`]'s documentation for more details. /// /// # Examples /// @@ -535,9 +527,6 @@ impl FromInner<c::sockaddr_in6> for SocketAddrV6 { #[stable(feature = "ip_from_ip", since = "1.16.0")] impl From<SocketAddrV4> for SocketAddr { /// Converts a [`SocketAddrV4`] into a [`SocketAddr::V4`]. - /// - /// [`SocketAddrV4`]: ../../std/net/struct.SocketAddrV4.html - /// [`SocketAddr::V4`]: ../../std/net/enum.SocketAddr.html#variant.V4 fn from(sock4: SocketAddrV4) -> SocketAddr { SocketAddr::V4(sock4) } @@ -546,9 +535,6 @@ impl From<SocketAddrV4> for SocketAddr { #[stable(feature = "ip_from_ip", since = "1.16.0")] impl From<SocketAddrV6> for SocketAddr { /// Converts a [`SocketAddrV6`] into a [`SocketAddr::V6`]. - /// - /// [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html - /// [`SocketAddr::V6`]: ../../std/net/enum.SocketAddr.html#variant.V6 fn from(sock6: SocketAddrV6) -> SocketAddr { SocketAddr::V6(sock6) } @@ -562,13 +548,6 @@ impl<I: Into<IpAddr>> From<(I, u16)> for SocketAddr { /// and creates a [`SocketAddr::V6`] for a [`IpAddr::V6`]. /// /// `u16` is treated as port of the newly created [`SocketAddr`]. - /// - /// [`IpAddr`]: ../../std/net/enum.IpAddr.html - /// [`IpAddr::V4`]: ../../std/net/enum.IpAddr.html#variant.V4 - /// [`IpAddr::V6`]: ../../std/net/enum.IpAddr.html#variant.V6 - /// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html - /// [`SocketAddr::V4`]: ../../std/net/enum.SocketAddr.html#variant.V4 - /// [`SocketAddr::V6`]: ../../std/net/enum.SocketAddr.html#variant.V6 fn from(pieces: (I, u16)) -> SocketAddr { SocketAddr::new(pieces.0.into(), pieces.1) } @@ -785,18 +764,11 @@ impl hash::Hash for SocketAddrV6 { /// Addresses returned by the operating system that are not IP addresses are /// silently ignored. /// -/// [`FromStr`]: ../../std/str/trait.FromStr.html -/// [`IpAddr`]: ../../std/net/enum.IpAddr.html -/// [`Ipv4Addr`]: ../../std/net/struct.Ipv4Addr.html -/// [`Ipv6Addr`]: ../../std/net/struct.Ipv6Addr.html -/// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html -/// [`SocketAddrV4`]: ../../std/net/struct.SocketAddrV4.html -/// [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html -/// [`&str`]: ../../std/primitive.str.html -/// [`TcpStream`]: ../../std/net/struct.TcpStream.html -/// [`to_socket_addrs`]: #tymethod.to_socket_addrs -/// [`UdpSocket`]: ../../std/net/struct.UdpSocket.html -/// [`u16`]: ../../std/primitive.u16.html +/// [`FromStr`]: crate::str::FromStr +/// [`&str`]: str +/// [`TcpStream`]: crate::net::TcpStream +/// [`to_socket_addrs`]: ToSocketAddrs::to_socket_addrs +/// [`UdpSocket`]: crate::net::UdpSocket /// /// # Examples /// @@ -867,7 +839,7 @@ impl hash::Hash for SocketAddrV6 { /// let stream = TcpStream::connect((Ipv4Addr::new(127, 0, 0, 1), 443)); /// ``` /// -/// [`TcpStream::connect`]: ../../std/net/struct.TcpStream.html#method.connect +/// [`TcpStream::connect`]: crate::net::TcpStream::connect #[stable(feature = "rust1", since = "1.0.0")] pub trait ToSocketAddrs { /// Returned iterator over socket addresses which this type may correspond diff --git a/library/std/src/net/ip.rs b/library/std/src/net/ip.rs index 9d7b2b80763..de28268ea36 100644 --- a/library/std/src/net/ip.rs +++ b/library/std/src/net/ip.rs @@ -22,9 +22,6 @@ use crate::sys_common::{AsInner, FromInner}; /// The size of an `IpAddr` instance may vary depending on the target operating /// system. /// -/// [`Ipv4Addr`]: ../../std/net/struct.Ipv4Addr.html -/// [`Ipv6Addr`]: ../../std/net/struct.Ipv6Addr.html -/// /// # Examples /// /// ``` @@ -61,14 +58,13 @@ pub enum IpAddr { /// system. /// /// [IETF RFC 791]: https://tools.ietf.org/html/rfc791 -/// [`IpAddr`]: ../../std/net/enum.IpAddr.html /// /// # Textual representation /// /// `Ipv4Addr` provides a [`FromStr`] implementation. The four octets are in decimal /// notation, divided by `.` (this is called "dot-decimal notation"). /// -/// [`FromStr`]: ../../std/str/trait.FromStr.html +/// [`FromStr`]: crate::str::FromStr /// /// # Examples /// @@ -96,7 +92,6 @@ pub struct Ipv4Addr { /// system. /// /// [IETF RFC 4291]: https://tools.ietf.org/html/rfc4291 -/// [`IpAddr`]: ../../std/net/enum.IpAddr.html /// /// # Textual representation /// @@ -105,7 +100,7 @@ pub struct Ipv4Addr { /// notation, and segments are separated by `:`. For more information, see /// [IETF RFC 5952]. /// -/// [`FromStr`]: ../../std/str/trait.FromStr.html +/// [`FromStr`]: crate::str::FromStr /// [IETF RFC 5952]: https://tools.ietf.org/html/rfc5952 /// /// # Examples @@ -138,11 +133,9 @@ pub enum Ipv6MulticastScope { impl IpAddr { /// Returns [`true`] for the special 'unspecified' address. /// - /// See the documentation for [`Ipv4Addr::is_unspecified`][IPv4] and - /// [`Ipv6Addr::is_unspecified`][IPv6] for more details. + /// See the documentation for [`Ipv4Addr::is_unspecified()`] and + /// [`Ipv6Addr::is_unspecified()`] for more details. /// - /// [IPv4]: ../../std/net/struct.Ipv4Addr.html#method.is_unspecified - /// [IPv6]: ../../std/net/struct.Ipv6Addr.html#method.is_unspecified /// [`true`]: ../../std/primitive.bool.html /// /// # Examples @@ -163,11 +156,9 @@ impl IpAddr { /// Returns [`true`] if this is a loopback address. /// - /// See the documentation for [`Ipv4Addr::is_loopback`][IPv4] and - /// [`Ipv6Addr::is_loopback`][IPv6] for more details. + /// See the documentation for [`Ipv4Addr::is_loopback()`] and + /// [`Ipv6Addr::is_loopback()`] for more details. /// - /// [IPv4]: ../../std/net/struct.Ipv4Addr.html#method.is_loopback - /// [IPv6]: ../../std/net/struct.Ipv6Addr.html#method.is_loopback /// [`true`]: ../../std/primitive.bool.html /// /// # Examples @@ -188,11 +179,9 @@ impl IpAddr { /// Returns [`true`] if the address appears to be globally routable. /// - /// See the documentation for [`Ipv4Addr::is_global`][IPv4] and - /// [`Ipv6Addr::is_global`][IPv6] for more details. + /// See the documentation for [`Ipv4Addr::is_global()`] and + /// [`Ipv6Addr::is_global()`] for more details. /// - /// [IPv4]: ../../std/net/struct.Ipv4Addr.html#method.is_global - /// [IPv6]: ../../std/net/struct.Ipv6Addr.html#method.is_global /// [`true`]: ../../std/primitive.bool.html /// /// # Examples @@ -214,11 +203,9 @@ impl IpAddr { /// Returns [`true`] if this is a multicast address. /// - /// See the documentation for [`Ipv4Addr::is_multicast`][IPv4] and - /// [`Ipv6Addr::is_multicast`][IPv6] for more details. + /// See the documentation for [`Ipv4Addr::is_multicast()`] and + /// [`Ipv6Addr::is_multicast()`] for more details. /// - /// [IPv4]: ../../std/net/struct.Ipv4Addr.html#method.is_multicast - /// [IPv6]: ../../std/net/struct.Ipv6Addr.html#method.is_multicast /// [`true`]: ../../std/primitive.bool.html /// /// # Examples @@ -239,11 +226,9 @@ impl IpAddr { /// Returns [`true`] if this address is in a range designated for documentation. /// - /// See the documentation for [`Ipv4Addr::is_documentation`][IPv4] and - /// [`Ipv6Addr::is_documentation`][IPv6] for more details. + /// See the documentation for [`Ipv4Addr::is_documentation()`] and + /// [`Ipv6Addr::is_documentation()`] for more details. /// - /// [IPv4]: ../../std/net/struct.Ipv4Addr.html#method.is_documentation - /// [IPv6]: ../../std/net/struct.Ipv6Addr.html#method.is_documentation /// [`true`]: ../../std/primitive.bool.html /// /// # Examples @@ -266,11 +251,12 @@ impl IpAddr { } } - /// Returns [`true`] if this address is an [IPv4 address], and [`false`] otherwise. + /// Returns [`true`] if this address is an [`IPv4` address], and [`false`] + /// otherwise. /// /// [`true`]: ../../std/primitive.bool.html /// [`false`]: ../../std/primitive.bool.html - /// [IPv4 address]: #variant.V4 + /// [`IPv4` address]: IpAddr::V4 /// /// # Examples /// @@ -285,11 +271,12 @@ impl IpAddr { matches!(self, IpAddr::V4(_)) } - /// Returns [`true`] if this address is an [IPv6 address], and [`false`] otherwise. + /// Returns [`true`] if this address is an [`IPv6` address], and [`false`] + /// otherwise. /// /// [`true`]: ../../std/primitive.bool.html /// [`false`]: ../../std/primitive.bool.html - /// [IPv6 address]: #variant.V6 + /// [`IPv6` address]: IpAddr::V6 /// /// # Examples /// @@ -385,8 +372,8 @@ impl Ipv4Addr { /// This property is defined in _UNIX Network Programming, Second Edition_, /// W. Richard Stevens, p. 891; see also [ip7]. /// - /// [ip7]: http://man7.org/linux/man-pages/man7/ip.7.html /// [`true`]: ../../std/primitive.bool.html + /// [ip7]: http://man7.org/linux/man-pages/man7/ip.7.html /// /// # Examples /// @@ -406,8 +393,8 @@ impl Ipv4Addr { /// /// This property is defined by [IETF RFC 1122]. /// - /// [IETF RFC 1122]: https://tools.ietf.org/html/rfc1122 /// [`true`]: ../../std/primitive.bool.html + /// [IETF RFC 1122]: https://tools.ietf.org/html/rfc1122 /// /// # Examples /// @@ -430,8 +417,8 @@ impl Ipv4Addr { /// - 172.16.0.0/12 /// - 192.168.0.0/16 /// - /// [IETF RFC 1918]: https://tools.ietf.org/html/rfc1918 /// [`true`]: ../../std/primitive.bool.html + /// [IETF RFC 1918]: https://tools.ietf.org/html/rfc1918 /// /// # Examples /// @@ -460,8 +447,8 @@ impl Ipv4Addr { /// /// This property is defined by [IETF RFC 3927]. /// - /// [IETF RFC 3927]: https://tools.ietf.org/html/rfc3927 /// [`true`]: ../../std/primitive.bool.html + /// [IETF RFC 3927]: https://tools.ietf.org/html/rfc3927 /// /// # Examples /// @@ -483,24 +470,25 @@ impl Ipv4Addr { /// Returns [`true`] if the address appears to be globally routable. /// See [iana-ipv4-special-registry][ipv4-sr]. /// - /// The following return false: + /// The following return [`false`]: /// - /// - private addresses (see [`is_private()`](#method.is_private)) - /// - the loopback address (see [`is_loopback()`](#method.is_loopback)) - /// - the link-local address (see [`is_link_local()`](#method.is_link_local)) - /// - the broadcast address (see [`is_broadcast()`](#method.is_broadcast)) - /// - addresses used for documentation (see [`is_documentation()`](#method.is_documentation)) - /// - the unspecified address (see [`is_unspecified()`](#method.is_unspecified)), and the whole + /// - private addresses (see [`Ipv4Addr::is_private()`]) + /// - the loopback address (see [`Ipv4Addr::is_loopback()`]) + /// - the link-local address (see [`Ipv4Addr::is_link_local()`]) + /// - the broadcast address (see [`Ipv4Addr::is_broadcast()`]) + /// - addresses used for documentation (see [`Ipv4Addr::is_documentation()`]) + /// - the unspecified address (see [`Ipv4Addr::is_unspecified()`]), and the whole /// 0.0.0.0/8 block /// - addresses reserved for future protocols (see - /// [`is_ietf_protocol_assignment()`](#method.is_ietf_protocol_assignment), except + /// [`Ipv4Addr::is_ietf_protocol_assignment()`], except /// `192.0.0.9/32` and `192.0.0.10/32` which are globally routable - /// - addresses reserved for future use (see [`is_reserved()`](#method.is_reserved) + /// - addresses reserved for future use (see [`Ipv4Addr::is_reserved()`] /// - addresses reserved for networking devices benchmarking (see - /// [`is_benchmarking`](#method.is_benchmarking)) + /// [`Ipv4Addr::is_benchmarking()`]) /// - /// [ipv4-sr]: https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml /// [`true`]: ../../std/primitive.bool.html + /// [`false`]: ../../std/primitive.bool.html + /// [ipv4-sr]: https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml /// /// # Examples /// @@ -572,8 +560,8 @@ impl Ipv4Addr { /// Returns [`true`] if this address is part of the Shared Address Space defined in /// [IETF RFC 6598] (`100.64.0.0/10`). /// - /// [IETF RFC 6598]: https://tools.ietf.org/html/rfc6598 /// [`true`]: ../../std/primitive.bool.html + /// [IETF RFC 6598]: https://tools.ietf.org/html/rfc6598 /// /// # Examples /// @@ -598,11 +586,11 @@ impl Ipv4Addr { /// - `192.0.0.9/32` is the "Port Control Protocol Anycast" (see [IETF RFC 7723]) /// - `192.0.0.10/32` is used for NAT traversal (see [IETF RFC 8155]) /// + /// [`true`]: ../../std/primitive.bool.html /// [IETF RFC 6890]: https://tools.ietf.org/html/rfc6890 /// [IETF RFC 7600]: https://tools.ietf.org/html/rfc7600 /// [IETF RFC 7723]: https://tools.ietf.org/html/rfc7723 /// [IETF RFC 8155]: https://tools.ietf.org/html/rfc8155 - /// [`true`]: ../../std/primitive.bool.html /// /// # Examples /// @@ -625,9 +613,9 @@ impl Ipv4Addr { /// network devices benchmarking. This range is defined in [IETF RFC 2544] as `192.18.0.0` /// through `198.19.255.255` but [errata 423] corrects it to `198.18.0.0/15`. /// + /// [`true`]: ../../std/primitive.bool.html /// [IETF RFC 2544]: https://tools.ietf.org/html/rfc2544 /// [errata 423]: https://www.rfc-editor.org/errata/eid423 - /// [`true`]: ../../std/primitive.bool.html /// /// # Examples /// @@ -649,8 +637,8 @@ impl Ipv4Addr { /// broadcast address `255.255.255.255`, but this implementation explicitly excludes it, since /// it is obviously not reserved for future use. /// - /// [IETF RFC 1112]: https://tools.ietf.org/html/rfc1112 /// [`true`]: ../../std/primitive.bool.html + /// [IETF RFC 1112]: https://tools.ietf.org/html/rfc1112 /// /// # Warning /// @@ -681,8 +669,8 @@ impl Ipv4Addr { /// Multicast addresses have a most significant octet between 224 and 239, /// and is defined by [IETF RFC 5771]. /// - /// [IETF RFC 5771]: https://tools.ietf.org/html/rfc5771 /// [`true`]: ../../std/primitive.bool.html + /// [IETF RFC 5771]: https://tools.ietf.org/html/rfc5771 /// /// # Examples /// @@ -702,8 +690,8 @@ impl Ipv4Addr { /// /// A broadcast address has all octets set to 255 as defined in [IETF RFC 919]. /// - /// [IETF RFC 919]: https://tools.ietf.org/html/rfc919 /// [`true`]: ../../std/primitive.bool.html + /// [IETF RFC 919]: https://tools.ietf.org/html/rfc919 /// /// # Examples /// @@ -726,8 +714,8 @@ impl Ipv4Addr { /// - 198.51.100.0/24 (TEST-NET-2) /// - 203.0.113.0/24 (TEST-NET-3) /// - /// [IETF RFC 5737]: https://tools.ietf.org/html/rfc5737 /// [`true`]: ../../std/primitive.bool.html + /// [IETF RFC 5737]: https://tools.ietf.org/html/rfc5737 /// /// # Examples /// @@ -749,11 +737,11 @@ impl Ipv4Addr { } } - /// Converts this address to an IPv4-compatible [IPv6 address]. + /// Converts this address to an IPv4-compatible [`IPv6` address]. /// /// a.b.c.d becomes ::a.b.c.d /// - /// [IPv6 address]: ../../std/net/struct.Ipv6Addr.html + /// [`IPv6` address]: Ipv6Addr /// /// # Examples /// @@ -771,11 +759,11 @@ impl Ipv4Addr { Ipv6Addr::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a, b, c, d]) } - /// Converts this address to an IPv4-mapped [IPv6 address]. + /// Converts this address to an IPv4-mapped [`IPv6` address]. /// /// a.b.c.d becomes ::ffff:a.b.c.d /// - /// [IPv6 address]: ../../std/net/struct.Ipv6Addr.html + /// [`IPv6` address]: Ipv6Addr /// /// # Examples /// @@ -1128,8 +1116,8 @@ impl Ipv6Addr { /// /// This property is defined in [IETF RFC 4291]. /// - /// [IETF RFC 4291]: https://tools.ietf.org/html/rfc4291 /// [`true`]: ../../std/primitive.bool.html + /// [IETF RFC 4291]: https://tools.ietf.org/html/rfc4291 /// /// # Examples /// @@ -1148,8 +1136,8 @@ impl Ipv6Addr { /// /// This property is defined in [IETF RFC 4291]. /// - /// [IETF RFC 4291]: https://tools.ietf.org/html/rfc4291 /// [`true`]: ../../std/primitive.bool.html + /// [IETF RFC 4291]: https://tools.ietf.org/html/rfc4291 /// /// # Examples /// @@ -1199,6 +1187,7 @@ impl Ipv6Addr { /// This property is defined in [IETF RFC 4193]. /// /// [IETF RFC 4193]: https://tools.ietf.org/html/rfc4193 + /// /// [`true`]: ../../std/primitive.bool.html /// /// # Examples @@ -1230,7 +1219,9 @@ impl Ipv6Addr { /// /// This method validates the format defined in the RFC and won't recognize the following /// addresses such as `fe80:0:0:1::` or `fe81::` as unicast link-local addresses for example. - /// If you need a less strict validation use [`is_unicast_link_local()`] instead. + /// If you need a less strict validation use [`Ipv6Addr::is_unicast_link_local()`] instead. + /// + /// [`true`]: ../../std/primitive.bool.html /// /// # Examples /// @@ -1259,13 +1250,11 @@ impl Ipv6Addr { /// - [IETF RFC 4291 section 2.5.6] /// - [RFC 4291 errata 4406] (which has been rejected but provides useful /// insight) - /// - [`is_unicast_link_local()`] + /// - [`Ipv6Addr::is_unicast_link_local()`] /// /// [IETF RFC 4291]: https://tools.ietf.org/html/rfc4291 /// [IETF RFC 4291 section 2.5.6]: https://tools.ietf.org/html/rfc4291#section-2.5.6 - /// [`true`]: ../../std/primitive.bool.html /// [RFC 4291 errata 4406]: https://www.rfc-editor.org/errata/eid4406 - /// [`is_unicast_link_local()`]: ../../std/net/struct.Ipv6Addr.html#method.is_unicast_link_local pub fn is_unicast_link_local_strict(&self) -> bool { (self.segments()[0] & 0xffff) == 0xfe80 && (self.segments()[1] & 0xffff) == 0 @@ -1287,9 +1276,11 @@ impl Ipv6Addr { /// ``` /// /// As a result, this method consider addresses such as `fe80:0:0:1::` or `fe81::` to be - /// unicast link-local addresses, whereas [`is_unicast_link_local_strict()`] does not. If you - /// need a strict validation fully compliant with the RFC, use - /// [`is_unicast_link_local_strict()`]. + /// unicast link-local addresses, whereas [`Ipv6Addr::is_unicast_link_local_strict()`] does not. + /// If you need a strict validation fully compliant with the RFC, use + /// [`Ipv6Addr::is_unicast_link_local_strict()`] instead. + /// + /// [`true`]: ../../std/primitive.bool.html /// /// # Examples /// @@ -1320,9 +1311,7 @@ impl Ipv6Addr { /// insight) /// /// [IETF RFC 4291 section 2.4]: https://tools.ietf.org/html/rfc4291#section-2.4 - /// [`true`]: ../../std/primitive.bool.html /// [RFC 4291 errata 4406]: https://www.rfc-editor.org/errata/eid4406 - /// [`is_unicast_link_local_strict()`]: ../../std/net/struct.Ipv6Addr.html#method.is_unicast_link_local_strict pub fn is_unicast_link_local(&self) -> bool { (self.segments()[0] & 0xffc0) == 0xfe80 } @@ -1371,8 +1360,8 @@ impl Ipv6Addr { /// /// This property is defined in [IETF RFC 3849]. /// - /// [IETF RFC 3849]: https://tools.ietf.org/html/rfc3849 /// [`true`]: ../../std/primitive.bool.html + /// [IETF RFC 3849]: https://tools.ietf.org/html/rfc3849 /// /// # Examples /// @@ -1464,8 +1453,8 @@ impl Ipv6Addr { /// /// This property is defined by [IETF RFC 4291]. /// - /// [IETF RFC 4291]: https://tools.ietf.org/html/rfc4291 /// [`true`]: ../../std/primitive.bool.html + /// [IETF RFC 4291]: https://tools.ietf.org/html/rfc4291 /// /// # Examples /// @@ -1480,14 +1469,13 @@ impl Ipv6Addr { (self.segments()[0] & 0xff00) == 0xff00 } - /// Converts this address to an [IPv4 address] if it's an "IPv4-mapped IPv6 address" + /// Converts this address to an [`IPv4` address] if it's an "IPv4-mapped IPv6 address" /// defined in [IETF RFC 4291 section 2.5.5.2], otherwise returns [`None`]. /// /// `::ffff:a.b.c.d` becomes `a.b.c.d`. /// All addresses *not* starting with `::ffff` will return `None`. /// - /// [IPv4 address]: ../../std/net/struct.Ipv4Addr.html - /// [`None`]: ../../std/option/enum.Option.html#variant.None + /// [`IPv4` address]: Ipv4Addr /// [IETF RFC 4291 section 2.5.5.2]: https://tools.ietf.org/html/rfc4291#section-2.5.5.2 /// /// # Examples @@ -1511,13 +1499,12 @@ impl Ipv6Addr { } } - /// Converts this address to an [IPv4 address]. Returns [`None`] if this address is + /// Converts this address to an [`IPv4` address]. Returns [`None`] if this address is /// neither IPv4-compatible or IPv4-mapped. /// /// ::a.b.c.d and ::ffff:a.b.c.d become a.b.c.d /// - /// [IPv4 address]: ../../std/net/struct.Ipv4Addr.html - /// [`None`]: ../../std/option/enum.Option.html#variant.None + /// [`IPv4` address]: Ipv4Addr /// /// # Examples /// diff --git a/library/std/src/net/mod.rs b/library/std/src/net/mod.rs index c87e0661dc9..d4b1552fec5 100644 --- a/library/std/src/net/mod.rs +++ b/library/std/src/net/mod.rs @@ -14,17 +14,6 @@ //! * [`ToSocketAddrs`] is a trait that used for generic address resolution when interacting //! with networking objects like [`TcpListener`], [`TcpStream`] or [`UdpSocket`] //! * Other types are return or parameter types for various methods in this module -//! -//! [`IpAddr`]: ../../std/net/enum.IpAddr.html -//! [`Ipv4Addr`]: ../../std/net/struct.Ipv4Addr.html -//! [`Ipv6Addr`]: ../../std/net/struct.Ipv6Addr.html -//! [`SocketAddr`]: ../../std/net/enum.SocketAddr.html -//! [`SocketAddrV4`]: ../../std/net/struct.SocketAddrV4.html -//! [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html -//! [`TcpListener`]: ../../std/net/struct.TcpListener.html -//! [`TcpStream`]: ../../std/net/struct.TcpStream.html -//! [`ToSocketAddrs`]: ../../std/net/trait.ToSocketAddrs.html -//! [`UdpSocket`]: ../../std/net/struct.UdpSocket.html #![stable(feature = "rust1", since = "1.0.0")] @@ -49,38 +38,27 @@ mod tcp; mod test; mod udp; -/// Possible values which can be passed to the [`shutdown`] method of -/// [`TcpStream`]. -/// -/// [`shutdown`]: struct.TcpStream.html#method.shutdown -/// [`TcpStream`]: struct.TcpStream.html +/// Possible values which can be passed to the [`TcpStream::shutdown`] method. #[derive(Copy, Clone, PartialEq, Eq, Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub enum Shutdown { /// The reading portion of the [`TcpStream`] should be shut down. /// - /// All currently blocked and future [reads] will return [`Ok(0)`]. + /// All currently blocked and future [reads] will return [`Ok`]`(0)`. /// - /// [`TcpStream`]: ../../std/net/struct.TcpStream.html - /// [reads]: ../../std/io/trait.Read.html - /// [`Ok(0)`]: ../../std/result/enum.Result.html#variant.Ok + /// [reads]: crate::io::Read #[stable(feature = "rust1", since = "1.0.0")] Read, /// The writing portion of the [`TcpStream`] should be shut down. /// /// All currently blocked and future [writes] will return an error. /// - /// [`TcpStream`]: ../../std/net/struct.TcpStream.html - /// [writes]: ../../std/io/trait.Write.html + /// [writes]: crate::io::Write #[stable(feature = "rust1", since = "1.0.0")] Write, /// Both the reading and the writing portions of the [`TcpStream`] should be shut down. /// /// See [`Shutdown::Read`] and [`Shutdown::Write`] for more information. - /// - /// [`TcpStream`]: ../../std/net/struct.TcpStream.html - /// [`Shutdown::Read`]: #variant.Read - /// [`Shutdown::Write`]: #variant.Write #[stable(feature = "rust1", since = "1.0.0")] Both, } diff --git a/library/std/src/net/parser.rs b/library/std/src/net/parser.rs index 12d3baf6333..a425aca5a64 100644 --- a/library/std/src/net/parser.rs +++ b/library/std/src/net/parser.rs @@ -302,14 +302,6 @@ impl FromStr for SocketAddr { /// // No problem, the `panic!` message has disappeared. /// let _foo: SocketAddr = "127.0.0.1:8080".parse().expect("unreachable panic"); /// ``` -/// -/// [`FromStr`]: ../../std/str/trait.FromStr.html -/// [`IpAddr`]: ../../std/net/enum.IpAddr.html -/// [`Ipv4Addr`]: ../../std/net/struct.Ipv4Addr.html -/// [`Ipv6Addr`]: ../../std/net/struct.Ipv6Addr.html -/// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html -/// [`SocketAddrV4`]: ../../std/net/struct.SocketAddrV4.html -/// [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html #[stable(feature = "rust1", since = "1.0.0")] #[derive(Debug, Clone, PartialEq, Eq)] pub struct AddrParseError(()); diff --git a/library/std/src/net/tcp.rs b/library/std/src/net/tcp.rs index 47b8532b7a6..a76c9c46c05 100644 --- a/library/std/src/net/tcp.rs +++ b/library/std/src/net/tcp.rs @@ -20,13 +20,12 @@ use crate::time::Duration; /// /// The Transmission Control Protocol is specified in [IETF RFC 793]. /// -/// [`accept`]: ../../std/net/struct.TcpListener.html#method.accept -/// [`connect`]: #method.connect +/// [`accept`]: TcpListener::accept +/// [`connect`]: TcpStream::connect /// [IETF RFC 793]: https://tools.ietf.org/html/rfc793 -/// [reading]: ../../std/io/trait.Read.html -/// [`shutdown`]: #method.shutdown -/// [`TcpListener`]: ../../std/net/struct.TcpListener.html -/// [writing]: ../../std/io/trait.Write.html +/// [reading]: Read +/// [`shutdown`]: TcpStream::shutdown +/// [writing]: Write /// /// # Examples /// @@ -55,11 +54,9 @@ pub struct TcpStream(net_imp::TcpStream); /// /// The Transmission Control Protocol is specified in [IETF RFC 793]. /// -/// [`accept`]: #method.accept -/// [`bind`]: #method.bind +/// [`accept`]: TcpListener::accept +/// [`bind`]: TcpListener::bind /// [IETF RFC 793]: https://tools.ietf.org/html/rfc793 -/// [`Incoming`]: ../../std/net/struct.Incoming.html -/// [`TcpListener::incoming`]: #method.incoming /// /// # Examples /// @@ -85,12 +82,10 @@ pub struct TcpListener(net_imp::TcpListener); /// An iterator that infinitely [`accept`]s connections on a [`TcpListener`]. /// -/// This `struct` is created by the [`incoming`] method on [`TcpListener`]. +/// This `struct` is created by the [`TcpListener::incoming`] method. /// See its documentation for more. /// -/// [`accept`]: ../../std/net/struct.TcpListener.html#method.accept -/// [`incoming`]: ../../std/net/struct.TcpListener.html#method.incoming -/// [`TcpListener`]: ../../std/net/struct.TcpListener.html +/// [`accept`]: TcpListener::accept #[stable(feature = "rust1", since = "1.0.0")] #[derive(Debug)] pub struct Incoming<'a> { @@ -109,8 +104,6 @@ impl TcpStream { /// the addresses result in a successful connection, the error returned from /// the last connection attempt (the last address) is returned. /// - /// [`ToSocketAddrs`]: ../../std/net/trait.ToSocketAddrs.html - /// /// # Examples /// /// Open a TCP connection to `127.0.0.1:8080`: @@ -157,8 +150,6 @@ impl TcpStream { /// single system call. It instead calls `connect` in nonblocking mode and /// then uses an OS-specific mechanism to await the completion of the /// connection request. - /// - /// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html #[stable(feature = "tcpstream_connect_timeout", since = "1.21.0")] pub fn connect_timeout(addr: &SocketAddr, timeout: Duration) -> io::Result<TcpStream> { net_imp::TcpStream::connect_timeout(addr, timeout).map(TcpStream) @@ -204,8 +195,6 @@ impl TcpStream { /// portions to return immediately with an appropriate value (see the /// documentation of [`Shutdown`]). /// - /// [`Shutdown`]: ../../std/net/enum.Shutdown.html - /// /// # Platform-specific behavior /// /// Calling this function multiple times may result in different behavior, @@ -260,12 +249,9 @@ impl TcpStream { /// a result of setting this option. For example Unix typically returns an /// error of the kind [`WouldBlock`], but Windows may return [`TimedOut`]. /// - /// [`None`]: ../../std/option/enum.Option.html#variant.None - /// [`Err`]: ../../std/result/enum.Result.html#variant.Err - /// [`read`]: ../../std/io/trait.Read.html#tymethod.read - /// [`WouldBlock`]: ../../std/io/enum.ErrorKind.html#variant.WouldBlock - /// [`TimedOut`]: ../../std/io/enum.ErrorKind.html#variant.TimedOut - /// [`Duration`]: ../../std/time/struct.Duration.html + /// [`read`]: Read::read + /// [`WouldBlock`]: io::ErrorKind::WouldBlock + /// [`TimedOut`]: io::ErrorKind::TimedOut /// /// # Examples /// @@ -307,12 +293,9 @@ impl TcpStream { /// as a result of setting this option. For example Unix typically returns /// an error of the kind [`WouldBlock`], but Windows may return [`TimedOut`]. /// - /// [`None`]: ../../std/option/enum.Option.html#variant.None - /// [`Err`]: ../../std/result/enum.Result.html#variant.Err - /// [`write`]: ../../std/io/trait.Write.html#tymethod.write - /// [`Duration`]: ../../std/time/struct.Duration.html - /// [`WouldBlock`]: ../../std/io/enum.ErrorKind.html#variant.WouldBlock - /// [`TimedOut`]: ../../std/io/enum.ErrorKind.html#variant.TimedOut + /// [`write`]: Write::write + /// [`WouldBlock`]: io::ErrorKind::WouldBlock + /// [`TimedOut`]: io::ErrorKind::TimedOut /// /// # Examples /// @@ -350,8 +333,7 @@ impl TcpStream { /// /// Some platforms do not provide access to the current timeout. /// - /// [`None`]: ../../std/option/enum.Option.html#variant.None - /// [`read`]: ../../std/io/trait.Read.html#tymethod.read + /// [`read`]: Read::read /// /// # Examples /// @@ -376,8 +358,7 @@ impl TcpStream { /// /// Some platforms do not provide access to the current timeout. /// - /// [`None`]: ../../std/option/enum.Option.html#variant.None - /// [`write`]: ../../std/io/trait.Write.html#tymethod.write + /// [`write`]: Write::write /// /// # Examples /// @@ -440,9 +421,7 @@ impl TcpStream { /// Gets the value of the `TCP_NODELAY` option on this socket. /// - /// For more information about this option, see [`set_nodelay`][link]. - /// - /// [link]: #method.set_nodelay + /// For more information about this option, see [`TcpStream::set_nodelay`]. /// /// # Examples /// @@ -480,9 +459,7 @@ impl TcpStream { /// Gets the value of the `IP_TTL` option for this socket. /// - /// For more information about this option, see [`set_ttl`][link]. - /// - /// [link]: #method.set_ttl + /// For more information about this option, see [`TcpStream::set_ttl`]. /// /// # Examples /// @@ -559,8 +536,6 @@ impl TcpStream { /// }; /// println!("bytes: {:?}", buf); /// ``` - /// - /// [`io::ErrorKind::WouldBlock`]: ../io/enum.ErrorKind.html#variant.WouldBlock #[stable(feature = "net2_mutators", since = "1.9.0")] pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> { self.0.set_nonblocking(nonblocking) @@ -681,7 +656,7 @@ impl TcpListener { /// /// Binding with a port number of 0 will request that the OS assigns a port /// to this listener. The port allocated can be queried via the - /// [`local_addr`] method. + /// [`TcpListener::local_addr`] method. /// /// The address type can be any implementor of [`ToSocketAddrs`] trait. See /// its documentation for concrete examples. @@ -691,9 +666,6 @@ impl TcpListener { /// none of the addresses succeed in creating a listener, the error returned /// from the last attempt (the last address) is returned. /// - /// [`local_addr`]: #method.local_addr - /// [`ToSocketAddrs`]: ../../std/net/trait.ToSocketAddrs.html - /// /// # Examples /// /// Creates a TCP listener bound to `127.0.0.1:80`: @@ -743,8 +715,6 @@ impl TcpListener { /// object references. Both handles can be used to accept incoming /// connections and options set on one listener will affect the other. /// - /// [`TcpListener`]: ../../std/net/struct.TcpListener.html - /// /// # Examples /// /// ```no_run @@ -764,8 +734,6 @@ impl TcpListener { /// is established. When established, the corresponding [`TcpStream`] and the /// remote peer's address will be returned. /// - /// [`TcpStream`]: ../../std/net/struct.TcpStream.html - /// /// # Examples /// /// ```no_run @@ -790,11 +758,7 @@ impl TcpListener { /// /// The returned iterator will never return [`None`] and will also not yield /// the peer's [`SocketAddr`] structure. Iterating over it is equivalent to - /// calling [`accept`] in a loop. - /// - /// [`None`]: ../../std/option/enum.Option.html#variant.None - /// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html - /// [`accept`]: #method.accept + /// calling [`TcpListener::accept`] in a loop. /// /// # Examples /// @@ -837,9 +801,7 @@ impl TcpListener { /// Gets the value of the `IP_TTL` option for this socket. /// - /// For more information about this option, see [`set_ttl`][link]. - /// - /// [link]: #method.set_ttl + /// For more information about this option, see [`TcpListener::set_ttl`]. /// /// # Examples /// @@ -936,8 +898,6 @@ impl TcpListener { /// } /// } /// ``` - /// - /// [`io::ErrorKind::WouldBlock`]: ../io/enum.ErrorKind.html#variant.WouldBlock #[stable(feature = "net2_mutators", since = "1.9.0")] pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> { self.0.set_nonblocking(nonblocking) diff --git a/library/std/src/net/udp.rs b/library/std/src/net/udp.rs index 0096b827ca4..d730b2b87ac 100644 --- a/library/std/src/net/udp.rs +++ b/library/std/src/net/udp.rs @@ -19,15 +19,15 @@ use crate::time::Duration; /// an unordered, unreliable protocol; refer to [`TcpListener`] and [`TcpStream`] for TCP /// primitives. /// -/// [`bind`]: #method.bind -/// [`connect`]: #method.connect +/// [`bind`]: UdpSocket::bind +/// [`connect`]: UdpSocket::connect /// [IETF RFC 768]: https://tools.ietf.org/html/rfc768 -/// [`recv`]: #method.recv -/// [received from]: #method.recv_from -/// [`send`]: #method.send -/// [sent to]: #method.send_to -/// [`TcpListener`]: ../../std/net/struct.TcpListener.html -/// [`TcpStream`]: ../../std/net/struct.TcpStream.html +/// [`recv`]: UdpSocket::recv +/// [received from]: UdpSocket::recv_from +/// [`send`]: UdpSocket::send +/// [sent to]: UdpSocket::send_to +/// [`TcpListener`]: crate::net::TcpListener +/// [`TcpStream`]: crate::net::TcpStream /// /// # Examples /// @@ -65,8 +65,6 @@ impl UdpSocket { /// of the addresses succeed in creating a socket, the error returned from /// the last attempt (the last address) is returned. /// - /// [`ToSocketAddrs`]: ../../std/net/trait.ToSocketAddrs.html - /// /// # Examples /// /// Creates a UDP socket bound to `127.0.0.1:3400`: @@ -160,8 +158,6 @@ impl UdpSocket { /// /// See issue #34202 for more details. /// - /// [`ToSocketAddrs`]: ../../std/net/trait.ToSocketAddrs.html - /// /// # Examples /// /// ```no_run @@ -193,7 +189,7 @@ impl UdpSocket { /// /// If the socket isn't connected, it will return a [`NotConnected`] error. /// - /// [`NotConnected`]: ../../std/io/enum.ErrorKind.html#variant.NotConnected + /// [`NotConnected`]: io::ErrorKind::NotConnected /// /// ```no_run /// use std::net::UdpSocket; @@ -254,12 +250,9 @@ impl UdpSocket { /// a result of setting this option. For example Unix typically returns an /// error of the kind [`WouldBlock`], but Windows may return [`TimedOut`]. /// - /// [`None`]: ../../std/option/enum.Option.html#variant.None - /// [`Err`]: ../../std/result/enum.Result.html#variant.Err - /// [`read`]: ../../std/io/trait.Read.html#tymethod.read - /// [`Duration`]: ../../std/time/struct.Duration.html - /// [`WouldBlock`]: ../../std/io/enum.ErrorKind.html#variant.WouldBlock - /// [`TimedOut`]: ../../std/io/enum.ErrorKind.html#variant.TimedOut + /// [`read`]: io::Read::read + /// [`WouldBlock`]: io::ErrorKind::WouldBlock + /// [`TimedOut`]: io::ErrorKind::TimedOut /// /// # Examples /// @@ -300,12 +293,9 @@ impl UdpSocket { /// as a result of setting this option. For example Unix typically returns /// an error of the kind [`WouldBlock`], but Windows may return [`TimedOut`]. /// - /// [`None`]: ../../std/option/enum.Option.html#variant.None - /// [`Err`]: ../../std/result/enum.Result.html#variant.Err - /// [`write`]: ../../std/io/trait.Write.html#tymethod.write - /// [`Duration`]: ../../std/time/struct.Duration.html - /// [`WouldBlock`]: ../../std/io/enum.ErrorKind.html#variant.WouldBlock - /// [`TimedOut`]: ../../std/io/enum.ErrorKind.html#variant.TimedOut + /// [`write`]: io::Write::write + /// [`WouldBlock`]: io::ErrorKind::WouldBlock + /// [`TimedOut`]: io::ErrorKind::TimedOut /// /// # Examples /// @@ -338,8 +328,7 @@ impl UdpSocket { /// /// If the timeout is [`None`], then [`read`] calls will block indefinitely. /// - /// [`None`]: ../../std/option/enum.Option.html#variant.None - /// [`read`]: ../../std/io/trait.Read.html#tymethod.read + /// [`read`]: io::Read::read /// /// # Examples /// @@ -359,8 +348,7 @@ impl UdpSocket { /// /// If the timeout is [`None`], then [`write`] calls will block indefinitely. /// - /// [`None`]: ../../std/option/enum.Option.html#variant.None - /// [`write`]: ../../std/io/trait.Write.html#tymethod.write + /// [`write`]: io::Write::write /// /// # Examples /// @@ -396,10 +384,7 @@ impl UdpSocket { /// Gets the value of the `SO_BROADCAST` option for this socket. /// - /// For more information about this option, see - /// [`set_broadcast`][link]. - /// - /// [link]: #method.set_broadcast + /// For more information about this option, see [`UdpSocket::set_broadcast`]. /// /// # Examples /// @@ -435,10 +420,7 @@ impl UdpSocket { /// Gets the value of the `IP_MULTICAST_LOOP` option for this socket. /// - /// For more information about this option, see - /// [`set_multicast_loop_v4`][link]. - /// - /// [link]: #method.set_multicast_loop_v4 + /// For more information about this option, see [`UdpSocket::set_multicast_loop_v4`]. /// /// # Examples /// @@ -477,10 +459,7 @@ impl UdpSocket { /// Gets the value of the `IP_MULTICAST_TTL` option for this socket. /// - /// For more information about this option, see - /// [`set_multicast_ttl_v4`][link]. - /// - /// [link]: #method.set_multicast_ttl_v4 + /// For more information about this option, see [`UdpSocket::set_multicast_ttl_v4`]. /// /// # Examples /// @@ -516,10 +495,7 @@ impl UdpSocket { /// Gets the value of the `IPV6_MULTICAST_LOOP` option for this socket. /// - /// For more information about this option, see - /// [`set_multicast_loop_v6`][link]. - /// - /// [link]: #method.set_multicast_loop_v6 + /// For more information about this option, see [`UdpSocket::set_multicast_loop_v6`]. /// /// # Examples /// @@ -555,9 +531,7 @@ impl UdpSocket { /// Gets the value of the `IP_TTL` option for this socket. /// - /// For more information about this option, see [`set_ttl`][link]. - /// - /// [link]: #method.set_ttl + /// For more information about this option, see [`UdpSocket::set_ttl`]. /// /// # Examples /// @@ -597,10 +571,7 @@ impl UdpSocket { /// Executes an operation of the `IP_DROP_MEMBERSHIP` type. /// - /// For more information about this option, see - /// [`join_multicast_v4`][link]. - /// - /// [link]: #method.join_multicast_v4 + /// For more information about this option, see [`UdpSocket::join_multicast_v4`]. #[stable(feature = "net2_mutators", since = "1.9.0")] pub fn leave_multicast_v4(&self, multiaddr: &Ipv4Addr, interface: &Ipv4Addr) -> io::Result<()> { self.0.leave_multicast_v4(multiaddr, interface) @@ -608,10 +579,7 @@ impl UdpSocket { /// Executes an operation of the `IPV6_DROP_MEMBERSHIP` type. /// - /// For more information about this option, see - /// [`join_multicast_v6`][link]. - /// - /// [link]: #method.join_multicast_v6 + /// For more information about this option, see [`UdpSocket::join_multicast_v6`]. #[stable(feature = "net2_mutators", since = "1.9.0")] pub fn leave_multicast_v6(&self, multiaddr: &Ipv6Addr, interface: u32) -> io::Result<()> { self.0.leave_multicast_v6(multiaddr, interface) @@ -675,11 +643,9 @@ impl UdpSocket { /// Sends data on the socket to the remote address to which it is connected. /// - /// The [`connect`] method will connect this socket to a remote address. This + /// [`UdpSocket::connect`] will connect this socket to a remote address. This /// method will fail if the socket is not connected. /// - /// [`connect`]: #method.connect - /// /// # Examples /// /// ```no_run @@ -701,11 +667,9 @@ impl UdpSocket { /// hold the message bytes. If a message is too long to fit in the supplied buffer, /// excess bytes may be discarded. /// - /// The [`connect`] method will connect this socket to a remote address. This + /// [`UdpSocket::connect`] will connect this socket to a remote address. This /// method will fail if the socket is not connected. /// - /// [`connect`]: #method.connect - /// /// # Examples /// /// ```no_run @@ -738,11 +702,9 @@ impl UdpSocket { /// Do not use this function to implement busy waiting, instead use `libc::poll` to /// synchronize IO events on one or more sockets. /// - /// The [`connect`] method will connect this socket to a remote address. This + /// [`UdpSocket::connect`] will connect this socket to a remote address. This /// method will fail if the socket is not connected. /// - /// [`connect`]: #method.connect - /// /// # Errors /// /// This method will fail if the socket is not connected. The `connect` method @@ -779,8 +741,6 @@ impl UdpSocket { /// `FIONBIO`. On Windows calling this method corresponds to calling /// `ioctlsocket` `FIONBIO`. /// - /// [`io::ErrorKind::WouldBlock`]: ../io/enum.ErrorKind.html#variant.WouldBlock - /// /// # Examples /// /// Creates a UDP socket bound to `127.0.0.1:7878` and read bytes in diff --git a/library/std/src/panic.rs b/library/std/src/panic.rs index 6ad5519d34a..8fcb24033b1 100644 --- a/library/std/src/panic.rs +++ b/library/std/src/panic.rs @@ -30,10 +30,6 @@ pub use core::panic::{Location, PanicInfo}; /// purpose of this trait is to encode what types are safe to cross a [`catch_unwind`] /// boundary with no fear of unwind safety. /// -/// [`Send`]: ../marker/trait.Send.html -/// [`Sync`]: ../marker/trait.Sync.html -/// [`catch_unwind`]: ./fn.catch_unwind.html -/// /// ## What is unwind safety? /// /// In Rust a function can "return" early if it either panics or calls a @@ -99,8 +95,6 @@ pub use core::panic::{Location, PanicInfo}; /// above, the lack of `unsafe` means it is mostly an advisory. The /// [`AssertUnwindSafe`] wrapper struct can be used to force this trait to be /// implemented for any closed over variables passed to `catch_unwind`. -/// -/// [`AssertUnwindSafe`]: ./struct.AssertUnwindSafe.html #[stable(feature = "catch_unwind", since = "1.9.0")] #[rustc_on_unimplemented( message = "the type `{Self}` may not be safely transferred across an unwind boundary", @@ -116,9 +110,6 @@ pub auto trait UnwindSafe {} /// /// This is a "helper marker trait" used to provide impl blocks for the /// [`UnwindSafe`] trait, for more information see that documentation. -/// -/// [`UnsafeCell`]: ../cell/struct.UnsafeCell.html -/// [`UnwindSafe`]: ./trait.UnwindSafe.html #[stable(feature = "catch_unwind", since = "1.9.0")] #[rustc_on_unimplemented( message = "the type `{Self}` may contain interior mutability and a reference may not be safely \ @@ -138,7 +129,6 @@ pub auto trait RefUnwindSafe {} /// account. This wrapper struct is useful for a quick and lightweight /// annotation that a variable is indeed unwind safe. /// -/// [`catch_unwind`]: ./fn.catch_unwind.html /// # Examples /// /// One way to use `AssertUnwindSafe` is to assert that the entire closure @@ -352,8 +342,6 @@ impl<F: Future> Future for AssertUnwindSafe<F> { /// can fail on a regular basis. Additionally, this function is not guaranteed /// to catch all panics, see the "Notes" section below. /// -/// [`Result`]: ../result/enum.Result.html -/// /// The closure provided is required to adhere to the [`UnwindSafe`] trait to ensure /// that all captured variables are safe to cross this boundary. The purpose of /// this bound is to encode the concept of [exception safety][rfc] in the type @@ -362,9 +350,6 @@ impl<F: Future> Future for AssertUnwindSafe<F> { /// becomes a problem the [`AssertUnwindSafe`] wrapper struct can be used to quickly /// assert that the usage here is indeed unwind safe. /// -/// [`AssertUnwindSafe`]: ./struct.AssertUnwindSafe.html -/// [`UnwindSafe`]: ./trait.UnwindSafe.html -/// /// [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1236-stabilize-catch-panic.md /// /// # Notes @@ -399,8 +384,6 @@ pub fn catch_unwind<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> { /// This is designed to be used in conjunction with [`catch_unwind`] to, for /// example, carry a panic across a layer of C code. /// -/// [`catch_unwind`]: ./fn.catch_unwind.html -/// /// # Notes /// /// Note that panics in Rust are not always implemented via unwinding, but they diff --git a/library/std/src/sys/unix/ext/fs.rs b/library/std/src/sys/unix/ext/fs.rs index f174a59b49a..b590a0280d1 100644 --- a/library/std/src/sys/unix/ext/fs.rs +++ b/library/std/src/sys/unix/ext/fs.rs @@ -9,9 +9,7 @@ use crate::sys; use crate::sys::platform::fs::MetadataExt as UnixMetadataExt; use crate::sys_common::{AsInner, AsInnerMut, FromInner}; -/// Unix-specific extensions to [`File`]. -/// -/// [`File`]: ../../../../std/fs/struct.File.html +/// Unix-specific extensions to [`fs::File`]. #[stable(feature = "file_offset", since = "1.15.0")] pub trait FileExt { /// Reads a number of bytes starting from a given offset. @@ -55,19 +53,18 @@ pub trait FileExt { /// /// The current file cursor is not affected by this function. /// - /// Similar to [`Read::read_exact`] but uses [`read_at`] instead of `read`. + /// Similar to [`io::Read::read_exact`] but uses [`read_at`] instead of `read`. /// - /// [`Read::read_exact`]: ../../../../std/io/trait.Read.html#method.read_exact - /// [`read_at`]: #tymethod.read_at + /// [`read_at`]: FileExt::read_at /// /// # Errors /// /// If this function encounters an error of the kind - /// [`ErrorKind::Interrupted`] then the error is ignored and the operation + /// [`io::ErrorKind::Interrupted`] then the error is ignored and the operation /// will continue. /// /// If this function encounters an "end of file" before completely filling - /// the buffer, it returns an error of the kind [`ErrorKind::UnexpectedEof`]. + /// the buffer, it returns an error of the kind [`io::ErrorKind::UnexpectedEof`]. /// The contents of `buf` are unspecified in this case. /// /// If any other read error is encountered then this function immediately @@ -77,9 +74,6 @@ pub trait FileExt { /// has read, but it will never read more than would be necessary to /// completely fill the buffer. /// - /// [`ErrorKind::Interrupted`]: ../../../../std/io/enum.ErrorKind.html#variant.Interrupted - /// [`ErrorKind::UnexpectedEof`]: ../../../../std/io/enum.ErrorKind.html#variant.UnexpectedEof - /// /// # Examples /// /// ```no_run @@ -161,19 +155,18 @@ pub trait FileExt { /// The current file cursor is not affected by this function. /// /// This method will continuously call [`write_at`] until there is no more data - /// to be written or an error of non-[`ErrorKind::Interrupted`] kind is + /// to be written or an error of non-[`io::ErrorKind::Interrupted`] kind is /// returned. This method will not return until the entire buffer has been /// successfully written or such an error occurs. The first error that is - /// not of [`ErrorKind::Interrupted`] kind generated from this method will be + /// not of [`io::ErrorKind::Interrupted`] kind generated from this method will be /// returned. /// /// # Errors /// /// This function will return the first error of - /// non-[`ErrorKind::Interrupted`] kind that [`write_at`] returns. + /// non-[`io::ErrorKind::Interrupted`] kind that [`write_at`] returns. /// - /// [`ErrorKind::Interrupted`]: ../../../../std/io/enum.ErrorKind.html#variant.Interrupted - /// [`write_at`]: #tymethod.write_at + /// [`write_at`]: FileExt::write_at /// /// # Examples /// @@ -223,8 +216,6 @@ impl FileExt for fs::File { } /// Unix-specific extensions to [`fs::Permissions`]. -/// -/// [`fs::Permissions`]: ../../../../std/fs/struct.Permissions.html #[stable(feature = "fs_ext", since = "1.1.0")] pub trait PermissionsExt { /// Returns the underlying raw `st_mode` bits that contain the standard @@ -302,8 +293,6 @@ impl PermissionsExt for Permissions { } /// Unix-specific extensions to [`fs::OpenOptions`]. -/// -/// [`fs::OpenOptions`]: ../../../../std/fs/struct.OpenOptions.html #[stable(feature = "fs_ext", since = "1.1.0")] pub trait OpenOptionsExt { /// Sets the mode bits that a new file will be created with. @@ -372,8 +361,6 @@ impl OpenOptionsExt for OpenOptions { } /// Unix-specific extensions to [`fs::Metadata`]. -/// -/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html #[stable(feature = "metadata_ext", since = "1.1.0")] pub trait MetadataExt { /// Returns the ID of the device containing the file. @@ -535,7 +522,7 @@ pub trait MetadataExt { fn atime(&self) -> i64; /// Returns the last access time of the file, in nanoseconds since [`atime`]. /// - /// [`atime`]: #tymethod.atime + /// [`atime`]: MetadataExt::atime /// /// # Examples /// @@ -571,7 +558,7 @@ pub trait MetadataExt { fn mtime(&self) -> i64; /// Returns the last modification time of the file, in nanoseconds since [`mtime`]. /// - /// [`mtime`]: #tymethod.mtime + /// [`mtime`]: MetadataExt::mtime /// /// # Examples /// @@ -607,7 +594,7 @@ pub trait MetadataExt { fn ctime(&self) -> i64; /// Returns the last status change time of the file, in nanoseconds since [`ctime`]. /// - /// [`ctime`]: #tymethod.ctime + /// [`ctime`]: MetadataExt::ctime /// /// # Examples /// @@ -714,12 +701,10 @@ impl MetadataExt for fs::Metadata { } } -/// Unix-specific extensions for [`FileType`]. +/// Unix-specific extensions for [`fs::FileType`]. /// /// Adds support for special Unix file types such as block/character devices, /// pipes, and sockets. -/// -/// [`FileType`]: ../../../../std/fs/struct.FileType.html #[stable(feature = "file_type_ext", since = "1.5.0")] pub trait FileTypeExt { /// Returns `true` if this file type is a block device. @@ -813,8 +798,6 @@ impl FileTypeExt for fs::FileType { } /// Unix-specific extension methods for [`fs::DirEntry`]. -/// -/// [`fs::DirEntry`]: ../../../../std/fs/struct.DirEntry.html #[stable(feature = "dir_entry_ext", since = "1.1.0")] pub trait DirEntryExt { /// Returns the underlying `d_ino` field in the contained `dirent` @@ -875,8 +858,6 @@ pub fn symlink<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<()> } /// Unix-specific extensions to [`fs::DirBuilder`]. -/// -/// [`fs::DirBuilder`]: ../../../../std/fs/struct.DirBuilder.html #[stable(feature = "dir_builder", since = "1.6.0")] pub trait DirBuilderExt { /// Sets the mode to create new directories with. This option defaults to diff --git a/library/std/src/sys/unix/ext/net.rs b/library/std/src/sys/unix/ext/net.rs index ada8eaa1c97..55803ddfc43 100644 --- a/library/std/src/sys/unix/ext/net.rs +++ b/library/std/src/sys/unix/ext/net.rs @@ -408,10 +408,7 @@ impl UnixStream { /// indefinitely. An [`Err`] is returned if the zero [`Duration`] is passed to this /// method. /// - /// [`None`]: ../../../../std/option/enum.Option.html#variant.None - /// [`Err`]: ../../../../std/result/enum.Result.html#variant.Err - /// [`read`]: ../../../../std/io/trait.Read.html#tymethod.read - /// [`Duration`]: ../../../../std/time/struct.Duration.html + /// [`read`]: io::Read::read /// /// # Examples /// @@ -453,10 +450,7 @@ impl UnixStream { /// indefinitely. An [`Err`] is returned if the zero [`Duration`] is /// passed to this method. /// - /// [`None`]: ../../../../std/option/enum.Option.html#variant.None - /// [`Err`]: ../../../../std/result/enum.Result.html#variant.Err - /// [`write`]: ../../../../std/io/trait.Write.html#tymethod.write - /// [`Duration`]: ../../../../std/time/struct.Duration.html + /// [`read`]: io::Read::read /// /// # Examples /// @@ -581,8 +575,6 @@ impl UnixStream { /// specified portions to immediately return with an appropriate value /// (see the documentation of [`Shutdown`]). /// - /// [`Shutdown`]: ../../../../std/net/enum.Shutdown.html - /// /// # Examples /// /// ```no_run @@ -852,7 +844,7 @@ impl UnixListener { /// is established. When established, the corresponding [`UnixStream`] and /// the remote peer's address will be returned. /// - /// [`UnixStream`]: ../../../../std/os/unix/net/struct.UnixStream.html + /// [`UnixStream`]: crate::os::unix::net::UnixStream /// /// # Examples /// @@ -937,8 +929,6 @@ impl UnixListener { /// Ok(()) /// } /// ``` - /// - /// [`io::ErrorKind::WouldBlock`]: ../../../io/enum.ErrorKind.html#variant.WouldBlock #[stable(feature = "unix_socket", since = "1.10.0")] pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> { self.0.set_nonblocking(nonblocking) @@ -973,9 +963,6 @@ impl UnixListener { /// The iterator will never return [`None`] and will also not yield the /// peer's [`SocketAddr`] structure. /// - /// [`None`]: ../../../../std/option/enum.Option.html#variant.None - /// [`SocketAddr`]: struct.SocketAddr.html - /// /// # Examples /// /// ```no_run @@ -1043,9 +1030,6 @@ impl<'a> IntoIterator for &'a UnixListener { /// /// It will never return [`None`]. /// -/// [`None`]: ../../../../std/option/enum.Option.html#variant.None -/// [`UnixListener`]: struct.UnixListener.html -/// /// # Examples /// /// ```no_run @@ -1205,9 +1189,9 @@ impl UnixDatagram { /// The [`send`] method may be used to send data to the specified address. /// [`recv`] and [`recv_from`] will only receive data from that address. /// - /// [`send`]: #method.send - /// [`recv`]: #method.recv - /// [`recv_from`]: #method.recv_from + /// [`send`]: UnixDatagram::send + /// [`recv`]: UnixDatagram::recv + /// [`recv_from`]: UnixDatagram::recv_from /// /// # Examples /// @@ -1284,7 +1268,7 @@ impl UnixDatagram { /// /// The [`connect`] method will connect the socket to a peer. /// - /// [`connect`]: #method.connect + /// [`connect`]: UnixDatagram::connect /// /// # Examples /// @@ -1432,11 +1416,8 @@ impl UnixDatagram { /// block indefinitely. An [`Err`] is returned if the zero [`Duration`] /// is passed to this method. /// - /// [`None`]: ../../../../std/option/enum.Option.html#variant.None - /// [`Err`]: ../../../../std/result/enum.Result.html#variant.Err - /// [`recv`]: #method.recv - /// [`recv_from`]: #method.recv_from - /// [`Duration`]: ../../../../std/time/struct.Duration.html + /// [`recv`]: UnixDatagram::recv + /// [`recv_from`]: UnixDatagram::recv_from /// /// # Examples /// @@ -1479,10 +1460,8 @@ impl UnixDatagram { /// block indefinitely. An [`Err`] is returned if the zero [`Duration`] is passed to this /// method. /// - /// [`None`]: ../../../../std/option/enum.Option.html#variant.None - /// [`send`]: #method.send - /// [`send_to`]: #method.send_to - /// [`Duration`]: ../../../../std/time/struct.Duration.html + /// [`send`]: UnixDatagram::send + /// [`send_to`]: UnixDatagram::send_to /// /// # Examples /// @@ -1605,8 +1584,6 @@ impl UnixDatagram { /// specified portions to immediately return with an appropriate value /// (see the documentation of [`Shutdown`]). /// - /// [`Shutdown`]: ../../../../std/net/enum.Shutdown.html - /// /// ```no_run /// use std::os::unix::net::UnixDatagram; /// use std::net::Shutdown; diff --git a/library/std/src/sys/unix/ext/process.rs b/library/std/src/sys/unix/ext/process.rs index 048ce24d6ba..82527c40e91 100644 --- a/library/std/src/sys/unix/ext/process.rs +++ b/library/std/src/sys/unix/ext/process.rs @@ -10,8 +10,6 @@ use crate::sys; use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; /// Unix-specific extensions to the [`process::Command`] builder. -/// -/// [`process::Command`]: ../../../../std/process/struct.Command.html #[stable(feature = "rust1", since = "1.0.0")] pub trait CommandExt { /// Sets the child process's user ID. This translates to a @@ -65,7 +63,7 @@ pub trait CommandExt { /// This method is stable and usable, but it should be unsafe. To fix /// that, it got deprecated in favor of the unsafe [`pre_exec`]. /// - /// [`pre_exec`]: #tymethod.pre_exec + /// [`pre_exec`]: CommandExt::pre_exec #[stable(feature = "process_exec", since = "1.15.0")] #[rustc_deprecated(since = "1.37.0", reason = "should be unsafe, use `pre_exec` instead")] fn before_exec<F>(&mut self, f: F) -> &mut process::Command @@ -94,8 +92,6 @@ pub trait CommandExt { /// a new child. Like spawn, however, the default behavior for the stdio /// descriptors will be to inherited from the current process. /// - /// [`process::exit`]: ../../../process/fn.exit.html - /// /// # Notes /// /// The process may be in a "broken state" if this function returns in @@ -151,8 +147,6 @@ impl CommandExt for process::Command { } /// Unix-specific extensions to [`process::ExitStatus`]. -/// -/// [`process::ExitStatus`]: ../../../../std/process/struct.ExitStatus.html #[stable(feature = "rust1", since = "1.0.0")] pub trait ExitStatusExt { /// Creates a new `ExitStatus` from the raw underlying `i32` return value of diff --git a/library/std/src/sys/unix/ext/thread.rs b/library/std/src/sys/unix/ext/thread.rs index 759ef6236e8..7221da1a9a7 100644 --- a/library/std/src/sys/unix/ext/thread.rs +++ b/library/std/src/sys/unix/ext/thread.rs @@ -11,9 +11,7 @@ use crate::thread::JoinHandle; #[allow(deprecated)] pub type RawPthread = pthread_t; -/// Unix-specific extensions to [`thread::JoinHandle`]. -/// -/// [`thread::JoinHandle`]: ../../../../std/thread/struct.JoinHandle.html +/// Unix-specific extensions to [`JoinHandle`]. #[stable(feature = "thread_extensions", since = "1.9.0")] pub trait JoinHandleExt { /// Extracts the raw pthread_t without taking ownership diff --git a/library/std/src/sys/windows/ext/ffi.rs b/library/std/src/sys/windows/ext/ffi.rs index 6e78119383f..1df2a0df143 100644 --- a/library/std/src/sys/windows/ext/ffi.rs +++ b/library/std/src/sys/windows/ext/ffi.rs @@ -30,13 +30,13 @@ //! [`OsString`] is the Rust wrapper for owned strings in the //! preferred representation of the operating system. On Windows, //! this struct gets augmented with an implementation of the -//! [`OsStringExt`] trait, which has a [`from_wide`] method. This +//! [`OsStringExt`] trait, which has a [`OsStringExt::from_wide`] method. This //! lets you create an [`OsString`] from a `&[u16]` slice; presumably //! you get such a slice out of a `WCHAR` Windows API. //! //! Similarly, [`OsStr`] is the Rust wrapper for borrowed strings from //! preferred representation of the operating system. On Windows, the -//! [`OsStrExt`] trait provides the [`encode_wide`] method, which +//! [`OsStrExt`] trait provides the [`OsStrExt::encode_wide`] method, which //! outputs an [`EncodeWide`] iterator. You can [`collect`] this //! iterator, for example, to obtain a `Vec<u16>`; you can later get a //! pointer to this vector's contents and feed it to Windows APIs. @@ -47,15 +47,8 @@ //! ill-formed UTF-16. //! //! [ill-formed-utf-16]: https://simonsapin.github.io/wtf-8/#ill-formed-utf-16 -//! [`OsString`]: ../../../ffi/struct.OsString.html -//! [`OsStr`]: ../../../ffi/struct.OsStr.html -//! [`OsStringExt`]: trait.OsStringExt.html -//! [`OsStrExt`]: trait.OsStrExt.html -//! [`EncodeWide`]: struct.EncodeWide.html -//! [`from_wide`]: trait.OsStringExt.html#tymethod.from_wide -//! [`encode_wide`]: trait.OsStrExt.html#tymethod.encode_wide -//! [`collect`]: ../../../iter/trait.Iterator.html#method.collect -//! [U+FFFD]: ../../../char/constant.REPLACEMENT_CHARACTER.html +//! [`collect`]: crate::iter::Iterator::collect +//! [U+FFFD]: crate::char::REPLACEMENT_CHARACTER #![stable(feature = "rust1", since = "1.0.0")] @@ -68,14 +61,12 @@ use crate::sys_common::{AsInner, FromInner}; pub use crate::sys_common::wtf8::EncodeWide; /// Windows-specific extensions to [`OsString`]. -/// -/// [`OsString`]: ../../../../std/ffi/struct.OsString.html #[stable(feature = "rust1", since = "1.0.0")] pub trait OsStringExt { /// Creates an `OsString` from a potentially ill-formed UTF-16 slice of /// 16-bit code units. /// - /// This is lossless: calling [`encode_wide`] on the resulting string + /// This is lossless: calling [`OsStrExt::encode_wide`] on the resulting string /// will always return the original code units. /// /// # Examples @@ -89,8 +80,6 @@ pub trait OsStringExt { /// /// let string = OsString::from_wide(&source[..]); /// ``` - /// - /// [`encode_wide`]: ./trait.OsStrExt.html#tymethod.encode_wide #[stable(feature = "rust1", since = "1.0.0")] fn from_wide(wide: &[u16]) -> Self; } @@ -103,14 +92,12 @@ impl OsStringExt for OsString { } /// Windows-specific extensions to [`OsStr`]. -/// -/// [`OsStr`]: ../../../../std/ffi/struct.OsStr.html #[stable(feature = "rust1", since = "1.0.0")] pub trait OsStrExt { /// Re-encodes an `OsStr` as a wide character sequence, i.e., potentially /// ill-formed UTF-16. /// - /// This is lossless: calling [`OsString::from_wide`] and then + /// This is lossless: calling [`OsStringExt::from_wide`] and then /// `encode_wide` on the result will yield the original code units. /// Note that the encoding does not add a final null terminator. /// @@ -128,8 +115,6 @@ pub trait OsStrExt { /// let result: Vec<u16> = string.encode_wide().collect(); /// assert_eq!(&source[..], &result[..]); /// ``` - /// - /// [`OsString::from_wide`]: ./trait.OsStringExt.html#tymethod.from_wide #[stable(feature = "rust1", since = "1.0.0")] fn encode_wide(&self) -> EncodeWide<'_>; } diff --git a/library/std/src/sys/windows/ext/fs.rs b/library/std/src/sys/windows/ext/fs.rs index 81b2bf99872..e0615f2d334 100644 --- a/library/std/src/sys/windows/ext/fs.rs +++ b/library/std/src/sys/windows/ext/fs.rs @@ -8,9 +8,7 @@ use crate::path::Path; use crate::sys; use crate::sys_common::{AsInner, AsInnerMut}; -/// Windows-specific extensions to [`File`]. -/// -/// [`File`]: ../../../fs/struct.File.html +/// Windows-specific extensions to [`fs::File`]. #[stable(feature = "file_offset", since = "1.15.0")] pub trait FileExt { /// Seeks to a given position and reads a number of bytes. @@ -94,8 +92,6 @@ impl FileExt for fs::File { } /// Windows-specific extensions to [`fs::OpenOptions`]. -/// -/// [`fs::OpenOptions`]: ../../../../std/fs/struct.OpenOptions.html #[stable(feature = "open_options_ext", since = "1.10.0")] pub trait OpenOptionsExt { /// Overrides the `dwDesiredAccess` argument to the call to [`CreateFile`] @@ -295,7 +291,6 @@ impl OpenOptionsExt for OpenOptions { /// The data members that this trait exposes correspond to the members /// of the [`BY_HANDLE_FILE_INFORMATION`] structure. /// -/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html /// [`BY_HANDLE_FILE_INFORMATION`]: /// https://docs.microsoft.com/en-us/windows/win32/api/fileapi/ns-fileapi-by_handle_file_information #[stable(feature = "metadata_ext", since = "1.1.0")] @@ -499,11 +494,9 @@ impl MetadataExt for Metadata { } } -/// Windows-specific extensions to [`FileType`]. +/// Windows-specific extensions to [`fs::FileType`]. /// /// On Windows, a symbolic link knows whether it is a file or directory. -/// -/// [`FileType`]: ../../../../std/fs/struct.FileType.html #[unstable(feature = "windows_file_type_ext", issue = "none")] pub trait FileTypeExt { /// Returns `true` if this file type is a symbolic link that is also a directory. diff --git a/library/std/src/sys/windows/ext/process.rs b/library/std/src/sys/windows/ext/process.rs index 8c34a9faf1d..61e4c6a1d17 100644 --- a/library/std/src/sys/windows/ext/process.rs +++ b/library/std/src/sys/windows/ext/process.rs @@ -73,8 +73,6 @@ impl IntoRawHandle for process::ChildStderr { } /// Windows-specific extensions to [`process::ExitStatus`]. -/// -/// [`process::ExitStatus`]: ../../../../std/process/struct.ExitStatus.html #[stable(feature = "exit_status_from", since = "1.12.0")] pub trait ExitStatusExt { /// Creates a new `ExitStatus` from the raw underlying `u32` return value of @@ -91,8 +89,6 @@ impl ExitStatusExt for process::ExitStatus { } /// Windows-specific extensions to the [`process::Command`] builder. -/// -/// [`process::Command`]: ../../../../std/process/struct.Command.html #[stable(feature = "windows_process_extensions", since = "1.16.0")] pub trait CommandExt { /// Sets the [process creation flags][1] to be passed to `CreateProcess`. |
