Skip to content

Commit dfc07a4

Browse files
committed
Auto merge of #50847 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 10 pull requests Successful merges: - #50387 (Remove leftover tab in libtest outputs) - #50553 (Add Option::xor method) - #50610 (Improve format string errors) - #50649 (Tweak `nearest_common_ancestor()`.) - #50790 (Fix grammar documentation wrt Unicode identifiers) - #50791 (Fix null exclusions in grammar docs) - #50806 (Add `bless` x.py subcommand for easy ui test replacement) - #50818 (Speed up `opt_normalize_projection_type`) - #50837 (Revert #49767) - #50839 (Make sure people know the book is free oline) Failed merges:
2 parents bedbf72 + faa1f21 commit dfc07a4

File tree

31 files changed

+595
-691
lines changed

31 files changed

+595
-691
lines changed

src/bootstrap/bin/rustc.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,12 @@ fn main() {
297297
}
298298

299299
if verbose > 1 {
300-
eprintln!("rustc command: {:?}", cmd);
300+
eprintln!(
301+
"rustc command: {:?}={:?} {:?}",
302+
bootstrap::util::dylib_path_var(),
303+
env::join_paths(&dylib_path).unwrap(),
304+
cmd,
305+
);
301306
eprintln!("sysroot: {:?}", sysroot);
302307
eprintln!("libdir: {:?}", libdir);
303308
}

src/bootstrap/builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1460,6 +1460,7 @@ mod __test {
14601460
rustc_args: vec![],
14611461
fail_fast: true,
14621462
doc_tests: DocTests::No,
1463+
bless: false,
14631464
};
14641465

14651466
let build = Build::new(config);

src/bootstrap/flags.rs

+12
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ pub enum Subcommand {
5959
},
6060
Test {
6161
paths: Vec<PathBuf>,
62+
/// Whether to automatically update stderr/stdout files
63+
bless: bool,
6264
test_args: Vec<String>,
6365
rustc_args: Vec<String>,
6466
fail_fast: bool,
@@ -173,6 +175,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
173175
);
174176
opts.optflag("", "no-doc", "do not run doc tests");
175177
opts.optflag("", "doc", "only run doc tests");
178+
opts.optflag("", "bless", "update all stderr/stdout files of failing ui tests");
176179
},
177180
"bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
178181
"clean" => { opts.optflag("", "all", "clean all build artifacts"); },
@@ -258,6 +261,7 @@ Arguments:
258261
./x.py test src/test/run-pass
259262
./x.py test src/libstd --test-args hash_map
260263
./x.py test src/libstd --stage 0
264+
./x.py test src/test/ui --bless
261265
262266
If no arguments are passed then the complete artifacts for that stage are
263267
compiled and tested.
@@ -322,6 +326,7 @@ Arguments:
322326
"test" => {
323327
Subcommand::Test {
324328
paths,
329+
bless: matches.opt_present("bless"),
325330
test_args: matches.opt_strs("test-args"),
326331
rustc_args: matches.opt_strs("rustc-args"),
327332
fail_fast: !matches.opt_present("no-fail-fast"),
@@ -424,6 +429,13 @@ impl Subcommand {
424429
_ => DocTests::Yes,
425430
}
426431
}
432+
433+
pub fn bless(&self) -> bool {
434+
match *self {
435+
Subcommand::Test { bless, .. } => bless,
436+
_ => false,
437+
}
438+
}
427439
}
428440

429441
fn split(s: Vec<String>) -> Vec<String> {

src/bootstrap/test.rs

+18-28
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ pub enum TestKind {
4747
Bench,
4848
}
4949

50+
impl From<Kind> for TestKind {
51+
fn from(kind: Kind) -> Self {
52+
match kind {
53+
Kind::Test => TestKind::Test,
54+
Kind::Bench => TestKind::Bench,
55+
_ => panic!("unexpected kind in crate: {:?}", kind)
56+
}
57+
}
58+
}
59+
5060
impl TestKind {
5161
// Return the cargo subcommand for this test kind
5262
fn subcommand(self) -> &'static str {
@@ -951,6 +961,10 @@ impl Step for Compiletest {
951961
cmd.arg("--host").arg(&*compiler.host);
952962
cmd.arg("--llvm-filecheck").arg(builder.llvm_filecheck(builder.config.build));
953963

964+
if builder.config.cmd.bless() {
965+
cmd.arg("--bless");
966+
}
967+
954968
if let Some(ref nodejs) = builder.config.nodejs {
955969
cmd.arg("--nodejs").arg(nodejs);
956970
}
@@ -1342,13 +1356,7 @@ impl Step for CrateLibrustc {
13421356

13431357
for krate in builder.in_tree_crates("rustc-main") {
13441358
if run.path.ends_with(&krate.path) {
1345-
let test_kind = if builder.kind == Kind::Test {
1346-
TestKind::Test
1347-
} else if builder.kind == Kind::Bench {
1348-
TestKind::Bench
1349-
} else {
1350-
panic!("unexpected builder.kind in crate: {:?}", builder.kind);
1351-
};
1359+
let test_kind = builder.kind.into();
13521360

13531361
builder.ensure(CrateLibrustc {
13541362
compiler,
@@ -1394,13 +1402,7 @@ impl Step for CrateNotDefault {
13941402
let builder = run.builder;
13951403
let compiler = builder.compiler(builder.top_stage, run.host);
13961404

1397-
let test_kind = if builder.kind == Kind::Test {
1398-
TestKind::Test
1399-
} else if builder.kind == Kind::Bench {
1400-
TestKind::Bench
1401-
} else {
1402-
panic!("unexpected builder.kind in crate: {:?}", builder.kind);
1403-
};
1405+
let test_kind = builder.kind.into();
14041406

14051407
builder.ensure(CrateNotDefault {
14061408
compiler,
@@ -1461,13 +1463,7 @@ impl Step for Crate {
14611463
let compiler = builder.compiler(builder.top_stage, run.host);
14621464

14631465
let make = |mode: Mode, krate: &CargoCrate| {
1464-
let test_kind = if builder.kind == Kind::Test {
1465-
TestKind::Test
1466-
} else if builder.kind == Kind::Bench {
1467-
TestKind::Bench
1468-
} else {
1469-
panic!("unexpected builder.kind in crate: {:?}", builder.kind);
1470-
};
1466+
let test_kind = builder.kind.into();
14711467

14721468
builder.ensure(Crate {
14731469
compiler,
@@ -1625,13 +1621,7 @@ impl Step for CrateRustdoc {
16251621
fn make_run(run: RunConfig) {
16261622
let builder = run.builder;
16271623

1628-
let test_kind = if builder.kind == Kind::Test {
1629-
TestKind::Test
1630-
} else if builder.kind == Kind::Bench {
1631-
TestKind::Bench
1632-
} else {
1633-
panic!("unexpected builder.kind in crate: {:?}", builder.kind);
1634-
};
1624+
let test_kind = builder.kind.into();
16351625

16361626
builder.ensure(CrateRustdoc {
16371627
host: run.host,

src/doc/grammar.md

+9-14
Original file line numberDiff line numberDiff line change
@@ -101,29 +101,24 @@ properties: `ident`, `non_null`, `non_eol`, `non_single_quote` and
101101

102102
### Identifiers
103103

104-
The `ident` production is any nonempty Unicode[^non_ascii_idents] string of
104+
The `ident` production is any nonempty Unicode string of
105105
the following form:
106106

107-
[^non_ascii_idents]: Non-ASCII characters in identifiers are currently feature
108-
gated. This is expected to improve soon.
107+
- The first character is in one of the following ranges `U+0041` to `U+005A`
108+
("A" to "Z"), `U+0061` to `U+007A` ("a" to "z"), or `U+005F` ("\_").
109+
- The remaining characters are in the range `U+0030` to `U+0039` ("0" to "9"),
110+
or any of the prior valid initial characters.
109111

110-
- The first character has property `XID_start`
111-
- The remaining characters have property `XID_continue`
112-
113-
that does _not_ occur in the set of [keywords](#keywords).
114-
115-
> **Note**: `XID_start` and `XID_continue` as character properties cover the
116-
> character ranges used to form the more familiar C and Java language-family
117-
> identifiers.
112+
as long as the identifier does _not_ occur in the set of [keywords](#keywords).
118113

119114
### Delimiter-restricted productions
120115

121116
Some productions are defined by exclusion of particular Unicode characters:
122117

123118
- `non_null` is any single Unicode character aside from `U+0000` (null)
124-
- `non_eol` is `non_null` restricted to exclude `U+000A` (`'\n'`)
125-
- `non_single_quote` is `non_null` restricted to exclude `U+0027` (`'`)
126-
- `non_double_quote` is `non_null` restricted to exclude `U+0022` (`"`)
119+
- `non_eol` is any single Unicode character aside from `U+000A` (`'\n'`)
120+
- `non_single_quote` is any single Unicode character aside from `U+0027` (`'`)
121+
- `non_double_quote` is any single Unicode character aside from `U+0022` (`"`)
127122

128123
## Comments
129124

src/doc/tutorial.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
% The Rust Tutorial
22

3-
This tutorial has been deprecated in favor of [the Book](book/index.html). Go check that out instead!
3+
This tutorial has been deprecated in favor of [the Book](book/index.html), which is available free online and in dead tree form. Go check that out instead!

0 commit comments

Comments
 (0)