Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
c35ce3f
Don't generate bootstrap usage unless it's needed
jyn514 Sep 16, 2020
1d2290f
Update LLVM
Sep 16, 2020
ed6c7ef
Use enum for status of non-const ops
ecstatic-morse Sep 2, 2020
c3607bd
Use helper function for searching `allow_internal_unstable`
ecstatic-morse Sep 2, 2020
e4edc16
Give name to extra `Span` in `LiveDrop` error
ecstatic-morse Sep 2, 2020
81b3b66
Error if an unstable const eval feature is used in a stable const fn
ecstatic-morse Sep 3, 2020
1e1257b
Bless `miri-unleashed` tests
ecstatic-morse Sep 16, 2020
abc7167
Test that `const_precise_live_drops` can't be depended upon stably
ecstatic-morse Sep 16, 2020
7e24136
Pass --target to lint docs
Mark-Simulacrum Sep 16, 2020
bd4e0af
Build rustdoc for cross-compiled targets
Mark-Simulacrum Sep 16, 2020
012974d
use strip_prefix over starts_with and manual slicing based on pattern…
matthiaskrgr Sep 17, 2020
c946c40
Let backends define custom targets
khyperia Sep 17, 2020
48655c2
PR feedback
khyperia Sep 17, 2020
7b5d983
Remove redundant to_string
zzau13 Sep 17, 2020
76ec3f8
Move to intra doc links in core/src/future
poliorcetics Sep 17, 2020
643eb07
update Miri
RalfJung Sep 17, 2020
363aff0
Add test for x.py build cross-compilation
Mark-Simulacrum Sep 17, 2020
8e9ad31
Use intra-doc links
denisvasilik Sep 17, 2020
3323a26
Fixed some intra-docs links in library/core
Amjad50 Sep 17, 2020
878dfa6
Fixed intra-docs links in library/std/src/collections/hash/map.rs
Amjad50 Sep 17, 2020
f05b47c
Don't download/sync llvm-project submodule if download-ci-llvm is set
est31 Sep 18, 2020
28cfa97
Simplify panic_if_treat_err_as_bug avoiding allocations
zzau13 Sep 18, 2020
4c92b3d
Apply suggestions from code review
poliorcetics Sep 18, 2020
bdb039d
Use intra-doc links
denisvasilik Sep 18, 2020
0bc405e
Remove DeclareMethods
khyperia Sep 18, 2020
0810c3e
support panic=abort in Miri
RalfJung Sep 18, 2020
b9af3e3
bootstrap: move the version number to a plaintext file
pietroalbini Sep 18, 2020
2230d8d
Update library/alloc/src/collections/binary_heap.rs
denisvasilik Sep 18, 2020
ec7225f
Update library/alloc/src/collections/binary_heap.rs
denisvasilik Sep 18, 2020
62e0ee1
Update library/alloc/src/collections/binary_heap.rs
denisvasilik Sep 18, 2020
719c40c
Update library/alloc/src/collections/binary_heap.rs
denisvasilik Sep 18, 2020
25883aa
Add allocation information to undefined behaviour errors.
hameerabbasi Sep 18, 2020
0d0a3e1
Record `tcx.def_span` instead of `item.span` in crate metadata
Aaron1011 Sep 19, 2020
0dc29d7
Rollup merge of #76799 - Mark-Simulacrum:fix-cross-compile-dist, r=al…
Dylan-DPC Sep 19, 2020
c8ead27
Rollup merge of #76800 - jyn514:usage, r=Mark-Simulacrum
Dylan-DPC Sep 19, 2020
d79fb73
Rollup merge of #76806 - jethrogb:jb/update-llvm, r=cuviper
Dylan-DPC Sep 19, 2020
b737b2d
Rollup merge of #76807 - ecstatic-morse:const-checking-staged-api, r=…
Dylan-DPC Sep 19, 2020
488543c
Rollup merge of #76828 - matthiaskrgr:clippy_manual_strip, r=lcnr
Dylan-DPC Sep 19, 2020
efeee84
Rollup merge of #76832 - khyperia:backend_target_override, r=eddyb
Dylan-DPC Sep 19, 2020
e6336f1
Rollup merge of #76840 - poliorcetics:intra-doc-core-sync-and-future,…
Dylan-DPC Sep 19, 2020
10bb970
Rollup merge of #76845 - Amjad50:fix-intra-docs-links, r=jyn514
Dylan-DPC Sep 19, 2020
e1030ec
Rollup merge of #76846 - botika:master, r=davidtwco
Dylan-DPC Sep 19, 2020
e0f9cd8
Rollup merge of #76848 - RalfJung:miri, r=RalfJung
Dylan-DPC Sep 19, 2020
099b738
Rollup merge of #76853 - denisvasilik:intra-doc-links-core-wake, r=jy…
Dylan-DPC Sep 19, 2020
9b656e7
Rollup merge of #76864 - est31:downloaded_llvm_no_clone_sources, r=Ma…
Dylan-DPC Sep 19, 2020
ad0ef4b
Rollup merge of #76871 - RalfJung:miri-panic-abort, r=dtolnay
Dylan-DPC Sep 19, 2020
e1f3ce3
Rollup merge of #76872 - khyperia:remove_declare_methods, r=eddyb
Dylan-DPC Sep 19, 2020
bf3d726
Rollup merge of #76875 - denisvasilik:intra-doc-links-alloc-binary-he…
Dylan-DPC Sep 19, 2020
43c1800
Rollup merge of #76878 - pietroalbini:version, r=Mark-Simulacrum
Dylan-DPC Sep 19, 2020
82e4d6b
Rollup merge of #76881 - hameerabbasi:issue-53325, r=oli-obk
Dylan-DPC Sep 19, 2020
6f926e9
Rollup merge of #76898 - Aaron1011:fix/item-def-span, r=oli-obk
Dylan-DPC Sep 19, 2020
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
Next Next commit
Don't generate bootstrap usage unless it's needed
Previously, `x.py` would unconditionally run `x.py build` to get the
help message. After #76165,
when checking the CI stage was moved into `Config`, that would cause an
assertion failure (but only only in CI!):

```
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `2`', src/bootstrap/config.rs:619:49
```

This changes bootstrap to only generate a help message when it needs
to (when someone passes `--help`).
  • Loading branch information
jyn514 committed Sep 16, 2020
commit c35ce3ff170333d11ccf89e75dc87c49f44a570a
62 changes: 32 additions & 30 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ impl Default for Subcommand {

impl Flags {
pub fn parse(args: &[String]) -> Flags {
let mut extra_help = String::new();
let mut subcommand_help = String::from(
"\
Usage: x.py <subcommand> [options] [<paths>...]
Expand Down Expand Up @@ -170,16 +169,6 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
"VALUE",
);

// fn usage()
let usage =
|exit_code: i32, opts: &Options, subcommand_help: &str, extra_help: &str| -> ! {
println!("{}", opts.usage(subcommand_help));
if !extra_help.is_empty() {
println!("{}", extra_help);
}
process::exit(exit_code);
};

// We can't use getopt to parse the options until we have completed specifying which
// options are valid, but under the current implementation, some options are conditional on
// the subcommand. Therefore we must manually identify the subcommand first, so that we can
Expand Down Expand Up @@ -263,12 +252,38 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
_ => {}
};

// fn usage()
let usage = |exit_code: i32, opts: &Options, verbose: bool, subcommand_help: &str| -> ! {
let mut extra_help = String::new();

// All subcommands except `clean` can have an optional "Available paths" section
if verbose {
let config = Config::parse(&["build".to_string()]);
let build = Build::new(config);

let maybe_rules_help = Builder::get_help(&build, subcommand.as_str());
extra_help.push_str(maybe_rules_help.unwrap_or_default().as_str());
} else if !(subcommand.as_str() == "clean" || subcommand.as_str() == "fmt") {
extra_help.push_str(
format!("Run `./x.py {} -h -v` to see a list of available paths.", subcommand)
.as_str(),
);
}

println!("{}", opts.usage(subcommand_help));
if !extra_help.is_empty() {
println!("{}", extra_help);
}
process::exit(exit_code);
};

// Done specifying what options are possible, so do the getopts parsing
let matches = opts.parse(&args[..]).unwrap_or_else(|e| {
// Invalid argument/option format
println!("\n{}\n", e);
usage(1, &opts, &subcommand_help, &extra_help);
usage(1, &opts, false, &subcommand_help);
});

// Extra sanity check to make sure we didn't hit this crazy corner case:
//
// ./x.py --frobulate clean build
Expand Down Expand Up @@ -436,24 +451,11 @@ Arguments:
let paths = matches.free[1..].iter().map(|p| p.into()).collect::<Vec<PathBuf>>();

let cfg_file = env::var_os("BOOTSTRAP_CONFIG").map(PathBuf::from);

// All subcommands except `clean` can have an optional "Available paths" section
if matches.opt_present("verbose") {
let config = Config::parse(&["build".to_string()]);
let build = Build::new(config);

let maybe_rules_help = Builder::get_help(&build, subcommand.as_str());
extra_help.push_str(maybe_rules_help.unwrap_or_default().as_str());
} else if !(subcommand.as_str() == "clean" || subcommand.as_str() == "fmt") {
extra_help.push_str(
format!("Run `./x.py {} -h -v` to see a list of available paths.", subcommand)
.as_str(),
);
}
let verbose = matches.opt_present("verbose");

// User passed in -h/--help?
if matches.opt_present("help") {
usage(0, &opts, &subcommand_help, &extra_help);
usage(0, &opts, verbose, &subcommand_help);
}

let cmd = match subcommand.as_str() {
Expand Down Expand Up @@ -483,7 +485,7 @@ Arguments:
"clean" => {
if !paths.is_empty() {
println!("\nclean does not take a path argument\n");
usage(1, &opts, &subcommand_help, &extra_help);
usage(1, &opts, verbose, &subcommand_help);
}

Subcommand::Clean { all: matches.opt_present("all") }
Expand All @@ -494,12 +496,12 @@ Arguments:
"run" | "r" => {
if paths.is_empty() {
println!("\nrun requires at least a path!\n");
usage(1, &opts, &subcommand_help, &extra_help);
usage(1, &opts, verbose, &subcommand_help);
}
Subcommand::Run { paths }
}
_ => {
usage(1, &opts, &subcommand_help, &extra_help);
usage(1, &opts, verbose, &subcommand_help);
}
};

Expand Down