Skip to content

Fix a few links in the docs #37316

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

Merged
merged 1 commit into from
Nov 2, 2016
Merged
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
6 changes: 3 additions & 3 deletions src/libcore/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ pub trait AsMut<T: ?Sized> {
///
/// # Generic Impls
///
/// - `[From<T>][From] for U` implies `Into<U> for T`
/// - [`From<T>`][From]` for U` implies `Into<U> for T`
/// - [`into()`] is reflexive, which means that `Into<T> for T` is implemented
///
/// [`TryInto`]: trait.TryInto.html
Expand Down Expand Up @@ -178,14 +178,14 @@ pub trait Into<T>: Sized {
/// ```
/// # Generic impls
///
/// - `From<T> for U` implies `[Into<U>] for T`
/// - `From<T> for U` implies [`Into<U>`]` for T`
/// - [`from()`] is reflexive, which means that `From<T> for T` is implemented
///
/// [`TryFrom`]: trait.TryFrom.html
/// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
/// [`String`]: ../../std/string/struct.String.html
/// [Into<U>]: trait.Into.html
/// [`Into<U>`]: trait.Into.html
/// [`from()`]: trait.From.html#tymethod.from
#[stable(feature = "rust1", since = "1.0.0")]
pub trait From<T>: Sized {
Expand Down
7 changes: 4 additions & 3 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ macro_rules! panic {
/// Unsafe code relies on `assert!` to enforce run-time invariants that, if
/// violated could lead to unsafety.
///
/// Other use-cases of `assert!` include
/// [testing](https://doc.rust-lang.org/book/testing.html) and enforcing
/// run-time invariants in safe code (whose violation cannot result in unsafety).
/// Other use-cases of `assert!` include [testing] and enforcing run-time
/// invariants in safe code (whose violation cannot result in unsafety).
///
/// This macro has a second version, where a custom panic message can be provided.
///
/// [testing]: ../book/testing.html
///
/// # Examples
///
/// ```
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ pub trait Unsize<T: ?Sized> {
/// compile-time error. Specifically, with structs you'll get [E0204] and with enums you'll get
/// [E0205].
///
/// [E0204]: https://doc.rust-lang.org/error-index.html#E0204
/// [E0205]: https://doc.rust-lang.org/error-index.html#E0205
/// [E0204]: ../../error-index.html#E0204
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a good idea. If you build docs locally, you'' have troubles.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? The error index is part of the local docs so this is no different to linking to the book like this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you run make docs (or any equivalent) then yes, but what if you just build libstd docs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well then these links won't work and neither will links to the book like on std::sync::Arc and std::borrow::Borrow for example. I don't consider that a problem because if you want to build the std docs without any dead links you need to use make docs anyway. The advantages of using relative links like this are: they work offline, they link to the same version of the docs you're already viewing and linkchecker can check them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, I see your point. I guess it's okay then.

/// [E0205]: ../../error-index.html#E0205
///
/// ## When *should* my type be `Copy`?
///
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ pub trait Drop {
/// After this function is over, the memory of `self` will be deallocated.
///
/// This function cannot be called explicitly. This is compiler error
/// [0040]. However, the [`std::mem::drop`] function in the prelude can be
/// [E0040]. However, the [`std::mem::drop`] function in the prelude can be
/// used to call the argument's `Drop` implementation.
///
/// [0040]: https://doc.rust-lang.org/error-index.html#E0040
/// [`std::mem::drop`]: https://doc.rust-lang.org/std/mem/fn.drop.html
/// [E0040]: ../../error-index.html#E0040
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment.

/// [`std::mem::drop`]: ../../std/mem/fn.drop.html
///
/// # Panics
///
Expand Down
4 changes: 3 additions & 1 deletion src/libstd/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ pub trait Error: Debug + Display {
/// It should not contain newlines or sentence-ending punctuation,
/// to facilitate embedding in larger user-facing strings.
/// For showing formatted error messages with more information see
/// [Display](https://doc.rust-lang.org/std/fmt/trait.Display.html).
/// [`Display`].
///
/// [`Display`]: ../fmt/trait.Display.html
///
/// # Examples
///
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/io/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use io::{self, SeekFrom, Error, ErrorKind};
///
/// The standard library implements some I/O traits on various types which
/// are commonly used as a buffer, like `Cursor<`[`Vec`]`<u8>>` and
/// `Cursor<`[`&[u8]`]`>`.
/// `Cursor<`[`&[u8]`][bytes]`>`.
///
/// # Examples
///
Expand All @@ -35,7 +35,7 @@ use io::{self, SeekFrom, Error, ErrorKind};
/// [`Read`]: ../../std/io/trait.Read.html
/// [`Write`]: ../../std/io/trait.Write.html
/// [`Vec`]: ../../std/vec/struct.Vec.html
/// [`&[u8]`]: ../../std/primitive.slice.html
/// [bytes]: ../../std/primitive.slice.html
/// [`File`]: ../fs/struct.File.html
///
/// ```no_run
Expand Down
1 change: 1 addition & 0 deletions src/libstd/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,7 @@ impl<'a> cmp::Ord for Components<'a> {
/// [`Path`]: struct.Path.html
/// [`push`]: struct.PathBuf.html#method.push
/// [`set_extension`]: struct.PathBuf.html#method.set_extension
/// [`Deref`]: ../ops/trait.Deref.html
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

///
/// More details about the overall approach can be found in
/// the module documentation.
Expand Down