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 6 pull requests #128996

Closed
wants to merge 21 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
acb0241
Add windows-targets crate to std's sysroot
ChrisDenton Aug 9, 2024
a1b2b7f
Exclude windows-targets from the workspace
ChrisDenton Aug 9, 2024
03ee7b5
Move verbose help parsing to `main`
Kobzol Aug 9, 2024
5431a93
Pass `Flags` to `Config::parse` explicitly
Kobzol Aug 9, 2024
4f8042e
Support reading thin archives in ArArchiveBuilder
bjorn3 Aug 10, 2024
a57f73d
Add test for thin archive reading support
bjorn3 Aug 10, 2024
c1f5350
Use ArArchiveBuilder with the LLVM backend too
bjorn3 Aug 10, 2024
141d9dc
remove unused imports from rmake tests
lqd Aug 10, 2024
f4cb0de
remove other warnings from rmake tests
lqd Aug 10, 2024
d63a067
Add fixme for removing LlvmArchiveBuilder in the future
bjorn3 Aug 10, 2024
dcd6170
use `rfs` in rustdoc io rmake test
lqd Aug 11, 2024
db68a19
Fix review comments and other improvements
bjorn3 Aug 11, 2024
01a97ed
bootstrap: fix trying to modify file times on read-only file
jieyouxu Aug 11, 2024
13c36f1
bootstrap: extract out a `set_file_times` helper
jieyouxu Aug 11, 2024
c361c92
Use assert_matches around the compiler
compiler-errors Aug 11, 2024
2165459
Rollup merge of #128873 - ChrisDenton:windows-targets, r=Mark-Simulacrum
matthiaskrgr Aug 12, 2024
ea31cd9
Rollup merge of #128878 - Kobzol:refactor-flags, r=onur-ozkan
matthiaskrgr Aug 12, 2024
62fddf1
Rollup merge of #128936 - bjorn3:fix_thin_archive_reading, r=jieyouxu
matthiaskrgr Aug 12, 2024
03c2854
Rollup merge of #128937 - lqd:clean-rmake-tests, r=jieyouxu
matthiaskrgr Aug 12, 2024
9ef4afb
Rollup merge of #128977 - jieyouxu:writable-file, r=Kobzol
matthiaskrgr Aug 12, 2024
345d0fe
Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxu
matthiaskrgr Aug 12, 2024
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
Pass Flags to Config::parse explicitly
Kobzol committed Aug 9, 2024
commit 5431a93ddc1c8482d9a801d1627991d16c2318d0
4 changes: 3 additions & 1 deletion src/bootstrap/src/bin/main.rs
Original file line number Diff line number Diff line change
@@ -17,12 +17,14 @@ use bootstrap::{

fn main() {
let args = env::args().skip(1).collect::<Vec<_>>();
let config = Config::parse(&args);

if Flags::try_parse_verbose_help(&args) {
return;
}

let flags = Flags::parse(&args);
let config = Config::parse(flags);

let mut build_lock;
let _build_lock_guard;

5 changes: 3 additions & 2 deletions src/bootstrap/src/core/builder/tests.rs
Original file line number Diff line number Diff line change
@@ -3,13 +3,14 @@ use std::thread;
use super::*;
use crate::core::build_steps::doc::DocumentationFormat;
use crate::core::config::Config;
use crate::Flags;

fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config {
configure_with_args(&[cmd.to_owned()], host, target)
}

fn configure_with_args(cmd: &[String], host: &[&str], target: &[&str]) -> Config {
let mut config = Config::parse(cmd);
let mut config = Config::parse(Flags::parse(cmd));
// don't save toolstates
config.save_toolstates = None;
config.dry_run = DryRun::SelfCheck;
@@ -23,7 +24,7 @@ fn configure_with_args(cmd: &[String], host: &[&str], target: &[&str]) -> Config
let submodule_build = Build::new(Config {
// don't include LLVM, so CI doesn't require ninja/cmake to be installed
rust_codegen_backends: vec![],
..Config::parse(&["check".to_owned()])
..Config::parse(Flags::parse(&["check".to_owned()]))
});
submodule_build.require_submodule("src/doc/book", None);
config.submodules = Some(false);
7 changes: 3 additions & 4 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
@@ -1188,7 +1188,7 @@ impl Config {
}
}

pub fn parse(args: &[String]) -> Config {
pub fn parse(flags: Flags) -> Config {
#[cfg(test)]
fn get_toml(_: &Path) -> TomlConfig {
TomlConfig::default()
@@ -1218,11 +1218,10 @@ impl Config {
exit!(2);
})
}
Self::parse_inner(args, get_toml)
Self::parse_inner(flags, get_toml)
}

pub(crate) fn parse_inner(args: &[String], get_toml: impl Fn(&Path) -> TomlConfig) -> Config {
let mut flags = Flags::parse(args);
pub(crate) fn parse_inner(mut flags: Flags, get_toml: impl Fn(&Path) -> TomlConfig) -> Config {
let mut config = Config::default_opts();

// Set flags.
19 changes: 10 additions & 9 deletions src/bootstrap/src/core/config/tests.rs
Original file line number Diff line number Diff line change
@@ -12,9 +12,10 @@ use crate::core::build_steps::clippy::get_clippy_rules_in_order;
use crate::core::config::{LldMode, Target, TargetSelection, TomlConfig};

fn parse(config: &str) -> Config {
Config::parse_inner(&["check".to_string(), "--config=/does/not/exist".to_string()], |&_| {
toml::from_str(&config).unwrap()
})
Config::parse_inner(
Flags::parse(&["check".to_string(), "--config=/does/not/exist".to_string()]),
|&_| toml::from_str(&config).unwrap(),
)
}

#[test]
@@ -108,7 +109,7 @@ fn clap_verify() {
#[test]
fn override_toml() {
let config = Config::parse_inner(
&[
Flags::parse(&[
"check".to_owned(),
"--config=/does/not/exist".to_owned(),
"--set=change-id=1".to_owned(),
@@ -121,7 +122,7 @@ fn override_toml() {
"--set=target.x86_64-unknown-linux-gnu.rpath=false".to_owned(),
"--set=target.aarch64-unknown-linux-gnu.sanitizers=false".to_owned(),
"--set=target.aarch64-apple-darwin.runner=apple".to_owned(),
],
]),
|&_| {
toml::from_str(
r#"
@@ -201,12 +202,12 @@ runner = "x86_64-runner"
#[should_panic]
fn override_toml_duplicate() {
Config::parse_inner(
&[
Flags::parse(&[
"check".to_owned(),
"--config=/does/not/exist".to_string(),
"--set=change-id=1".to_owned(),
"--set=change-id=2".to_owned(),
],
]),
|&_| toml::from_str("change-id = 0").unwrap(),
);
}
@@ -226,7 +227,7 @@ fn profile_user_dist() {
.and_then(|table: toml::Value| TomlConfig::deserialize(table))
.unwrap()
}
Config::parse_inner(&["check".to_owned()], get_toml);
Config::parse_inner(Flags::parse(&["check".to_owned()]), get_toml);
}

#[test]
@@ -301,7 +302,7 @@ fn order_of_clippy_rules() {
"-Aclippy::foo1".to_string(),
"-Aclippy::foo2".to_string(),
];
let config = Config::parse(&args);
let config = Config::parse(Flags::parse(&args));

let actual = match &config.cmd {
crate::Subcommand::Clippy { allow, deny, warn, forbid, .. } => {
8 changes: 5 additions & 3 deletions src/bootstrap/src/utils/helpers/tests.rs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ use std::path::PathBuf;
use crate::utils::helpers::{
check_cfg_arg, extract_beta_rev, hex_encode, make, program_out_of_date, symlink_dir,
};
use crate::Config;
use crate::{Config, Flags};

#[test]
fn test_make() {
@@ -58,7 +58,8 @@ fn test_check_cfg_arg() {

#[test]
fn test_program_out_of_date() {
let config = Config::parse(&["check".to_owned(), "--config=/does/not/exist".to_owned()]);
let config =
Config::parse(Flags::parse(&["check".to_owned(), "--config=/does/not/exist".to_owned()]));
let tempfile = config.tempdir().join(".tmp-stamp-file");
File::create(&tempfile).unwrap().write_all(b"dummy value").unwrap();
assert!(tempfile.exists());
@@ -73,7 +74,8 @@ fn test_program_out_of_date() {

#[test]
fn test_symlink_dir() {
let config = Config::parse(&["check".to_owned(), "--config=/does/not/exist".to_owned()]);
let config =
Config::parse(Flags::parse(&["check".to_owned(), "--config=/does/not/exist".to_owned()]));
let tempdir = config.tempdir().join(".tmp-dir");
let link_path = config.tempdir().join(".tmp-link");