Skip to content

Commit d5a26c5

Browse files
authored
Rollup merge of rust-lang#141526 - jyn514:env-vars, r=petrochenkov
add a dedicated section for compiler environment variables in the unstable book rendered: ![image](https://github.com/user-attachments/assets/dcb6e2a3-2e2d-43bb-8f45-79715705bf45) fixes rust-lang#141523
2 parents 408dc51 + 231e8cb commit d5a26c5

File tree

7 files changed

+18
-2
lines changed

7 files changed

+18
-2
lines changed

src/doc/unstable-book/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Unstable Book
2+
3+
These are the sources for <https://doc.rust-lang.org/nightly/unstable-book/>.
4+
To generate them, run `./x doc unstable-book`, which will generate HTML files in `build/host/doc/unstable-book` using `src/tools/rustbook`.
5+
If you need to change the overall structure, modify `src/tools/unstable-book-gen/src/SUMMARY.md`.
6+
7+
Note that most of this book is autogenerated by `unstable-book-gen`, with the exception of `compiler-flags` and `compiler-environment-variables`.
8+
As a result, it does not integrate well with `mdbook`. Use `./x doc` instead.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Compiler environment variables

src/doc/unstable-book/src/compiler-flags/rustc-bootstrap.md renamed to src/doc/unstable-book/src/compiler-environment-variables/RUSTC_BOOTSTRAP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Cargo disallows setting `cargo::rustc-env=RUSTC_BOOTSTRAP` in build scripts.
1414
Build systems can limit the features they enable with [`-Z allow-features=feature1,feature2`][Z-allow-features].
1515
Crates can fully opt out of unstable features by using [`#![forbid(unstable_features)]`][unstable-features] at the crate root (or any other way of enabling lints, such as `-F unstable-features`).
1616

17-
[Z-allow-features]: ./allow-features.html
17+
[Z-allow-features]: ../compiler-flags/allow-features.html
1818
[unstable-features]: ../../rustc/lints/listing/allowed-by-default.html#unstable-features
1919

2020
## Why does this environment variable exist?

src/doc/unstable-book/src/compiler-flags/allow-features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ Features are comma-separated, for example `-Z allow-features=ffi_pure,f16`.
1111
If the flag is present, any feature listed will be allowed and any feature not listed will be disallowed.
1212
Any unrecognized feature is ignored.
1313

14-
[`RUSTC_BOOTSTRAP`]: ./rustc-bootstrap.html
14+
[`RUSTC_BOOTSTRAP`]: ../compiler-environment-variables/RUSTC_BOOTSTRAP.html

src/tools/unstable-book-gen/src/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[The Unstable Book](the-unstable-book.md)
22

3+
- [Compiler environment variables](compiler-environment-variables.md)
4+
{compiler_env_vars}
35
- [Compiler flags](compiler-flags.md)
46
{compiler_flags}
57
- [Language features](language-features.md)

src/tools/unstable-book-gen/src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ fn set_to_summary_str(set: &BTreeSet<String>, dir: &str) -> String {
3535

3636
fn generate_summary(path: &Path, lang_features: &Features, lib_features: &Features) {
3737
let compiler_flags = collect_unstable_book_section_file_names(&path.join("src/compiler-flags"));
38+
let compiler_env_vars =
39+
collect_unstable_book_section_file_names(&path.join("src/compiler-environment-variables"));
3840

3941
let compiler_flags_str = set_to_summary_str(&compiler_flags, "compiler-flags");
42+
let compiler_env_vars_str =
43+
set_to_summary_str(&compiler_env_vars, "compiler-environment-variables");
4044

4145
let unstable_lang_features = collect_unstable_feature_names(&lang_features);
4246
let unstable_lib_features = collect_unstable_feature_names(&lib_features);
@@ -47,6 +51,7 @@ fn generate_summary(path: &Path, lang_features: &Features, lib_features: &Featur
4751
let summary_path = path.join("src/SUMMARY.md");
4852
let content = format!(
4953
include_str!("SUMMARY.md"),
54+
compiler_env_vars = compiler_env_vars_str,
5055
compiler_flags = compiler_flags_str,
5156
language_features = lang_features_str,
5257
library_features = lib_features_str

0 commit comments

Comments
 (0)