Skip to content

Commit 1ad46cd

Browse files
committed
Fix links on keyword docs.
- Make links relative. - Adjust links from old 2018-edition book. - Fix broken link in `let` docs.
1 parent 3750348 commit 1ad46cd

File tree

1 file changed

+25
-30
lines changed

1 file changed

+25
-30
lines changed

src/libstd/keyword_docs.rs

+25-30
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
///
2626
/// For more information on what `as` is capable of, see the [Reference]
2727
///
28-
/// [Reference]:
29-
/// https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions
28+
/// [Reference]: ../reference/expressions/operator-expr.html#type-cast-expressions
3029
/// [`crate`]: keyword.crate.html
3130
mod as_keyword { }
3231

@@ -80,8 +79,8 @@ mod as_keyword { }
8079
///
8180
/// [pointer]: primitive.pointer.html
8281
/// [Rust Book]:
83-
/// https://doc.rust-lang.org/stable/book/2018-edition/ch03-01-variables-and-mutability.html#differences-between-variables-and-constants
84-
/// [Reference]: https://doc.rust-lang.org/reference/items/constant-items.html
82+
/// ../book/ch03-01-variables-and-mutability.html#differences-between-variables-and-constants
83+
/// [Reference]: ../reference/items/constant-items.html
8584
mod const_keyword { }
8685

8786
#[doc(keyword = "crate")]
@@ -114,7 +113,7 @@ mod const_keyword { }
114113
/// }
115114
/// ```
116115
///
117-
/// [Reference]: https://doc.rust-lang.org/reference/items/extern-crates.html
116+
/// [Reference]: ../reference/items/extern-crates.html
118117
mod crate_keyword { }
119118

120119
#[doc(keyword = "enum")]
@@ -169,8 +168,8 @@ mod crate_keyword { }
169168
///
170169
/// [Algebraic Data Types]: https://en.wikipedia.org/wiki/Algebraic_data_type
171170
/// [`Option`]: option/enum.Option.html
172-
/// [Rust Book]: https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html
173-
/// [Reference]: https://doc.rust-lang.org/reference/items/enumerations.html
171+
/// [Rust Book]: ../book/ch06-01-defining-an-enum.html
172+
/// [Reference]: ../reference/items/enumerations.html
174173
mod enum_keyword { }
175174

176175
#[doc(keyword = "extern")]
@@ -211,8 +210,8 @@ mod enum_keyword { }
211210
/// For more information on FFI, check the [Rust book] or the [Reference].
212211
///
213212
/// [Rust book]:
214-
/// https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html#using-extern-functions-to-call-external-code
215-
/// [Reference]: https://doc.rust-lang.org/reference/items/external-blocks.html
213+
/// ../book/ch19-01-unsafe-rust.html#using-extern-functions-to-call-external-code
214+
/// [Reference]: ../reference/items/external-blocks.html
216215
mod extern_keyword { }
217216

218217
#[doc(keyword = "fn")]
@@ -278,8 +277,8 @@ mod extern_keyword { }
278277
///
279278
/// [`impl`]: keyword.impl.html
280279
/// [`extern`]: keyword.extern.html
281-
/// [Rust book]: https://doc.rust-lang.org/book/ch03-03-how-functions-work.html
282-
/// [Reference]: https://doc.rust-lang.org/reference/items/functions.html
280+
/// [Rust book]: ../book/ch03-03-how-functions-work.html
281+
/// [Reference]: ../reference/items/functions.html
283282
mod fn_keyword { }
284283

285284
#[doc(keyword = "for")]
@@ -352,12 +351,11 @@ mod fn_keyword { }
352351
/// For more information on for-loops, see the [Rust book] or the [Reference].
353352
///
354353
/// [`impl`]: keyword.impl.html
355-
/// [higher-ranked trait bounds]:
356-
/// https://doc.rust-lang.org/nightly/reference/trait-bounds.html#higher-ranked-trait-bounds
354+
/// [higher-ranked trait bounds]: ../reference/trait-bounds.html#higher-ranked-trait-bounds
357355
/// [`IntoIterator`]: iter/trait.IntoIterator.html
358356
/// [Rust book]:
359-
/// https://doc.rust-lang.org/book/2018-edition/ch03-05-control-flow.html#looping-through-a-collection-with-for
360-
/// [Reference]: https://doc.rust-lang.org/reference/expressions/loop-expr.html#iterator-loops
357+
/// ../book/ch03-05-control-flow.html#looping-through-a-collection-with-for
358+
/// [Reference]: ../reference/expressions/loop-expr.html#iterator-loops
361359
mod for_keyword { }
362360

363361
#[doc(keyword = "if")]
@@ -430,9 +428,8 @@ mod for_keyword { }
430428
///
431429
/// For more information on `if` expressions, see the [Rust book] or the [Reference].
432430
///
433-
/// [Rust book]:
434-
/// https://doc.rust-lang.org/stable/book/2018-edition/ch03-05-control-flow.html#if-expressions
435-
/// [Reference]: https://doc.rust-lang.org/reference/expressions/if-expr.html
431+
/// [Rust book]: ../book/ch03-05-control-flow.html#if-expressions
432+
/// [Reference]: ../reference/expressions/if-expr.html
436433
mod if_keyword { }
437434

438435
#[doc(keyword = "impl")]
@@ -493,10 +490,9 @@ mod if_keyword { }
493490
///
494491
/// For more information on `impl Trait` syntax, see the [Rust book][book2].
495492
///
496-
/// [book1]: https://doc.rust-lang.org/stable/book/2018-edition/ch05-03-method-syntax.html
497-
/// [Reference]: https://doc.rust-lang.org/reference/items/implementations.html
498-
/// [book2]:
499-
/// https://doc.rust-lang.org/stable/book/2018-edition/ch10-02-traits.html#returning-traits
493+
/// [book1]: ../book/ch05-03-method-syntax.html
494+
/// [Reference]: ../reference/items/implementations.html
495+
/// [book2]: ../book/ch10-02-traits.html#returning-types-that-implement-traits
500496
mod impl_keyword { }
501497

502498
#[doc(keyword = "let")]
@@ -554,13 +550,12 @@ mod impl_keyword { }
554550
/// enumerations. `while let` also exists, which runs a loop with a pattern matched value until
555551
/// that pattern can't be matched.
556552
///
557-
/// For more information on the `let` keyword, see the [Rust book] or the [Reference]
553+
/// For more information on the `let` keyword, see the [Rust book][book2] or the [Reference]
558554
///
559-
/// [book1]: https://doc.rust-lang.org/stable/book/2018-edition/ch06-02-match.html
555+
/// [book1]: ../book/ch06-02-match.html
560556
/// [`if`]: keyword.if.html
561-
/// [book2]:
562-
/// https://doc.rust-lang.org/stable/book/2018-edition/ch18-01-all-the-places-for-patterns.html#let-statements
563-
/// [Reference]: https://doc.rust-lang.org/reference/statements.html#let-statements
557+
/// [book2]: ../book/ch18-01-all-the-places-for-patterns.html#let-statements
558+
/// [Reference]: ../reference/statements.html#let-statements
564559
mod let_keyword { }
565560

566561
#[doc(keyword = "loop")]
@@ -605,7 +600,7 @@ mod let_keyword { }
605600
///
606601
/// For more information on `loop` and loops in general, see the [Reference].
607602
///
608-
/// [Reference]: https://doc.rust-lang.org/reference/expressions/loop-expr.html
603+
/// [Reference]: ../reference/expressions/loop-expr.html
609604
mod loop_keyword { }
610605

611606
#[doc(keyword = "struct")]
@@ -712,6 +707,6 @@ mod loop_keyword { }
712707
/// [Reference][reference].
713708
///
714709
/// [`PhantomData`]: marker/struct.PhantomData.html
715-
/// [book]: https://doc.rust-lang.org/book/ch05-01-defining-structs.html
716-
/// [reference]: https://doc.rust-lang.org/reference/items/structs.html
710+
/// [book]: ../book/ch05-01-defining-structs.html
711+
/// [reference]: ../reference/items/structs.html
717712
mod struct_keyword { }

0 commit comments

Comments
 (0)