Skip to content

Add primitive docs to libcore #61851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libcore/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! up to a certain length. Eventually we should able to generalize
//! to all lengths.
//!
//! *[See also the array primitive type](../../std/primitive.array.html).*
//! *[See also the array primitive type](../primitive.array.html).*

#![stable(feature = "core_array", since = "1.36.0")]

Expand Down
8 changes: 4 additions & 4 deletions src/libcore/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
/// provide a reference to related type `T`, it is often better to use
/// [`AsRef<T>`] as more types can safely implement it.
///
/// [`AsRef<T>`]: ../../std/convert/trait.AsRef.html
/// [`AsRef<T>`]: ../convert/trait.AsRef.html
/// [`BorrowMut<T>`]: trait.BorrowMut.html
/// [`Box<T>`]: ../../std/boxed/struct.Box.html
/// [`Mutex<T>`]: ../../std/sync/struct.Mutex.html
/// [`Rc<T>`]: ../../std/rc/struct.Rc.html
/// [`str`]: ../../std/primitive.str.html
/// [`str`]: ../primitive.str.html
/// [`String`]: ../../std/string/struct.String.html
/// [`borrow`]: #tymethod.borrow
///
Expand Down Expand Up @@ -152,10 +152,10 @@
/// If it wants to allow others access to the underlying `str`, it can do
/// that via `AsRef<str>` which doesn’t carry any extra requirements.
///
/// [`Hash`]: ../../std/hash/trait.Hash.html
/// [`Hash`]: ../hash/trait.Hash.html
/// [`HashMap<K, V>`]: ../../std/collections/struct.HashMap.html
/// [`String`]: ../../std/string/struct.String.html
/// [`str`]: ../../std/primitive.str.html
/// [`str`]: ../primitive.str.html
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Borrow<Borrowed: ?Sized> {
/// Immutably borrows from an owned value.
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/char/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use super::MAX;
/// [`char`]s. `from_u32()` will return `None` if the input is not a valid value
/// for a [`char`].
///
/// [`char`]: ../../std/primitive.char.html
/// [`u32`]: ../../std/primitive.u32.html
/// [`char`]: ../primitive.char.html
/// [`u32`]: ../primitive.u32.html
///
/// For an unsafe version of this function which ignores these checks, see
/// [`from_u32_unchecked`].
Expand Down Expand Up @@ -74,8 +74,8 @@ pub fn from_u32(i: u32) -> Option<char> {
/// [`char`]s. `from_u32_unchecked()` will ignore this, and blindly cast to
/// [`char`], possibly creating an invalid one.
///
/// [`char`]: ../../std/primitive.char.html
/// [`u32`]: ../../std/primitive.u32.html
/// [`char`]: ../primitive.char.html
/// [`u32`]: ../primitive.u32.html
///
/// # Safety
///
Expand Down
24 changes: 12 additions & 12 deletions src/libcore/char/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//! [Unicode code point]: http://www.unicode.org/glossary/#code_point
//!
//! This module exists for technical reasons, the primary documentation for
//! `char` is directly on [the `char` primitive type](../../std/primitive.char.html)
//! `char` is directly on [the `char` primitive type](../primitive.char.html)
//! itself.
//!
//! This module is the home of the iterator implementations for the iterators
Expand Down Expand Up @@ -92,7 +92,7 @@ const MAX_THREE_B: u32 = 0x10000;
/// Point], but only ones within a certain range. `MAX` is the highest valid
/// code point that's a valid [Unicode Scalar Value].
///
/// [`char`]: ../../std/primitive.char.html
/// [`char`]: ../primitive.char.html
/// [Unicode Scalar Value]: http://www.unicode.org/glossary/#unicode_scalar_value
/// [Code Point]: http://www.unicode.org/glossary/#code_point
#[stable(feature = "rust1", since = "1.0.0")]
Expand All @@ -112,8 +112,8 @@ pub const REPLACEMENT_CHARACTER: char = '\u{FFFD}';
/// This `struct` is created by the [`escape_unicode`] method on [`char`]. See
/// its documentation for more.
///
/// [`escape_unicode`]: ../../std/primitive.char.html#method.escape_unicode
/// [`char`]: ../../std/primitive.char.html
/// [`escape_unicode`]: ../primitive.char.html#method.escape_unicode
/// [`char`]: ../primitive.char.html
#[derive(Clone, Debug)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct EscapeUnicode {
Expand Down Expand Up @@ -233,8 +233,8 @@ impl fmt::Display for EscapeUnicode {
/// This `struct` is created by the [`escape_default`] method on [`char`]. See
/// its documentation for more.
///
/// [`escape_default`]: ../../std/primitive.char.html#method.escape_default
/// [`char`]: ../../std/primitive.char.html
/// [`escape_default`]: ../primitive.char.html#method.escape_default
/// [`char`]: ../primitive.char.html
#[derive(Clone, Debug)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct EscapeDefault {
Expand Down Expand Up @@ -346,8 +346,8 @@ impl fmt::Display for EscapeDefault {
/// This `struct` is created by the [`escape_debug`] method on [`char`]. See its
/// documentation for more.
///
/// [`escape_debug`]: ../../std/primitive.char.html#method.escape_debug
/// [`char`]: ../../std/primitive.char.html
/// [`escape_debug`]: ../primitive.char.html#method.escape_debug
/// [`char`]: ../primitive.char.html
#[stable(feature = "char_escape_debug", since = "1.20.0")]
#[derive(Clone, Debug)]
pub struct EscapeDebug(EscapeDefault);
Expand Down Expand Up @@ -377,8 +377,8 @@ impl fmt::Display for EscapeDebug {
/// This `struct` is created by the [`to_lowercase`] method on [`char`]. See
/// its documentation for more.
///
/// [`to_lowercase`]: ../../std/primitive.char.html#method.to_lowercase
/// [`char`]: ../../std/primitive.char.html
/// [`to_lowercase`]: ../primitive.char.html#method.to_lowercase
/// [`char`]: ../primitive.char.html
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Debug, Clone)]
pub struct ToLowercase(CaseMappingIter);
Expand All @@ -405,8 +405,8 @@ impl ExactSizeIterator for ToLowercase {}
/// This `struct` is created by the [`to_uppercase`] method on [`char`]. See
/// its documentation for more.
///
/// [`to_uppercase`]: ../../std/primitive.char.html#method.to_uppercase
/// [`char`]: ../../std/primitive.char.html
/// [`to_uppercase`]: ../primitive.char.html#method.to_uppercase
/// [`char`]: ../primitive.char.html
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Debug, Clone)]
pub struct ToUppercase(CaseMappingIter);
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//!
//! [`Clone`]: trait.Clone.html
//! [clone]: trait.Clone.html#tymethod.clone
//! [`Drop`]: ../../std/ops/trait.Drop.html
//! [`Drop`]: ../ops/trait.Drop.html
//!
//! Basic usage example:
//!
Expand Down Expand Up @@ -74,7 +74,7 @@
/// An example is a generic struct holding a function pointer. In this case, the
/// implementation of `Clone` cannot be `derive`d, but can be implemented as:
///
/// [`Copy`]: ../../std/marker/trait.Copy.html
/// [`Copy`]: ../marker/trait.Copy.html
/// [`clone`]: trait.Clone.html#tymethod.clone
///
/// ```
Expand Down
20 changes: 10 additions & 10 deletions src/libcore/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ pub const fn identity<T>(x: T) -> T { x }
/// equivalent to those of the owned value. For this reason, if you want to
/// borrow only a single field of a struct you can implement `AsRef`, but not `Borrow`.
///
/// [`Borrow`]: ../../std/borrow/trait.Borrow.html
/// [`Borrow`]: ../borrow/trait.Borrow.html
///
/// **Note: This trait must not fail**. If the conversion can fail, use a
/// dedicated method which returns an [`Option<T>`] or a [`Result<T, E>`].
///
/// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
/// [`Option<T>`]: ../option/enum.Option.html
/// [`Result<T, E>`]: ../result/enum.Result.html
///
/// # Generic Implementations
///
Expand Down Expand Up @@ -164,8 +164,8 @@ pub trait AsRef<T: ?Sized> {
/// **Note: This trait must not fail**. If the conversion can fail, use a
/// dedicated method which returns an [`Option<T>`] or a [`Result<T, E>`].
///
/// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
/// [`Option<T>`]: ../option/enum.Option.html
/// [`Result<T, E>`]: ../result/enum.Result.html
///
/// # Generic Implementations
///
Expand Down Expand Up @@ -269,8 +269,8 @@ pub trait AsMut<T: ?Sized> {
/// ```
///
/// [`TryInto`]: trait.TryInto.html
/// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
/// [`Option<T>`]: ../option/enum.Option.html
/// [`Result<T, E>`]: ../result/enum.Result.html
/// [`String`]: ../../std/string/struct.String.html
/// [`From`]: trait.From.html
/// [`into`]: trait.Into.html#tymethod.into
Expand Down Expand Up @@ -358,8 +358,8 @@ pub trait Into<T>: Sized {
/// ```
///
/// [`TryFrom`]: trait.TryFrom.html
/// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
/// [`Option<T>`]: ../option/enum.Option.html
/// [`Result<T, E>`]: ../result/enum.Result.html
/// [`String`]: ../../std/string/struct.String.html
/// [`Into`]: trait.Into.html
/// [`from`]: trait.From.html#tymethod.from
Expand Down Expand Up @@ -651,7 +651,7 @@ impl AsRef<str> for str {
/// [`Result`]: ../result/enum.Result.html
/// [`TryFrom`]: trait.TryFrom.html
/// [`Into`]: trait.Into.html
/// [never]: ../../std/primitive.never.html
/// [never]: ../primitive.never.html
#[stable(feature = "convert_infallible", since = "1.34.0")]
#[derive(Copy)]
pub enum Infallible {}
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::fmt;
/// stabilized, it is recommended to use a newtype wrapper around an empty
/// byte array. See the [Nomicon] for details.
///
/// [pointer]: ../../std/primitive.pointer.html
/// [pointer]: ../primitive.pointer.html
/// [Nomicon]: https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs
// N.B., for LLVM to recognize the void pointer type and by extension
// functions like malloc(), we need to have it represented as i8* in
Expand Down
30 changes: 15 additions & 15 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub struct Error;
/// library. The [`write!`] macro accepts an instance of [`io::Write`], and the
/// [`io::Write`] trait is favored over implementing this trait.
///
/// [`write!`]: ../../std/macro.write.html
/// [`write!`]: ../macro.write.html
/// [`io::Write`]: ../../std/io/trait.Write.html
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Write {
Expand Down Expand Up @@ -148,7 +148,7 @@ pub trait Write {
///
/// This function will return an instance of [`Error`] on error.
///
/// [`char`]: ../../std/primitive.char.html
/// [`char`]: ../primitive.char.html
/// [`Error`]: struct.Error.html
///
/// # Examples
Expand All @@ -175,7 +175,7 @@ pub trait Write {
/// This method should generally not be invoked manually, but rather through
/// the [`write!`] macro itself.
///
/// [`write!`]: ../../std/macro.write.html
/// [`write!`]: ../macro.write.html
///
/// # Examples
///
Expand Down Expand Up @@ -387,9 +387,9 @@ impl<'a> Arguments<'a> {
/// assert_eq!(display, debug);
/// ```
///
/// [`format_args!`]: ../../std/macro.format_args.html
/// [`format_args!`]: ../macro.format_args.html
/// [`format`]: ../../std/fmt/fn.format.html
/// [`write`]: ../../std/fmt/fn.write.html
/// [`write`]: ../fmt/fn.write.html
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy, Clone)]
pub struct Arguments<'a> {
Expand Down Expand Up @@ -485,8 +485,8 @@ impl Display for Arguments<'_> {
/// `Debug` implementations using either `derive` or the debug builder API
/// on [`Formatter`] support pretty-printing using the alternate flag: `{:#?}`.
///
/// [debug_struct]: ../../std/fmt/struct.Formatter.html#method.debug_struct
/// [`Formatter`]: ../../std/fmt/struct.Formatter.html
/// [debug_struct]: ../fmt/struct.Formatter.html#method.debug_struct
/// [`Formatter`]: ../fmt/struct.Formatter.html
///
/// Pretty-printing with `#?`:
///
Expand Down Expand Up @@ -714,10 +714,10 @@ pub trait Octal {
/// ```
///
/// [module]: ../../std/fmt/index.html
/// [`i8`]: ../../std/primitive.i8.html
/// [`i128`]: ../../std/primitive.i128.html
/// [`isize`]: ../../std/primitive.isize.html
/// [`i32`]: ../../std/primitive.i32.html
/// [`i8`]: ../primitive.i8.html
/// [`i128`]: ../primitive.i128.html
/// [`isize`]: ../primitive.isize.html
/// [`i32`]: ../primitive.i32.html
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Binary {
/// Formats the value using the given formatter.
Expand Down Expand Up @@ -992,7 +992,7 @@ pub trait UpperExp {
/// assert_eq!(output, "Hello world!");
/// ```
///
/// [`write!`]: ../../std/macro.write.html
/// [`write!`]: ../macro.write.html
#[stable(feature = "rust1", since = "1.0.0")]
pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result {
let mut formatter = Formatter {
Expand Down Expand Up @@ -1704,8 +1704,8 @@ impl<'a> Formatter<'a> {
/// Creates a [`DebugStruct`] builder designed to assist with creation of
/// [`fmt::Debug`] implementations for structs.
///
/// [`DebugStruct`]: ../../std/fmt/struct.DebugStruct.html
/// [`fmt::Debug`]: ../../std/fmt/trait.Debug.html
/// [`DebugStruct`]: ../fmt/struct.DebugStruct.html
/// [`fmt::Debug`]: ../fmt/trait.Debug.html
///
/// # Examples
///
Expand Down Expand Up @@ -1818,7 +1818,7 @@ impl<'a> Formatter<'a> {
/// println!("{:?}", Foo(vec![10, 11]));
/// ```
///
/// [`format_args!`]: ../../std/macro.format_args.html
/// [`format_args!`]: ../macro.format_args.html
///
/// In this more complex example, we use [`format_args!`] and `.debug_set()`
/// to build a list of match arms:
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ mod sip;
/// Thankfully, you won't need to worry about upholding this property when
/// deriving both [`Eq`] and `Hash` with `#[derive(PartialEq, Eq, Hash)]`.
///
/// [`Eq`]: ../../std/cmp/trait.Eq.html
/// [`Eq`]: ../cmp/trait.Eq.html
/// [`Hasher`]: trait.Hasher.html
/// [`HashMap`]: ../../std/collections/struct.HashMap.html
/// [`HashSet`]: ../../std/collections/struct.HashSet.html
Expand Down
Loading