Skip to content

Commit

Permalink
Rollup merge of rust-lang#57856 - lzutao:fix-old-first-edition, r=ste…
Browse files Browse the repository at this point in the history
…veklabnik

Convert old first edition links to current edition one

r? @steveklabnik
  • Loading branch information
Centril authored Feb 14, 2019
2 parents 93ecae6 + e7f8e63 commit aa896f3
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 50 deletions.
2 changes: 1 addition & 1 deletion src/doc/guide-error-handling.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
% Error Handling in Rust

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).
2 changes: 1 addition & 1 deletion src/doc/guide-ownership.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
% The (old) Rust Ownership Guide

This content has moved into
[the Rust Programming Language book](book/ownership.html).
[the Rust Programming Language book](book/ch04-00-understanding-ownership.html).
2 changes: 1 addition & 1 deletion src/doc/guide-pointers.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

This content has been removed, with no direct replacement. Rust only
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
types, they’re gone now.
2 changes: 1 addition & 1 deletion src/doc/guide-testing.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
% The (old) Rust Testing Guide

This content has moved into
[the Rust Programming Language book](book/testing.html).
[the Rust Programming Language book](book/ch11-00-testing.html).
5 changes: 1 addition & 4 deletions src/libcore/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ pub const fn identity<T>(x: T) -> T { x }
/// - 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
///
/// See [the book][book] for a more detailed comparison.
///
/// [book]: ../../book/first-edition/borrow-and-asref.html
/// [`Borrow`]: ../../std/borrow/trait.Borrow.html
///
/// **Note: this trait must not fail**. If the conversion can fail, use a
Expand Down Expand Up @@ -351,7 +348,7 @@ pub trait Into<T>: Sized {
/// [`String`]: ../../std/string/struct.String.html
/// [`Into<U>`]: trait.Into.html
/// [`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")]
pub trait From<T>: Sized {
/// Performs the conversion.
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl<T: ?Sized> !Send for *mut T { }
/// // 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")]
#[lang = "sized"]
#[rustc_on_unimplemented(
Expand Down Expand Up @@ -518,7 +518,7 @@ macro_rules! impls{
/// types. We track the Rust type using a phantom type parameter on
/// 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)]
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ pub const fn size_of<T>() -> usize {
/// then `size_of_val` can be used to get the dynamically-known size.
///
/// [slice]: ../../std/primitive.slice.html
/// [trait object]: ../../book/first-edition/trait-objects.html
/// [trait object]: ../../book/ch17-02-trait-objects.html
///
/// # Examples
///
Expand Down
4 changes: 3 additions & 1 deletion src/libproc_macro/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
//! function-like macros `#[proc_macro]`, macro attributes `#[proc_macro_attribute]` and
//! 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")]
#![deny(missing_docs)]
Expand Down
9 changes: 6 additions & 3 deletions src/librustc/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ignore-tidy-linelength
#![allow(non_snake_case)]

// Error messages for EXXXX errors.
Expand Down Expand Up @@ -410,7 +411,7 @@ fn baz<'a>(x: &'a str, y: &str) -> &str { }
Lifetime elision in implementation headers was part of the lifetime elision
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
"##,

Expand Down Expand Up @@ -646,7 +647,9 @@ attributes:
#![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##"
Expand Down Expand Up @@ -1713,7 +1716,7 @@ fn main() {
```
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##"
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern {}
```
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##"
Expand Down
14 changes: 7 additions & 7 deletions src/librustc_mir/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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##"
Expand Down Expand Up @@ -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
Book:
https://doc.rust-lang.org/book/first-edition/ownership.html
https://doc.rust-lang.org/book/ch04-00-understanding-ownership.html
"##,

E0383: r##"
Expand Down Expand Up @@ -1207,7 +1207,7 @@ let mut a = &mut i;
Please note that in rust, you can either have many immutable references, or one
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:
Expand Down Expand Up @@ -1374,7 +1374,7 @@ fn foo(a: &mut i32) {
```
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##"
Expand Down Expand Up @@ -1430,7 +1430,7 @@ fn main() {
```
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##"
Expand Down Expand Up @@ -1614,7 +1614,7 @@ fn main() {
```
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##"
Expand Down Expand Up @@ -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:
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##"
Expand Down
55 changes: 34 additions & 21 deletions src/librustc_typeck/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ignore-tidy-linelength
#![allow(non_snake_case)]

register_long_diagnostics! {
Expand Down Expand Up @@ -1544,7 +1545,9 @@ fn f<T>() {}
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
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 _:
Expand Down Expand Up @@ -2918,10 +2921,11 @@ impl Baz for Bar { } // Note: This is OK

E0374: r##"
A struct without a field containing an unsized type cannot implement
`CoerceUnsized`. An
[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
compile time. Any struct containing an unsized type is also unsized.
`CoerceUnsized`. An [unsized type][1] 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.
[1]: https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait
Example of erroneous code:
Expand Down Expand Up @@ -2978,9 +2982,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
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
takes. An [unsized type] 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.
takes. An [unsized type][1] 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.
Example of erroneous code:
Expand Down Expand Up @@ -3025,19 +3029,20 @@ 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##"
The type you are trying to impl `CoerceUnsized` for is not a struct.
`CoerceUnsized` can only be implemented for a struct. Unsized types are
already able to be coerced without an implementation of `CoerceUnsized`
whereas a struct containing an unsized type needs to know the unsized type
field it's containing is able to be coerced. An
[unsized type](https://doc.rust-lang.org/book/first-edition/unsized-types.html)
field it's containing is able to be coerced. An [unsized type][1]
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.
[1]: https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait
Example of erroneous code:
```compile_fail,E0376
Expand Down Expand Up @@ -3883,8 +3888,10 @@ let c = 86u8 as char; // ok!
assert_eq!(c, 'V');
```
For more information about casts, take a look at The Book:
https://doc.rust-lang.org/book/first-edition/casting-between-types.html
For more information about casts, take a look at the Type cast section in
[The Reference Book][1].
[1]: https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions
"##,

E0605: r##"
Expand Down Expand Up @@ -3912,8 +3919,10 @@ let v = 0 as *const u8;
v as *const i8; // ok!
```
For more information about casts, take a look at The Book:
https://doc.rust-lang.org/book/first-edition/casting-between-types.html
For more information about casts, take a look at the Type cast section in
[The Reference Book][1].
[1]: https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions
"##,

E0606: r##"
Expand All @@ -3934,8 +3943,10 @@ let x = &0u8;
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:
https://doc.rust-lang.org/book/first-edition/casting-between-types.html
For more information about casts, take a look at the Type cast section in
[The Reference Book][1].
[1]: https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions
"##,

E0607: r##"
Expand All @@ -3961,8 +3972,10 @@ pointer holds is their size.
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:
https://doc.rust-lang.org/book/first-edition/casting-between-types.html
For more information about casts, take a look at the Type cast section in
[The Reference Book][1].
[1]: https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions
"##,

E0609: r##"
Expand Down Expand Up @@ -4020,8 +4033,8 @@ println!("x: {}, y: {}", variable.x, variable.y);
```
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/first-edition/structs.html
https://doc.rust-lang.org/book/ch03-02-data-types.html
https://doc.rust-lang.org/book/ch05-00-structs.html
"##,

E0614: r##"
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/structured_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ 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:
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
}
}
8 changes: 4 additions & 4 deletions src/libstd/prelude/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@
//! [`std::string`]: ../string/index.html
//! [`std::vec`]: ../vec/index.html
//! [`to_owned`]: ../borrow/trait.ToOwned.html#tymethod.to_owned
//! [book-closures]: ../../book/first-edition/closures.html
//! [book-dtor]: ../../book/first-edition/drop.html
//! [book-enums]: ../../book/first-edition/enums.html
//! [book-iter]: ../../book/first-edition/iterators.html
//! [book-closures]: ../../book/ch13-01-closures.html
//! [book-dtor]: ../../book/ch15-03-drop.html
//! [book-enums]: ../../book/ch06-01-defining-an-enum.html
//! [book-iter]: ../../book/ch13-02-iterators.html

#![stable(feature = "rust1", since = "1.0.0")]

Expand Down
2 changes: 1 addition & 1 deletion src/libtest/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! benchmarks themselves) should be done via the `#[test]` and
//! `#[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
// support the simplest interface possible for representing and
Expand Down

0 comments on commit aa896f3

Please sign in to comment.