Skip to content

Commit 3c493e7

Browse files
authored
Unrolled build for #154508
Rollup merge of #154508 - Mark-Simulacrum:fix-ambiguous-parse, r=jieyouxu Fix ambiguous parsing in bootstrap.py Noticed this while trying to produce rustdoc-json for std and saw JSON output from the bootstrap.py build of bootstrap's Rust code. This is technically a breaking change, but I think the fix should be simple and arguably an improvement in future compatibility if/when the flag set changes.
2 parents a25435b + 024acdd commit 3c493e7

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

‎src/bootstrap/bootstrap.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,12 @@ def check_vendored_status(self):
12591259

12601260
def parse_args(args):
12611261
"""Parse the command line arguments that the python script needs."""
1262-
parser = argparse.ArgumentParser(add_help=False)
1262+
1263+
# Pass allow_abbrev=False to remove support for inexact matches (e.g.,
1264+
# `--json` turning on `--json-output`). The argument list here is partial,
1265+
# most flags are matched in the Rust bootstrap code. This prevents the the
1266+
# default ambiguity checks in argparse from functioning correctly.
1267+
parser = argparse.ArgumentParser(add_help=False, allow_abbrev=False)
12631268
parser.add_argument("-h", "--help", action="store_true")
12641269
parser.add_argument("--config")
12651270
parser.add_argument("--build-dir")

‎src/bootstrap/src/utils/change_tracker.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,4 +616,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
616616
severity: ChangeSeverity::Warning,
617617
summary: "`x.py test --no-doc` is renamed to `--all-targets`. Additionally `--tests` is added which only executes unit and integration tests.",
618618
},
619+
ChangeInfo {
620+
change_id: 154508,
621+
severity: ChangeSeverity::Info,
622+
summary: "`x.py` stopped accepting partial argument names. Use full names to avoid errors.",
623+
},
619624
];

0 commit comments

Comments
 (0)