From c38230e3b639783483277465ff3c3436a8fd5545 Mon Sep 17 00:00:00 2001 From: Alexis Bourget Date: Tue, 14 Jul 2020 17:05:29 +0200 Subject: [PATCH 01/26] Deny unsafe op in unsafe functions in libstd/alloc.rs --- src/libstd/alloc.rs | 91 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 71 insertions(+), 20 deletions(-) diff --git a/src/libstd/alloc.rs b/src/libstd/alloc.rs index 38d223d84e90f..ecfaaeace513e 100644 --- a/src/libstd/alloc.rs +++ b/src/libstd/alloc.rs @@ -59,6 +59,7 @@ //! The `#[global_allocator]` can only be used once in a crate //! or its recursive dependencies. +#![deny(unsafe_op_in_unsafe_fn)] #![stable(feature = "alloc_module", since = "1.28.0")] use core::intrinsics; @@ -158,7 +159,9 @@ unsafe impl AllocRef for System { #[inline] unsafe fn dealloc(&mut self, ptr: NonNull, layout: Layout) { if layout.size() != 0 { - GlobalAlloc::dealloc(self, ptr.as_ptr(), layout) + // SAFETY: The safety guarantees are explained in the documentation + // for the `GlobalAlloc` trait and its `dealloc` method. + unsafe { GlobalAlloc::dealloc(self, ptr.as_ptr(), layout) } } } @@ -184,16 +187,36 @@ unsafe impl AllocRef for System { match placement { ReallocPlacement::InPlace => Err(AllocErr), ReallocPlacement::MayMove if layout.size() == 0 => { - let new_layout = Layout::from_size_align_unchecked(new_size, layout.align()); + let new_layout = + // SAFETY: The new size and layout alignement guarantees + // are transfered to the caller (they come from parameters). + // + // See the preconditions for `Layout::from_size_align` to + // see what must be checked. + unsafe { Layout::from_size_align_unchecked(new_size, layout.align()) }; self.alloc(new_layout, init) } ReallocPlacement::MayMove => { - // `realloc` probably checks for `new_size > size` or something similar. - intrinsics::assume(new_size > size); - let ptr = GlobalAlloc::realloc(self, ptr.as_ptr(), layout, new_size); - let memory = - MemoryBlock { ptr: NonNull::new(ptr).ok_or(AllocErr)?, size: new_size }; - init.init_offset(memory, size); + // SAFETY: + // + // The safety guarantees are explained in the documentation + // for the `GlobalAlloc` trait and its `dealloc` method. + // + // `realloc` probably checks for `new_size > size` or something + // similar. + // + // For the guarantees about `init_offset`, see its documentation: + // `ptr` is assumed valid (and checked for non-NUL) and + // `memory.size` is set to `new_size` so the offset being `size` + // is valid. + let memory = unsafe { + intrinsics::assume(new_size > size); + let ptr = GlobalAlloc::realloc(self, ptr.as_ptr(), layout, new_size); + let memory = + MemoryBlock { ptr: NonNull::new(ptr).ok_or(AllocErr)?, size: new_size }; + init.init_offset(memory, size); + memory + }; Ok(memory) } } @@ -220,14 +243,28 @@ unsafe impl AllocRef for System { match placement { ReallocPlacement::InPlace => Err(AllocErr), ReallocPlacement::MayMove if new_size == 0 => { - self.dealloc(ptr, layout); + // SAFETY: see `GlobalAlloc::dealloc` for the guarantees that + // must be respected. `ptr` and `layout` are parameters and so + // those guarantees must be checked by the caller. + unsafe { self.dealloc(ptr, layout) }; Ok(MemoryBlock { ptr: layout.dangling(), size: 0 }) } ReallocPlacement::MayMove => { - // `realloc` probably checks for `new_size < size` or something similar. - intrinsics::assume(new_size < size); - let ptr = GlobalAlloc::realloc(self, ptr.as_ptr(), layout, new_size); - Ok(MemoryBlock { ptr: NonNull::new(ptr).ok_or(AllocErr)?, size: new_size }) + // SAFETY: + // + // See `GlobalAlloc::realloc` for more informations about the + // guarantees expected by this method. `ptr`, `layout` and + // `new_size` are parameters and the responsability for their + // correctness is left to the caller. + // + // `realloc` probably checks for `new_size < size` or something + // similar. + let memory = unsafe { + intrinsics::assume(new_size < size); + let ptr = GlobalAlloc::realloc(self, ptr.as_ptr(), layout, new_size); + MemoryBlock { ptr: NonNull::new(ptr).ok_or(AllocErr)?, size: new_size } + }; + Ok(memory) } } } @@ -300,13 +337,19 @@ pub mod __default_lib_allocator { #[rustc_std_internal_symbol] pub unsafe extern "C" fn __rdl_alloc(size: usize, align: usize) -> *mut u8 { - let layout = Layout::from_size_align_unchecked(size, align); - System.alloc(layout) + // SAFETY: see the guarantees expected by `Layout::from_size_align` and + // `GlobalAlloc::alloc`. + unsafe { + let layout = Layout::from_size_align_unchecked(size, align); + System.alloc(layout) + } } #[rustc_std_internal_symbol] pub unsafe extern "C" fn __rdl_dealloc(ptr: *mut u8, size: usize, align: usize) { - System.dealloc(ptr, Layout::from_size_align_unchecked(size, align)) + // SAFETY: see the guarantees expected by `Layout::from_size_align` and + // `GlobalAlloc::dealloc`. + unsafe { System.dealloc(ptr, Layout::from_size_align_unchecked(size, align)) } } #[rustc_std_internal_symbol] @@ -316,13 +359,21 @@ pub mod __default_lib_allocator { align: usize, new_size: usize, ) -> *mut u8 { - let old_layout = Layout::from_size_align_unchecked(old_size, align); - System.realloc(ptr, old_layout, new_size) + // SAFETY: see the guarantees expected by `Layout::from_size_align` and + // `GlobalAlloc::realloc`. + unsafe { + let old_layout = Layout::from_size_align_unchecked(old_size, align); + System.realloc(ptr, old_layout, new_size) + } } #[rustc_std_internal_symbol] pub unsafe extern "C" fn __rdl_alloc_zeroed(size: usize, align: usize) -> *mut u8 { - let layout = Layout::from_size_align_unchecked(size, align); - System.alloc_zeroed(layout) + // SAFETY: see the guarantees expected by `Layout::from_size_align` and + // `GlobalAlloc::alloc_zeroed`. + unsafe { + let layout = Layout::from_size_align_unchecked(size, align); + System.alloc_zeroed(layout) + } } } From afbfe603fc1c288a0cff63b3b1cad43902a66e9b Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Wed, 15 Jul 2020 08:14:55 +0000 Subject: [PATCH 02/26] Remove combine function Comparing two array directly helps generate better assert message --- src/libstd/sys/unix/process/process_unix.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/libstd/sys/unix/process/process_unix.rs b/src/libstd/sys/unix/process/process_unix.rs index de35fe0521d03..a8499070e1508 100644 --- a/src/libstd/sys/unix/process/process_unix.rs +++ b/src/libstd/sys/unix/process/process_unix.rs @@ -84,12 +84,12 @@ impl Command { Ok(0) => return Ok((p, ours)), Ok(8) => { let (errno, footer) = bytes.split_at(4); - assert!( - combine(CLOEXEC_MSG_FOOTER) == combine(footer.try_into().unwrap()), + assert_eq!( + CLOEXEC_MSG_FOOTER, footer, "Validation on the CLOEXEC pipe failed: {:?}", bytes ); - let errno = combine(errno.try_into().unwrap()); + let errno = i32::from_be_bytes(errno.try_into().unwrap()); assert!(p.wait().is_ok(), "wait() should either return Ok or panic"); return Err(Error::from_raw_os_error(errno)); } @@ -105,10 +105,6 @@ impl Command { } } } - - fn combine(arr: [u8; 4]) -> i32 { - i32::from_be_bytes(arr) - } } pub fn exec(&mut self, default: Stdio) -> io::Error { From 48ec236c8c7c5a32077c465eb254646a9860f802 Mon Sep 17 00:00:00 2001 From: Lokathor Date: Thu, 16 Jul 2020 07:05:08 -0600 Subject: [PATCH 03/26] start GBA file. --- .../spec/thumbv4t_nintendo_gba.rs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/librustc_target/spec/thumbv4t_nintendo_gba.rs diff --git a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs new file mode 100644 index 0000000000000..b7e70167c0d09 --- /dev/null +++ b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs @@ -0,0 +1,30 @@ +//! Targets the Nintendo Game Boy Advance (GBA). +//! +//! The GBA is a handheld game device from 2001. Inside, the CPU is an ARM7TDMI. +//! That's in the ARMv4T architecture family. +//! +//! Technically the device has no OS, however we're going to copy the +//! `mipsel_sony_psp` target setup and set the OS string to be "GBA". Other than +//! the setting of the `target_os` and `target_vendor` values, this target is a +//! fairly standard configuration for `thumbv4t` + +use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; + +pub fn target() -> TargetResult { + Ok(Target { + llvm_target: "thumbv4t-none-eabi".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + target_os: "gba".to_string(), + target_env: String::new(), + target_vendor: "nintendo".to_string(), + arch: "arm".to_string(), + data_layout: "TODO".to_string(), + linker_flavor: LinkerFlavor::Ld, + options: TargetOptions { + // TODO + ..TargetOptions::default() + }, + }) +} From e190bdf710101d8fdf12195dcc73749719a57e72 Mon Sep 17 00:00:00 2001 From: Lokathor Date: Thu, 16 Jul 2020 16:40:50 -0600 Subject: [PATCH 04/26] fill in all those options. --- .../spec/thumbv4t_nintendo_gba.rs | 72 ++++++++++++++++--- 1 file changed, 61 insertions(+), 11 deletions(-) diff --git a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs index b7e70167c0d09..2b3aa33dfa3d6 100644 --- a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs +++ b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs @@ -1,12 +1,11 @@ -//! Targets the Nintendo Game Boy Advance (GBA). +//! Targets the Nintendo Game Boy Advance (GBA), a handheld game device from 2001. //! -//! The GBA is a handheld game device from 2001. Inside, the CPU is an ARM7TDMI. -//! That's in the ARMv4T architecture family. +//! Please ping @Lokathor if changes are needed. //! -//! Technically the device has no OS, however we're going to copy the -//! `mipsel_sony_psp` target setup and set the OS string to be "GBA". Other than -//! the setting of the `target_os` and `target_vendor` values, this target is a -//! fairly standard configuration for `thumbv4t` +//! Important: This target **does not** specify a linker script or the ROM +//! header. You'll still need to provide these yourself to construct a final +//! binary. Generally you'd do this with something like +//! `-Clink-arg=-Tmy_script.ld` and `-Clink-arg=my_crt.o`. use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; @@ -16,14 +15,65 @@ pub fn target() -> TargetResult { target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), - target_os: "gba".to_string(), - target_env: String::new(), + target_os: "none".to_string(), + target_env: "gba".to_string(), target_vendor: "nintendo".to_string(), arch: "arm".to_string(), - data_layout: "TODO".to_string(), + /* Data layout args are '-' separated: + * little endian + * stack is 64-bit aligned (EABI) + * pointers are 32-bit + * i64 must be 64-bit aligned (EABI) + * mangle names with ELF style + * native integers are 32-bit + * All other elements are default + */ + data_layout: "e-S64-p:32:32-i64:64-m:e-n32".to_string(), linker_flavor: LinkerFlavor::Ld, options: TargetOptions { - // TODO + linker: Some("arm-none-eabi-ld".to_string()), + linker_is_gnu: true, + + // extra args passed to the external assembler + asm_args: vec!["-mcpu=arm7tdmi".to_string(), "-mthumb-interwork".to_string()], + + cpu: "arm7tdmi".to_string(), + + // minimum extra features, these cannot be disabled via -C + features: "+soft-float,+strict-align".to_string(), + + executables: true, + + relocation_model: RelocModel::Static, + + //function_sections: bool, + //exe_suffix: String, + main_needs_argc_argv: false, + + // if we have thread-local storage + has_elf_tls: false, + + // don't have atomic compare-and-swap + atomic_cas: false, + + // always just abort + panic_strategy: PanicStrategy::Abort, + + // ABIs to not use + unsupported_abis: super::arm_base::unsupported_abis(), + + // The minimum alignment for global symbols. + min_global_align: Some(4), + + // no threads here + singlethread: true, + + // GBA has no builtins + no_builtins: true, + + // this is off just like in the `thumb_base` + emit_debug_gdb_scripts: false, + ..TargetOptions::default() }, }) From 9c4ac7395953435a5f39cfaf93c7679df068bade Mon Sep 17 00:00:00 2001 From: Lokathor Date: Thu, 16 Jul 2020 17:24:36 -0600 Subject: [PATCH 05/26] Docs clarifications. --- src/librustc_target/spec/thumbv4t_nintendo_gba.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs index 2b3aa33dfa3d6..1be6c4a9ff875 100644 --- a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs +++ b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs @@ -1,11 +1,11 @@ -//! Targets the Nintendo Game Boy Advance (GBA), a handheld game device from 2001. +//! Targets the Nintendo Game Boy Advance (GBA), +//! a handheld game device from 2001. //! //! Please ping @Lokathor if changes are needed. //! -//! Important: This target **does not** specify a linker script or the ROM -//! header. You'll still need to provide these yourself to construct a final -//! binary. Generally you'd do this with something like -//! `-Clink-arg=-Tmy_script.ld` and `-Clink-arg=my_crt.o`. +//! The target profile assumes that you have the ARM binutils in your path (specifically the linker, `arm-none-eabi-ld`). They can be obtained for free for all major OSes from the ARM developer's website, and they may also be available in your system's package manager +//! +//! **Important:** This target profile **does not** specify a linker script or the ROM header. You'll still need to provide these yourself to construct a final binary. Generally you'd do this with something like `-Clink-arg=-Tmy_script.ld` and `-Clink-arg=my_crt.o`. use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; From 72fa7f82503d4eb3c09e5dce600ac044c2835688 Mon Sep 17 00:00:00 2001 From: Lokathor Date: Thu, 16 Jul 2020 17:24:58 -0600 Subject: [PATCH 06/26] Add to supported_targets list. --- src/librustc_target/spec/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index 4a2dd8913185f..d1c3fc5847851 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -676,6 +676,7 @@ supported_targets! { ("powerpc64-wrs-vxworks", powerpc64_wrs_vxworks), ("mipsel-sony-psp", mipsel_sony_psp), + ("thumbv4t-nintendo-gba", thumbv4t_nintendo_gba), } /// Everything `rustc` knows about how to compile for a specific target. From 66a3d6859ba8cca6eab614014c001a0ef4be9809 Mon Sep 17 00:00:00 2001 From: Lokathor Date: Thu, 16 Jul 2020 17:37:47 -0600 Subject: [PATCH 07/26] fix the imports. --- src/librustc_target/spec/thumbv4t_nintendo_gba.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs index 1be6c4a9ff875..6af2716623c3e 100644 --- a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs +++ b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs @@ -7,7 +7,7 @@ //! //! **Important:** This target profile **does not** specify a linker script or the ROM header. You'll still need to provide these yourself to construct a final binary. Generally you'd do this with something like `-Clink-arg=-Tmy_script.ld` and `-Clink-arg=my_crt.o`. -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { Ok(Target { From 7cbff846edcedc7ab9d0dfd82e6f711fe99e2520 Mon Sep 17 00:00:00 2001 From: Lokathor Date: Thu, 16 Jul 2020 18:39:15 -0600 Subject: [PATCH 08/26] Resolve https://github.com/rust-lang/rust/pull/74419#discussion_r456141344 --- src/librustc_target/spec/thumbv4t_nintendo_gba.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs index 6af2716623c3e..2399ac9b91df7 100644 --- a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs +++ b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs @@ -65,9 +65,6 @@ pub fn target() -> TargetResult { // The minimum alignment for global symbols. min_global_align: Some(4), - // no threads here - singlethread: true, - // GBA has no builtins no_builtins: true, From 888077bf105568f59fba5b76086ac902588fd58c Mon Sep 17 00:00:00 2001 From: Lokathor Date: Thu, 16 Jul 2020 18:39:56 -0600 Subject: [PATCH 09/26] Resolve https://github.com/rust-lang/rust/pull/74419#discussion_r456142514 --- src/librustc_target/spec/thumbv4t_nintendo_gba.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs index 2399ac9b91df7..d8ac53ccb4143 100644 --- a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs +++ b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs @@ -65,9 +65,6 @@ pub fn target() -> TargetResult { // The minimum alignment for global symbols. min_global_align: Some(4), - // GBA has no builtins - no_builtins: true, - // this is off just like in the `thumb_base` emit_debug_gdb_scripts: false, From dbfe8fc61c9420aca1679249749df6b9cd1c00df Mon Sep 17 00:00:00 2001 From: Lokathor Date: Thu, 16 Jul 2020 18:41:39 -0600 Subject: [PATCH 10/26] resolve https://github.com/rust-lang/rust/pull/74419#discussion_r456140272 --- src/librustc_target/spec/thumbv4t_nintendo_gba.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs index d8ac53ccb4143..1602296eb6977 100644 --- a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs +++ b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs @@ -62,9 +62,6 @@ pub fn target() -> TargetResult { // ABIs to not use unsupported_abis: super::arm_base::unsupported_abis(), - // The minimum alignment for global symbols. - min_global_align: Some(4), - // this is off just like in the `thumb_base` emit_debug_gdb_scripts: false, From fba90f9c3f6fb6eb66b661708f569e8c15c0b282 Mon Sep 17 00:00:00 2001 From: Lokathor Date: Thu, 16 Jul 2020 18:42:26 -0600 Subject: [PATCH 11/26] Resolve https://github.com/rust-lang/rust/pull/74419#discussion_r456139741 --- src/librustc_target/spec/thumbv4t_nintendo_gba.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs index 1602296eb6977..a3ab0c9e2deb3 100644 --- a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs +++ b/src/librustc_target/spec/thumbv4t_nintendo_gba.rs @@ -46,8 +46,6 @@ pub fn target() -> TargetResult { relocation_model: RelocModel::Static, - //function_sections: bool, - //exe_suffix: String, main_needs_argc_argv: false, // if we have thread-local storage From 5c63bffe2d893123da0a54410fe7b9bad324c58c Mon Sep 17 00:00:00 2001 From: Lokathor Date: Fri, 17 Jul 2020 18:59:24 -0600 Subject: [PATCH 12/26] Make the new target a general thumbv4t target. --- src/librustc_target/spec/mod.rs | 2 +- ..._nintendo_gba.rs => thumbv4t_none_eabi.rs} | 30 +++++++++++-------- 2 files changed, 19 insertions(+), 13 deletions(-) rename src/librustc_target/spec/{thumbv4t_nintendo_gba.rs => thumbv4t_none_eabi.rs} (56%) diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index d1c3fc5847851..7605fa3bab951 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -676,7 +676,7 @@ supported_targets! { ("powerpc64-wrs-vxworks", powerpc64_wrs_vxworks), ("mipsel-sony-psp", mipsel_sony_psp), - ("thumbv4t-nintendo-gba", thumbv4t_nintendo_gba), + ("thumbv4t-none-eabi", thumbv4t_none_eabi), } /// Everything `rustc` knows about how to compile for a specific target. diff --git a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs b/src/librustc_target/spec/thumbv4t_none_eabi.rs similarity index 56% rename from src/librustc_target/spec/thumbv4t_nintendo_gba.rs rename to src/librustc_target/spec/thumbv4t_none_eabi.rs index a3ab0c9e2deb3..04a272cb4ae77 100644 --- a/src/librustc_target/spec/thumbv4t_nintendo_gba.rs +++ b/src/librustc_target/spec/thumbv4t_none_eabi.rs @@ -1,11 +1,12 @@ -//! Targets the Nintendo Game Boy Advance (GBA), -//! a handheld game device from 2001. +//! Targets the ARMv4T, with code as `t32` code by default. +//! +//! Primarily of use for the GBA, but usable with other devices too. //! //! Please ping @Lokathor if changes are needed. //! -//! The target profile assumes that you have the ARM binutils in your path (specifically the linker, `arm-none-eabi-ld`). They can be obtained for free for all major OSes from the ARM developer's website, and they may also be available in your system's package manager +//! This target profile assumes that you have the ARM binutils in your path (specifically the linker, `arm-none-eabi-ld`). They can be obtained for free for all major OSes from the ARM developer's website, and they may also be available in your system's package manager. Unfortunately, the standard linker that Rust uses (`lld`) only supports as far back as `ARMv5TE`, so we must use the GNU `ld` linker. //! -//! **Important:** This target profile **does not** specify a linker script or the ROM header. You'll still need to provide these yourself to construct a final binary. Generally you'd do this with something like `-Clink-arg=-Tmy_script.ld` and `-Clink-arg=my_crt.o`. +//! **Important:** This target profile **does not** specify a linker script. You just get the default link script when you build a binary for this target. The default link script is very likely wrong, so you should use `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script. use crate::spec::{LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions, TargetResult}; @@ -16,8 +17,8 @@ pub fn target() -> TargetResult { target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), target_os: "none".to_string(), - target_env: "gba".to_string(), - target_vendor: "nintendo".to_string(), + target_env: "".to_string(), + target_vendor: "".to_string(), arch: "arm".to_string(), /* Data layout args are '-' separated: * little endian @@ -34,10 +35,15 @@ pub fn target() -> TargetResult { linker: Some("arm-none-eabi-ld".to_string()), linker_is_gnu: true, - // extra args passed to the external assembler - asm_args: vec!["-mcpu=arm7tdmi".to_string(), "-mthumb-interwork".to_string()], - - cpu: "arm7tdmi".to_string(), + // extra args passed to the external assembler (assuming `arm-none-eabi-as`): + // * activate t32/a32 interworking + // * use arch ARMv4T + // * use little-endian + asm_args: vec![ + "-mthumb-interwork".to_string(), + "-march=armv4t".to_string(), + "-mlittle-endian".to_string(), + ], // minimum extra features, these cannot be disabled via -C features: "+soft-float,+strict-align".to_string(), @@ -48,7 +54,7 @@ pub fn target() -> TargetResult { main_needs_argc_argv: false, - // if we have thread-local storage + // No thread-local storage (just use a static Cell) has_elf_tls: false, // don't have atomic compare-and-swap @@ -60,7 +66,7 @@ pub fn target() -> TargetResult { // ABIs to not use unsupported_abis: super::arm_base::unsupported_abis(), - // this is off just like in the `thumb_base` + // this is turned off just like in the `thumb_base` module emit_debug_gdb_scripts: false, ..TargetOptions::default() From a594603f50940624e3da3392e1349a53bd64f4db Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 18 Jul 2020 09:43:39 -0700 Subject: [PATCH 13/26] More links in std::str --- src/libcore/str/mod.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index faf58cafbb70b..790ec4bd24f8d 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -4,7 +4,7 @@ //! //! For more details, see the [`std::str`] module. //! -//! [`std::str`]: ../../std/str/index.html +//! [`std::str`]: self #![stable(feature = "rust1", since = "1.0.0")] @@ -163,13 +163,11 @@ Section: Creating a string /// Errors which can occur when attempting to interpret a sequence of [`u8`] /// as a string. /// -/// [`u8`]: ../../std/primitive.u8.html -/// /// As such, the `from_utf8` family of functions and methods for both [`String`]s /// and [`&str`]s make use of this error, for example. /// /// [`String`]: ../../std/string/struct.String.html#method.from_utf8 -/// [`&str`]: ../../std/str/fn.from_utf8.html +/// [`&str`]: from_utf8 /// /// # Examples /// From d6d48b4ca992cc9db8f5443a65c0fe28f300f748 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 18 Jul 2020 10:14:00 -0700 Subject: [PATCH 14/26] Use intra-doc links in alloc::String --- src/liballoc/str.rs | 17 +---- src/liballoc/string.rs | 130 ++++++++++++---------------------- src/tools/linkchecker/main.rs | 6 +- 3 files changed, 48 insertions(+), 105 deletions(-) diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index 57927c688479b..339592728ac24 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -240,8 +240,6 @@ impl str { /// While doing so, it attempts to find matches of a pattern. If it finds any, it /// replaces them with the replacement string slice. /// - /// [`String`]: string/struct.String.html - /// /// # Examples /// /// Basic usage: @@ -280,8 +278,6 @@ impl str { /// While doing so, it attempts to find matches of a pattern. If it finds any, it /// replaces them with the replacement string slice at most `count` times. /// - /// [`String`]: string/struct.String.html - /// /// # Examples /// /// Basic usage: @@ -324,8 +320,6 @@ impl str { /// the case, this function returns a [`String`] instead of modifying the /// parameter in-place. /// - /// [`String`]: string/struct.String.html - /// /// # Examples /// /// Basic usage: @@ -411,8 +405,6 @@ impl str { /// the case, this function returns a [`String`] instead of modifying the /// parameter in-place. /// - /// [`String`]: string/struct.String.html - /// /// # Examples /// /// Basic usage: @@ -459,8 +451,7 @@ impl str { /// Converts a [`Box`] into a [`String`] without copying or allocating. /// - /// [`String`]: string/struct.String.html - /// [`Box`]: boxed/struct.Box.html + /// [`Box`]: Box /// /// # Examples /// @@ -485,8 +476,6 @@ impl str { /// /// This function will panic if the capacity would overflow. /// - /// [`String`]: string/struct.String.html - /// /// # Examples /// /// Basic usage: @@ -525,7 +514,7 @@ impl str { /// assert_eq!("GRüßE, JüRGEN ❤", s.to_ascii_uppercase()); /// ``` /// - /// [`make_ascii_uppercase`]: #method.make_ascii_uppercase + /// [`make_ascii_uppercase`]: str::make_ascii_uppercase /// [`to_uppercase`]: #method.to_uppercase #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] #[inline] @@ -555,7 +544,7 @@ impl str { /// assert_eq!("grüße, jürgen ❤", s.to_ascii_lowercase()); /// ``` /// - /// [`make_ascii_lowercase`]: #method.make_ascii_lowercase + /// [`make_ascii_lowercase`]: str::make_ascii_lowercase /// [`to_lowercase`]: #method.to_lowercase #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] #[inline] diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index 5b671b41b5bf6..f864b76366806 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -4,8 +4,6 @@ //! [`ToString`]s, and several error types that may result from working with //! [`String`]s. //! -//! [`ToString`]: trait.ToString.html -//! //! # Examples //! //! There are multiple ways to create a new [`String`] from a string literal: @@ -20,8 +18,6 @@ //! You can create a new [`String`] from an existing one by concatenating with //! `+`: //! -//! [`String`]: struct.String.html -//! //! ``` //! let s = "Hello".to_string(); //! @@ -67,12 +63,12 @@ use crate::vec::Vec; /// contents of the string. It has a close relationship with its borrowed /// counterpart, the primitive [`str`]. /// -/// [`str`]: ../../std/primitive.str.html -/// /// # Examples /// /// You can create a `String` from a literal string with [`String::from`]: /// +/// [`String::from`]: From::from +/// /// ``` /// let hello = String::from("Hello, world!"); /// ``` @@ -87,10 +83,8 @@ use crate::vec::Vec; /// hello.push_str("orld!"); /// ``` /// -/// [`String::from`]: #method.from -/// [`char`]: ../../std/primitive.char.html -/// [`push`]: #method.push -/// [`push_str`]: #method.push_str +/// [`push`]: String::push +/// [`push_str`]: String::push_str /// /// If you have a vector of UTF-8 bytes, you can create a `String` from it with /// the [`from_utf8`] method: @@ -105,7 +99,7 @@ use crate::vec::Vec; /// assert_eq!("💖", sparkle_heart); /// ``` /// -/// [`from_utf8`]: #method.from_utf8 +/// [`from_utf8`]: String::from_utf8 /// /// # UTF-8 /// @@ -128,8 +122,8 @@ use crate::vec::Vec; /// The [`bytes`] and [`chars`] methods return iterators over the first /// two, respectively. /// -/// [`bytes`]: #method.bytes -/// [`chars`]: #method.chars +/// [`bytes`]: str::bytes +/// [`chars`]: str::chars /// /// # Deref /// @@ -215,9 +209,9 @@ use crate::vec::Vec; /// assert_eq!(String::from("Once upon a time..."), s); /// ``` /// -/// [`as_ptr`]: #method.as_ptr -/// [`len`]: #method.len -/// [`capacity`]: #method.capacity +/// [`as_ptr`]: str::as_ptr +/// [`len`]: String::len +/// [`capacity`]: String::capacity /// /// If a `String` has enough capacity, adding elements to it will not /// re-allocate. For example, consider this program: @@ -259,7 +253,7 @@ use crate::vec::Vec; /// } /// ``` /// -/// [`with_capacity`]: #method.with_capacity +/// [`with_capacity`]: String::with_capacity /// /// We end up with a different output: /// @@ -274,9 +268,9 @@ use crate::vec::Vec; /// /// Here, there's no need to allocate more memory inside the loop. /// -/// [`&str`]: ../../std/primitive.str.html -/// [`Deref`]: ../../std/ops/trait.Deref.html -/// [`as_str()`]: struct.String.html#method.as_str +/// [`&str`]: str +/// [`Deref`]: core::ops::Deref +/// [`as_str()`]: String::as_str #[derive(PartialOrd, Eq, Ord)] #[cfg_attr(not(test), rustc_diagnostic_item = "string_type")] #[stable(feature = "rust1", since = "1.0.0")] @@ -291,20 +285,18 @@ pub struct String { /// [`into_bytes`] method will give back the byte vector that was used in the /// conversion attempt. /// -/// [`from_utf8`]: struct.String.html#method.from_utf8 -/// [`String`]: struct.String.html -/// [`into_bytes`]: struct.FromUtf8Error.html#method.into_bytes +/// [`from_utf8`]: String::from_utf8 +/// [`into_bytes`]: FromUtf8Error::into_bytes /// /// The [`Utf8Error`] type provided by [`std::str`] represents an error that may /// occur when converting a slice of [`u8`]s to a [`&str`]. In this sense, it's /// an analogue to `FromUtf8Error`, and you can get one from a `FromUtf8Error` /// through the [`utf8_error`] method. /// -/// [`Utf8Error`]: ../../std/str/struct.Utf8Error.html -/// [`std::str`]: ../../std/str/index.html -/// [`u8`]: ../../std/primitive.u8.html -/// [`&str`]: ../../std/primitive.str.html -/// [`utf8_error`]: #method.utf8_error +/// [`Utf8Error`]: core::str::Utf8Error +/// [`std::str`]: core::str +/// [`&str`]: str +/// [`utf8_error`]: Self::utf8_error /// /// # Examples /// @@ -330,9 +322,7 @@ pub struct FromUtf8Error { /// /// This type is the error type for the [`from_utf16`] method on [`String`]. /// -/// [`from_utf16`]: struct.String.html#method.from_utf16 -/// [`String`]: struct.String.html -/// +/// [`from_utf16`]: String::from_utf16 /// # Examples /// /// Basic usage: @@ -358,7 +348,7 @@ impl String { /// consider the [`with_capacity`] method to prevent excessive /// re-allocation. /// - /// [`with_capacity`]: #method.with_capacity + /// [`with_capacity`]: String::with_capacity /// /// # Examples /// @@ -383,12 +373,12 @@ impl String { /// appending a bunch of data to the `String`, reducing the number of /// reallocations it needs to do. /// - /// [`capacity`]: #method.capacity + /// [`capacity`]: String::capacity /// /// If the given capacity is `0`, no allocation will occur, and this method /// is identical to the [`new`] method. /// - /// [`new`]: #method.new + /// [`new`]: String::new /// /// # Examples /// @@ -479,15 +469,10 @@ impl String { /// See the docs for [`FromUtf8Error`] for more details on what you can do /// with this error. /// - /// [`from_utf8_unchecked`]: struct.String.html#method.from_utf8_unchecked - /// [`String`]: struct.String.html - /// [`u8`]: ../../std/primitive.u8.html - /// [`Vec`]: ../../std/vec/struct.Vec.html - /// [`&str`]: ../../std/primitive.str.html - /// [`str::from_utf8`]: ../../std/str/fn.from_utf8.html - /// [`into_bytes`]: struct.String.html#method.into_bytes - /// [`FromUtf8Error`]: struct.FromUtf8Error.html - /// [`Err`]: ../../std/result/enum.Result.html#variant.Err + /// [`from_utf8_unchecked`]: String::from_utf8_unchecked + /// [`Vec`]: crate::vec::Vec + /// [`&str`]: str + /// [`into_bytes`]: String::into_bytes #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn from_utf8(vec: Vec) -> Result { @@ -506,16 +491,15 @@ impl String { /// `from_utf8_lossy()` will replace any invalid UTF-8 sequences with /// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD], which looks like this: � /// - /// [`u8`]: ../../std/primitive.u8.html /// [byteslice]: ../../std/primitive.slice.html - /// [U+FFFD]: ../char/constant.REPLACEMENT_CHARACTER.html + /// [U+FFFD]: core::char::REPLACEMENT_CHARACTER /// /// If you are sure that the byte slice is valid UTF-8, and you don't want /// to incur the overhead of the conversion, there is an unsafe version /// of this function, [`from_utf8_unchecked`], which has the same behavior /// but skips the checks. /// - /// [`from_utf8_unchecked`]: struct.String.html#method.from_utf8_unchecked + /// [`from_utf8_unchecked`]: String::from_utf8_unchecked /// /// This function returns a [`Cow<'a, str>`]. If our byte slice is invalid /// UTF-8, then we need to insert the replacement characters, which will @@ -523,7 +507,7 @@ impl String { /// it's already valid UTF-8, we don't need a new allocation. This return /// type allows us to handle both cases. /// - /// [`Cow<'a, str>`]: ../../std/borrow/enum.Cow.html + /// [`Cow<'a, str>`]: crate::borrow::Cow /// /// # Examples /// @@ -583,8 +567,6 @@ impl String { /// Decode a UTF-16 encoded vector `v` into a `String`, returning [`Err`] /// if `v` contains any invalid data. /// - /// [`Err`]: ../../std/result/enum.Result.html#variant.Err - /// /// # Examples /// /// Basic usage: @@ -623,9 +605,9 @@ impl String { /// `from_utf16_lossy` returns a `String` since the UTF-16 to UTF-8 /// conversion requires a memory allocation. /// - /// [`from_utf8_lossy`]: #method.from_utf8_lossy - /// [`Cow<'a, str>`]: ../borrow/enum.Cow.html - /// [U+FFFD]: ../char/constant.REPLACEMENT_CHARACTER.html + /// [`from_utf8_lossy`]: String::from_utf8_lossy + /// [`Cow<'a, str>`]: crate::borrow::Cow + /// [U+FFFD]: core::char::REPLACEMENT_CHARACTER /// /// # Examples /// @@ -659,7 +641,7 @@ impl String { /// into a `String` with the [`from_raw_parts`] function, allowing /// the destructor to perform the cleanup. /// - /// [`from_raw_parts`]: #method.from_raw_parts + /// [`from_raw_parts`]: String::from_raw_parts /// /// # Examples /// @@ -732,7 +714,7 @@ impl String { /// /// See the safe version, [`from_utf8`], for more details. /// - /// [`from_utf8`]: struct.String.html#method.from_utf8 + /// [`from_utf8`]: String::from_utf8 /// /// # Safety /// @@ -867,8 +849,7 @@ impl String { /// /// Panics if the new capacity overflows [`usize`]. /// - /// [`reserve_exact`]: struct.String.html#method.reserve_exact - /// [`usize`]: ../../std/primitive.usize.html + /// [`reserve_exact`]: String::reserve_exact /// /// # Examples /// @@ -911,7 +892,7 @@ impl String { /// Consider using the [`reserve`] method unless you absolutely know /// better than the allocator. /// - /// [`reserve`]: #method.reserve + /// [`reserve`]: String::reserve /// /// # Panics /// @@ -1076,8 +1057,6 @@ impl String { /// Appends the given [`char`] to the end of this `String`. /// - /// [`char`]: ../../std/primitive.char.html - /// /// # Examples /// /// Basic usage: @@ -1104,7 +1083,7 @@ impl String { /// /// The inverse of this method is [`from_utf8`]. /// - /// [`from_utf8`]: #method.from_utf8 + /// [`from_utf8`]: String::from_utf8 /// /// # Examples /// @@ -1133,8 +1112,6 @@ impl String { /// /// Panics if `new_len` does not lie on a [`char`] boundary. /// - /// [`char`]: ../../std/primitive.char.html - /// /// # Examples /// /// Basic usage: @@ -1159,8 +1136,6 @@ impl String { /// /// Returns [`None`] if this `String` is empty. /// - /// [`None`]: ../../std/option/enum.Option.html#variant.None - /// /// # Examples /// /// Basic usage: @@ -1195,8 +1170,6 @@ impl String { /// Panics if `idx` is larger than or equal to the `String`'s length, /// or if it does not lie on a [`char`] boundary. /// - /// [`char`]: ../../std/primitive.char.html - /// /// # Examples /// /// Basic usage: @@ -1297,8 +1270,6 @@ impl String { /// Panics if `idx` is larger than the `String`'s length, or if it does not /// lie on a [`char`] boundary. /// - /// [`char`]: ../../std/primitive.char.html - /// /// # Examples /// /// Basic usage: @@ -1346,8 +1317,6 @@ impl String { /// Panics if `idx` is larger than the `String`'s length, or if it does not /// lie on a [`char`] boundary. /// - /// [`char`]: ../../std/primitive.char.html - /// /// # Examples /// /// Basic usage: @@ -1507,8 +1476,6 @@ impl String { /// Panics if the starting point or end point do not lie on a [`char`] /// boundary, or if they're out of bounds. /// - /// [`char`]: ../../std/primitive.char.html - /// /// # Examples /// /// Basic usage: @@ -1567,9 +1534,6 @@ impl String { /// Panics if the starting point or end point do not lie on a [`char`] /// boundary, or if they're out of bounds. /// - /// [`char`]: ../../std/primitive.char.html - /// [`Vec::splice`]: ../../std/vec/struct.Vec.html#method.splice - /// /// # Examples /// /// Basic usage: @@ -1610,9 +1574,6 @@ impl String { /// /// This will drop any excess capacity. /// - /// [`Box`]: ../../std/boxed/struct.Box.html - /// [`str`]: ../../std/primitive.str.html - /// /// # Examples /// /// Basic usage: @@ -1680,10 +1641,8 @@ impl FromUtf8Error { /// an analogue to `FromUtf8Error`. See its documentation for more details /// on using it. /// - /// [`Utf8Error`]: ../../std/str/struct.Utf8Error.html - /// [`std::str`]: ../../std/str/index.html - /// [`u8`]: ../../std/primitive.u8.html - /// [`&str`]: ../../std/primitive.str.html + /// [`std::str`]: core::str + /// [`&str`]: str /// /// # Examples /// @@ -2187,7 +2146,7 @@ impl ops::DerefMut for String { /// /// This alias exists for backwards compatibility, and may be eventually deprecated. /// -/// [`Infallible`]: ../../core/convert/enum.Infallible.html +/// [`Infallible`]: core::convert::Infallible #[stable(feature = "str_parse_error", since = "1.5.0")] pub type ParseError = core::convert::Infallible; @@ -2207,7 +2166,7 @@ impl FromStr for String { /// [`Display`] should be implemented instead, and you get the `ToString` /// implementation for free. /// -/// [`Display`]: ../../std/fmt/trait.Display.html +/// [`Display`]: fmt::Display #[stable(feature = "rust1", since = "1.0.0")] pub trait ToString { /// Converts the given value to a `String`. @@ -2465,8 +2424,7 @@ impl fmt::Write for String { /// This struct is created by the [`drain`] method on [`String`]. See its /// documentation for more. /// -/// [`drain`]: struct.String.html#method.drain -/// [`String`]: struct.String.html +/// [`drain`]: String::drain #[stable(feature = "drain", since = "1.6.0")] pub struct Drain<'a> { /// Will be used as &'a mut String in the destructor diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index 74601f9e4c679..10d3ed50e4bfe 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -121,14 +121,10 @@ fn check(cache: &mut Cache, root: &Path, file: &Path, errors: &mut bool) -> Opti // exceptions to get this past `make check` today. // FIXME(#32129) if file.ends_with("std/io/struct.IoSlice.html") - || file.ends_with("std/string/struct.String.html") { return None; } - // FIXME(#32553) - if file.ends_with("alloc/string/struct.String.html") { - return None; - } + // FIXME(#32130) if file.ends_with("alloc/collections/btree_map/struct.BTreeMap.html") || file.ends_with("alloc/collections/btree_set/struct.BTreeSet.html") From 3168b7d6c0bb129637e0b6797a5f4a5cf72a807f Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 18 Jul 2020 11:21:22 -0700 Subject: [PATCH 15/26] Use more intra-doc links in BTreeSet --- src/liballoc/collections/btree/set.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/liballoc/collections/btree/set.rs b/src/liballoc/collections/btree/set.rs index 530cb0c91b8e3..35f4ef1d9b4c7 100644 --- a/src/liballoc/collections/btree/set.rs +++ b/src/liballoc/collections/btree/set.rs @@ -22,9 +22,9 @@ use super::Recover; /// to any other item, as determined by the [`Ord`] trait, changes while it is in the set. This is /// normally only possible through [`Cell`], [`RefCell`], global state, I/O, or unsafe code. /// -/// [`Ord`]: ../../std/cmp/trait.Ord.html -/// [`Cell`]: ../../std/cell/struct.Cell.html -/// [`RefCell`]: ../../std/cell/struct.RefCell.html +/// [`Ord`]: core::cmp::Ord +/// [`Cell`]: core::cell::Cell +/// [`RefCell`]: core::cell::RefCell /// /// # Examples /// From 4c48ac3e88e438f6b478adca61629a611db6b3dc Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 18 Jul 2020 11:41:41 -0700 Subject: [PATCH 16/26] Use intra-doc links in BTreeMap --- src/liballoc/collections/btree/map.rs | 33 ++++++++++----------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs index bf5748739d470..d2f4278d0d0e0 100644 --- a/src/liballoc/collections/btree/map.rs +++ b/src/liballoc/collections/btree/map.rs @@ -47,9 +47,9 @@ use UnderflowResult::*; /// any other key, as determined by the [`Ord`] trait, changes while it is in the map. This is /// normally only possible through [`Cell`], [`RefCell`], global state, I/O, or unsafe code. /// -/// [`Ord`]: ../../std/cmp/trait.Ord.html -/// [`Cell`]: ../../std/cell/struct.Cell.html -/// [`RefCell`]: ../../std/cell/struct.RefCell.html +/// [`Ord`]: core::cmp::Ord +/// [`Cell`]: core::cell::Cell +/// [`RefCell`]: core::cell::RefCell /// /// # Examples /// @@ -256,8 +256,7 @@ where /// This `struct` is created by the [`iter`] method on [`BTreeMap`]. See its /// documentation for more. /// -/// [`iter`]: struct.BTreeMap.html#method.iter -/// [`BTreeMap`]: struct.BTreeMap.html +/// [`iter`]: BTreeMap::iter #[stable(feature = "rust1", since = "1.0.0")] pub struct Iter<'a, K: 'a, V: 'a> { range: Range<'a, K, V>, @@ -276,8 +275,7 @@ impl fmt::Debug for Iter<'_, K, V> { /// This `struct` is created by the [`iter_mut`] method on [`BTreeMap`]. See its /// documentation for more. /// -/// [`iter_mut`]: struct.BTreeMap.html#method.iter_mut -/// [`BTreeMap`]: struct.BTreeMap.html +/// [`iter_mut`]: BTreeMap::iter_mut #[stable(feature = "rust1", since = "1.0.0")] #[derive(Debug)] pub struct IterMut<'a, K: 'a, V: 'a> { @@ -290,8 +288,7 @@ pub struct IterMut<'a, K: 'a, V: 'a> { /// This `struct` is created by the [`into_iter`] method on [`BTreeMap`] /// (provided by the `IntoIterator` trait). See its documentation for more. /// -/// [`into_iter`]: struct.BTreeMap.html#method.into_iter -/// [`BTreeMap`]: struct.BTreeMap.html +/// [`into_iter`]: IntoIterator::into_iter #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter { front: Option, marker::Edge>>, @@ -315,8 +312,7 @@ impl fmt::Debug for IntoIter { /// This `struct` is created by the [`keys`] method on [`BTreeMap`]. See its /// documentation for more. /// -/// [`keys`]: struct.BTreeMap.html#method.keys -/// [`BTreeMap`]: struct.BTreeMap.html +/// [`keys`]: BTreeMap::keys #[stable(feature = "rust1", since = "1.0.0")] pub struct Keys<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, @@ -334,8 +330,7 @@ impl fmt::Debug for Keys<'_, K, V> { /// This `struct` is created by the [`values`] method on [`BTreeMap`]. See its /// documentation for more. /// -/// [`values`]: struct.BTreeMap.html#method.values -/// [`BTreeMap`]: struct.BTreeMap.html +/// [`values`]: BTreeMap::values #[stable(feature = "rust1", since = "1.0.0")] pub struct Values<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, @@ -353,8 +348,7 @@ impl fmt::Debug for Values<'_, K, V> { /// This `struct` is created by the [`values_mut`] method on [`BTreeMap`]. See its /// documentation for more. /// -/// [`values_mut`]: struct.BTreeMap.html#method.values_mut -/// [`BTreeMap`]: struct.BTreeMap.html +/// [`values_mut`]: BTreeMap::values_mut #[stable(feature = "map_values_mut", since = "1.10.0")] #[derive(Debug)] pub struct ValuesMut<'a, K: 'a, V: 'a> { @@ -366,8 +360,7 @@ pub struct ValuesMut<'a, K: 'a, V: 'a> { /// This `struct` is created by the [`range`] method on [`BTreeMap`]. See its /// documentation for more. /// -/// [`range`]: struct.BTreeMap.html#method.range -/// [`BTreeMap`]: struct.BTreeMap.html +/// [`range`]: BTreeMap::range #[stable(feature = "btree_range", since = "1.17.0")] pub struct Range<'a, K: 'a, V: 'a> { front: Option, K, V, marker::Leaf>, marker::Edge>>, @@ -386,8 +379,7 @@ impl fmt::Debug for Range<'_, K, V> { /// This `struct` is created by the [`range_mut`] method on [`BTreeMap`]. See its /// documentation for more. /// -/// [`range_mut`]: struct.BTreeMap.html#method.range_mut -/// [`BTreeMap`]: struct.BTreeMap.html +/// [`range_mut`]: BTreeMap::range_mut #[stable(feature = "btree_range", since = "1.17.0")] pub struct RangeMut<'a, K: 'a, V: 'a> { front: Option, K, V, marker::Leaf>, marker::Edge>>, @@ -412,8 +404,7 @@ impl fmt::Debug for RangeMut<'_, K, V> { /// /// This `enum` is constructed from the [`entry`] method on [`BTreeMap`]. /// -/// [`BTreeMap`]: struct.BTreeMap.html -/// [`entry`]: struct.BTreeMap.html#method.entry +/// [`entry`]: BTreeMap::entry #[stable(feature = "rust1", since = "1.0.0")] pub enum Entry<'a, K: 'a, V: 'a> { /// A vacant entry. From 26ba0e12e838bb674064c5e04d20ed91b7420e2e Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 18 Jul 2020 12:02:03 -0700 Subject: [PATCH 17/26] Use intra-doc links in std::io --- src/libstd/io/mod.rs | 141 ++++++++++++++++--------------------------- 1 file changed, 51 insertions(+), 90 deletions(-) diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index d5af4f25102d1..ce9dd19ace104 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -238,25 +238,14 @@ //! contract. The implementation of many of these functions are subject to change over //! time and may call fewer or more syscalls/library functions. //! -//! [`Read`]: trait.Read.html -//! [`Write`]: trait.Write.html -//! [`Seek`]: trait.Seek.html -//! [`BufRead`]: trait.BufRead.html -//! [`File`]: ../fs/struct.File.html -//! [`TcpStream`]: ../net/struct.TcpStream.html -//! [`Vec`]: ../vec/struct.Vec.html -//! [`BufReader`]: struct.BufReader.html -//! [`BufWriter`]: struct.BufWriter.html -//! [`Write::write`]: trait.Write.html#tymethod.write -//! [`io::stdout`]: fn.stdout.html -//! [`println!`]: ../macro.println.html -//! [`Lines`]: struct.Lines.html -//! [`io::Result`]: type.Result.html +//! [`File`]: crate::fs::File +//! [`TcpStream`]: crate::net::TcpStream +//! [`Vec`]: crate::vec::Vec +//! [`io::stdout`]: stdout +//! [`io::Result`]: crate::io::Result //! [`?` operator]: ../../book/appendix-02-operators.html -//! [`Read::read`]: trait.Read.html#tymethod.read -//! [`Result`]: ../result/enum.Result.html -//! [`.unwrap()`]: ../result/enum.Result.html#method.unwrap -// ignore-tidy-filelength +//! [`Result`]: crate::result::Result +//! [`.unwrap()`]: crate::result::Result::unwrap #![stable(feature = "rust1", since = "1.0.0")] @@ -491,12 +480,10 @@ where /// } /// ``` /// -/// [`read()`]: trait.Read.html#tymethod.read -/// [`std::io`]: ../../std/io/index.html -/// [`File`]: ../fs/struct.File.html -/// [`BufRead`]: trait.BufRead.html -/// [`BufReader`]: struct.BufReader.html -/// [`&str`]: ../../std/primitive.str.html +/// [`read()`]: Read::read +/// [`&str`]: str +/// [`std::io`]: self +/// [`File`]: crate::fs::File /// [slice]: ../../std/primitive.slice.html #[stable(feature = "rust1", since = "1.0.0")] #[doc(spotlight)] @@ -535,7 +522,7 @@ pub trait Read { /// before calling `read`. Calling `read` with an uninitialized `buf` (of the kind one /// obtains via [`MaybeUninit`]) is not safe, and can lead to undefined behavior. /// - /// [`MaybeUninit`]: ../mem/union.MaybeUninit.html + /// [`MaybeUninit`]: crate::mem::MaybeUninit /// /// # Errors /// @@ -550,10 +537,8 @@ pub trait Read { /// /// [`File`]s implement `Read`: /// - /// [`Err`]: ../../std/result/enum.Result.html#variant.Err - /// [`Ok(n)`]: ../../std/result/enum.Result.html#variant.Ok - /// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted - /// [`File`]: ../fs/struct.File.html + /// [`Ok(n)`]: Ok + /// [`File`]: crate::fs::File /// /// ```no_run /// use std::io; @@ -620,9 +605,6 @@ pub trait Read { /// This method is unsafe because a `Read`er could otherwise return a /// non-zeroing `Initializer` from another `Read` type without an `unsafe` /// block. - /// - /// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop - /// [`Initializer`]: ../../std/io/struct.Initializer.html #[unstable(feature = "read_initializer", issue = "42788")] #[inline] unsafe fn initializer(&self) -> Initializer { @@ -652,10 +634,9 @@ pub trait Read { /// /// [`File`]s implement `Read`: /// - /// [`read()`]: trait.Read.html#tymethod.read - /// [`Ok(0)`]: ../../std/result/enum.Result.html#variant.Ok - /// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted - /// [`File`]: ../fs/struct.File.html + /// [`read()`]: Read::read + /// [`Ok(0)`]: Ok + /// [`File`]: crate::fs::File /// /// ```no_run /// use std::io; @@ -675,7 +656,7 @@ pub trait Read { /// (See also the [`std::fs::read`] convenience function for reading from a /// file.) /// - /// [`std::fs::read`]: ../fs/fn.read.html + /// [`std::fs::read`]: crate::fs::read #[stable(feature = "rust1", since = "1.0.0")] fn read_to_end(&mut self, buf: &mut Vec) -> Result { read_to_end(self, buf) @@ -693,13 +674,13 @@ pub trait Read { /// /// See [`read_to_end`][readtoend] for other error semantics. /// - /// [readtoend]: #method.read_to_end + /// [readtoend]: Self::read_to_end /// /// # Examples /// /// [`File`][file]s implement `Read`: /// - /// [file]: ../fs/struct.File.html + /// [file]: crate::fs::File /// /// ```no_run /// use std::io; @@ -718,7 +699,7 @@ pub trait Read { /// (See also the [`std::fs::read_to_string`] convenience function for /// reading from a file.) /// - /// [`std::fs::read_to_string`]: ../fs/fn.read_to_string.html + /// [`std::fs::read_to_string`]: crate::fs::read_to_string #[stable(feature = "rust1", since = "1.0.0")] fn read_to_string(&mut self, buf: &mut String) -> Result { // Note that we do *not* call `.read_to_end()` here. We are passing @@ -764,9 +745,7 @@ pub trait Read { /// /// [`File`]s implement `Read`: /// - /// [`File`]: ../fs/struct.File.html - /// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted - /// [`ErrorKind::UnexpectedEof`]: ../../std/io/enum.ErrorKind.html#variant.UnexpectedEof + /// [`File`]: crate::fs::File /// /// ```no_run /// use std::io; @@ -811,7 +790,7 @@ pub trait Read { /// /// [`File`][file]s implement `Read`: /// - /// [file]: ../fs/struct.File.html + /// [file]: crate::fs::File /// /// ```no_run /// use std::io; @@ -855,14 +834,10 @@ pub trait Read { /// /// [`File`][file]s implement `Read`: /// - /// [file]: ../fs/struct.File.html - /// [`Iterator`]: ../../std/iter/trait.Iterator.html - /// [`Result`]: ../../std/result/enum.Result.html - /// [`io::Error`]: ../../std/io/struct.Error.html - /// [`u8`]: ../../std/primitive.u8.html - /// [`Ok`]: ../../std/result/enum.Result.html#variant.Ok - /// [`Err`]: ../../std/result/enum.Result.html#variant.Err - /// [`None`]: ../../std/option/enum.Option.html#variant.None + /// [file]: crate::fs::File + /// [`Iterator`]: crate::iter::Iterator + /// [`Result`]: crate::result::Result + /// [`io::Error`]: self::Error /// /// ```no_run /// use std::io; @@ -896,7 +871,7 @@ pub trait Read { /// /// [`File`][file]s implement `Read`: /// - /// [file]: ../fs/struct.File.html + /// [file]: crate::fs::File /// /// ```no_run /// use std::io; @@ -935,9 +910,9 @@ pub trait Read { /// /// [`File`]s implement `Read`: /// - /// [`File`]: ../fs/struct.File.html - /// [`Ok(0)`]: ../../std/result/enum.Result.html#variant.Ok - /// [`read()`]: trait.Read.html#tymethod.read + /// [`File`]: crate::fs::File + /// [`Ok(0)`]: Ok + /// [`read()`]: Read::read /// /// ```no_run /// use std::io; @@ -1233,8 +1208,8 @@ impl Initializer { /// throughout [`std::io`] take and provide types which implement the `Write` /// trait. /// -/// [`write`]: #tymethod.write -/// [`flush`]: #tymethod.flush +/// [`write`]: Self::write +/// [`flush`]: Self::flush /// [`std::io`]: index.html /// /// # Examples @@ -1260,7 +1235,7 @@ impl Initializer { /// The trait also provides convenience methods like [`write_all`], which calls /// `write` in a loop until its entire input has been written. /// -/// [`write_all`]: #method.write_all +/// [`write_all`]: Self::write_all #[stable(feature = "rust1", since = "1.0.0")] #[doc(spotlight)] pub trait Write { @@ -1292,10 +1267,6 @@ pub trait Write { /// An error of the [`ErrorKind::Interrupted`] kind is non-fatal and the /// write operation should be retried if there is nothing else to do. /// - /// [`Err`]: ../../std/result/enum.Result.html#variant.Err - /// [`Ok(n)`]: ../../std/result/enum.Result.html#variant.Ok - /// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted - /// /// # Examples /// /// ```no_run @@ -1381,8 +1352,7 @@ pub trait Write { /// This function will return the first error of /// non-[`ErrorKind::Interrupted`] kind that [`write`] returns. /// - /// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted - /// [`write`]: #tymethod.write + /// [`write`]: Self::write /// /// # Examples /// @@ -1423,8 +1393,7 @@ pub trait Write { /// /// If the buffer contains no data, this will never call [`write_vectored`]. /// - /// [`write_vectored`]: #method.write_vectored - /// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted + /// [`write_vectored`]: Self::write_vectored /// /// # Notes /// @@ -1480,19 +1449,16 @@ pub trait Write { /// encountered. /// /// This method is primarily used to interface with the - /// [`format_args!`][formatargs] macro, but it is rare that this should - /// explicitly be called. The [`write!`][write] macro should be favored to + /// [`format_args!()`] macro, but it is rare that this should + /// explicitly be called. The [`write!()`][write] macro should be favored to /// invoke this method instead. /// - /// [formatargs]: ../macro.format_args.html - /// [write]: ../macro.write.html - /// /// This function internally uses the [`write_all`][writeall] method on /// this trait and hence will continuously write data so long as no errors /// are received. This also means that partial writes are not indicated in /// this signature. /// - /// [writeall]: #method.write_all + /// [writeall]: Self::write_all /// /// # Errors /// @@ -1589,7 +1555,7 @@ pub trait Write { /// /// [`File`][file]s implement `Seek`: /// -/// [file]: ../fs/struct.File.html +/// [file]: crate::fs::File /// /// ```no_run /// use std::io; @@ -1789,9 +1755,9 @@ fn read_until(r: &mut R, delim: u8, buf: &mut Vec) -> R /// [`BufReader`] to the rescue! /// /// [`BufReader`]: struct.BufReader.html -/// [`File`]: ../fs/struct.File.html -/// [`read_line`]: #method.read_line -/// [`lines`]: #method.lines +/// [`File`]: crate::fs::File +/// [`read_line`]: Self::read_line +/// [`lines`]: Self::lines /// [`Read`]: trait.Read.html /// /// ```no_run @@ -1823,7 +1789,7 @@ pub trait BufRead: Read { /// be called with the number of bytes that are consumed from this buffer to /// ensure that the bytes are never returned twice. /// - /// [`consume`]: #tymethod.consume + /// [`consume`]: Self::consume /// /// An empty buffer returned indicates that the stream has reached EOF. /// @@ -1873,7 +1839,7 @@ pub trait BufRead: Read { /// Since `consume()` is meant to be used with [`fill_buf`], /// that method's example includes an example of `consume()`. /// - /// [`fill_buf`]: #tymethod.fill_buf + /// [`fill_buf`]: Self::fill_buf #[stable(feature = "rust1", since = "1.0.0")] fn consume(&mut self, amt: usize); @@ -1897,7 +1863,7 @@ pub trait BufRead: Read { /// If an I/O error is encountered then all bytes read so far will be /// present in `buf` and its length will have been adjusted appropriately. /// - /// [`fill_buf`]: #tymethod.fill_buf + /// [`fill_buf`]: Self::fill_buf /// [`ErrorKind::Interrupted`]: enum.ErrorKind.html#variant.Interrupted /// /// # Examples @@ -1962,7 +1928,7 @@ pub trait BufRead: Read { /// error is encountered then `buf` may contain some bytes already read in /// the event that all data read so far was valid UTF-8. /// - /// [`read_until`]: #method.read_until + /// [`read_until`]: Self::read_until /// /// # Examples /// @@ -2015,9 +1981,9 @@ pub trait BufRead: Read { /// This function will yield errors whenever [`read_until`] would have /// also yielded an error. /// - /// [`io::Result`]: type.Result.html - /// [`Vec`]: ../vec/struct.Vec.html - /// [`read_until`]: #method.read_until + /// [`io::Result`]: self::Result + /// [`Vec`]: crate::vec::Vec + /// [`read_until`]: Self::read_until /// /// # Examples /// @@ -2052,8 +2018,7 @@ pub trait BufRead: Read { /// [`io::Result`]`<`[`String`]`>`. Each string returned will *not* have a newline /// byte (the 0xA byte) or CRLF (0xD, 0xA bytes) at the end. /// - /// [`io::Result`]: type.Result.html - /// [`String`]: ../string/struct.String.html + /// [`io::Result`]: self::Result /// /// # Examples /// @@ -2061,8 +2026,6 @@ pub trait BufRead: Read { /// this example, we use [`Cursor`] to iterate over all the lines in a byte /// slice. /// - /// [`Cursor`]: struct.Cursor.html - /// /// ``` /// use std::io::{self, BufRead}; /// @@ -2253,8 +2216,6 @@ impl Take { /// This instance may reach `EOF` after reading fewer bytes than indicated by /// this method if the underlying [`Read`] instance reaches EOF. /// - /// [`Read`]: ../../std/io/trait.Read.html - /// /// # Examples /// /// ```no_run From e53fea7e061a5f669e7729093f0613d047f7dfc3 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 18 Jul 2020 12:20:16 -0700 Subject: [PATCH 18/26] Use intra-doc links on HashMap --- src/libstd/collections/hash/map.rs | 87 +++++++----------------------- src/tools/linkchecker/main.rs | 1 - 2 files changed, 19 insertions(+), 69 deletions(-) diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 5ba5eff44076b..7b48deee1abdf 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -148,14 +148,11 @@ use crate::sys; /// The easiest way to use `HashMap` with a custom key type is to derive [`Eq`] and [`Hash`]. /// We must also derive [`PartialEq`]. /// -/// [`Eq`]: ../../std/cmp/trait.Eq.html -/// [`Hash`]: ../../std/hash/trait.Hash.html -/// [`PartialEq`]: ../../std/cmp/trait.PartialEq.html -/// [`RefCell`]: ../../std/cell/struct.RefCell.html -/// [`Cell`]: ../../std/cell/struct.Cell.html -/// [`default`]: #method.default -/// [`with_hasher`]: #method.with_hasher -/// [`with_capacity_and_hasher`]: #method.with_capacity_and_hasher +/// [`RefCell`]: crate::cell::RefCell +/// [`Cell`]: crate::cell::Cell +/// [`default`]: Default::default +/// [`with_hasher`]: Self::with_hasher +/// [`with_capacity_and_hasher`]: Self::with_capacity_and_hasher /// [`fnv`]: https://crates.io/crates/fnv /// /// ``` @@ -264,8 +261,6 @@ impl HashMap { /// let mut map = HashMap::with_hasher(s); /// map.insert(1, 2); /// ``` - /// - /// [`BuildHasher`]: ../../std/hash/trait.BuildHasher.html #[inline] #[stable(feature = "hashmap_build_hasher", since = "1.7.0")] pub fn with_hasher(hash_builder: S) -> HashMap { @@ -296,8 +291,6 @@ impl HashMap { /// let mut map = HashMap::with_capacity_and_hasher(10, s); /// map.insert(1, 2); /// ``` - /// - /// [`BuildHasher`]: ../../std/hash/trait.BuildHasher.html #[inline] #[stable(feature = "hashmap_build_hasher", since = "1.7.0")] pub fn with_capacity_and_hasher(capacity: usize, hash_builder: S) -> HashMap { @@ -524,8 +517,6 @@ impl HashMap { /// Returns a reference to the map's [`BuildHasher`]. /// - /// [`BuildHasher`]: ../../std/hash/trait.BuildHasher.html - /// /// # Examples /// /// ``` @@ -556,8 +547,6 @@ where /// /// Panics if the new allocation size overflows [`usize`]. /// - /// [`usize`]: ../../std/primitive.usize.html - /// /// # Examples /// /// ``` @@ -676,9 +665,6 @@ where /// [`Hash`] and [`Eq`] on the borrowed form *must* match those for /// the key type. /// - /// [`Eq`]: ../../std/cmp/trait.Eq.html - /// [`Hash`]: ../../std/hash/trait.Hash.html - /// /// # Examples /// /// ``` @@ -705,9 +691,6 @@ where /// [`Hash`] and [`Eq`] on the borrowed form *must* match those for /// the key type. /// - /// [`Eq`]: ../../std/cmp/trait.Eq.html - /// [`Hash`]: ../../std/hash/trait.Hash.html - /// /// # Examples /// /// ``` @@ -734,9 +717,6 @@ where /// [`Hash`] and [`Eq`] on the borrowed form *must* match those for /// the key type. /// - /// [`Eq`]: ../../std/cmp/trait.Eq.html - /// [`Hash`]: ../../std/hash/trait.Hash.html - /// /// # Examples /// /// ``` @@ -763,9 +743,6 @@ where /// [`Hash`] and [`Eq`] on the borrowed form *must* match those for /// the key type. /// - /// [`Eq`]: ../../std/cmp/trait.Eq.html - /// [`Hash`]: ../../std/hash/trait.Hash.html - /// /// # Examples /// /// ``` @@ -797,8 +774,7 @@ where /// types that can be `==` without being identical. See the [module-level /// documentation] for more. /// - /// [`None`]: ../../std/option/enum.Option.html#variant.None - /// [module-level documentation]: index.html#insert-and-complex-keys + /// [module-level documentation]: crate::collections#insert-and-complex-keys /// /// # Examples /// @@ -826,9 +802,6 @@ where /// [`Hash`] and [`Eq`] on the borrowed form *must* match those for /// the key type. /// - /// [`Eq`]: ../../std/cmp/trait.Eq.html - /// [`Hash`]: ../../std/hash/trait.Hash.html - /// /// # Examples /// /// ``` @@ -856,9 +829,6 @@ where /// [`Hash`] and [`Eq`] on the borrowed form *must* match those for /// the key type. /// - /// [`Eq`]: ../../std/cmp/trait.Eq.html - /// [`Hash`]: ../../std/hash/trait.Hash.html - /// /// # Examples /// /// ``` @@ -1040,8 +1010,7 @@ where /// This `struct` is created by the [`iter`] method on [`HashMap`]. See its /// documentation for more. /// -/// [`iter`]: struct.HashMap.html#method.iter -/// [`HashMap`]: struct.HashMap.html +/// [`iter`]: HashMap::iter #[stable(feature = "rust1", since = "1.0.0")] pub struct Iter<'a, K: 'a, V: 'a> { base: base::Iter<'a, K, V>, @@ -1068,8 +1037,7 @@ impl fmt::Debug for Iter<'_, K, V> { /// This `struct` is created by the [`iter_mut`] method on [`HashMap`]. See its /// documentation for more. /// -/// [`iter_mut`]: struct.HashMap.html#method.iter_mut -/// [`HashMap`]: struct.HashMap.html +/// [`iter_mut`]: HashMap::iter_mut #[stable(feature = "rust1", since = "1.0.0")] pub struct IterMut<'a, K: 'a, V: 'a> { base: base::IterMut<'a, K, V>, @@ -1088,8 +1056,7 @@ impl<'a, K, V> IterMut<'a, K, V> { /// This `struct` is created by the [`into_iter`] method on [`HashMap`] /// (provided by the `IntoIterator` trait). See its documentation for more. /// -/// [`into_iter`]: struct.HashMap.html#method.into_iter -/// [`HashMap`]: struct.HashMap.html +/// [`into_iter`]: IntoIterator::into_iter #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter { base: base::IntoIter, @@ -1108,8 +1075,7 @@ impl IntoIter { /// This `struct` is created by the [`keys`] method on [`HashMap`]. See its /// documentation for more. /// -/// [`keys`]: struct.HashMap.html#method.keys -/// [`HashMap`]: struct.HashMap.html +/// [`keys`]: HashMap::keys #[stable(feature = "rust1", since = "1.0.0")] pub struct Keys<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, @@ -1136,8 +1102,7 @@ impl fmt::Debug for Keys<'_, K, V> { /// This `struct` is created by the [`values`] method on [`HashMap`]. See its /// documentation for more. /// -/// [`values`]: struct.HashMap.html#method.values -/// [`HashMap`]: struct.HashMap.html +/// [`values`]: HashMap::values #[stable(feature = "rust1", since = "1.0.0")] pub struct Values<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, @@ -1164,8 +1129,7 @@ impl fmt::Debug for Values<'_, K, V> { /// This `struct` is created by the [`drain`] method on [`HashMap`]. See its /// documentation for more. /// -/// [`drain`]: struct.HashMap.html#method.drain -/// [`HashMap`]: struct.HashMap.html +/// [`drain`]: HashMap::drain #[stable(feature = "drain", since = "1.6.0")] pub struct Drain<'a, K: 'a, V: 'a> { base: base::Drain<'a, K, V>, @@ -1184,8 +1148,7 @@ impl<'a, K, V> Drain<'a, K, V> { /// This `struct` is created by the [`values_mut`] method on [`HashMap`]. See its /// documentation for more. /// -/// [`values_mut`]: struct.HashMap.html#method.values_mut -/// [`HashMap`]: struct.HashMap.html +/// [`values_mut`]: HashMap::values_mut #[stable(feature = "map_values_mut", since = "1.10.0")] pub struct ValuesMut<'a, K: 'a, V: 'a> { inner: IterMut<'a, K, V>, @@ -1195,7 +1158,7 @@ pub struct ValuesMut<'a, K: 'a, V: 'a> { /// /// See the [`HashMap::raw_entry_mut`] docs for usage examples. /// -/// [`HashMap::raw_entry_mut`]: struct.HashMap.html#method.raw_entry_mut +/// [`HashMap::raw_entry_mut`]: HashMap::raw_entry_mut #[unstable(feature = "hash_raw_entry", issue = "56167")] pub struct RawEntryBuilderMut<'a, K: 'a, V: 'a, S: 'a> { @@ -1209,9 +1172,8 @@ pub struct RawEntryBuilderMut<'a, K: 'a, V: 'a, S: 'a> { /// This `enum` is constructed through the [`raw_entry_mut`] method on [`HashMap`], /// then calling one of the methods of that [`RawEntryBuilderMut`]. /// -/// [`HashMap`]: struct.HashMap.html /// [`Entry`]: enum.Entry.html -/// [`raw_entry_mut`]: struct.HashMap.html#method.raw_entry_mut +/// [`raw_entry_mut`]: HashMap::raw_entry_mut /// [`RawEntryBuilderMut`]: struct.RawEntryBuilderMut.html #[unstable(feature = "hash_raw_entry", issue = "56167")] pub enum RawEntryMut<'a, K: 'a, V: 'a, S: 'a> { @@ -1223,8 +1185,6 @@ pub enum RawEntryMut<'a, K: 'a, V: 'a, S: 'a> { /// A view into an occupied entry in a `HashMap`. /// It is part of the [`RawEntryMut`] enum. -/// -/// [`RawEntryMut`]: enum.RawEntryMut.html #[unstable(feature = "hash_raw_entry", issue = "56167")] pub struct RawOccupiedEntryMut<'a, K: 'a, V: 'a> { base: base::RawOccupiedEntryMut<'a, K, V>, @@ -1232,8 +1192,6 @@ pub struct RawOccupiedEntryMut<'a, K: 'a, V: 'a> { /// A view into a vacant entry in a `HashMap`. /// It is part of the [`RawEntryMut`] enum. -/// -/// [`RawEntryMut`]: enum.RawEntryMut.html #[unstable(feature = "hash_raw_entry", issue = "56167")] pub struct RawVacantEntryMut<'a, K: 'a, V: 'a, S: 'a> { base: base::RawVacantEntryMut<'a, K, V, S>, @@ -1243,7 +1201,7 @@ pub struct RawVacantEntryMut<'a, K: 'a, V: 'a, S: 'a> { /// /// See the [`HashMap::raw_entry`] docs for usage examples. /// -/// [`HashMap::raw_entry`]: struct.HashMap.html#method.raw_entry +/// [`HashMap::raw_entry`]: HashMap::raw_entry #[unstable(feature = "hash_raw_entry", issue = "56167")] pub struct RawEntryBuilder<'a, K: 'a, V: 'a, S: 'a> { map: &'a HashMap, @@ -1597,8 +1555,7 @@ impl Debug for RawEntryBuilder<'_, K, V, S> { /// /// This `enum` is constructed from the [`entry`] method on [`HashMap`]. /// -/// [`HashMap`]: struct.HashMap.html -/// [`entry`]: struct.HashMap.html#method.entry +/// [`entry`]: HashMap::entry #[stable(feature = "rust1", since = "1.0.0")] pub enum Entry<'a, K: 'a, V: 'a> { /// An occupied entry. @@ -2156,7 +2113,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> { /// If you need a reference to the `OccupiedEntry` which may outlive the /// destruction of the `Entry` value, see [`into_mut`]. /// - /// [`into_mut`]: #method.into_mut + /// [`into_mut`]: Self::into_mut /// /// # Examples /// @@ -2189,7 +2146,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> { /// /// If you need multiple references to the `OccupiedEntry`, see [`get_mut`]. /// - /// [`get_mut`]: #method.get_mut + /// [`get_mut`]: Self::get_mut /// /// # Examples /// @@ -2475,9 +2432,6 @@ where /// [`Hasher`], but the hashers created by two different `RandomState` /// instances are unlikely to produce the same result for the same values. /// -/// [`HashMap`]: struct.HashMap.html -/// [`Hasher`]: ../../hash/trait.Hasher.html -/// /// # Examples /// /// ``` @@ -2547,9 +2501,6 @@ impl BuildHasher for RandomState { /// /// The internal algorithm is not specified, and so it and its hashes should /// not be relied upon over releases. -/// -/// [`RandomState`]: struct.RandomState.html -/// [`Hasher`]: ../../hash/trait.Hasher.html #[stable(feature = "hashmap_default_hasher", since = "1.13.0")] #[allow(deprecated)] #[derive(Clone, Debug)] diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index 10d3ed50e4bfe..a689f3e85ba24 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -130,7 +130,6 @@ fn check(cache: &mut Cache, root: &Path, file: &Path, errors: &mut bool) -> Opti || file.ends_with("alloc/collections/btree_set/struct.BTreeSet.html") || file.ends_with("std/collections/btree_map/struct.BTreeMap.html") || file.ends_with("std/collections/btree_set/struct.BTreeSet.html") - || file.ends_with("std/collections/hash_map/struct.HashMap.html") || file.ends_with("std/collections/hash_set/struct.HashSet.html") { return None; From 9392a5ed945e8f816d6a288029face31c40c9d10 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 18 Jul 2020 12:21:14 -0700 Subject: [PATCH 19/26] Use intra-doc links on HashSet --- src/libstd/collections/hash/set.rs | 47 ++++++------------------------ 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index cb2f829803b85..10bf917daea46 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -98,12 +98,8 @@ use super::map::{self, HashMap, Keys, RandomState}; /// // use the values stored in the set /// ``` /// -/// [`Cell`]: ../../std/cell/struct.Cell.html -/// [`Eq`]: ../../std/cmp/trait.Eq.html -/// [`Hash`]: ../../std/hash/trait.Hash.html -/// [`HashMap`]: struct.HashMap.html -/// [`PartialEq`]: ../../std/cmp/trait.PartialEq.html -/// [`RefCell`]: ../../std/cell/struct.RefCell.html +/// [`RefCell`]: crate::cell::RefCell +/// [`Cell`]: crate::cell::Cell #[derive(Clone)] #[cfg_attr(not(test), rustc_diagnostic_item = "hashset_type")] #[stable(feature = "rust1", since = "1.0.0")] @@ -286,8 +282,6 @@ impl HashSet { /// let mut set = HashSet::with_hasher(s); /// set.insert(2); /// ``` - /// - /// [`BuildHasher`]: ../../std/hash/trait.BuildHasher.html #[inline] #[stable(feature = "hashmap_build_hasher", since = "1.7.0")] pub fn with_hasher(hasher: S) -> HashSet { @@ -318,8 +312,6 @@ impl HashSet { /// let mut set = HashSet::with_capacity_and_hasher(10, s); /// set.insert(1); /// ``` - /// - /// [`BuildHasher`]: ../../std/hash/trait.BuildHasher.html #[inline] #[stable(feature = "hashmap_build_hasher", since = "1.7.0")] pub fn with_capacity_and_hasher(capacity: usize, hasher: S) -> HashSet { @@ -328,8 +320,6 @@ impl HashSet { /// Returns a reference to the set's [`BuildHasher`]. /// - /// [`BuildHasher`]: ../../std/hash/trait.BuildHasher.html - /// /// # Examples /// /// ``` @@ -577,9 +567,6 @@ where /// assert_eq!(set.contains(&1), true); /// assert_eq!(set.contains(&4), false); /// ``` - /// - /// [`Eq`]: ../../std/cmp/trait.Eq.html - /// [`Hash`]: ../../std/hash/trait.Hash.html #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn contains(&self, value: &Q) -> bool @@ -605,9 +592,6 @@ where /// assert_eq!(set.get(&2), Some(&2)); /// assert_eq!(set.get(&4), None); /// ``` - /// - /// [`Eq`]: ../../std/cmp/trait.Eq.html - /// [`Hash`]: ../../std/hash/trait.Hash.html #[inline] #[stable(feature = "set_recovery", since = "1.9.0")] pub fn get(&self, value: &Q) -> Option<&T> @@ -849,9 +833,6 @@ where /// assert_eq!(set.remove(&2), true); /// assert_eq!(set.remove(&2), false); /// ``` - /// - /// [`Eq`]: ../../std/cmp/trait.Eq.html - /// [`Hash`]: ../../std/hash/trait.Hash.html #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn remove(&mut self, value: &Q) -> bool @@ -877,9 +858,6 @@ where /// assert_eq!(set.take(&2), Some(2)); /// assert_eq!(set.take(&2), None); /// ``` - /// - /// [`Eq`]: ../../std/cmp/trait.Eq.html - /// [`Hash`]: ../../std/hash/trait.Hash.html #[inline] #[stable(feature = "set_recovery", since = "1.9.0")] pub fn take(&mut self, value: &Q) -> Option @@ -1153,8 +1131,7 @@ where /// This `struct` is created by the [`iter`] method on [`HashSet`]. /// See its documentation for more. /// -/// [`HashSet`]: struct.HashSet.html -/// [`iter`]: struct.HashSet.html#method.iter +/// [`iter`]: HashSet::iter #[stable(feature = "rust1", since = "1.0.0")] pub struct Iter<'a, K: 'a> { iter: Keys<'a, K, ()>, @@ -1165,8 +1142,7 @@ pub struct Iter<'a, K: 'a> { /// This `struct` is created by the [`into_iter`] method on [`HashSet`] /// (provided by the `IntoIterator` trait). See its documentation for more. /// -/// [`HashSet`]: struct.HashSet.html -/// [`into_iter`]: struct.HashSet.html#method.into_iter +/// [`into_iter`]: IntoIterator::into_iter #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter { iter: map::IntoIter, @@ -1177,8 +1153,7 @@ pub struct IntoIter { /// This `struct` is created by the [`drain`] method on [`HashSet`]. /// See its documentation for more. /// -/// [`HashSet`]: struct.HashSet.html -/// [`drain`]: struct.HashSet.html#method.drain +/// [`drain`]: HashSet::drain #[stable(feature = "rust1", since = "1.0.0")] pub struct Drain<'a, K: 'a> { iter: map::Drain<'a, K, ()>, @@ -1189,8 +1164,7 @@ pub struct Drain<'a, K: 'a> { /// This `struct` is created by the [`intersection`] method on [`HashSet`]. /// See its documentation for more. /// -/// [`HashSet`]: struct.HashSet.html -/// [`intersection`]: struct.HashSet.html#method.intersection +/// [`intersection`]: HashSet::intersection #[stable(feature = "rust1", since = "1.0.0")] pub struct Intersection<'a, T: 'a, S: 'a> { // iterator of the first set @@ -1204,8 +1178,7 @@ pub struct Intersection<'a, T: 'a, S: 'a> { /// This `struct` is created by the [`difference`] method on [`HashSet`]. /// See its documentation for more. /// -/// [`HashSet`]: struct.HashSet.html -/// [`difference`]: struct.HashSet.html#method.difference +/// [`difference`]: HashSet::difference #[stable(feature = "rust1", since = "1.0.0")] pub struct Difference<'a, T: 'a, S: 'a> { // iterator of the first set @@ -1219,8 +1192,7 @@ pub struct Difference<'a, T: 'a, S: 'a> { /// This `struct` is created by the [`symmetric_difference`] method on /// [`HashSet`]. See its documentation for more. /// -/// [`HashSet`]: struct.HashSet.html -/// [`symmetric_difference`]: struct.HashSet.html#method.symmetric_difference +/// [`symmetric_difference`]: HashSet::symmetric_difference #[stable(feature = "rust1", since = "1.0.0")] pub struct SymmetricDifference<'a, T: 'a, S: 'a> { iter: Chain, Difference<'a, T, S>>, @@ -1231,8 +1203,7 @@ pub struct SymmetricDifference<'a, T: 'a, S: 'a> { /// This `struct` is created by the [`union`] method on [`HashSet`]. /// See its documentation for more. /// -/// [`HashSet`]: struct.HashSet.html -/// [`union`]: struct.HashSet.html#method.union +/// [`union`]: HashSet::union #[stable(feature = "rust1", since = "1.0.0")] pub struct Union<'a, T: 'a, S: 'a> { iter: Chain, Difference<'a, T, S>>, From a9680938d0840066cb79a50248fb8a099e61389e Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 18 Jul 2020 13:36:27 -0700 Subject: [PATCH 20/26] Add explicit exception list to linkchecker --- src/tools/linkchecker/main.rs | 62 ++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index a689f3e85ba24..63fb1ccf79967 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -23,6 +23,31 @@ use std::rc::Rc; use crate::Redirect::*; +// Add linkcheck exceptions here +// If at all possible you should use intra-doc links to avoid linkcheck issues. These +// are cases where that does not work +const LINKCHECK_EXCEPTIONS: &[(&str, &[&str])] = &[ + // These are methods on slice, and `Self` does not work on primitive impls + // in intra-doc links (intra-doc links are weird) + // https://github.com/rust-lang/rust/issues/62834 is necessary to be + // able to link to slices + ( + "std/io/struct.IoSlice.html", + &[ + "#method.as_mut_ptr", + "#method.sort_by_key", + "#method.make_ascii_uppercase", + "#method.make_ascii_lowercase", + ], + ), + // These try to link to std::collections, but are defined in alloc + // https://github.com/rust-lang/rust/issues/74481 + ("std/collections/btree_map/struct.BTreeMap.html", &["#insert-and-complex-keys"]), + ("std/collections/btree_set/struct.BTreeSet.html", &["#insert-and-complex-keys"]), + ("alloc/collections/btree_map/struct.BTreeMap.html", &["#insert-and-complex-keys"]), + ("alloc/collections/btree_set/struct.BTreeSet.html", &["#insert-and-complex-keys"]), +]; + macro_rules! t { ($e:expr) => { match $e { @@ -111,30 +136,20 @@ fn walk(cache: &mut Cache, root: &Path, dir: &Path, errors: &mut bool) { } } +fn is_exception(file: &Path, link: &str) -> bool { + if let Some(entry) = LINKCHECK_EXCEPTIONS.iter().find(|&(f, _)| file.ends_with(f)) { + entry.1.contains(&link) + } else { + false + } +} + fn check(cache: &mut Cache, root: &Path, file: &Path, errors: &mut bool) -> Option { // Ignore non-HTML files. if file.extension().and_then(|s| s.to_str()) != Some("html") { return None; } - // Unfortunately we're not 100% full of valid links today to we need a few - // exceptions to get this past `make check` today. - // FIXME(#32129) - if file.ends_with("std/io/struct.IoSlice.html") - { - return None; - } - - // FIXME(#32130) - if file.ends_with("alloc/collections/btree_map/struct.BTreeMap.html") - || file.ends_with("alloc/collections/btree_set/struct.BTreeSet.html") - || file.ends_with("std/collections/btree_map/struct.BTreeMap.html") - || file.ends_with("std/collections/btree_set/struct.BTreeSet.html") - || file.ends_with("std/collections/hash_set/struct.HashSet.html") - { - return None; - } - let res = load_file(cache, root, file, SkipRedirect); let (pretty_file, contents) = match res { Ok(res) => res, @@ -249,17 +264,20 @@ fn check(cache: &mut Cache, root: &Path, file: &Path, errors: &mut bool) -> Opti let entry = &mut cache.get_mut(&pretty_path).unwrap(); entry.parse_ids(&pretty_path, &contents, errors); - if !entry.ids.contains(*fragment) { + if !entry.ids.contains(*fragment) && !is_exception(file, &format!("#{}", fragment)) + { *errors = true; print!("{}:{}: broken link fragment ", pretty_file.display(), i + 1); println!("`#{}` pointing to `{}`", fragment, pretty_path.display()); }; } } else { - *errors = true; - print!("{}:{}: broken link - ", pretty_file.display(), i + 1); let pretty_path = path.strip_prefix(root).unwrap_or(&path); - println!("{}", pretty_path.display()); + if !is_exception(file, pretty_path.to_str().unwrap()) { + *errors = true; + print!("{}:{}: broken link - ", pretty_file.display(), i + 1); + println!("{}", pretty_path.display()); + } } }); Some(pretty_file) From 4c8e62b43313136d41a55340032ba02a81ac941c Mon Sep 17 00:00:00 2001 From: Lokathor Date: Sat, 18 Jul 2020 21:57:37 -0600 Subject: [PATCH 21/26] Resolve https://github.com/rust-lang/rust/pull/74419#issuecomment-660518936 --- src/librustc_target/spec/thumbv4t_none_eabi.rs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/librustc_target/spec/thumbv4t_none_eabi.rs b/src/librustc_target/spec/thumbv4t_none_eabi.rs index 04a272cb4ae77..1e55efbb59fba 100644 --- a/src/librustc_target/spec/thumbv4t_none_eabi.rs +++ b/src/librustc_target/spec/thumbv4t_none_eabi.rs @@ -48,10 +48,6 @@ pub fn target() -> TargetResult { // minimum extra features, these cannot be disabled via -C features: "+soft-float,+strict-align".to_string(), - executables: true, - - relocation_model: RelocModel::Static, - main_needs_argc_argv: false, // No thread-local storage (just use a static Cell) @@ -60,16 +56,7 @@ pub fn target() -> TargetResult { // don't have atomic compare-and-swap atomic_cas: false, - // always just abort - panic_strategy: PanicStrategy::Abort, - - // ABIs to not use - unsupported_abis: super::arm_base::unsupported_abis(), - - // this is turned off just like in the `thumb_base` module - emit_debug_gdb_scripts: false, - - ..TargetOptions::default() + ..super::thumb_base::opts() }, }) } From ec9c8d81f65cf4a1d8ce720bfe06b8312903f845 Mon Sep 17 00:00:00 2001 From: Lokathor Date: Sat, 18 Jul 2020 23:01:01 -0600 Subject: [PATCH 22/26] remove unused imports --- src/librustc_target/spec/thumbv4t_none_eabi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_target/spec/thumbv4t_none_eabi.rs b/src/librustc_target/spec/thumbv4t_none_eabi.rs index 1e55efbb59fba..31417b0154759 100644 --- a/src/librustc_target/spec/thumbv4t_none_eabi.rs +++ b/src/librustc_target/spec/thumbv4t_none_eabi.rs @@ -8,7 +8,7 @@ //! //! **Important:** This target profile **does not** specify a linker script. You just get the default link script when you build a binary for this target. The default link script is very likely wrong, so you should use `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script. -use crate::spec::{LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { Ok(Target { From 4a324b8117d5e7ffadca1bdc6d109486cc242464 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 18 Jul 2020 22:30:25 -0700 Subject: [PATCH 23/26] Update src/tools/linkchecker/main.rs Co-authored-by: Joshua Nelson --- src/tools/linkchecker/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index 63fb1ccf79967..dbff6ba2a657b 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -26,6 +26,7 @@ use crate::Redirect::*; // Add linkcheck exceptions here // If at all possible you should use intra-doc links to avoid linkcheck issues. These // are cases where that does not work +// [(generated_documentation_page, &[broken_links])] const LINKCHECK_EXCEPTIONS: &[(&str, &[&str])] = &[ // These are methods on slice, and `Self` does not work on primitive impls // in intra-doc links (intra-doc links are weird) From 8d470b57968fd875c2d9ce50446868b906f54752 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 18 Jul 2020 22:31:35 -0700 Subject: [PATCH 24/26] Update src/libstd/io/mod.rs Co-authored-by: Joshua Nelson --- src/libstd/io/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index ce9dd19ace104..823ce30febed4 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1450,7 +1450,7 @@ pub trait Write { /// /// This method is primarily used to interface with the /// [`format_args!()`] macro, but it is rare that this should - /// explicitly be called. The [`write!()`][write] macro should be favored to + /// explicitly be called. The [`write!()`] macro should be favored to /// invoke this method instead. /// /// This function internally uses the [`write_all`][writeall] method on From ea70cc0ae6e2299a211496b2dab8e1dadb85fa7e Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 18 Jul 2020 22:32:42 -0700 Subject: [PATCH 25/26] Clarify the literal string --- src/liballoc/string.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index f864b76366806..1c3879c40c2f9 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -65,7 +65,7 @@ use crate::vec::Vec; /// /// # Examples /// -/// You can create a `String` from a literal string with [`String::from`]: +/// You can create a `String` from [a literal string][str] with [`String::from`]: /// /// [`String::from`]: From::from /// From ec966ae13d7b844ae84aac1e588a8d944198b108 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 18 Jul 2020 22:33:00 -0700 Subject: [PATCH 26/26] primitive impls are weird --- src/tools/linkchecker/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index dbff6ba2a657b..194318d7a59b5 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -29,7 +29,7 @@ use crate::Redirect::*; // [(generated_documentation_page, &[broken_links])] const LINKCHECK_EXCEPTIONS: &[(&str, &[&str])] = &[ // These are methods on slice, and `Self` does not work on primitive impls - // in intra-doc links (intra-doc links are weird) + // in intra-doc links (primitive impls are weird) // https://github.com/rust-lang/rust/issues/62834 is necessary to be // able to link to slices (