Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
c6a97d3
emit `StorageLive` and schedule `StorageDead` for `let`-`else` after …
dianne Jun 25, 2025
5a5027a
Move float non determinism helpers to math.rs
LorrensP-2158466 Jul 7, 2025
4653b7a
Stabilize const `TypeId::of`
oli-obk Jul 18, 2025
ed50029
ci: Switch to nightly rustfmt
tgross35 Jul 21, 2025
f391acb
Implement nondet behaviour and change/add tests.
LorrensP-2158466 Jul 7, 2025
08bca4d
ci: Add native PowerPC64LE and s390x jobs
tgross35 Jul 23, 2025
fcc7824
ci: Update to the latest ubuntu:25.04 Docker images
tgross35 Jul 24, 2025
95c4263
symcheck: Switch the `object` dependency from git to crates.io
tgross35 Jul 24, 2025
83aea65
ci: Use a mirror for musl
tgross35 Jul 24, 2025
5c4abe9
ci: Upgrade ubuntu:25.04 for the PowerPC64LE test
tgross35 Jul 24, 2025
43c3e1b
Enable tests that were skipped on PowerPC
tgross35 Jul 24, 2025
b168793
Enable tests that were skipped on aarch64
tgross35 Jul 24, 2025
0b6c1d3
Enable skipped `f32` and `f64` multiplication tests
tgross35 Jul 24, 2025
9dad77f
Use `x86_no_sse` configuration in more places
tgross35 Jul 24, 2025
4743158
libm: Update for new warn-by-default clippy lints
tgross35 Jul 26, 2025
c061e73
Avoid inlining `floor` into `rem_pio2`
quaternic Jul 27, 2025
9c683d3
Implement `floor` and `ceil` in assembly on `i586`
folkertdev Jul 27, 2025
16cb37c
Remove `no-asm` gating when there is no alternative implementation
tgross35 Jul 25, 2025
54f6ab7
Switch to using a GH app for authenticating sync PRs
Kobzol Jul 29, 2025
54a4f86
cleanup: Trim trailing whitespace
tgross35 Jul 29, 2025
97c35d3
ci: Simplify tests for verbatim paths
tgross35 Jul 29, 2025
987a49b
bootstrap: extract `cc` query into a new function
mati865 Jul 29, 2025
9cfe5f6
bootstrap: split runtime DLL part out of `make_win_dist`
mati865 Jul 29, 2025
ab8a2e1
ci: Switch to strongly typed directives
tgross35 Jul 30, 2025
eafafc4
ci: Don't print output twice in `ci-util`
tgross35 Jul 30, 2025
c045c9b
ci: Commonize the way `PrInfo` is loaded from env
tgross35 Jul 30, 2025
4ebfdf7
ci: Add a way to run `libm` tests that would otherwise be skipped
tgross35 Jul 30, 2025
3cbd088
ci: Set pipefail before running ci-util
tgross35 Jul 30, 2025
ecf6d3c
Simplify the configuration for no-panic
tgross35 Jul 30, 2025
b3f369d
Address some rustc inconsistency issues
zeroomega Jul 17, 2025
f95edbe
move gcc config parsing to parse_inner
Shourya742 Jul 30, 2025
3f9bf57
move dist to parse_inner
Shourya742 Jul 30, 2025
924912c
move target parsing to parse_inner
Shourya742 Jul 30, 2025
89219ff
move install to parse_inner
Shourya742 Jul 30, 2025
3248ff1
move llvm parsing to parse_inner
Shourya742 Jul 30, 2025
ddd2a54
move rust config to parse_inner
Shourya742 Jul 30, 2025
ae05591
Force initializing ExecutionContext with verbosity and fail_fast mode
Shourya742 Jul 30, 2025
82756fd
Extract TOML config loading and src directory computation into separa…
Shourya742 Jul 30, 2025
f89ea08
Split TOML postprocessing into a separate function
Shourya742 Jul 30, 2025
cfc40de
Override some build TOML values by flags
Shourya742 Jul 30, 2025
8652d96
Fix logging of config skip values
Shourya742 Jul 30, 2025
58a38cd
Fix verbosity setting
Shourya742 Jul 30, 2025
222dfcc
add install default implementation
Shourya742 Aug 1, 2025
bbe7c08
add gcc and dist default implementation
Shourya742 Aug 1, 2025
38ddefa
add llvm default implementation
Shourya742 Aug 1, 2025
8b80cb0
add rust default implementation
Shourya742 Aug 1, 2025
d3d3b10
make llvm toml fields follow a specific naming convention
Shourya742 Aug 1, 2025
c008a4b
make gcc toml fields follow a specific naming convention
Shourya742 Aug 1, 2025
4d2a2c2
make dist toml fields follow a specific naming convention
Shourya742 Aug 1, 2025
ad98550
make install toml fields follow a specific naming convention
Shourya742 Aug 1, 2025
2c96132
make build toml fields follow a specific naming convention
Shourya742 Aug 1, 2025
a75326b
move build config to the top of parse method
Shourya742 Aug 1, 2025
39d9cf7
move install config to the top of parse method
Shourya742 Aug 1, 2025
120d93e
move rust config to the top of parse method
Shourya742 Aug 1, 2025
f74f1a0
move llvm config to the top of parse method
Shourya742 Aug 1, 2025
7f20ad8
move dist and gcc config to the top of parse method
Shourya742 Aug 1, 2025
d2cfe48
remove feature gate
Kivooeo Aug 4, 2025
b7f5392
remove begin prefix
Kivooeo Aug 4, 2025
91e606b
Tweak auto trait errors
estebank Feb 28, 2025
d2e3ea9
windows-gnullvm: include `libunwind.dll` in dist
mati865 Jul 29, 2025
36383dd
[win][arm64ec] Fix msvc-wholearchive for Arm64EC
dpaoliello Aug 5, 2025
33cb419
Mark all deprecation lints in name resolution as deny-by-default and …
petrochenkov Jul 14, 2025
3b50253
compiler-builtins: plumb LSE support for aarch64 on linux
pmur Aug 4, 2025
6936bb9
Dynamically enable LSE for aarch64 rust provided intrinsics
pmur Jul 31, 2025
fbc700f
configure: Use `CARGO_CFG_*_{F16,F128}` rather than invoking rustc
tgross35 Aug 5, 2025
962836d
remove redundant _toml suffix and other misc changes
Shourya742 Aug 4, 2025
9ccc9f1
replace version placeholder
BoxyUwU Aug 4, 2025
2108631
bump stage0
BoxyUwU Aug 6, 2025
351e4bd
handle bootstrap cfgs
BoxyUwU Aug 6, 2025
6e7b9d5
Introduce ModernIdent type to unify macro 2.0 hygiene handling
xizheyin Aug 6, 2025
2472d19
Include allocator module in LLVM_passes timer
bjorn3 Aug 6, 2025
ee38bc0
Remove unused field from ModuleConfig
bjorn3 Aug 6, 2025
6fbea4f
Remove bitcode_llvm_cmdline
bjorn3 Aug 6, 2025
71add2f
Change stdlib float tests to account for miri nondet floats.
LorrensP-2158466 Jul 13, 2025
7bc3462
tidy
BoxyUwU Aug 6, 2025
270c1a4
Revert "Embed GDB pretty printers in rlibs and dylibs"
bjorn3 Aug 6, 2025
e02cc40
Revert "Preserve the .debug_gdb_scripts section"
bjorn3 Aug 6, 2025
4ff22dd
Move some TypeVisitable/TypeFoldable impls to rustc_type_ir
flodiebold Nov 10, 2024
856e381
don't schedule unnecessary drops when lowering or-patterns
dianne Jul 9, 2025
ea1eca5
base drop order on the first sub-branch
dianne Jul 9, 2025
b7de539
lower bindings in the order they're written
dianne Jul 10, 2025
f7ad406
Port `#[should_panic]` to the new attribute parsing infrastructure
JonathanBrouwer Jul 11, 2025
4281e05
Changes to the tests for the `#[should_panic]` port
JonathanBrouwer Jul 11, 2025
a8f6528
Add a missing UpcastFrom impl in rustc_type_ir
flodiebold Nov 10, 2024
eac66a5
Rollup merge of #137831 - estebank:auto-trait-err, r=compiler-errors
Zalathar Aug 7, 2025
097cf05
Rollup merge of #143028 - dianne:let-else-storage, r=oli-obk,traviscross
Zalathar Aug 7, 2025
3720016
Rollup merge of #143764 - dianne:primary-binding-drop-order, r=Nadrie…
Zalathar Aug 7, 2025
9a4ee32
Rollup merge of #143808 - JonathanBrouwer:should_panic_parser, r=jdon…
Zalathar Aug 7, 2025
481ac14
Rollup merge of #143906 - LorrensP-2158466:miri-float-nondet-foreign-…
Zalathar Aug 7, 2025
ac6dcc1
Rollup merge of #143929 - petrochenkov:depresolve, r=lcnr
Zalathar Aug 7, 2025
69aa48a
Rollup merge of #144133 - oli-obk:stabilize-const-type-id, r=lcnr
Zalathar Aug 7, 2025
1bc0fda
Rollup merge of #144439 - xizheyin:symbol-rs, r=petrochenkov
Zalathar Aug 7, 2025
152548a
Rollup merge of #144473 - zeroomega:rustc_inconsistency, r=Mark-Simul…
Zalathar Aug 7, 2025
444c033
Rollup merge of #144659 - mati865:gnullvm-vendor-libunwind, r=Kobzol
Zalathar Aug 7, 2025
a1b3eb4
Rollup merge of #144705 - pmur:murp/aarch64-lse, r=Amanieu
Zalathar Aug 7, 2025
0d2f25c
Rollup merge of #144807 - Shourya742:2025-07-30-streamline-config, r=…
Zalathar Aug 7, 2025
e3340d4
Rollup merge of #144900 - Kivooeo:unsigned_signed_diff-stabilize, r=d…
Zalathar Aug 7, 2025
7fc0903
Rollup merge of #144903 - Kivooeo:panic_handler-is-not-begin, r=m-ou-se
Zalathar Aug 7, 2025
d11ec13
Rollup merge of #144931 - dpaoliello:msvc-wholearchive, r=jieyouxu
Zalathar Aug 7, 2025
3836e9d
Rollup merge of #144974 - tgross35:update-builtins, r=tgross35
Zalathar Aug 7, 2025
c928e00
Rollup merge of #144997 - BoxyUwU:bootstrap_bump, r=Mark-Simulacrum
Zalathar Aug 7, 2025
8d11a6f
Rollup merge of #145004 - bjorn3:remove_unused_fields, r=WaffleLapkin
Zalathar Aug 7, 2025
bc3a3a5
Rollup merge of #145009 - jackh726:ra-next-solver-changes, r=compiler…
Zalathar Aug 7, 2025
a2974c3
Rollup merge of #145014 - bjorn3:revert_preserve_debug_gdb_scripts, r…
Zalathar Aug 7, 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
Prev Previous commit
Next Next commit
Extract TOML config loading and src directory computation into separa…
…te functions
  • Loading branch information
Shourya742 committed Aug 1, 2025
commit 82756fd5f3b8abfef1838aac86f97ba96ca9612f
206 changes: 117 additions & 89 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,21 @@ impl Config {
skip_std_check_if_no_download_rustc: flags_skip_std_check_if_no_download_rustc,
} = flags;

// First initialize the bare minimum that we need for further operation - source directory
// and execution context.
let mut config = Config::default_opts();
let exec_ctx = ExecutionContext::new(flags_verbose, flags_cmd.fail_fast());

config.exec_ctx = exec_ctx;

if let Some(src) = compute_src_directory(flags_src, &config.exec_ctx) {
config.src = src;
}

// Now load the TOML config, as soon as possible
let (mut toml, toml_path) = load_toml_config(&config.src, flags_config, &get_toml);
config.config = toml_path.clone();

// Set flags.
config.paths = std::mem::take(&mut flags_paths);

Expand Down Expand Up @@ -501,53 +511,6 @@ impl Config {

// Infer the rest of the configuration.

if let Some(src) = flags_src {
config.src = src
} else {
// Infer the source directory. This is non-trivial because we want to support a downloaded bootstrap binary,
// running on a completely different machine from where it was compiled.
let mut cmd = helpers::git(None);
// NOTE: we cannot support running from outside the repository because the only other path we have available
// is set at compile time, which can be wrong if bootstrap was downloaded rather than compiled locally.
// We still support running outside the repository if we find we aren't in a git directory.

// NOTE: We get a relative path from git to work around an issue on MSYS/mingw. If we used an absolute path,
// and end up using MSYS's git rather than git-for-windows, we would get a unix-y MSYS path. But as bootstrap
// has already been (kinda-cross-)compiled to Windows land, we require a normal Windows path.
cmd.arg("rev-parse").arg("--show-cdup");
// Discard stderr because we expect this to fail when building from a tarball.
let output = cmd.allow_failure().run_capture_stdout(&config);
if output.is_success() {
let git_root_relative = output.stdout();
// We need to canonicalize this path to make sure it uses backslashes instead of forward slashes,
// and to resolve any relative components.
let git_root = env::current_dir()
.unwrap()
.join(PathBuf::from(git_root_relative.trim()))
.canonicalize()
.unwrap();
let s = git_root.to_str().unwrap();

// Bootstrap is quite bad at handling /? in front of paths
let git_root = match s.strip_prefix("\\\\?\\") {
Some(p) => PathBuf::from(p),
None => git_root,
};
// If this doesn't have at least `stage0`, we guessed wrong. This can happen when,
// for example, the build directory is inside of another unrelated git directory.
// In that case keep the original `CARGO_MANIFEST_DIR` handling.
//
// NOTE: this implies that downloadable bootstrap isn't supported when the build directory is outside
// the source directory. We could fix that by setting a variable from all three of python, ./x, and x.ps1.
if git_root.join("src").join("stage0").exists() {
config.src = git_root;
}
} else {
// We're building from a tarball, not git sources.
// We don't support pre-downloaded bootstrap in this case.
}
}

if cfg!(test) {
// Use the build directory of the original x.py invocation, so that we can set `initial_rustc` properly.
config.out = Path::new(
Expand All @@ -560,47 +523,6 @@ impl Config {

config.stage0_metadata = build_helper::stage0_parser::parse_stage0_file();

// Locate the configuration file using the following priority (first match wins):
// 1. `--config <path>` (explicit flag)
// 2. `RUST_BOOTSTRAP_CONFIG` environment variable
// 3. `./bootstrap.toml` (local file)
// 4. `<root>/bootstrap.toml`
// 5. `./config.toml` (fallback for backward compatibility)
// 6. `<root>/config.toml`
let toml_path = flags_config
.clone()
.or_else(|| env::var_os("RUST_BOOTSTRAP_CONFIG").map(PathBuf::from));
let using_default_path = toml_path.is_none();
let mut toml_path = toml_path.unwrap_or_else(|| PathBuf::from("bootstrap.toml"));

if using_default_path && !toml_path.exists() {
toml_path = config.src.join(PathBuf::from("bootstrap.toml"));
if !toml_path.exists() {
toml_path = PathBuf::from("config.toml");
if !toml_path.exists() {
toml_path = config.src.join(PathBuf::from("config.toml"));
}
}
}

// Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
// but not if `bootstrap.toml` hasn't been created.
let mut toml = if !using_default_path || toml_path.exists() {
config.config = Some(if cfg!(not(test)) {
toml_path = toml_path.canonicalize().unwrap();
toml_path.clone()
} else {
toml_path.clone()
});
get_toml(&toml_path).unwrap_or_else(|e| {
eprintln!("ERROR: Failed to parse '{}': {e}", toml_path.display());
exit!(2);
})
} else {
config.config = None;
TomlConfig::default()
};

if cfg!(test) {
// When configuring bootstrap for tests, make sure to set the rustc and Cargo to the
// same ones used to call the tests (if custom ones are not defined in the toml). If we
Expand All @@ -622,7 +544,12 @@ impl Config {
// This must be handled before applying the `profile` since `include`s should always take
// precedence over `profile`s.
for include_path in toml.include.clone().unwrap_or_default().iter().rev() {
let include_path = toml_path.parent().unwrap().join(include_path);
let include_path = toml_path
.as_ref()
.expect("include found in default TOML config")
.parent()
.unwrap()
.join(include_path);

let included_toml = get_toml(&include_path).unwrap_or_else(|e| {
eprintln!("ERROR: Failed to parse '{}': {e}", include_path.display());
Expand Down Expand Up @@ -2309,3 +2236,104 @@ impl AsRef<ExecutionContext> for Config {
&self.exec_ctx
}
}

fn compute_src_directory(src_dir: Option<PathBuf>, exec_ctx: &ExecutionContext) -> Option<PathBuf> {
if let Some(src) = src_dir {
return Some(src);
} else {
// Infer the source directory. This is non-trivial because we want to support a downloaded bootstrap binary,
// running on a completely different machine from where it was compiled.
let mut cmd = helpers::git(None);
// NOTE: we cannot support running from outside the repository because the only other path we have available
// is set at compile time, which can be wrong if bootstrap was downloaded rather than compiled locally.
// We still support running outside the repository if we find we aren't in a git directory.

// NOTE: We get a relative path from git to work around an issue on MSYS/mingw. If we used an absolute path,
// and end up using MSYS's git rather than git-for-windows, we would get a unix-y MSYS path. But as bootstrap
// has already been (kinda-cross-)compiled to Windows land, we require a normal Windows path.
cmd.arg("rev-parse").arg("--show-cdup");
// Discard stderr because we expect this to fail when building from a tarball.
let output = cmd.allow_failure().run_capture_stdout(exec_ctx);
if output.is_success() {
let git_root_relative = output.stdout();
// We need to canonicalize this path to make sure it uses backslashes instead of forward slashes,
// and to resolve any relative components.
let git_root = env::current_dir()
.unwrap()
.join(PathBuf::from(git_root_relative.trim()))
.canonicalize()
.unwrap();
let s = git_root.to_str().unwrap();

// Bootstrap is quite bad at handling /? in front of paths
let git_root = match s.strip_prefix("\\\\?\\") {
Some(p) => PathBuf::from(p),
None => git_root,
};
// If this doesn't have at least `stage0`, we guessed wrong. This can happen when,
// for example, the build directory is inside of another unrelated git directory.
// In that case keep the original `CARGO_MANIFEST_DIR` handling.
//
// NOTE: this implies that downloadable bootstrap isn't supported when the build directory is outside
// the source directory. We could fix that by setting a variable from all three of python, ./x, and x.ps1.
if git_root.join("src").join("stage0").exists() {
return Some(git_root);
}
} else {
// We're building from a tarball, not git sources.
// We don't support pre-downloaded bootstrap in this case.
}
};
None
}

/// Loads bootstrap TOML config and returns the config together with a path from where
/// it was loaded.
/// `src` is the source root directory, and `config_path` is an optionally provided path to the
/// config.
fn load_toml_config(
src: &Path,
config_path: Option<PathBuf>,
get_toml: &impl Fn(&Path) -> Result<TomlConfig, toml::de::Error>,
) -> (TomlConfig, Option<PathBuf>) {
// Locate the configuration file using the following priority (first match wins):
// 1. `--config <path>` (explicit flag)
// 2. `RUST_BOOTSTRAP_CONFIG` environment variable
// 3. `./bootstrap.toml` (local file)
// 4. `<root>/bootstrap.toml`
// 5. `./config.toml` (fallback for backward compatibility)
// 6. `<root>/config.toml`
let toml_path = config_path.or_else(|| env::var_os("RUST_BOOTSTRAP_CONFIG").map(PathBuf::from));
let using_default_path = toml_path.is_none();
let mut toml_path = toml_path.unwrap_or_else(|| PathBuf::from("bootstrap.toml"));

if using_default_path && !toml_path.exists() {
toml_path = src.join(PathBuf::from("bootstrap.toml"));
if !toml_path.exists() {
toml_path = PathBuf::from("config.toml");
if !toml_path.exists() {
toml_path = src.join(PathBuf::from("config.toml"));
}
}
}

// Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
// but not if `bootstrap.toml` hasn't been created.
if !using_default_path || toml_path.exists() {
let path = Some(if cfg!(not(test)) {
toml_path = toml_path.canonicalize().unwrap();
toml_path.clone()
} else {
toml_path.clone()
});
(
get_toml(&toml_path).unwrap_or_else(|e| {
eprintln!("ERROR: Failed to parse '{}': {e}", toml_path.display());
exit!(2);
}),
path,
)
} else {
(TomlConfig::default(), None)
}
}