Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #137884

Closed
wants to merge 33 commits into from
Closed
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b6f2240
rustdoc: disable forbidden #[target_feature] check
RalfJung Feb 25, 2025
039af88
also fix potential issues with mixed stable/unstable target features …
RalfJung Feb 25, 2025
745297e
Use helper function instead of reimplementing the logic to check if r…
GuillaumeGomez Feb 26, 2025
98eb2e3
Add rustdoc support for `--emit=dep-info[=path]`
GuillaumeGomez Feb 26, 2025
46a39f0
Add new `Rustdoc::emit` method in `run-make-support`
GuillaumeGomez Feb 26, 2025
b97310c
Add run-make test for rustdoc `--emit=dep-info` option
GuillaumeGomez Feb 26, 2025
1bf15c2
compiletest: change `TEST_BUILD_DIR` to maximally normalize
jieyouxu Feb 11, 2025
a9b1ff9
tests: remove explicit long type filename hash normalization from som…
jieyouxu Feb 11, 2025
d3222cc
tests: rebless some tests as a side-effect of `TEST_BUILD_DIR` changes
jieyouxu Feb 11, 2025
39c7107
tests: manually rebless `tests/ui-fulldeps/codegen-backend/hotplug.rs`
jieyouxu Feb 11, 2025
e66bf08
sort list
tshepang Feb 28, 2025
f8091c4
qnx: avoid test failure
tshepang Feb 28, 2025
7fdd193
tests: Unignore target modifier tests on all platforms
petrochenkov Feb 28, 2025
dc04c0c
add test
RalfJung Feb 28, 2025
107d7ef
test(codegen): add looping_over_ne_bytes test for #133528
karolzwolak Feb 28, 2025
cd479f3
change config.toml to bootstrap.toml for bootstrap module
Shourya742 Feb 15, 2025
53eb7ae
replace config.toml to bootstrap.toml in src:doc:rustc-dev-guide
Shourya742 Feb 15, 2025
71b293a
replace config.toml to bootstrap.toml in src:doc:rustc
Shourya742 Feb 15, 2025
66aff25
replace config.toml to bootstrap.toml in src:doc:unstable-book
Shourya742 Feb 15, 2025
d09a4b3
replace config.toml to bootstrap.toml in src:tools
Shourya742 Feb 15, 2025
c04bc3c
replace config.toml to bootstrap.toml in src/ci, src/etc/* and tests/…
Shourya742 Feb 15, 2025
11e7aaf
jsondocck: minor cleanups
yotamofek Feb 15, 2025
94645f6
jsondocck: catch and error on deprecated syntax
yotamofek Feb 15, 2025
797ef64
htmldocck: catch and error on deprecated syntax
yotamofek Feb 15, 2025
4c939db
also skip abi_required_features check in rustdoc
RalfJung Feb 28, 2025
76bbb3b
Rollup merge of #136865 - jieyouxu:long-type-path-compare-mode, r=lqd
matthiaskrgr Mar 2, 2025
d156259
Rollup merge of #137081 - Shourya742:2025-02-15-change-config.toml-to…
matthiaskrgr Mar 2, 2025
de85a27
Rollup merge of #137103 - yotamofek:pr/jsonhtmldocck-deprecated-synta…
matthiaskrgr Mar 2, 2025
8ebcd38
Rollup merge of #137632 - RalfJung:rustdoc-target-features, r=working…
matthiaskrgr Mar 2, 2025
2dc5b22
Rollup merge of #137684 - GuillaumeGomez:rustdoc-dep-info, r=notriddle
matthiaskrgr Mar 2, 2025
e804cfb
Rollup merge of #137794 - tshepang:make-qnx-pass, r=pietroalbini
matthiaskrgr Mar 2, 2025
0f7997e
Rollup merge of #137801 - petrochenkov:tarmod, r=compiler-errors
matthiaskrgr Mar 2, 2025
8efe509
Rollup merge of #137826 - karolzwolak:looping_over_ne_bytes_133528, r…
matthiaskrgr Mar 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bootstrap.md
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ Describe what you expected to happen.
Describe what actually happened.
-->

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

## Configuration
/bootstrap.toml
/config.toml
/Makefile
config.mk
3 changes: 2 additions & 1 deletion .ignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Make vscode *not* count `config.toml` as ignored, so it is included in search
# Make vscode *not* count `bootstrap.toml` and `config.toml` as ignored, so it is included in search
!/bootstrap.toml
!/config.toml
10 changes: 5 additions & 5 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ If you just want to install Rust, check out the [README.md](README.md) instead.*

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

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

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

```sh
./configure
make && sudo make install
```

`configure` generates a `config.toml` which can also be used with normal `x.py`
`configure` generates a `bootstrap.toml` which can also be used with normal `x.py`
invocations.

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

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

4 changes: 2 additions & 2 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -2282,7 +2282,7 @@ Compatibility Notes
- [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/)
- [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/)
- [The Rust distribution no longer always includes rustdoc](https://github.com/rust-lang/rust/pull/106886)
If `tools = [...]` is set in config.toml, we will respect a missing rustdoc in that list. By
If `tools = [...]` is set in bootstrap.toml, we will respect a missing rustdoc in that list. By
default rustdoc remains included. To retain the prior behavior explicitly add `"rustdoc"` to the
list.

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

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

2 changes: 1 addition & 1 deletion REUSE.toml
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ path = [
"Cargo.lock",
"Cargo.toml",
"CODE_OF_CONDUCT.md",
"config.example.toml",
"bootstrap.example.toml",
"configure",
"CONTRIBUTING.md",
"COPYRIGHT",
6 changes: 3 additions & 3 deletions config.example.toml → bootstrap.example.toml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
#
# All options are commented out by default in this file, and they're commented
# out with their default values. The build system by default looks for
# `config.toml` in the current directory of a build for build configuration, but
# `bootstrap.toml` in the current directory of a build for build configuration, but
# a custom configuration file can also be specified with `--config` to the build
# system.

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

# Keeps track of major changes made to this configuration.
@@ -325,7 +325,7 @@
# Enable a build of the extended Rust tool set which is not only the compiler
# but also tools such as Cargo. This will also produce "combined installers"
# which are used to install Rust and Cargo together.
# The `tools` (check `config.example.toml` to see its default value) option specifies
# The `tools` (check `bootstrap.example.toml` to see its default value) option specifies
# which tools should be built if `extended = true`.
#
# This is disabled by default.
56 changes: 44 additions & 12 deletions compiler/rustc_codegen_ssa/src/target_features.rs
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ use rustc_middle::query::Providers;
use rustc_middle::ty::TyCtxt;
use rustc_session::parse::feature_err;
use rustc_span::{Span, Symbol, sym};
use rustc_target::target_features;
use rustc_target::target_features::{self, Stability};

use crate::errors;

@@ -87,12 +87,17 @@ pub(crate) fn from_target_feature_attr(
// But ensure the ABI does not forbid enabling this.
// Here we do assume that LLVM doesn't add even more implied features
// we don't know about, at least no features that would have ABI effects!
if abi_feature_constraints.incompatible.contains(&name.as_str()) {
tcx.dcx().emit_err(errors::ForbiddenTargetFeatureAttr {
span: item.span(),
feature: name.as_str(),
reason: "this feature is incompatible with the target ABI",
});
// We skip this logic in rustdoc, where we want to allow all target features of
// all targets, so we can't check their ABI compatibility and anyway we are not
// generating code so "it's fine".
if !tcx.sess.opts.actually_rustdoc {
if abi_feature_constraints.incompatible.contains(&name.as_str()) {
tcx.dcx().emit_err(errors::ForbiddenTargetFeatureAttr {
span: item.span(),
feature: name.as_str(),
reason: "this feature is incompatible with the target ABI",
});
}
}
target_features.push(TargetFeature { name, implied: name != feature_sym })
}
@@ -142,11 +147,38 @@ pub(crate) fn provide(providers: &mut Providers) {
rust_target_features: |tcx, cnum| {
assert_eq!(cnum, LOCAL_CRATE);
if tcx.sess.opts.actually_rustdoc {
// rustdoc needs to be able to document functions that use all the features, so
// whitelist them all
rustc_target::target_features::all_rust_features()
.map(|(a, b)| (a.to_string(), b))
.collect()
// HACK: rustdoc would like to pretend that we have all the target features, so we
// have to merge all the lists into one. To ensure an unstable target never prevents
// a stable one from working, we merge the stability info of all instances of the
// same target feature name, with the "most stable" taking precedence. And then we
// hope that this doesn't cause issues anywhere else in the compiler...
let mut result: UnordMap<String, Stability> = Default::default();
for (name, stability) in rustc_target::target_features::all_rust_features() {
use std::collections::hash_map::Entry;
match result.entry(name.to_owned()) {
Entry::Vacant(vacant_entry) => {
vacant_entry.insert(stability);
}
Entry::Occupied(mut occupied_entry) => {
// Merge the two stabilities, "more stable" taking precedence.
match (occupied_entry.get(), stability) {
(Stability::Stable, _)
| (
Stability::Unstable { .. },
Stability::Unstable { .. } | Stability::Forbidden { .. },
)
| (Stability::Forbidden { .. }, Stability::Forbidden { .. }) => {
// The stability in the entry is at least as good as the new one, just keep it.
}
_ => {
// Overwrite stabilite.
occupied_entry.insert(stability);
}
}
}
}
}
result
} else {
tcx.sess
.target
2 changes: 1 addition & 1 deletion src/bootstrap/README.md
Original file line number Diff line number Diff line change
@@ -163,7 +163,7 @@ compiler, which will then build the bootstrap binary written in Rust.

Because there are two separate codebases behind `x.py`, they need to
be kept in sync. In particular, both `bootstrap.py` and the bootstrap binary
parse `config.toml` and read the same command line arguments. `bootstrap.py`
parse `bootstrap.toml` and read the same command line arguments. `bootstrap.py`
keeps these in sync by setting various environment variables, and the
programs sometimes have to add arguments that are explicitly ignored, to be
read by the other.
26 changes: 17 additions & 9 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
@@ -726,7 +726,7 @@ def download_toolchain(self):

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

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

def get_toml(self, key, section=None):
"""Returns the value of the given key in config.toml, otherwise returns None
"""Returns the value of the given key in bootstrap.toml, otherwise returns None

>>> rb = RustBuild()
>>> rb.config_toml = 'key1 = "value1"\\nkey2 = "value2"'
@@ -1250,17 +1250,23 @@ def bootstrap(args):
"unless you put them in place manually."
)

# Read from `--config`, then `RUST_BOOTSTRAP_CONFIG`, then `./config.toml`,
# then `config.toml` in the root directory.
# Read from `--config` first, followed by `RUST_BOOTSTRAP_CONFIG`.
# If neither is set, check `./bootstrap.toml`, then `bootstrap.toml` in the root directory.
# If those are unavailable, fall back to `./config.toml`, then `config.toml` for
# backward compatibility.
toml_path = args.config or os.getenv("RUST_BOOTSTRAP_CONFIG")
using_default_path = toml_path is None
if using_default_path:
toml_path = "config.toml"
toml_path = "bootstrap.toml"
if not os.path.exists(toml_path):
toml_path = os.path.join(rust_root, toml_path)
toml_path = os.path.join(rust_root, "bootstrap.toml")
if not os.path.exists(toml_path):
toml_path = "config.toml"
if not os.path.exists(toml_path):
toml_path = os.path.join(rust_root, "config.toml")

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

6 changes: 3 additions & 3 deletions src/bootstrap/bootstrap_test.py
Original file line number Diff line number Diff line change
@@ -156,7 +156,7 @@ def test_known_args(self):


class GenerateAndParseConfig(unittest.TestCase):
"""Test that we can serialize and deserialize a config.toml file"""
"""Test that we can serialize and deserialize a bootstrap.toml file"""

def test_no_args(self):
build = serialize_and_parse([])
@@ -206,11 +206,11 @@ def build_args(self, configure_args=None, args=None, env=None):
# problem in most cases, but there is a scenario where it would cause
# the test to fail.
#
# When a custom local Cargo is configured in config.toml (with the
# When a custom local Cargo is configured in bootstrap.toml (with the
# build.cargo setting), no Cargo is downloaded to any location known by
# bootstrap, and bootstrap relies on that setting to find it.
#
# In this test though we are not using the config.toml of the caller:
# In this test though we are not using the bootstrap.toml of the caller:
# we are generating a blank one instead. If we don't set build.cargo in
# it, the test will have no way to find Cargo, failing the test.
cargo_bin = os.environ.get("BOOTSTRAP_TEST_CARGO_BIN")
20 changes: 10 additions & 10 deletions src/bootstrap/configure.py
Original file line number Diff line number Diff line change
@@ -362,8 +362,8 @@ def is_value_list(key):
print("\t\t" + option.desc)
print("")
print("This configure script is a thin configuration shim over the true")
print("configuration system, `config.toml`. You can explore the comments")
print("in `config.example.toml` next to this configure script to see")
print("configuration system, `bootstrap.toml`. You can explore the comments")
print("in `bootstrap.example.toml` next to this configure script to see")
print("more information about what each option is. Additionally you can")
print("pass `--set` as an argument to set arbitrary key/value pairs")
print("in the TOML configuration if desired")
@@ -562,8 +562,8 @@ def apply_args(known_args, option_checking, config):
raise RuntimeError("unhandled option {}".format(option.name))


# "Parse" the `config.example.toml` file into the various sections, and we'll
# use this as a template of a `config.toml` to write out which preserves
# "Parse" the `bootstrap.example.toml` file into the various sections, and we'll
# use this as a template of a `bootstrap.toml` to write out which preserves
# all the various comments and whatnot.
#
# Note that the `target` section is handled separately as we'll duplicate it
@@ -576,7 +576,7 @@ def parse_example_config(known_args, config):
targets = {}
top_level_keys = []

with open(rust_dir + "/config.example.toml") as example_config:
with open(rust_dir + "/bootstrap.example.toml") as example_config:
example_lines = example_config.read().split("\n")
for line in example_lines:
if cur_section is None:
@@ -750,8 +750,8 @@ def quit_if_file_exists(file):


if __name__ == "__main__":
# If 'config.toml' already exists, exit the script at this point
quit_if_file_exists("config.toml")
# If 'bootstrap.toml' already exists, exit the script at this point
quit_if_file_exists("bootstrap.toml")

if "GITHUB_ACTIONS" in os.environ:
print("::group::Configure the build")
@@ -761,11 +761,11 @@ def quit_if_file_exists(file):
p("")
section_order, sections, targets = parse_args(sys.argv[1:])

# Now that we've built up our `config.toml`, write it all out in the same
# Now that we've built up our `bootstrap.toml`, write it all out in the same
# order that we read it in.
p("")
p("writing `config.toml` in current directory")
with bootstrap.output("config.toml") as f:
p("writing `bootstrap.toml` in current directory")
with bootstrap.output("bootstrap.toml") as f:
write_config_toml(f, section_order, targets, sections)

with bootstrap.output("Makefile") as f:
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading