Change:
Right now, x.py is pretty inconsistent with cargo's CLI. To pass arguments to compiletest, you use ; to pass arguments to you use ; to pass arguments to cargo you use CARGOFLAGS. I would like to unify these with the same syntax as cargo: would behave the same as today would behave the same as would behave the same as today, except that it would only pass it to cargo commands invoked by bootstrap, not when building bootstrap itself (avoiding the "argument --fix-broken not expected" error you'd get today). <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
claim
Looking at the current setup for argument parsing, it appears that getopts::Options struct doesn't have a state engine based parser, so it wont be able to parse -- as a state changing flag. I'm thinking probably parse and translate the args in python then just pass it on to the bootstrap executable, (unless someone here has a better idea).
let's not put any logic in python if we can help it, it's going away soon: . I think it would be ok to switch to or another arg parser if it makes things easier.
Ah, I was thinking something like getting rid of the python script was going to happen someday. will probably do for the functionality we will need from it.
I'm out of town for the rest of the week so if anyone would like to take this issue while I'm away, go for it.

Discussion:
clippy_lint_warn.iter().for_each(|v| clippy_lint_levels.push(format!("-W{}", v))); clippy_lint_forbid.iter().for_each(|v| clippy_lint_levels.push(format!("-F{}", v))); args.extend(clippy_lint_levels); <ins> args.extend(builder.config.free_args.clone()); </ins> args } else { <del> vec![] </del> <ins> builder.config.free_args.clone() </ins> } }

pub cmd: Subcommand, pub incremental: bool, pub dry_run: DryRun, <ins> /// Arguments appearing after `--` to be forwarded to tools, /// e.g. `--fix-broken` or test arguments. pub free_args: Vec<String>, </ins> /// `None` if we shouldn't download CI compiler artifacts, or the commit to download if we should. #[cfg(not(test))] download_rustc_commit: Option<String>,

config.keep_stage = flags.keep_stage; config.keep_stage_std = flags.keep_stage_std; config.color = flags.color; <ins> config.free_args = flags.free_args.clone().unwrap_or_default(); </ins> if let Some(value) = flags.deny_warnings { config.deny_warnings = value; }

pub llvm_profile_generate: bool, pub llvm_bolt_profile_generate: bool, pub llvm_bolt_profile_use: Option<String>, <ins> /// Arguments appearing after `--` to be forwarded to tools, /// e.g. `--fix-broken` or test arguments. pub free_args: Option<Vec<String>>, </ins> } #[derive(Debug)]

impl Flags { pub fn parse(args: &[String]) -> Flags { <ins> let (args, free_args) = if let Some(pos) = args.iter().position(|s| s == "--") { let (args, free) = args.split_at(pos); (args, Some(free[1..].to_vec())) } else { (args, None) }; </ins> let mut subcommand_help = String::from( " Usage: x.py <subcommand> [options] [<paths>...]

llvm_profile_generate: matches.opt_present("llvm-profile-generate"), llvm_bolt_profile_generate: matches.opt_present("llvm-bolt-profile-generate"), llvm_bolt_profile_use: matches.opt_str("llvm-bolt-profile-use"), <ins> free_args, </ins> } } }

// Forward arguments. miri.arg("--").arg("--target").arg(target.rustc_target_arg()); miri.args(builder.config.cmd.args()); <ins> miri.args(&builder.config.free_args); </ins> // miri tests need to know about the stage sysroot miri.env("MIRI_SYSROOT", &miri_sysroot);

.collect(); test_args.append(&mut builder.config.cmd.test_args()); <ins> test_args.extend(builder.config.free_args.iter().map(|s| s.as_str())); </ins> // On Windows, replace forward slashes in test-args by backslashes // so the correct filters are passed to libtest