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`
This commit is contained in:
bors 2022-12-16 09:30:56 +00:00
commit 01ef4b21dc
14 changed files with 23 additions and 23 deletions

View File

@ -217,7 +217,7 @@ It is recommended that explicit wrapping methods such as `wrapping_add` be
used when wrapping semantics are intended, and that explicit checking and
wrapping methods always be used when using Unsafe Rust.
<small id="fn:2">2\. See <https://doc.rust-lang.org/std/primitive.u32.html>
<small id="fn:2">2\. See [the `u32` docs](../std/primitive.u32.html)
for more information on the checked, overflowing, saturating, and wrapping
methods (using u32 as an example). <a href="#fnref:2"
class="reversefootnote" role="doc-backlink">↩</a></small>
@ -575,17 +575,17 @@ defaults (unrelated to `READ_IMPLIES_EXEC`).
<https://hacks.mozilla.org/2019/02/fearless-security-thread-safety/>.
3. S. Klabnik and C. Nichols. “What Is Ownership?.” The Rust Programming
Language. <https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html>.
Language. [https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html](../book/ch04-01-what-is-ownership.html).
4. S. Klabnik and C. Nichols. “References and Borrowing.” The Rust
Programming Language.
<https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html>.
[https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html](../book/ch04-02-references-and-borrowing.html).
5. S. Klabnik and C. Nichols. “The Slice Type.” The Rust Programming
Language. <https://doc.rust-lang.org/book/ch04-03-slices.html>.
Language. [https://doc.rust-lang.org/book/ch04-03-slices.html](../book/ch04-03-slices.html).
6. S. Klabnik and C. Nichols. “Unsafe Rust.” The Rust Programming Language.
<https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html>.
[https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html](../book/ch19-01-unsafe-rust.html).
7. S. Davidoff. “How Rusts standard library was vulnerable for years and
nobody noticed.” Medium.
@ -696,4 +696,4 @@ defaults (unrelated to `READ_IMPLIES_EXEC`).
for Rust #89653.” GitHub. <https://github.com/rust-lang/rust/issues/89653>.
41. “ControlFlowIntegrity.” The Rust Unstable Book.
<https://doc.rust-lang.org/beta/unstable-book/compiler-flags/sanitizer.html#controlflowintegrity>.
[https://doc.rust-lang.org/unstable-book/compiler-flags/sanitizer.html#controlflowintegrity](../unstable-book/compiler-flags/sanitizer.html#controlflowintegrity).

View File

@ -112,7 +112,7 @@ targeting Windows-like targets
This is fixed if you explicitly set the target, for example
`cargo build --target x86_64-pc-windows-msvc`
Without an explicit --target the flags will be passed to all compiler invocations (including build
scripts and proc macros), see [cargo docs on rustflags](https://doc.rust-lang.org/cargo/reference/config.html#buildrustflags)
scripts and proc macros), see [cargo docs on rustflags](../cargo/reference/config.html#buildrustflags)
If you have dependencies using the `cc` crate, you will need to set these
environment variables:

View File

@ -42,4 +42,4 @@ edition of the [Android NDK]. Supported Android targets are:
[Android NDK]: https://developer.android.com/ndk/downloads
A list of all supported targets can be found
[here](https://doc.rust-lang.org/rustc/platform-support.html)
[here](../platform-support.html)

View File

@ -111,7 +111,7 @@ to an SD card to be inserted in the device.
The `cargo-3ds` tool mentioned in [Building Rust programs](#building-rust-programs)
supports the use of `3dslink` with `cargo 3ds run`. The default Rust test runner
is not supported, but
[custom test frameworks](https://doc.rust-lang.org/beta/unstable-book/language-features/custom-test-frameworks.html)
[custom test frameworks](../../unstable-book/language-features/custom-test-frameworks.html)
can be used with `cargo 3ds test` to run unit tests on a device.
The Rust test suite for `library/std` is not yet supported.

View File

@ -90,7 +90,7 @@ rustup target add aarch64-fuchsia
After installing our Fuchsia targets, we can now compile a Rust binary that targets
Fuchsia.
To create our Rust project, we can issue a standard `cargo` command as follows:
To create our Rust project, we can use [`cargo`][cargo] as follows:
**From base working directory**
```sh
@ -867,7 +867,7 @@ ${SDK_PATH}/tools/${ARCH}/ffx debug connect -- \
[Fuchsia]: https://fuchsia.dev/
[source tree]: https://fuchsia.dev/fuchsia-src/get-started/learn/build
[rustup]: https://rustup.rs/
[cargo]: https://doc.rust-lang.org/cargo/
[cargo]: ../../cargo/index.html
[Fuchsia SDK]: https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core
[overview of CML]: https://fuchsia.dev/fuchsia-src/concepts/components/v2/component_manifests
[reference for the file format]: https://fuchsia.dev/reference/cml

View File

@ -14,4 +14,4 @@ To see it for a different target, add the `--target` flag:
rustc +nightly -Z unstable-options --target=wasm32-unknown-unknown --print target-spec-json
```
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`.
To use a custom target, see the (unstable) [`build-std` feature](../../cargo/reference/unstable.html#build-std) of `cargo`.

View File

@ -15,4 +15,4 @@ For example, `-Z branch-protection=bti,pac-ret,leaf` is valid, but
Rust's standard library does not ship with BTI or pointer authentication enabled by default.
In Cargo projects the standard library can be recompiled with pointer authentication using the nightly
[build-std](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std) feature.
[build-std](../../cargo/reference/unstable.html#build-std) feature.

View File

@ -39,7 +39,7 @@ It is strongly recommended to also enable CFG checks for all linked libraries, i
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.
[build-std]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std
[build-std]: ../../cargo/reference/unstable.html#build-std
For example:
```cmd

View File

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

View File

@ -36,4 +36,4 @@ optimized out, if unused. However, with `make_foo` you can produce a wrapped
to inlining of `f`, `Foo::foo` can then be called from a foreign crate. This can
lead to miscompilations.
[Clto]: https://doc.rust-lang.org/rustc/codegen-options/index.html#lto
[Clto]: ../../rustc/codegen-options/index.html#lto

View File

@ -13,8 +13,8 @@ that are automatically implemented for every type, unless the type, or a type it
has explicitly opted out via a negative impl. (Negative impls are separately controlled
by the `negative_impls` feature.)
[`Send`]: https://doc.rust-lang.org/std/marker/trait.Send.html
[`Sync`]: https://doc.rust-lang.org/std/marker/trait.Sync.html
[`Send`]: ../../std/marker/trait.Send.html
[`Sync`]: ../../std/marker/trait.Sync.html
```rust,ignore (partial-example)
impl !Trait for Type {}

View File

@ -12,7 +12,7 @@ The `unboxed_closures` feature allows you to write functions using the `"rust-ca
required for implementing the [`Fn*`] family of traits. `"rust-call"` functions must have
exactly one (non self) argument, a tuple representing the argument list.
[`Fn*`]: https://doc.rust-lang.org/std/ops/trait.Fn.html
[`Fn*`]: ../../std/ops/trait.Fn.html
```rust
#![feature(unboxed_closures)]

View File

@ -10,7 +10,7 @@ Adds a free `default()` function to the `std::default` module. This function
just forwards to [`Default::default()`], but may remove repetition of the word
"default" from the call site.
[`Default::default()`]: https://doc.rust-lang.org/nightly/std/default/trait.Default.html#tymethod.default
[`Default::default()`]: ../../std/default/trait.Default.html#tymethod.default
Here is an example:

View File

@ -11,7 +11,7 @@ See Also: [`unboxed_closures`](../language-features/unboxed-closures.md)
The `fn_traits` feature allows for implementation of the [`Fn*`] traits
for creating custom closure-like types.
[`Fn*`]: https://doc.rust-lang.org/std/ops/trait.Fn.html
[`Fn*`]: ../../std/ops/trait.Fn.html
```rust
#![feature(unboxed_closures)]