Skip to content

Commit 70db836

Browse files
committedMay 24, 2023
Auto merge of rust-lang#111566 - clubby789:bootstrap-override-config, r=ozkanonur
Override config.toml options from command line https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/Running.20tests.20on.20precompiled.20rustc/near/357763280 cc `@jyn514`
2 parents d69787f + 7a7cbe0 commit 70db836

File tree

6 files changed

+303
-47
lines changed

6 files changed

+303
-47
lines changed
 

‎src/bootstrap/config.rs‎

Lines changed: 124 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ impl SplitDebuginfo {
350350
}
351351

352352
/// LTO mode used for compiling rustc itself.
353-
#[derive(Default, Clone, PartialEq)]
353+
#[derive(Default, Clone, PartialEq, Debug)]
354354
pub enum RustcLto {
355355
Off,
356356
#[default]
@@ -508,29 +508,42 @@ struct TomlConfig {
508508
profile: Option<String>,
509509
}
510510

511+
/// Describes how to handle conflicts in merging two [`TomlConfig`]
512+
#[derive(Copy, Clone, Debug)]
513+
enum ReplaceOpt {
514+
/// Silently ignore a duplicated value
515+
IgnoreDuplicate,
516+
/// Override the current value, even if it's `Some`
517+
Override,
518+
/// Exit with an error on duplicate values
519+
ErrorOnDuplicate,
520+
}
521+
511522
trait Merge {
512-
fn merge(&mut self, other: Self);
523+
fn merge(&mut self, other: Self, replace: ReplaceOpt);
513524
}
514525

515526
impl Merge for TomlConfig {
516527
fn merge(
517528
&mut self,
518-
TomlConfig { build, install, llvm, rust, dist, target, profile: _, changelog_seen: _ }: Self,
529+
TomlConfig { build, install, llvm, rust, dist, target, profile: _, changelog_seen }: Self,
530+
replace: ReplaceOpt,
519531
) {
520-
fn do_merge<T: Merge>(x: &mut Option<T>, y: Option<T>) {
532+
fn do_merge<T: Merge>(x: &mut Option<T>, y: Option<T>, replace: ReplaceOpt) {
521533
if let Some(new) = y {
522534
if let Some(original) = x {
523-
original.merge(new);
535+
original.merge(new, replace);
524536
} else {
525537
*x = Some(new);
526538
}
527539
}
528540
}
529-
do_merge(&mut self.build, build);
530-
do_merge(&mut self.install, install);
531-
do_merge(&mut self.llvm, llvm);
532-
do_merge(&mut self.rust, rust);
533-
do_merge(&mut self.dist, dist);
541+
self.changelog_seen.merge(changelog_seen, replace);
542+
do_merge(&mut self.build, build, replace);
543+
do_merge(&mut self.install, install, replace);
544+
do_merge(&mut self.llvm, llvm, replace);
545+
do_merge(&mut self.rust, rust, replace);
546+
do_merge(&mut self.dist, dist, replace);
534547
assert!(target.is_none(), "merging target-specific config is not currently supported");
535548
}
536549
}
@@ -547,10 +560,33 @@ macro_rules! define_config {
547560
}
548561

549562
impl Merge for $name {
550-
fn merge(&mut self, other: Self) {
563+
fn merge(&mut self, other: Self, replace: ReplaceOpt) {
551564
$(
552-
if !self.$field.is_some() {
553-
self.$field = other.$field;
565+
match replace {
566+
ReplaceOpt::IgnoreDuplicate => {
567+
if self.$field.is_none() {
568+
self.$field = other.$field;
569+
}
570+
},
571+
ReplaceOpt::Override => {
572+
if other.$field.is_some() {
573+
self.$field = other.$field;
574+
}
575+
}
576+
ReplaceOpt::ErrorOnDuplicate => {
577+
if other.$field.is_some() {
578+
if self.$field.is_some() {
579+
if cfg!(test) {
580+
panic!("overriding existing option")
581+
} else {
582+
eprintln!("overriding existing option: `{}`", stringify!($field));
583+
crate::detail_exit(2);
584+
}
585+
} else {
586+
self.$field = other.$field;
587+
}
588+
}
589+
}
554590
}
555591
)*
556592
}
@@ -623,6 +659,37 @@ macro_rules! define_config {
623659
}
624660
}
625661

662+
impl<T> Merge for Option<T> {
663+
fn merge(&mut self, other: Self, replace: ReplaceOpt) {
664+
match replace {
665+
ReplaceOpt::IgnoreDuplicate => {
666+
if self.is_none() {
667+
*self = other;
668+
}
669+
}
670+
ReplaceOpt::Override => {
671+
if other.is_some() {
672+
*self = other;
673+
}
674+
}
675+
ReplaceOpt::ErrorOnDuplicate => {
676+
if other.is_some() {
677+
if self.is_some() {
678+
if cfg!(test) {
679+
panic!("overriding existing option")
680+
} else {
681+
eprintln!("overriding existing option");
682+
crate::detail_exit(2);
683+
}
684+
} else {
685+
*self = other;
686+
}
687+
}
688+
}
689+
}
690+
}
691+
}
692+
626693
define_config! {
627694
/// TOML representation of various global build decisions.
628695
#[derive(Default)]
@@ -864,28 +931,27 @@ impl Config {
864931

865932
pub fn parse(args: &[String]) -> Config {
866933
#[cfg(test)]
867-
let get_toml = |_: &_| TomlConfig::default();
934+
fn get_toml(_: &Path) -> TomlConfig {
935+
TomlConfig::default()
936+
}
937+
868938
#[cfg(not(test))]
869-
let get_toml = |file: &Path| {
939+
fn get_toml(file: &Path) -> TomlConfig {
870940
let contents =
871941
t!(fs::read_to_string(file), format!("config file {} not found", file.display()));
872942
// Deserialize to Value and then TomlConfig to prevent the Deserialize impl of
873943
// TomlConfig and sub types to be monomorphized 5x by toml.
874-
match toml::from_str(&contents)
944+
toml::from_str(&contents)
875945
.and_then(|table: toml::Value| TomlConfig::deserialize(table))
876-
{
877-
Ok(table) => table,
878-
Err(err) => {
879-
eprintln!("failed to parse TOML configuration '{}': {}", file.display(), err);
946+
.unwrap_or_else(|err| {
947+
eprintln!("failed to parse TOML configuration '{}': {err}", file.display());
880948
crate::detail_exit(2);
881-
}
882-
}
883-
};
884-
949+
})
950+
}
885951
Self::parse_inner(args, get_toml)
886952
}
887953

888-
fn parse_inner<'a>(args: &[String], get_toml: impl 'a + Fn(&Path) -> TomlConfig) -> Config {
954+
fn parse_inner(args: &[String], get_toml: impl Fn(&Path) -> TomlConfig) -> Config {
889955
let mut flags = Flags::parse(&args);
890956
let mut config = Config::default_opts();
891957

@@ -998,8 +1064,40 @@ impl Config {
9981064
include_path.push("defaults");
9991065
include_path.push(format!("config.{}.toml", include));
10001066
let included_toml = get_toml(&include_path);
1001-
toml.merge(included_toml);
1067+
toml.merge(included_toml, ReplaceOpt::IgnoreDuplicate);
1068+
}
1069+
1070+
let mut override_toml = TomlConfig::default();
1071+
for option in flags.set.iter() {
1072+
fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
1073+
toml::from_str(&option)
1074+
.and_then(|table: toml::Value| TomlConfig::deserialize(table))
1075+
}
1076+
1077+
let mut err = match get_table(option) {
1078+
Ok(v) => {
1079+
override_toml.merge(v, ReplaceOpt::ErrorOnDuplicate);
1080+
continue;
1081+
}
1082+
Err(e) => e,
1083+
};
1084+
// We want to be able to set string values without quotes,
1085+
// like in `configure.py`. Try adding quotes around the right hand side
1086+
if let Some((key, value)) = option.split_once("=") {
1087+
if !value.contains('"') {
1088+
match get_table(&format!(r#"{key}="{value}""#)) {
1089+
Ok(v) => {
1090+
override_toml.merge(v, ReplaceOpt::ErrorOnDuplicate);
1091+
continue;
1092+
}
1093+
Err(e) => err = e,
1094+
}
1095+
}
1096+
}
1097+
eprintln!("failed to parse override `{option}`: `{err}");
1098+
crate::detail_exit(2)
10021099
}
1100+
toml.merge(override_toml, ReplaceOpt::Override);
10031101

10041102
config.changelog_seen = toml.changelog_seen;
10051103

‎src/bootstrap/config/tests.rs‎

Lines changed: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
use super::{Config, Flags, TomlConfig};
1+
use super::{Config, Flags};
22
use clap::CommandFactory;
33
use std::{env, path::Path};
44

5-
fn toml(config: &str) -> impl '_ + Fn(&Path) -> TomlConfig {
6-
|&_| toml::from_str(config).unwrap()
7-
}
8-
95
fn parse(config: &str) -> Config {
10-
Config::parse_inner(&["check".to_owned(), "--config=/does/not/exist".to_owned()], toml(config))
6+
Config::parse_inner(&["check".to_owned(), "--config=/does/not/exist".to_owned()], |&_| {
7+
toml::from_str(config).unwrap()
8+
})
119
}
1210

1311
#[test]
@@ -94,3 +92,70 @@ fn detect_src_and_out() {
9492
fn clap_verify() {
9593
Flags::command().debug_assert();
9694
}
95+
96+
#[test]
97+
fn override_toml() {
98+
let config = Config::parse_inner(
99+
&[
100+
"check".to_owned(),
101+
"--config=/does/not/exist".to_owned(),
102+
"--set=changelog-seen=1".to_owned(),
103+
"--set=rust.lto=fat".to_owned(),
104+
"--set=rust.deny-warnings=false".to_owned(),
105+
"--set=build.gdb=\"bar\"".to_owned(),
106+
"--set=build.tools=[\"cargo\"]".to_owned(),
107+
"--set=llvm.build-config={\"foo\" = \"bar\"}".to_owned(),
108+
],
109+
|&_| {
110+
toml::from_str(
111+
r#"
112+
changelog-seen = 0
113+
[rust]
114+
lto = "off"
115+
deny-warnings = true
116+
117+
[build]
118+
gdb = "foo"
119+
tools = []
120+
121+
[llvm]
122+
download-ci-llvm = false
123+
build-config = {}
124+
"#,
125+
)
126+
.unwrap()
127+
},
128+
);
129+
assert_eq!(config.changelog_seen, Some(1), "setting top-level value");
130+
assert_eq!(
131+
config.rust_lto,
132+
crate::config::RustcLto::Fat,
133+
"setting string value without quotes"
134+
);
135+
assert_eq!(config.gdb, Some("bar".into()), "setting string value with quotes");
136+
assert_eq!(config.deny_warnings, false, "setting boolean value");
137+
assert_eq!(
138+
config.tools,
139+
Some(["cargo".to_string()].into_iter().collect()),
140+
"setting list value"
141+
);
142+
assert_eq!(
143+
config.llvm_build_config,
144+
[("foo".to_string(), "bar".to_string())].into_iter().collect(),
145+
"setting dictionary value"
146+
);
147+
}
148+
149+
#[test]
150+
#[should_panic]
151+
fn override_toml_duplicate() {
152+
Config::parse_inner(
153+
&[
154+
"check".to_owned(),
155+
"--config=/does/not/exist".to_owned(),
156+
"--set=changelog-seen=1".to_owned(),
157+
"--set=changelog-seen=2".to_owned(),
158+
],
159+
|&_| toml::from_str("changelog-seen = 0").unwrap(),
160+
);
161+
}

‎src/bootstrap/flags.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ pub struct Flags {
158158
#[arg(global(true))]
159159
/// paths for the subcommand
160160
pub paths: Vec<PathBuf>,
161+
/// override options in config.toml
162+
#[arg(global(true), value_hint = clap::ValueHint::Other, long, value_name = "section.option=value")]
163+
pub set: Vec<String>,
161164
/// arguments passed to subcommands
162165
#[arg(global(true), last(true), value_name = "ARGS")]
163166
pub free_args: Vec<String>,

‎src/etc/completions/x.py.fish‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ complete -c x.py -n "__fish_use_subcommand" -l rust-profile-generate -d 'generat
1919
complete -c x.py -n "__fish_use_subcommand" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
2020
complete -c x.py -n "__fish_use_subcommand" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
2121
complete -c x.py -n "__fish_use_subcommand" -l llvm-bolt-profile-use -d 'use BOLT profile for LLVM build' -r -F
22+
complete -c x.py -n "__fish_use_subcommand" -l set -d 'override options in config.toml' -r -f
2223
complete -c x.py -n "__fish_use_subcommand" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
2324
complete -c x.py -n "__fish_use_subcommand" -s i -l incremental -d 'use incremental compilation'
2425
complete -c x.py -n "__fish_use_subcommand" -l include-default-paths -d 'include default paths in addition to the provided ones'
@@ -62,6 +63,7 @@ complete -c x.py -n "__fish_seen_subcommand_from build" -l rust-profile-generate
6263
complete -c x.py -n "__fish_seen_subcommand_from build" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
6364
complete -c x.py -n "__fish_seen_subcommand_from build" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
6465
complete -c x.py -n "__fish_seen_subcommand_from build" -l llvm-bolt-profile-use -d 'use BOLT profile for LLVM build' -r -F
66+
complete -c x.py -n "__fish_seen_subcommand_from build" -l set -d 'override options in config.toml' -r -f
6567
complete -c x.py -n "__fish_seen_subcommand_from build" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
6668
complete -c x.py -n "__fish_seen_subcommand_from build" -s i -l incremental -d 'use incremental compilation'
6769
complete -c x.py -n "__fish_seen_subcommand_from build" -l include-default-paths -d 'include default paths in addition to the provided ones'
@@ -91,6 +93,7 @@ complete -c x.py -n "__fish_seen_subcommand_from check" -l rust-profile-generate
9193
complete -c x.py -n "__fish_seen_subcommand_from check" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
9294
complete -c x.py -n "__fish_seen_subcommand_from check" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
9395
complete -c x.py -n "__fish_seen_subcommand_from check" -l llvm-bolt-profile-use -d 'use BOLT profile for LLVM build' -r -F
96+
complete -c x.py -n "__fish_seen_subcommand_from check" -l set -d 'override options in config.toml' -r -f
9497
complete -c x.py -n "__fish_seen_subcommand_from check" -l all-targets -d 'Check all targets'
9598
complete -c x.py -n "__fish_seen_subcommand_from check" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
9699
complete -c x.py -n "__fish_seen_subcommand_from check" -s i -l incremental -d 'use incremental compilation'
@@ -125,6 +128,7 @@ complete -c x.py -n "__fish_seen_subcommand_from clippy" -l rust-profile-generat
125128
complete -c x.py -n "__fish_seen_subcommand_from clippy" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
126129
complete -c x.py -n "__fish_seen_subcommand_from clippy" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
127130
complete -c x.py -n "__fish_seen_subcommand_from clippy" -l llvm-bolt-profile-use -d 'use BOLT profile for LLVM build' -r -F
131+
complete -c x.py -n "__fish_seen_subcommand_from clippy" -l set -d 'override options in config.toml' -r -f
128132
complete -c x.py -n "__fish_seen_subcommand_from clippy" -l fix
129133
complete -c x.py -n "__fish_seen_subcommand_from clippy" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
130134
complete -c x.py -n "__fish_seen_subcommand_from clippy" -s i -l incremental -d 'use incremental compilation'
@@ -155,6 +159,7 @@ complete -c x.py -n "__fish_seen_subcommand_from fix" -l rust-profile-generate -
155159
complete -c x.py -n "__fish_seen_subcommand_from fix" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
156160
complete -c x.py -n "__fish_seen_subcommand_from fix" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
157161
complete -c x.py -n "__fish_seen_subcommand_from fix" -l llvm-bolt-profile-use -d 'use BOLT profile for LLVM build' -r -F
162+
complete -c x.py -n "__fish_seen_subcommand_from fix" -l set -d 'override options in config.toml' -r -f
158163
complete -c x.py -n "__fish_seen_subcommand_from fix" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
159164
complete -c x.py -n "__fish_seen_subcommand_from fix" -s i -l incremental -d 'use incremental compilation'
160165
complete -c x.py -n "__fish_seen_subcommand_from fix" -l include-default-paths -d 'include default paths in addition to the provided ones'
@@ -184,6 +189,7 @@ complete -c x.py -n "__fish_seen_subcommand_from fmt" -l rust-profile-generate -
184189
complete -c x.py -n "__fish_seen_subcommand_from fmt" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
185190
complete -c x.py -n "__fish_seen_subcommand_from fmt" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
186191
complete -c x.py -n "__fish_seen_subcommand_from fmt" -l llvm-bolt-profile-use -d 'use BOLT profile for LLVM build' -r -F
192+
complete -c x.py -n "__fish_seen_subcommand_from fmt" -l set -d 'override options in config.toml' -r -f
187193
complete -c x.py -n "__fish_seen_subcommand_from fmt" -l check -d 'check formatting instead of applying'
188194
complete -c x.py -n "__fish_seen_subcommand_from fmt" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
189195
complete -c x.py -n "__fish_seen_subcommand_from fmt" -s i -l incremental -d 'use incremental compilation'
@@ -214,6 +220,7 @@ complete -c x.py -n "__fish_seen_subcommand_from doc" -l rust-profile-generate -
214220
complete -c x.py -n "__fish_seen_subcommand_from doc" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
215221
complete -c x.py -n "__fish_seen_subcommand_from doc" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
216222
complete -c x.py -n "__fish_seen_subcommand_from doc" -l llvm-bolt-profile-use -d 'use BOLT profile for LLVM build' -r -F
223+
complete -c x.py -n "__fish_seen_subcommand_from doc" -l set -d 'override options in config.toml' -r -f
217224
complete -c x.py -n "__fish_seen_subcommand_from doc" -l open -d 'open the docs in a browser'
218225
complete -c x.py -n "__fish_seen_subcommand_from doc" -l json -d 'render the documentation in JSON format in addition to the usual HTML format'
219226
complete -c x.py -n "__fish_seen_subcommand_from doc" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
@@ -251,6 +258,7 @@ complete -c x.py -n "__fish_seen_subcommand_from test" -l rust-profile-generate
251258
complete -c x.py -n "__fish_seen_subcommand_from test" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
252259
complete -c x.py -n "__fish_seen_subcommand_from test" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
253260
complete -c x.py -n "__fish_seen_subcommand_from test" -l llvm-bolt-profile-use -d 'use BOLT profile for LLVM build' -r -F
261+
complete -c x.py -n "__fish_seen_subcommand_from test" -l set -d 'override options in config.toml' -r -f
254262
complete -c x.py -n "__fish_seen_subcommand_from test" -l no-fail-fast -d 'run all tests regardless of failure'
255263
complete -c x.py -n "__fish_seen_subcommand_from test" -l no-doc -d 'do not run doc tests'
256264
complete -c x.py -n "__fish_seen_subcommand_from test" -l doc -d 'only run doc tests'
@@ -288,6 +296,7 @@ complete -c x.py -n "__fish_seen_subcommand_from bench" -l rust-profile-generate
288296
complete -c x.py -n "__fish_seen_subcommand_from bench" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
289297
complete -c x.py -n "__fish_seen_subcommand_from bench" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
290298
complete -c x.py -n "__fish_seen_subcommand_from bench" -l llvm-bolt-profile-use -d 'use BOLT profile for LLVM build' -r -F
299+
complete -c x.py -n "__fish_seen_subcommand_from bench" -l set -d 'override options in config.toml' -r -f
291300
complete -c x.py -n "__fish_seen_subcommand_from bench" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
292301
complete -c x.py -n "__fish_seen_subcommand_from bench" -s i -l incremental -d 'use incremental compilation'
293302
complete -c x.py -n "__fish_seen_subcommand_from bench" -l include-default-paths -d 'include default paths in addition to the provided ones'
@@ -317,6 +326,7 @@ complete -c x.py -n "__fish_seen_subcommand_from clean" -l rust-profile-generate
317326
complete -c x.py -n "__fish_seen_subcommand_from clean" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
318327
complete -c x.py -n "__fish_seen_subcommand_from clean" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
319328
complete -c x.py -n "__fish_seen_subcommand_from clean" -l llvm-bolt-profile-use -d 'use BOLT profile for LLVM build' -r -F
329+
complete -c x.py -n "__fish_seen_subcommand_from clean" -l set -d 'override options in config.toml' -r -f
320330
complete -c x.py -n "__fish_seen_subcommand_from clean" -l all
321331
complete -c x.py -n "__fish_seen_subcommand_from clean" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
322332
complete -c x.py -n "__fish_seen_subcommand_from clean" -s i -l incremental -d 'use incremental compilation'
@@ -347,6 +357,7 @@ complete -c x.py -n "__fish_seen_subcommand_from dist" -l rust-profile-generate
347357
complete -c x.py -n "__fish_seen_subcommand_from dist" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
348358
complete -c x.py -n "__fish_seen_subcommand_from dist" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
349359
complete -c x.py -n "__fish_seen_subcommand_from dist" -l llvm-bolt-profile-use -d 'use BOLT profile for LLVM build' -r -F
360+
complete -c x.py -n "__fish_seen_subcommand_from dist" -l set -d 'override options in config.toml' -r -f
350361
complete -c x.py -n "__fish_seen_subcommand_from dist" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
351362
complete -c x.py -n "__fish_seen_subcommand_from dist" -s i -l incremental -d 'use incremental compilation'
352363
complete -c x.py -n "__fish_seen_subcommand_from dist" -l include-default-paths -d 'include default paths in addition to the provided ones'
@@ -376,6 +387,7 @@ complete -c x.py -n "__fish_seen_subcommand_from install" -l rust-profile-genera
376387
complete -c x.py -n "__fish_seen_subcommand_from install" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
377388
complete -c x.py -n "__fish_seen_subcommand_from install" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
378389
complete -c x.py -n "__fish_seen_subcommand_from install" -l llvm-bolt-profile-use -d 'use BOLT profile for LLVM build' -r -F
390+
complete -c x.py -n "__fish_seen_subcommand_from install" -l set -d 'override options in config.toml' -r -f
379391
complete -c x.py -n "__fish_seen_subcommand_from install" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
380392
complete -c x.py -n "__fish_seen_subcommand_from install" -s i -l incremental -d 'use incremental compilation'
381393
complete -c x.py -n "__fish_seen_subcommand_from install" -l include-default-paths -d 'include default paths in addition to the provided ones'
@@ -406,6 +418,7 @@ complete -c x.py -n "__fish_seen_subcommand_from run" -l rust-profile-generate -
406418
complete -c x.py -n "__fish_seen_subcommand_from run" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
407419
complete -c x.py -n "__fish_seen_subcommand_from run" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
408420
complete -c x.py -n "__fish_seen_subcommand_from run" -l llvm-bolt-profile-use -d 'use BOLT profile for LLVM build' -r -F
421+
complete -c x.py -n "__fish_seen_subcommand_from run" -l set -d 'override options in config.toml' -r -f
409422
complete -c x.py -n "__fish_seen_subcommand_from run" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
410423
complete -c x.py -n "__fish_seen_subcommand_from run" -s i -l incremental -d 'use incremental compilation'
411424
complete -c x.py -n "__fish_seen_subcommand_from run" -l include-default-paths -d 'include default paths in addition to the provided ones'
@@ -435,6 +448,7 @@ complete -c x.py -n "__fish_seen_subcommand_from setup" -l rust-profile-generate
435448
complete -c x.py -n "__fish_seen_subcommand_from setup" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
436449
complete -c x.py -n "__fish_seen_subcommand_from setup" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
437450
complete -c x.py -n "__fish_seen_subcommand_from setup" -l llvm-bolt-profile-use -d 'use BOLT profile for LLVM build' -r -F
451+
complete -c x.py -n "__fish_seen_subcommand_from setup" -l set -d 'override options in config.toml' -r -f
438452
complete -c x.py -n "__fish_seen_subcommand_from setup" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
439453
complete -c x.py -n "__fish_seen_subcommand_from setup" -s i -l incremental -d 'use incremental compilation'
440454
complete -c x.py -n "__fish_seen_subcommand_from setup" -l include-default-paths -d 'include default paths in addition to the provided ones'
@@ -464,6 +478,7 @@ complete -c x.py -n "__fish_seen_subcommand_from suggest" -l rust-profile-genera
464478
complete -c x.py -n "__fish_seen_subcommand_from suggest" -l rust-profile-use -d 'use PGO profile for rustc build' -r -F
465479
complete -c x.py -n "__fish_seen_subcommand_from suggest" -l llvm-profile-use -d 'use PGO profile for LLVM build' -r -F
466480
complete -c x.py -n "__fish_seen_subcommand_from suggest" -l llvm-bolt-profile-use -d 'use BOLT profile for LLVM build' -r -F
481+
complete -c x.py -n "__fish_seen_subcommand_from suggest" -l set -d 'override options in config.toml' -r -f
467482
complete -c x.py -n "__fish_seen_subcommand_from suggest" -l run -d 'run suggested tests'
468483
complete -c x.py -n "__fish_seen_subcommand_from suggest" -s v -l verbose -d 'use verbose output (-vv for very verbose)'
469484
complete -c x.py -n "__fish_seen_subcommand_from suggest" -s i -l incremental -d 'use incremental compilation'

‎src/etc/completions/x.py.ps1‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
4343
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
4444
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
4545
[CompletionResult]::new('--llvm-bolt-profile-use', 'llvm-bolt-profile-use', [CompletionResultType]::ParameterName, 'use BOLT profile for LLVM build')
46+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
4647
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
4748
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
4849
[CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'use incremental compilation')
@@ -93,6 +94,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
9394
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
9495
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
9596
[CompletionResult]::new('--llvm-bolt-profile-use', 'llvm-bolt-profile-use', [CompletionResultType]::ParameterName, 'use BOLT profile for LLVM build')
97+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
9698
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
9799
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
98100
[CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'use incremental compilation')
@@ -129,6 +131,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
129131
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
130132
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
131133
[CompletionResult]::new('--llvm-bolt-profile-use', 'llvm-bolt-profile-use', [CompletionResultType]::ParameterName, 'use BOLT profile for LLVM build')
134+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
132135
[CompletionResult]::new('--all-targets', 'all-targets', [CompletionResultType]::ParameterName, 'Check all targets')
133136
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
134137
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
@@ -170,6 +173,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
170173
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
171174
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
172175
[CompletionResult]::new('--llvm-bolt-profile-use', 'llvm-bolt-profile-use', [CompletionResultType]::ParameterName, 'use BOLT profile for LLVM build')
176+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
173177
[CompletionResult]::new('--fix', 'fix', [CompletionResultType]::ParameterName, 'fix')
174178
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
175179
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
@@ -207,6 +211,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
207211
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
208212
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
209213
[CompletionResult]::new('--llvm-bolt-profile-use', 'llvm-bolt-profile-use', [CompletionResultType]::ParameterName, 'use BOLT profile for LLVM build')
214+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
210215
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
211216
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
212217
[CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'use incremental compilation')
@@ -243,6 +248,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
243248
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
244249
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
245250
[CompletionResult]::new('--llvm-bolt-profile-use', 'llvm-bolt-profile-use', [CompletionResultType]::ParameterName, 'use BOLT profile for LLVM build')
251+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
246252
[CompletionResult]::new('--check', 'check', [CompletionResultType]::ParameterName, 'check formatting instead of applying')
247253
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
248254
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
@@ -280,6 +286,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
280286
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
281287
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
282288
[CompletionResult]::new('--llvm-bolt-profile-use', 'llvm-bolt-profile-use', [CompletionResultType]::ParameterName, 'use BOLT profile for LLVM build')
289+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
283290
[CompletionResult]::new('--open', 'open', [CompletionResultType]::ParameterName, 'open the docs in a browser')
284291
[CompletionResult]::new('--json', 'json', [CompletionResultType]::ParameterName, 'render the documentation in JSON format in addition to the usual HTML format')
285292
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
@@ -324,6 +331,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
324331
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
325332
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
326333
[CompletionResult]::new('--llvm-bolt-profile-use', 'llvm-bolt-profile-use', [CompletionResultType]::ParameterName, 'use BOLT profile for LLVM build')
334+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
327335
[CompletionResult]::new('--no-fail-fast', 'no-fail-fast', [CompletionResultType]::ParameterName, 'run all tests regardless of failure')
328336
[CompletionResult]::new('--no-doc', 'no-doc', [CompletionResultType]::ParameterName, 'do not run doc tests')
329337
[CompletionResult]::new('--doc', 'doc', [CompletionResultType]::ParameterName, 'only run doc tests')
@@ -368,6 +376,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
368376
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
369377
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
370378
[CompletionResult]::new('--llvm-bolt-profile-use', 'llvm-bolt-profile-use', [CompletionResultType]::ParameterName, 'use BOLT profile for LLVM build')
379+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
371380
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
372381
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
373382
[CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'use incremental compilation')
@@ -404,6 +413,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
404413
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
405414
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
406415
[CompletionResult]::new('--llvm-bolt-profile-use', 'llvm-bolt-profile-use', [CompletionResultType]::ParameterName, 'use BOLT profile for LLVM build')
416+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
407417
[CompletionResult]::new('--all', 'all', [CompletionResultType]::ParameterName, 'all')
408418
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
409419
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
@@ -441,6 +451,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
441451
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
442452
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
443453
[CompletionResult]::new('--llvm-bolt-profile-use', 'llvm-bolt-profile-use', [CompletionResultType]::ParameterName, 'use BOLT profile for LLVM build')
454+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
444455
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
445456
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
446457
[CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'use incremental compilation')
@@ -477,6 +488,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
477488
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
478489
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
479490
[CompletionResult]::new('--llvm-bolt-profile-use', 'llvm-bolt-profile-use', [CompletionResultType]::ParameterName, 'use BOLT profile for LLVM build')
491+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
480492
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
481493
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
482494
[CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'use incremental compilation')
@@ -514,6 +526,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
514526
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
515527
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
516528
[CompletionResult]::new('--llvm-bolt-profile-use', 'llvm-bolt-profile-use', [CompletionResultType]::ParameterName, 'use BOLT profile for LLVM build')
529+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
517530
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
518531
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
519532
[CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'use incremental compilation')
@@ -550,6 +563,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
550563
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
551564
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
552565
[CompletionResult]::new('--llvm-bolt-profile-use', 'llvm-bolt-profile-use', [CompletionResultType]::ParameterName, 'use BOLT profile for LLVM build')
566+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
553567
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
554568
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
555569
[CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'use incremental compilation')
@@ -586,6 +600,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock {
586600
[CompletionResult]::new('--rust-profile-use', 'rust-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for rustc build')
587601
[CompletionResult]::new('--llvm-profile-use', 'llvm-profile-use', [CompletionResultType]::ParameterName, 'use PGO profile for LLVM build')
588602
[CompletionResult]::new('--llvm-bolt-profile-use', 'llvm-bolt-profile-use', [CompletionResultType]::ParameterName, 'use BOLT profile for LLVM build')
603+
[CompletionResult]::new('--set', 'set', [CompletionResultType]::ParameterName, 'override options in config.toml')
589604
[CompletionResult]::new('--run', 'run', [CompletionResultType]::ParameterName, 'run suggested tests')
590605
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')
591606
[CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'use verbose output (-vv for very verbose)')

‎src/etc/completions/x.py.sh‎

Lines changed: 75 additions & 15 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.