Skip to content

Commit 01ef4b2

Browse files
committed
Auto merge of #105763 - Ezrashaw:rustc-book-relative-links, r=jyn514
Use relative links in the unstable and rustc book Fixes #98227. As it stands, potential issues could arise from mismatch of stable/ nightly in the books. This PR fixes this issue by using relative links instead of absolute ones. I have replaced every absolute link under `src/doc/rustc` and `src/doc/unstable-book/` and tested each manually. The link at `src/doc/rustc/src/targets/index.md:7`: `[here](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/struct.Target.html).` I need help with because my local directory structure and https://doc.rust-lang.org/ seem to be different, where is `nightly-rustc`? `@jyn514`
2 parents a803f31 + 9ea3550 commit 01ef4b2

File tree

14 files changed

+23
-23
lines changed

14 files changed

+23
-23
lines changed

src/doc/rustc/src/exploit-mitigations.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ It is recommended that explicit wrapping methods such as `wrapping_add` be
217217
used when wrapping semantics are intended, and that explicit checking and
218218
wrapping methods always be used when using Unsafe Rust.
219219

220-
<small id="fn:2">2\. See <https://doc.rust-lang.org/std/primitive.u32.html>
220+
<small id="fn:2">2\. See [the `u32` docs](../std/primitive.u32.html)
221221
for more information on the checked, overflowing, saturating, and wrapping
222222
methods (using u32 as an example). <a href="#fnref:2"
223223
class="reversefootnote" role="doc-backlink">↩</a></small>
@@ -575,17 +575,17 @@ defaults (unrelated to `READ_IMPLIES_EXEC`).
575575
<https://hacks.mozilla.org/2019/02/fearless-security-thread-safety/>.
576576

577577
3. S. Klabnik and C. Nichols. “What Is Ownership?.” The Rust Programming
578-
Language. <https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html>.
578+
Language. [https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html](../book/ch04-01-what-is-ownership.html).
579579

580580
4. S. Klabnik and C. Nichols. “References and Borrowing.” The Rust
581581
Programming Language.
582-
<https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html>.
582+
[https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html](../book/ch04-02-references-and-borrowing.html).
583583

584584
5. S. Klabnik and C. Nichols. “The Slice Type.” The Rust Programming
585-
Language. <https://doc.rust-lang.org/book/ch04-03-slices.html>.
585+
Language. [https://doc.rust-lang.org/book/ch04-03-slices.html](../book/ch04-03-slices.html).
586586

587587
6. S. Klabnik and C. Nichols. “Unsafe Rust.” The Rust Programming Language.
588-
<https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html>.
588+
[https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html](../book/ch19-01-unsafe-rust.html).
589589

590590
7. S. Davidoff. “How Rust’s standard library was vulnerable for years and
591591
nobody noticed.” Medium.
@@ -696,4 +696,4 @@ defaults (unrelated to `READ_IMPLIES_EXEC`).
696696
for Rust #89653.” GitHub. <https://github.com/rust-lang/rust/issues/89653>.
697697

698698
41. “ControlFlowIntegrity.” The Rust Unstable Book.
699-
<https://doc.rust-lang.org/beta/unstable-book/compiler-flags/sanitizer.html#controlflowintegrity>.
699+
[https://doc.rust-lang.org/unstable-book/compiler-flags/sanitizer.html#controlflowintegrity](../unstable-book/compiler-flags/sanitizer.html#controlflowintegrity).

src/doc/rustc/src/linker-plugin-lto.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ targeting Windows-like targets
112112
This is fixed if you explicitly set the target, for example
113113
`cargo build --target x86_64-pc-windows-msvc`
114114
Without an explicit --target the flags will be passed to all compiler invocations (including build
115-
scripts and proc macros), see [cargo docs on rustflags](https://doc.rust-lang.org/cargo/reference/config.html#buildrustflags)
115+
scripts and proc macros), see [cargo docs on rustflags](../cargo/reference/config.html#buildrustflags)
116116

117117
If you have dependencies using the `cc` crate, you will need to set these
118118
environment variables:

src/doc/rustc/src/platform-support/android.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ edition of the [Android NDK]. Supported Android targets are:
4242
[Android NDK]: https://developer.android.com/ndk/downloads
4343

4444
A list of all supported targets can be found
45-
[here](https://doc.rust-lang.org/rustc/platform-support.html)
45+
[here](../platform-support.html)

src/doc/rustc/src/platform-support/armv6k-nintendo-3ds.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ to an SD card to be inserted in the device.
111111
The `cargo-3ds` tool mentioned in [Building Rust programs](#building-rust-programs)
112112
supports the use of `3dslink` with `cargo 3ds run`. The default Rust test runner
113113
is not supported, but
114-
[custom test frameworks](https://doc.rust-lang.org/beta/unstable-book/language-features/custom-test-frameworks.html)
114+
[custom test frameworks](../../unstable-book/language-features/custom-test-frameworks.html)
115115
can be used with `cargo 3ds test` to run unit tests on a device.
116116

117117
The Rust test suite for `library/std` is not yet supported.

src/doc/rustc/src/platform-support/fuchsia.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ rustup target add aarch64-fuchsia
9090
After installing our Fuchsia targets, we can now compile a Rust binary that targets
9191
Fuchsia.
9292

93-
To create our Rust project, we can issue a standard `cargo` command as follows:
93+
To create our Rust project, we can use [`cargo`][cargo] as follows:
9494

9595
**From base working directory**
9696
```sh
@@ -867,7 +867,7 @@ ${SDK_PATH}/tools/${ARCH}/ffx debug connect -- \
867867
[Fuchsia]: https://fuchsia.dev/
868868
[source tree]: https://fuchsia.dev/fuchsia-src/get-started/learn/build
869869
[rustup]: https://rustup.rs/
870-
[cargo]: https://doc.rust-lang.org/cargo/
870+
[cargo]: ../../cargo/index.html
871871
[Fuchsia SDK]: https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core
872872
[overview of CML]: https://fuchsia.dev/fuchsia-src/concepts/components/v2/component_manifests
873873
[reference for the file format]: https://fuchsia.dev/reference/cml

src/doc/rustc/src/targets/custom.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ To see it for a different target, add the `--target` flag:
1414
rustc +nightly -Z unstable-options --target=wasm32-unknown-unknown --print target-spec-json
1515
```
1616

17-
To use a custom target, see the (unstable) [`build-std` feature](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std) of `cargo`.
17+
To use a custom target, see the (unstable) [`build-std` feature](../../cargo/reference/unstable.html#build-std) of `cargo`.

src/doc/unstable-book/src/compiler-flags/branch-protection.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ For example, `-Z branch-protection=bti,pac-ret,leaf` is valid, but
1515

1616
Rust's standard library does not ship with BTI or pointer authentication enabled by default.
1717
In Cargo projects the standard library can be recompiled with pointer authentication using the nightly
18-
[build-std](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std) feature.
18+
[build-std](../../cargo/reference/unstable.html#build-std) feature.

src/doc/unstable-book/src/compiler-flags/control-flow-guard.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ It is strongly recommended to also enable CFG checks for all linked libraries, i
3939

4040
To enable CFG in the standard library, use the [cargo `-Z build-std` functionality][build-std] to recompile the standard library with the same configuration options as the main program.
4141

42-
[build-std]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std
42+
[build-std]: ../../cargo/reference/unstable.html#build-std
4343

4444
For example:
4545
```cmd

src/doc/unstable-book/src/compiler-flags/sanitizer.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,8 @@ flow using an indirect branch/call to a function with different return and
420420
parameter types than the return type expected and arguments intended/passed in
421421
the call/branch site, the execution is also terminated (see Fig. 9).
422422
423-
[rust-book-ch19-05]: https://doc.rust-lang.org/book/ch19-05-advanced-functions-and-closures.html
424-
[rust-book]: https://doc.rust-lang.org/book/title-page.html
423+
[rust-book-ch19-05]: ../../book/ch19-05-advanced-functions-and-closures.html
424+
[rust-book]: ../../book/title-page.html
425425
426426
# HWAddressSanitizer
427427
@@ -691,7 +691,7 @@ It is strongly recommended to combine sanitizers with recompiled and
691691
instrumented standard library, for example using [cargo `-Zbuild-std`
692692
functionality][build-std].
693693
694-
[build-std]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std
694+
[build-std]: ../../cargo/reference/unstable.html#build-std
695695
696696
# Build scripts and procedural macros
697697

src/doc/unstable-book/src/compiler-flags/virtual-function-elimination.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ optimized out, if unused. However, with `make_foo` you can produce a wrapped
3636
to inlining of `f`, `Foo::foo` can then be called from a foreign crate. This can
3737
lead to miscompilations.
3838

39-
[Clto]: https://doc.rust-lang.org/rustc/codegen-options/index.html#lto
39+
[Clto]: ../../rustc/codegen-options/index.html#lto

src/doc/unstable-book/src/language-features/auto-traits.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ that are automatically implemented for every type, unless the type, or a type it
1313
has explicitly opted out via a negative impl. (Negative impls are separately controlled
1414
by the `negative_impls` feature.)
1515

16-
[`Send`]: https://doc.rust-lang.org/std/marker/trait.Send.html
17-
[`Sync`]: https://doc.rust-lang.org/std/marker/trait.Sync.html
16+
[`Send`]: ../../std/marker/trait.Send.html
17+
[`Sync`]: ../../std/marker/trait.Sync.html
1818

1919
```rust,ignore (partial-example)
2020
impl !Trait for Type {}

src/doc/unstable-book/src/language-features/unboxed-closures.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The `unboxed_closures` feature allows you to write functions using the `"rust-ca
1212
required for implementing the [`Fn*`] family of traits. `"rust-call"` functions must have
1313
exactly one (non self) argument, a tuple representing the argument list.
1414

15-
[`Fn*`]: https://doc.rust-lang.org/std/ops/trait.Fn.html
15+
[`Fn*`]: ../../std/ops/trait.Fn.html
1616

1717
```rust
1818
#![feature(unboxed_closures)]

src/doc/unstable-book/src/library-features/default-free-fn.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Adds a free `default()` function to the `std::default` module. This function
1010
just forwards to [`Default::default()`], but may remove repetition of the word
1111
"default" from the call site.
1212

13-
[`Default::default()`]: https://doc.rust-lang.org/nightly/std/default/trait.Default.html#tymethod.default
13+
[`Default::default()`]: ../../std/default/trait.Default.html#tymethod.default
1414

1515
Here is an example:
1616

src/doc/unstable-book/src/library-features/fn-traits.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ See Also: [`unboxed_closures`](../language-features/unboxed-closures.md)
1111
The `fn_traits` feature allows for implementation of the [`Fn*`] traits
1212
for creating custom closure-like types.
1313

14-
[`Fn*`]: https://doc.rust-lang.org/std/ops/trait.Fn.html
14+
[`Fn*`]: ../../std/ops/trait.Fn.html
1515

1616
```rust
1717
#![feature(unboxed_closures)]

0 commit comments

Comments
 (0)