1
Fork 0

Convert old doc links to current edition

Use footnote style to bypass the tidy check
This commit is contained in:
Lzu Tao 2019-01-23 03:55:37 +00:00
parent 6bba352cad
commit e7f8e63ed4
15 changed files with 65 additions and 50 deletions

View file

@ -1,4 +1,4 @@
% Error Handling in Rust % Error Handling in Rust
This content has moved into This content has moved into
[the Rust Programming Language book](book/error-handling.html). [the Rust Programming Language book](book/ch09-00-error-handling.html).

View file

@ -1,4 +1,4 @@
% The (old) Rust Ownership Guide % The (old) Rust Ownership Guide
This content has moved into This content has moved into
[the Rust Programming Language book](book/ownership.html). [the Rust Programming Language book](book/ch04-00-understanding-ownership.html).

View file

@ -2,6 +2,6 @@
This content has been removed, with no direct replacement. Rust only This content has been removed, with no direct replacement. Rust only
has two built-in pointer types now, has two built-in pointer types now,
[references](book/references-and-borrowing.html) and [raw [references](book/ch04-02-references-and-borrowing.html) and [raw
pointers](book/raw-pointers.html). Older Rusts had many more pointer pointers](book/raw-pointers.html). Older Rusts had many more pointer
types, theyre gone now. types, theyre gone now.

View file

@ -1,4 +1,4 @@
% The (old) Rust Testing Guide % The (old) Rust Testing Guide
This content has moved into This content has moved into
[the Rust Programming Language book](book/testing.html). [the Rust Programming Language book](book/ch11-00-testing.html).

View file

@ -113,9 +113,6 @@ pub const fn identity<T>(x: T) -> T { x }
/// - Use `Borrow` when the goal is related to writing code that is agnostic to /// - Use `Borrow` when the goal is related to writing code that is agnostic to
/// the type of borrow and whether it is a reference or value /// the type of borrow and whether it is a reference or value
/// ///
/// See [the book][book] for a more detailed comparison.
///
/// [book]: ../../book/first-edition/borrow-and-asref.html
/// [`Borrow`]: ../../std/borrow/trait.Borrow.html /// [`Borrow`]: ../../std/borrow/trait.Borrow.html
/// ///
/// **Note: this trait must not fail**. If the conversion can fail, use a /// **Note: this trait must not fail**. If the conversion can fail, use a
@ -348,7 +345,7 @@ pub trait Into<T>: Sized {
/// [`String`]: ../../std/string/struct.String.html /// [`String`]: ../../std/string/struct.String.html
/// [`Into<U>`]: trait.Into.html /// [`Into<U>`]: trait.Into.html
/// [`from`]: trait.From.html#tymethod.from /// [`from`]: trait.From.html#tymethod.from
/// [book]: ../../book/first-edition/error-handling.html /// [book]: ../../book/ch09-00-error-handling.html
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait From<T>: Sized { pub trait From<T>: Sized {
/// Performs the conversion. /// Performs the conversion.

View file

@ -78,7 +78,7 @@ impl<T: ?Sized> !Send for *mut T { }
/// // be made into an object /// // be made into an object
/// ``` /// ```
/// ///
/// [trait object]: ../../book/first-edition/trait-objects.html /// [trait object]: ../../book/ch17-02-trait-objects.html
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[lang = "sized"] #[lang = "sized"]
#[rustc_on_unimplemented( #[rustc_on_unimplemented(
@ -518,7 +518,7 @@ macro_rules! impls{
/// types. We track the Rust type using a phantom type parameter on /// types. We track the Rust type using a phantom type parameter on
/// the struct `ExternalResource` which wraps a handle. /// the struct `ExternalResource` which wraps a handle.
/// ///
/// [FFI]: ../../book/first-edition/ffi.html /// [FFI]: ../../book/ch19-01-unsafe-rust.html#using-extern-functions-to-call-external-code
/// ///
/// ``` /// ```
/// # #![allow(dead_code)] /// # #![allow(dead_code)]

View file

@ -298,7 +298,7 @@ pub const fn size_of<T>() -> usize {
/// then `size_of_val` can be used to get the dynamically-known size. /// then `size_of_val` can be used to get the dynamically-known size.
/// ///
/// [slice]: ../../std/primitive.slice.html /// [slice]: ../../std/primitive.slice.html
/// [trait object]: ../../book/first-edition/trait-objects.html /// [trait object]: ../../book/ch17-02-trait-objects.html
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -5,7 +5,9 @@
//! function-like macros `#[proc_macro]`, macro attributes `#[proc_macro_attribute]` and //! function-like macros `#[proc_macro]`, macro attributes `#[proc_macro_attribute]` and
//! custom derive attributes`#[proc_macro_derive]`. //! custom derive attributes`#[proc_macro_derive]`.
//! //!
//! See [the book](../book/first-edition/procedural-macros.html) for more. //! See [the book] for more.
//!
//! [the book]: ../book/ch19-06-macros.html#procedural-macros-for-generating-code-from-attributes
#![stable(feature = "proc_macro_lib", since = "1.15.0")] #![stable(feature = "proc_macro_lib", since = "1.15.0")]
#![deny(missing_docs)] #![deny(missing_docs)]

View file

@ -1,3 +1,4 @@
// ignore-tidy-linelength
#![allow(non_snake_case)] #![allow(non_snake_case)]
// Error messages for EXXXX errors. // Error messages for EXXXX errors.
@ -406,7 +407,7 @@ fn baz<'a>(x: &'a str, y: &str) -> &str { }
Lifetime elision in implementation headers was part of the lifetime elision Lifetime elision in implementation headers was part of the lifetime elision
RFC. It is, however, [currently unimplemented][iss15872]. RFC. It is, however, [currently unimplemented][iss15872].
[book-le]: https://doc.rust-lang.org/nightly/book/first-edition/lifetimes.html#lifetime-elision [book-le]: https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html#lifetime-elision
[iss15872]: https://github.com/rust-lang/rust/issues/15872 [iss15872]: https://github.com/rust-lang/rust/issues/15872
"##, "##,
@ -642,7 +643,9 @@ attributes:
#![no_std] #![no_std]
``` ```
See also https://doc.rust-lang.org/book/first-edition/no-stdlib.html See also the [unstable book][1].
[1]: https://doc.rust-lang.org/unstable-book/language-features/lang-items.html#writing-an-executable-without-stdlib
"##, "##,
E0214: r##" E0214: r##"
@ -1680,7 +1683,7 @@ fn main() {
``` ```
To understand better how closures work in Rust, read: To understand better how closures work in Rust, read:
https://doc.rust-lang.org/book/first-edition/closures.html https://doc.rust-lang.org/book/ch13-01-closures.html
"##, "##,
E0580: r##" E0580: r##"

View file

@ -35,7 +35,7 @@ extern {}
``` ```
See more: See more:
https://doc.rust-lang.org/book/first-edition/conditional-compilation.html https://doc.rust-lang.org/reference/attributes.html#conditional-compilation
"##, "##,
E0458: r##" E0458: r##"

View file

@ -690,7 +690,7 @@ fn main() {
} }
``` ```
See also https://doc.rust-lang.org/book/first-edition/unsafe.html See also https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html
"##, "##,
E0373: r##" E0373: r##"
@ -873,7 +873,7 @@ that at most one writer or multiple readers can access the data at any one time.
If you wish to learn more about ownership in Rust, start with the chapter in the If you wish to learn more about ownership in Rust, start with the chapter in the
Book: Book:
https://doc.rust-lang.org/book/first-edition/ownership.html https://doc.rust-lang.org/book/ch04-00-understanding-ownership.html
"##, "##,
E0383: r##" E0383: r##"
@ -1207,7 +1207,7 @@ let mut a = &mut i;
Please note that in rust, you can either have many immutable references, or one Please note that in rust, you can either have many immutable references, or one
mutable reference. Take a look at mutable reference. Take a look at
https://doc.rust-lang.org/stable/book/references-and-borrowing.html for more https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html for more
information. Example: information. Example:
@ -1374,7 +1374,7 @@ fn foo(a: &mut i32) {
``` ```
For more information on the rust ownership system, take a look at For more information on the rust ownership system, take a look at
https://doc.rust-lang.org/stable/book/references-and-borrowing.html. https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html.
"##, "##,
E0503: r##" E0503: r##"
@ -1430,7 +1430,7 @@ fn main() {
``` ```
You can find more information about borrowing in the rust-book: You can find more information about borrowing in the rust-book:
http://doc.rust-lang.org/stable/book/references-and-borrowing.html http://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html
"##, "##,
E0504: r##" E0504: r##"
@ -1614,7 +1614,7 @@ fn main() {
``` ```
You can find more information about borrowing in the rust-book: You can find more information about borrowing in the rust-book:
http://doc.rust-lang.org/stable/book/references-and-borrowing.html http://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html
"##, "##,
E0506: r##" E0506: r##"
@ -1825,7 +1825,7 @@ mem::replace(&mut borrowed.knight, TheDarkKnight).nothing_is_true(); // ok!
``` ```
You can find more information about borrowing in the rust-book: You can find more information about borrowing in the rust-book:
http://doc.rust-lang.org/book/first-edition/references-and-borrowing.html http://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html
"##, "##,
E0508: r##" E0508: r##"

View file

@ -1,3 +1,4 @@
// ignore-tidy-linelength
#![allow(non_snake_case)] #![allow(non_snake_case)]
register_long_diagnostics! { register_long_diagnostics! {
@ -1543,7 +1544,9 @@ fn f<T>() {}
It is not possible to declare type parameters on a function that has the `start` It is not possible to declare type parameters on a function that has the `start`
attribute. Such a function must have the following type signature (for more attribute. Such a function must have the following type signature (for more
information: http://doc.rust-lang.org/stable/book/first-edition/no-stdlib.html): information, view [the unstable book][1]):
[1]: https://doc.rust-lang.org/unstable-book/language-features/lang-items.html#writing-an-executable-without-stdlib
``` ```
# let _: # let _:
@ -2917,10 +2920,11 @@ impl Baz for Bar { } // Note: This is OK
E0374: r##" E0374: r##"
A struct without a field containing an unsized type cannot implement A struct without a field containing an unsized type cannot implement
`CoerceUnsized`. An `CoerceUnsized`. An [unsized type][1] is any type that the compiler
[unsized type](https://doc.rust-lang.org/book/first-edition/unsized-types.html) doesn't know the length or alignment of at compile time. Any struct
is any type that the compiler doesn't know the length or alignment of at containing an unsized type is also unsized.
compile time. Any struct containing an unsized type is also unsized.
[1]: https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait
Example of erroneous code: Example of erroneous code:
@ -2977,9 +2981,9 @@ A struct with more than one field containing an unsized type cannot implement
`CoerceUnsized`. This only occurs when you are trying to coerce one of the `CoerceUnsized`. This only occurs when you are trying to coerce one of the
types in your struct to another type in the struct. In this case we try to types in your struct to another type in the struct. In this case we try to
impl `CoerceUnsized` from `T` to `U` which are both types that the struct impl `CoerceUnsized` from `T` to `U` which are both types that the struct
takes. An [unsized type] is any type that the compiler doesn't know the length takes. An [unsized type][1] is any type that the compiler doesn't know the
or alignment of at compile time. Any struct containing an unsized type is also length or alignment of at compile time. Any struct containing an unsized type
unsized. is also unsized.
Example of erroneous code: Example of erroneous code:
@ -3024,7 +3028,7 @@ fn coerce_foo<T: CoerceUnsized<U>, U>(t: T) -> Foo<U> {
} }
``` ```
[unsized type]: https://doc.rust-lang.org/book/first-edition/unsized-types.html [1]: https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait
"##, "##,
E0376: r##" E0376: r##"
@ -3032,11 +3036,12 @@ The type you are trying to impl `CoerceUnsized` for is not a struct.
`CoerceUnsized` can only be implemented for a struct. Unsized types are `CoerceUnsized` can only be implemented for a struct. Unsized types are
already able to be coerced without an implementation of `CoerceUnsized` already able to be coerced without an implementation of `CoerceUnsized`
whereas a struct containing an unsized type needs to know the unsized type whereas a struct containing an unsized type needs to know the unsized type
field it's containing is able to be coerced. An field it's containing is able to be coerced. An [unsized type][1]
[unsized type](https://doc.rust-lang.org/book/first-edition/unsized-types.html)
is any type that the compiler doesn't know the length or alignment of at is any type that the compiler doesn't know the length or alignment of at
compile time. Any struct containing an unsized type is also unsized. compile time. Any struct containing an unsized type is also unsized.
[1]: https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait
Example of erroneous code: Example of erroneous code:
```compile_fail,E0376 ```compile_fail,E0376
@ -3882,8 +3887,10 @@ let c = 86u8 as char; // ok!
assert_eq!(c, 'V'); assert_eq!(c, 'V');
``` ```
For more information about casts, take a look at The Book: For more information about casts, take a look at the Type cast section in
https://doc.rust-lang.org/book/first-edition/casting-between-types.html [The Reference Book][1].
[1]: https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions
"##, "##,
E0605: r##" E0605: r##"
@ -3911,8 +3918,10 @@ let v = 0 as *const u8;
v as *const i8; // ok! v as *const i8; // ok!
``` ```
For more information about casts, take a look at The Book: For more information about casts, take a look at the Type cast section in
https://doc.rust-lang.org/book/first-edition/casting-between-types.html [The Reference Book][1].
[1]: https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions
"##, "##,
E0606: r##" E0606: r##"
@ -3933,8 +3942,10 @@ let x = &0u8;
let y: u32 = *x as u32; // We dereference it first and then cast it. let y: u32 = *x as u32; // We dereference it first and then cast it.
``` ```
For more information about casts, take a look at The Book: For more information about casts, take a look at the Type cast section in
https://doc.rust-lang.org/book/first-edition/casting-between-types.html [The Reference Book][1].
[1]: https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions
"##, "##,
E0607: r##" E0607: r##"
@ -3960,8 +3971,10 @@ pointer holds is their size.
To fix this error, don't try to cast directly between thin and fat pointers. To fix this error, don't try to cast directly between thin and fat pointers.
For more information about casts, take a look at The Book: For more information about casts, take a look at the Type cast section in
https://doc.rust-lang.org/book/first-edition/casting-between-types.html [The Reference Book][1].
[1]: https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions
"##, "##,
E0609: r##" E0609: r##"
@ -4019,8 +4032,8 @@ println!("x: {}, y: {}", variable.x, variable.y);
``` ```
For more information about primitives and structs, take a look at The Book: For more information about primitives and structs, take a look at The Book:
https://doc.rust-lang.org/book/first-edition/primitive-types.html https://doc.rust-lang.org/book/ch03-02-data-types.html
https://doc.rust-lang.org/book/first-edition/structs.html https://doc.rust-lang.org/book/ch05-00-structs.html
"##, "##,
E0614: r##" E0614: r##"

View file

@ -137,7 +137,7 @@ To fix this error, don't try to cast directly between thin and fat
pointers. pointers.
For more information about casts, take a look at The Book: For more information about casts, take a look at The Book:
https://doc.rust-lang.org/book/first-edition/casting-between-types.html"); https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions");
err err
} }
} }

View file

@ -129,10 +129,10 @@
//! [`std::string`]: ../string/index.html //! [`std::string`]: ../string/index.html
//! [`std::vec`]: ../vec/index.html //! [`std::vec`]: ../vec/index.html
//! [`to_owned`]: ../borrow/trait.ToOwned.html#tymethod.to_owned //! [`to_owned`]: ../borrow/trait.ToOwned.html#tymethod.to_owned
//! [book-closures]: ../../book/first-edition/closures.html //! [book-closures]: ../../book/ch13-01-closures.html
//! [book-dtor]: ../../book/first-edition/drop.html //! [book-dtor]: ../../book/ch15-03-drop.html
//! [book-enums]: ../../book/first-edition/enums.html //! [book-enums]: ../../book/ch06-01-defining-an-enum.html
//! [book-iter]: ../../book/first-edition/iterators.html //! [book-iter]: ../../book/ch13-02-iterators.html
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]

View file

@ -6,7 +6,7 @@
//! benchmarks themselves) should be done via the `#[test]` and //! benchmarks themselves) should be done via the `#[test]` and
//! `#[bench]` attributes. //! `#[bench]` attributes.
//! //!
//! See the [Testing Chapter](../book/first-edition/testing.html) of the book for more details. //! See the [Testing Chapter](../book/ch11-00-testing.html) of the book for more details.
// Currently, not much of this is meant for users. It is intended to // Currently, not much of this is meant for users. It is intended to
// support the simplest interface possible for representing and // support the simplest interface possible for representing and