Skip to content

Commit 6786e3c

Browse files
committed
Auto merge of #137884 - matthiaskrgr:rollup-d9m5rhf, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #136865 (Perform deeper compiletest path normalization for `$TEST_BUILD_DIR` to account for compare-mode/debugger cases, and normalize long type file filename hashes) - #137081 (change config.toml to bootstrap.toml) - #137103 ({json|html}docck: catch and error on deprecated syntax) - #137632 (rustdoc: when merging target features, keep the highest stability) - #137684 (Add rustdoc support for `--emit=dep-info[=path]`) - #137794 (make qnx pass a test) - #137801 (tests: Unignore target modifier tests on all platforms) - #137826 (test(codegen): add looping_over_ne_bytes test for #133528) r? `@ghost` `@rustbot` modify labels: rollup
2 parents f4a216d + 8efe509 commit 6786e3c

File tree

218 files changed

+966
-850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

218 files changed

+966
-850
lines changed

‎.github/ISSUE_TEMPLATE/bootstrap.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Describe what you expected to happen.
3232
Describe what actually happened.
3333
-->
3434

35-
### Bootstrap configuration (config.toml)
35+
### Bootstrap configuration (bootstrap.toml)
3636
```toml
3737
<config>
3838
```

‎.gitignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file should only ignore things that are generated during a `x.py` build,
22
# generated by common IDEs, and optional files controlled by the user that
3-
# affect the build (such as config.toml).
3+
# affect the build (such as bootstrap.toml).
44
# In particular, things like `mir_dump` should not be listed here; they are only
55
# created during manual debugging and many people like to clean up instead of
66
# having git ignore such leftovers. You can use `.git/info/exclude` to
@@ -34,6 +34,7 @@ Session.vim
3434
!/tests/run-make/thumb-none-qemu/example/.cargo
3535

3636
## Configuration
37+
/bootstrap.toml
3738
/config.toml
3839
/Makefile
3940
config.mk

‎.ignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# Make vscode *not* count `config.toml` as ignored, so it is included in search
1+
# Make vscode *not* count `bootstrap.toml` and `config.toml` as ignored, so it is included in search
2+
!/bootstrap.toml
23
!/config.toml

‎INSTALL.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ If you just want to install Rust, check out the [README.md](README.md) instead.*
66

77
The Rust build system uses a Python script called `x.py` to build the compiler,
88
which manages the bootstrapping process. It lives at the root of the project.
9-
It also uses a file named `config.toml` to determine various configuration
9+
It also uses a file named `bootstrap.toml` to determine various configuration
1010
settings for the build. You can see a full list of options in
11-
`config.example.toml`.
11+
`bootstrap.example.toml`.
1212

1313
The `x.py` command can be run directly on most Unix systems in the following
1414
format:
@@ -115,15 +115,15 @@ See [the rustc-dev-guide for more info][sysllvm].
115115

116116
This project provides a configure script and makefile (the latter of which just
117117
invokes `x.py`). `./configure` is the recommended way to programmatically
118-
generate a `config.toml`. `make` is not recommended (we suggest using `x.py`
118+
generate a `bootstrap.toml`. `make` is not recommended (we suggest using `x.py`
119119
directly), but it is supported and we try not to break it unnecessarily.
120120

121121
```sh
122122
./configure
123123
make && sudo make install
124124
```
125125

126-
`configure` generates a `config.toml` which can also be used with normal `x.py`
126+
`configure` generates a `bootstrap.toml` which can also be used with normal `x.py`
127127
invocations.
128128

129129
## Building on Windows
@@ -251,7 +251,7 @@ Windows build triples are:
251251
- `x86_64-pc-windows-msvc`
252252

253253
The build triple can be specified by either specifying `--build=<triple>` when
254-
invoking `x.py` commands, or by creating a `config.toml` file (as described in
254+
invoking `x.py` commands, or by creating a `bootstrap.toml` file (as described in
255255
[Building on a Unix-like system](#building-on-a-unix-like-system)), and passing
256256
`--set build.build=<triple>` to `./configure`.
257257

‎RELEASES.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2282,7 +2282,7 @@ Compatibility Notes
22822282
- [Cargo denies `CARGO_HOME` in the `[env]` configuration table. Cargo itself doesn't pick up this value, but recursive calls to cargo would, which was not intended.](https://github.com/rust-lang/cargo/pull/11644/)
22832283
- [Debuginfo for build dependencies is now off if not explicitly set. This is expected to improve the overall build time.](https://github.com/rust-lang/cargo/pull/11252/)
22842284
- [The Rust distribution no longer always includes rustdoc](https://github.com/rust-lang/rust/pull/106886)
2285-
If `tools = [...]` is set in config.toml, we will respect a missing rustdoc in that list. By
2285+
If `tools = [...]` is set in bootstrap.toml, we will respect a missing rustdoc in that list. By
22862286
default rustdoc remains included. To retain the prior behavior explicitly add `"rustdoc"` to the
22872287
list.
22882288

@@ -5268,7 +5268,7 @@ related tools.
52685268

52695269
- [Building `rustc` from source now uses `ninja` by default over `make`.][74922]
52705270
You can continue building with `make` by setting `ninja=false` in
5271-
your `config.toml`.
5271+
your `bootstrap.toml`.
52725272
- [cg_llvm: `fewer_names` in `uncached_llvm_type`][76030]
52735273
- [Made `ensure_sufficient_stack()` non-generic][76680]
52745274

‎REUSE.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ path = [
2222
"Cargo.lock",
2323
"Cargo.toml",
2424
"CODE_OF_CONDUCT.md",
25-
"config.example.toml",
25+
"bootstrap.example.toml",
2626
"configure",
2727
"CONTRIBUTING.md",
2828
"COPYRIGHT",
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# All options are commented out by default in this file, and they're commented
77
# out with their default values. The build system by default looks for
8-
# `config.toml` in the current directory of a build for build configuration, but
8+
# `bootstrap.toml` in the current directory of a build for build configuration, but
99
# a custom configuration file can also be specified with `--config` to the build
1010
# system.
1111

@@ -16,7 +16,7 @@
1616
# Use different pre-set defaults than the global defaults.
1717
#
1818
# See `src/bootstrap/defaults` for more information.
19-
# Note that this has no default value (x.py uses the defaults in `config.example.toml`).
19+
# Note that this has no default value (x.py uses the defaults in `bootstrap.example.toml`).
2020
#profile = <none>
2121

2222
# Keeps track of major changes made to this configuration.
@@ -325,7 +325,7 @@
325325
# Enable a build of the extended Rust tool set which is not only the compiler
326326
# but also tools such as Cargo. This will also produce "combined installers"
327327
# which are used to install Rust and Cargo together.
328-
# The `tools` (check `config.example.toml` to see its default value) option specifies
328+
# The `tools` (check `bootstrap.example.toml` to see its default value) option specifies
329329
# which tools should be built if `extended = true`.
330330
#
331331
# This is disabled by default.

‎compiler/rustc_codegen_ssa/src/target_features.rs‎

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_middle::query::Providers;
1010
use rustc_middle::ty::TyCtxt;
1111
use rustc_session::parse::feature_err;
1212
use rustc_span::{Span, Symbol, sym};
13-
use rustc_target::target_features;
13+
use rustc_target::target_features::{self, Stability};
1414

1515
use crate::errors;
1616

@@ -87,12 +87,17 @@ pub(crate) fn from_target_feature_attr(
8787
// But ensure the ABI does not forbid enabling this.
8888
// Here we do assume that LLVM doesn't add even more implied features
8989
// we don't know about, at least no features that would have ABI effects!
90-
if abi_feature_constraints.incompatible.contains(&name.as_str()) {
91-
tcx.dcx().emit_err(errors::ForbiddenTargetFeatureAttr {
92-
span: item.span(),
93-
feature: name.as_str(),
94-
reason: "this feature is incompatible with the target ABI",
95-
});
90+
// We skip this logic in rustdoc, where we want to allow all target features of
91+
// all targets, so we can't check their ABI compatibility and anyway we are not
92+
// generating code so "it's fine".
93+
if !tcx.sess.opts.actually_rustdoc {
94+
if abi_feature_constraints.incompatible.contains(&name.as_str()) {
95+
tcx.dcx().emit_err(errors::ForbiddenTargetFeatureAttr {
96+
span: item.span(),
97+
feature: name.as_str(),
98+
reason: "this feature is incompatible with the target ABI",
99+
});
100+
}
96101
}
97102
target_features.push(TargetFeature { name, implied: name != feature_sym })
98103
}
@@ -142,11 +147,38 @@ pub(crate) fn provide(providers: &mut Providers) {
142147
rust_target_features: |tcx, cnum| {
143148
assert_eq!(cnum, LOCAL_CRATE);
144149
if tcx.sess.opts.actually_rustdoc {
145-
// rustdoc needs to be able to document functions that use all the features, so
146-
// whitelist them all
147-
rustc_target::target_features::all_rust_features()
148-
.map(|(a, b)| (a.to_string(), b))
149-
.collect()
150+
// HACK: rustdoc would like to pretend that we have all the target features, so we
151+
// have to merge all the lists into one. To ensure an unstable target never prevents
152+
// a stable one from working, we merge the stability info of all instances of the
153+
// same target feature name, with the "most stable" taking precedence. And then we
154+
// hope that this doesn't cause issues anywhere else in the compiler...
155+
let mut result: UnordMap<String, Stability> = Default::default();
156+
for (name, stability) in rustc_target::target_features::all_rust_features() {
157+
use std::collections::hash_map::Entry;
158+
match result.entry(name.to_owned()) {
159+
Entry::Vacant(vacant_entry) => {
160+
vacant_entry.insert(stability);
161+
}
162+
Entry::Occupied(mut occupied_entry) => {
163+
// Merge the two stabilities, "more stable" taking precedence.
164+
match (occupied_entry.get(), stability) {
165+
(Stability::Stable, _)
166+
| (
167+
Stability::Unstable { .. },
168+
Stability::Unstable { .. } | Stability::Forbidden { .. },
169+
)
170+
| (Stability::Forbidden { .. }, Stability::Forbidden { .. }) => {
171+
// The stability in the entry is at least as good as the new one, just keep it.
172+
}
173+
_ => {
174+
// Overwrite stabilite.
175+
occupied_entry.insert(stability);
176+
}
177+
}
178+
}
179+
}
180+
}
181+
result
150182
} else {
151183
tcx.sess
152184
.target

‎src/bootstrap/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ compiler, which will then build the bootstrap binary written in Rust.
163163

164164
Because there are two separate codebases behind `x.py`, they need to
165165
be kept in sync. In particular, both `bootstrap.py` and the bootstrap binary
166-
parse `config.toml` and read the same command line arguments. `bootstrap.py`
166+
parse `bootstrap.toml` and read the same command line arguments. `bootstrap.py`
167167
keeps these in sync by setting various environment variables, and the
168168
programs sometimes have to add arguments that are explicitly ignored, to be
169169
read by the other.

‎src/bootstrap/bootstrap.py‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ def download_toolchain(self):
726726

727727
def should_fix_bins_and_dylibs(self):
728728
"""Whether or not `fix_bin_or_dylib` needs to be run; can only be True
729-
on NixOS or if config.toml has `build.patch-binaries-for-nix` set.
729+
on NixOS or if bootstrap.toml has `build.patch-binaries-for-nix` set.
730730
"""
731731
if self._should_fix_bins_and_dylibs is not None:
732732
return self._should_fix_bins_and_dylibs
@@ -775,7 +775,7 @@ def get_answer():
775775
"The IN_NIX_SHELL environment variable is `{}`;".format(
776776
in_nix_shell
777777
),
778-
"you may need to set `patch-binaries-for-nix=true` in config.toml",
778+
"you may need to set `patch-binaries-for-nix=true` in bootstrap.toml",
779779
)
780780

781781
return is_nixos
@@ -884,7 +884,7 @@ def bin_root(self):
884884
return os.path.join(self.build_dir, self.build, subdir)
885885

886886
def get_toml(self, key, section=None):
887-
"""Returns the value of the given key in config.toml, otherwise returns None
887+
"""Returns the value of the given key in bootstrap.toml, otherwise returns None
888888
889889
>>> rb = RustBuild()
890890
>>> rb.config_toml = 'key1 = "value1"\\nkey2 = "value2"'
@@ -1250,17 +1250,23 @@ def bootstrap(args):
12501250
"unless you put them in place manually."
12511251
)
12521252

1253-
# Read from `--config`, then `RUST_BOOTSTRAP_CONFIG`, then `./config.toml`,
1254-
# then `config.toml` in the root directory.
1253+
# Read from `--config` first, followed by `RUST_BOOTSTRAP_CONFIG`.
1254+
# If neither is set, check `./bootstrap.toml`, then `bootstrap.toml` in the root directory.
1255+
# If those are unavailable, fall back to `./config.toml`, then `config.toml` for
1256+
# backward compatibility.
12551257
toml_path = args.config or os.getenv("RUST_BOOTSTRAP_CONFIG")
12561258
using_default_path = toml_path is None
12571259
if using_default_path:
1258-
toml_path = "config.toml"
1260+
toml_path = "bootstrap.toml"
12591261
if not os.path.exists(toml_path):
1260-
toml_path = os.path.join(rust_root, toml_path)
1262+
toml_path = os.path.join(rust_root, "bootstrap.toml")
1263+
if not os.path.exists(toml_path):
1264+
toml_path = "config.toml"
1265+
if not os.path.exists(toml_path):
1266+
toml_path = os.path.join(rust_root, "config.toml")
12611267

12621268
# Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
1263-
# but not if `config.toml` hasn't been created.
1269+
# but not if `bootstrap.toml` hasn't been created.
12641270
if not using_default_path or os.path.exists(toml_path):
12651271
with open(toml_path) as config:
12661272
config_toml = config.read()
@@ -1278,7 +1284,9 @@ def bootstrap(args):
12781284
# profiles to be renamed while maintaining back compatibility
12791285
# Keep in sync with `profile_aliases` in config.rs
12801286
profile_aliases = {"user": "dist"}
1281-
include_file = "config.{}.toml".format(profile_aliases.get(profile) or profile)
1287+
include_file = "bootstrap.{}.toml".format(
1288+
profile_aliases.get(profile) or profile
1289+
)
12821290
include_dir = os.path.join(rust_root, "src", "bootstrap", "defaults")
12831291
include_path = os.path.join(include_dir, include_file)
12841292

0 commit comments

Comments
 (0)