diff options
| author | Tshepang Mbambo <hopsi@tuta.io> | 2025-06-09 07:19:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-09 07:19:50 +0200 |
| commit | 4967fd24dec0b178e8766c0d5ce6146d2fd2c152 (patch) | |
| tree | 84784da83b710a97f9944b753c9d7717e37b631b /src/doc | |
| parent | 8290ab531ce162a920da5d3c625889697ff65375 (diff) | |
| parent | 7565e75591c2ef184bc7a359b3a436a62d45358a (diff) | |
| download | rust-4967fd24dec0b178e8766c0d5ce6146d2fd2c152.tar.gz rust-4967fd24dec0b178e8766c0d5ce6146d2fd2c152.zip | |
Merge pull request #2461 from rust-lang/rustc-pull
Rustc pull update
Diffstat (limited to 'src/doc')
| m--------- | src/doc/book | 0 | ||||
| m--------- | src/doc/embedded-book | 0 | ||||
| m--------- | src/doc/nomicon | 0 | ||||
| m--------- | src/doc/reference | 0 | ||||
| m--------- | src/doc/rust-by-example | 0 | ||||
| -rw-r--r-- | src/doc/rustc-dev-guide/rust-version | 2 | ||||
| -rw-r--r-- | src/doc/rustc-dev-guide/src/building/suggested.md | 8 | ||||
| -rw-r--r-- | src/doc/rustc/src/codegen-options/index.md | 52 | ||||
| -rw-r--r-- | src/doc/rustc/src/platform-support.md | 4 | ||||
| -rw-r--r-- | src/doc/rustc/src/platform-support/solaris.md | 4 | ||||
| -rw-r--r-- | src/doc/rustdoc/src/write-documentation/the-doc-attribute.md | 32 |
11 files changed, 86 insertions, 16 deletions
diff --git a/src/doc/book b/src/doc/book -Subproject 230c68bc1e08f5f3228384a28cc228c81dfbd10 +Subproject 634724ea85ebb08a542970bf8871ac8b0f77fd1 diff --git a/src/doc/embedded-book b/src/doc/embedded-book -Subproject 0b8219ac23a3e09464e4e0166c768cf1c4bba0d +Subproject 10fa1e084365f23f24ad0000df541923385b73b diff --git a/src/doc/nomicon b/src/doc/nomicon -Subproject c76a20f0d987145dcedf05c5c073ce8d91f2e82 +Subproject 8b61acfaea822e9ac926190bc8f15791c33336e diff --git a/src/doc/reference b/src/doc/reference -Subproject 118fd1f1f0854f50e3ae1fe4b64862aad23009c +Subproject 8e0f593a30f3b56ddb0908fb7ab9249974e0873 diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example -Subproject c9d151f9147c4808c77f0375ba3fa5d54443cb9 +Subproject 21f4e32b8b40d36453fae16ec07ad4b857c445b diff --git a/src/doc/rustc-dev-guide/rust-version b/src/doc/rustc-dev-guide/rust-version index 8b48bd518bd..c8721bb3600 100644 --- a/src/doc/rustc-dev-guide/rust-version +++ b/src/doc/rustc-dev-guide/rust-version @@ -1 +1 @@ -c68032fd4c442d275f4daa571ba19c076106b490 +c31cccb7b5cc098b1a8c1794ed38d7fdbec0ccb0 diff --git a/src/doc/rustc-dev-guide/src/building/suggested.md b/src/doc/rustc-dev-guide/src/building/suggested.md index 76c39608449..bfb2f4d1084 100644 --- a/src/doc/rustc-dev-guide/src/building/suggested.md +++ b/src/doc/rustc-dev-guide/src/building/suggested.md @@ -59,6 +59,14 @@ always overrides the inner ones. ## Configuring `rust-analyzer` for `rustc` +### Checking the "library" tree + +Checking the "library" tree requires a stage1 compiler, which can be a heavy process on some computers. +For this reason, bootstrap has a flag called `--skip-std-check-if-no-download-rustc` that skips checking the +"library" tree if `rust.download-rustc` isn't available. If you want to avoid putting a heavy load on your computer +with `rust-analyzer`, you can add the `--skip-std-check-if-no-download-rustc` flag to your `./x check` command in +the `rust-analyzer` configuration. + ### Project-local rust-analyzer setup `rust-analyzer` can help you check and format your code whenever you save a diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md index a3b70e7f977..bb109adf76f 100644 --- a/src/doc/rustc/src/codegen-options/index.md +++ b/src/doc/rustc/src/codegen-options/index.md @@ -192,6 +192,8 @@ to save information after compiling a crate to be reused when recompiling the crate, improving re-compile times. This takes a path to a directory where incremental files will be stored. +Using incremental compilation inhibits certain optimizations (for example by increasing the amount of codegen units) and is therefore not recommended for release builds. + ## inline-threshold This option is deprecated and does nothing. @@ -213,6 +215,8 @@ This flag lets you append a single extra argument to the linker invocation. "Append" is significant; you can pass this flag multiple times to add multiple arguments. +On Unix-like targets that use `cc` as the linker driver, use `-Clink-arg=-Wl,$ARG` to pass an argument to the actual linker. + ## link-args This flag lets you append multiple extra arguments to the linker invocation. The @@ -248,6 +252,10 @@ path to the linker executable. If this flag is not specified, the linker will be inferred based on the target. See also the [linker-flavor](#linker-flavor) flag for another way to specify the linker. +Note that on Unix-like targets (for example, `*-unknown-linux-gnu` or `*-unknown-freebsd`) +the C compiler (for example `cc` or `clang`) is used as the "linker" here, serving as a linker driver. +It will invoke the actual linker with all the necessary flags to be able to link against the system libraries like libc. + ## linker-flavor This flag controls the linker flavor used by `rustc`. If a linker is given with @@ -301,6 +309,12 @@ The list must be separated by spaces. Pass `--help` to see a list of options. +<div class="warning"> + +Because this flag directly talks to LLVM, it is not subject to the usual stability guarantees of rustc's CLI interface. + +</div> + ## lto This flag controls whether LLVM uses [link time @@ -315,6 +329,7 @@ linking time. It takes one of the following values: LTO](http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html). This is similar to "fat", but takes substantially less time to run while still achieving performance gains similar to "fat". + For larger projects like the Rust compiler, ThinLTO can even result in better performance than fat LTO. If `-C lto` is not specified, then the compiler will attempt to perform "thin local LTO" which performs "thin" LTO on the local crate only across its @@ -343,6 +358,8 @@ between two different versions of the same crate being linked. This flag tells the pass manager to use an empty list of passes, instead of the usual pre-populated list of passes. +When combined with `-O --emit llvm-ir`, it can be used to see the optimized LLVM IR emitted by rustc before any optimizations are applied by LLVM. + ## no-redzone This flag allows you to disable [the @@ -379,7 +396,7 @@ This flag controls the optimization level. * `2`: some optimizations. * `3`: all optimizations. * `s`: optimize for binary size. -* `z`: optimize for binary size, but also turn off loop vectorization. +* `z`: optimize for binary size, but more aggressively. Often results in larger binaries than `s` Note: The [`-O` flag][option-o-optimize] is an alias for `-C opt-level=3`. @@ -407,6 +424,9 @@ This option lets you control what happens when the code panics. If not specified, the default depends on the target. +If any crate in the crate graph uses `abort`, the final binary (`bin`, `dylib`, `cdylib`, `staticlib`) must also use `abort`. +If `std` is used as a `dylib` with `unwind`, the final binary must also use `unwind`. + ## passes This flag can be used to add extra [LLVM @@ -416,6 +436,12 @@ The list must be separated by spaces. See also the [`no-prepopulate-passes`](#no-prepopulate-passes) flag. +<div class="warning"> + +Because this flag directly talks to LLVM, it not subject to the usual stability guarantees of rustc's CLI interface. + +</div> + ## prefer-dynamic By default, `rustc` prefers to statically link dependencies. This option will @@ -523,12 +549,30 @@ The list of passes should be separated by spaces. ## rpath -This flag controls whether [`rpath`](https://en.wikipedia.org/wiki/Rpath) is -enabled. It takes one of the following values: +This flag controls whether rustc sets an [`rpath`](https://en.wikipedia.org/wiki/Rpath) for the binary. +It takes one of the following values: * `y`, `yes`, `on`, `true` or no value: enable rpath. * `n`, `no`, `off` or `false`: disable rpath (the default). +This flag only does something on Unix-like platforms (Mach-O and ELF), it is ignored on other platforms. + +If enabled, rustc will add output-relative (using `@load_path` on Mach-O and `$ORIGIN` on ELF respectively) rpaths to all `dylib` dependencies. + +For example, for the following directory structure, with `libdep.so` being a `dylib` crate compiled with `-Cprefer-dynamic`: + +```text +dep + |- libdep.so +a.rs +``` + +`rustc a.rs --extern dep=dep/libdep.so -Crpath` will, on x86-64 Linux, result in approximately the following `DT_RUNPATH`: `$ORIGIN/dep:$ORIGIN/$RELATIVE_PATH_TO_SYSROOT/lib/rustlib/x86_64-unknown-linux-gnu/lib` (where `RELATIVE_PATH_TO_SYSROOT` depends on the build directory location). + +This is primarily useful for local development, to ensure that all the `dylib` dependencies can be found appropriately. + +To set the rpath to a different value (which can be useful for distribution), `-Clink-arg` with a platform-specific linker argument can be used to set the rpath directly. + ## save-temps This flag controls whether temporary files generated during compilation are @@ -545,6 +589,8 @@ point instructions in software. It takes one of the following values: * `y`, `yes`, `on`, `true` or no value: use soft floats. * `n`, `no`, `off` or `false`: use hardware floats (the default). +This flag only works on `*eabihf` targets and **is unsound and deprecated**. + ## split-debuginfo This option controls the emission of "split debuginfo" for debug information diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index 60002a5f9e5..e7dfaaf4fd5 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -110,6 +110,8 @@ target | notes `x86_64-unknown-linux-musl` | 64-bit Linux with musl 1.2.3 [`x86_64-unknown-linux-ohos`](platform-support/openharmony.md) | x86_64 OpenHarmony [`x86_64-unknown-netbsd`](platform-support/netbsd.md) | NetBSD/amd64 +[`x86_64-pc-solaris`](platform-support/solaris.md) | 64-bit x86 Solaris 11.4 +[`sparcv9-sun-solaris`](platform-support/solaris.md) | SPARC V9 Solaris 11.4 ## Tier 2 without Host Tools @@ -183,7 +185,6 @@ target | std | notes `riscv64gc-unknown-none-elf` | * | Bare RISC-V (RV64IMAFDC ISA) `riscv64imac-unknown-none-elf` | * | Bare RISC-V (RV64IMAC ISA) `sparc64-unknown-linux-gnu` | ✓ | SPARC Linux (kernel 4.4, glibc 2.23) -[`sparcv9-sun-solaris`](platform-support/solaris.md) | ✓ | SPARC V9 Solaris 11.4 [`thumbv6m-none-eabi`](platform-support/thumbv6m-none-eabi.md) | * | Bare Armv6-M [`thumbv7em-none-eabi`](platform-support/thumbv7em-none-eabi.md) | * | Bare Armv7E-M [`thumbv7em-none-eabihf`](platform-support/thumbv7em-none-eabi.md) | * | Bare Armv7E-M, hardfloat @@ -203,7 +204,6 @@ target | std | notes [`x86_64-apple-ios-macabi`](platform-support/apple-ios-macabi.md) | ✓ | Mac Catalyst on x86_64 [`x86_64-fortanix-unknown-sgx`](platform-support/x86_64-fortanix-unknown-sgx.md) | ✓ | [Fortanix ABI] for 64-bit Intel SGX [`x86_64-linux-android`](platform-support/android.md) | ✓ | 64-bit x86 Android -[`x86_64-pc-solaris`](platform-support/solaris.md) | ✓ | 64-bit x86 Solaris 11.4 [`x86_64-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | ✓ | 64-bit x86 MinGW (Windows 10+), LLVM ABI [`x86_64-unknown-fuchsia`](platform-support/fuchsia.md) | ✓ | 64-bit x86 Fuchsia `x86_64-unknown-linux-gnux32` | ✓ | 64-bit Linux (x32 ABI) (kernel 4.15, glibc 2.27) diff --git a/src/doc/rustc/src/platform-support/solaris.md b/src/doc/rustc/src/platform-support/solaris.md index c22b5c24c12..1b2372eaa0e 100644 --- a/src/doc/rustc/src/platform-support/solaris.md +++ b/src/doc/rustc/src/platform-support/solaris.md @@ -12,7 +12,9 @@ Rust for Solaris operating system. ## Requirements -Binary built for this target is expected to run on sparcv9 or x86_64, and Solaris 11.4. +The `sparcv9-sun-solaris` and `x86_64-pc-solaris` targets are Tier 2 with host tools. + +Binary built for these targets are expected to run on sparcv9 or x86_64, and Solaris 11.4. ## Testing diff --git a/src/doc/rustdoc/src/write-documentation/the-doc-attribute.md b/src/doc/rustdoc/src/write-documentation/the-doc-attribute.md index 6ec93d1746c..65e6b417427 100644 --- a/src/doc/rustdoc/src/write-documentation/the-doc-attribute.md +++ b/src/doc/rustdoc/src/write-documentation/the-doc-attribute.md @@ -143,15 +143,6 @@ But if you include this: it will not. -### `test(attr(...))` - -This form of the `doc` attribute allows you to add arbitrary attributes to all your doctests. For -example, if you want your doctests to fail if they have dead code, you could add this: - -```rust,no_run -#![doc(test(attr(deny(dead_code))))] -``` - ## At the item level These forms of the `#[doc]` attribute are used on individual items, to control how @@ -283,3 +274,26 @@ To get around this limitation, we just add `#[doc(alias = "lib_name_do_something on the `do_something` method and then it's all good! Users can now look for `lib_name_do_something` in our crate directly and find `Obj::do_something`. + +### `test(attr(...))` + +This form of the `doc` attribute allows you to add arbitrary attributes to all your doctests. For +example, if you want your doctests to fail if they have dead code, you could add this: + +```rust,no_run +#![doc(test(attr(deny(dead_code))))] + +mod my_mod { + #![doc(test(attr(allow(dead_code))))] // but allow `dead_code` for this module +} +``` + +`test(attr(..))` attributes are appended to the parent module's, they do not replace the current +list of attributes. In the previous example, both attributes would be present: + +```rust,no_run +// For every doctest in `my_mod` + +#![deny(dead_code)] // from the crate-root +#![allow(dead_code)] // from `my_mod` +``` |
