diff options
| author | bors <bors@rust-lang.org> | 2022-04-09 20:13:28 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-04-09 20:13:28 +0000 |
| commit | 8bf93e9b6791acee3a594ed202fdfe45ad9952b5 (patch) | |
| tree | b7068e427d11a5cbc64f5da386e58e102f671235 /src | |
| parent | 8c1fb2eb23964b56bd279b12aa925935d8559870 (diff) | |
| parent | 7726265ae0d3d2b37b4254980a72d5d5347fb92d (diff) | |
| download | rust-8bf93e9b6791acee3a594ed202fdfe45ad9952b5.tar.gz rust-8bf93e9b6791acee3a594ed202fdfe45ad9952b5.zip | |
Auto merge of #95855 - Dylan-DPC:rollup-h45xmpw, r=Dylan-DPC
Rollup of 7 pull requests Successful merges: - #94794 (Clarify indexing into Strings) - #95361 (Make non-power-of-two alignments a validity error in `Layout`) - #95369 (Fix `x test src/librustdoc` with `download-rustc` enabled ) - #95805 (Left overs of #95761) - #95808 (expand: Remove `ParseSess::missing_fragment_specifiers`) - #95817 (hide another #[allow] directive from a docs example) - #95831 (Use bitwise XOR in to_ascii_uppercase) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/test.rs | 35 | ||||
| -rw-r--r-- | src/test/ui/consts/std/alloc.32bit.stderr | 19 | ||||
| -rw-r--r-- | src/test/ui/consts/std/alloc.64bit.stderr | 19 | ||||
| -rw-r--r-- | src/test/ui/consts/std/alloc.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/macros/macro-match-nonterminal.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/macros/macro-match-nonterminal.stderr | 13 | ||||
| -rw-r--r-- | src/test/ui/macros/macro-missing-fragment-deduplication.rs | 15 | ||||
| -rw-r--r-- | src/test/ui/macros/macro-missing-fragment-deduplication.stderr | 18 | ||||
| -rw-r--r-- | src/test/ui/macros/macro-missing-fragment.rs | 25 | ||||
| -rw-r--r-- | src/test/ui/macros/macro-missing-fragment.stderr | 36 | ||||
| -rw-r--r-- | src/test/ui/parser/macro/issue-33569.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/parser/macro/issue-33569.stderr | 14 |
12 files changed, 181 insertions, 24 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 339b7a8d1e6..81200ba60b0 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -2065,6 +2065,7 @@ impl Step for Crate { } } +/// Rustdoc is special in various ways, which is why this step is different from `Crate`. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct CrateRustdoc { host: TargetSelection, @@ -2092,11 +2093,15 @@ impl Step for CrateRustdoc { let test_kind = self.test_kind; let target = self.host; - // Use the previous stage compiler to reuse the artifacts that are - // created when running compiletest for src/test/rustdoc. If this used - // `compiler`, then it would cause rustdoc to be built *again*, which - // isn't really necessary. - let compiler = builder.compiler_for(builder.top_stage, target, target); + let compiler = if builder.config.download_rustc { + builder.compiler(builder.top_stage, target) + } else { + // Use the previous stage compiler to reuse the artifacts that are + // created when running compiletest for src/test/rustdoc. If this used + // `compiler`, then it would cause rustdoc to be built *again*, which + // isn't really necessary. + builder.compiler_for(builder.top_stage, target, target) + }; builder.ensure(compile::Rustc { compiler, target }); let mut cargo = tool::prepare_tool_cargo( @@ -2112,6 +2117,15 @@ impl Step for CrateRustdoc { if test_kind.subcommand() == "test" && !builder.fail_fast { cargo.arg("--no-fail-fast"); } + match builder.doc_tests { + DocTests::Only => { + cargo.arg("--doc"); + } + DocTests::No => { + cargo.args(&["--lib", "--bins", "--examples", "--tests", "--benches"]); + } + DocTests::Yes => {} + } cargo.arg("-p").arg("rustdoc:0.0.0"); @@ -2136,6 +2150,8 @@ impl Step for CrateRustdoc { // sets up the dylib path for the *host* (stage1/lib), which is the // wrong directory. // + // Recall that we special-cased `compiler_for(top_stage)` above, so we always use stage1. + // // It should be considered to just stop running doctests on // librustdoc. There is only one test, and it doesn't look too // important. There might be other ways to avoid this, but it seems @@ -2144,8 +2160,15 @@ impl Step for CrateRustdoc { // See also https://github.com/rust-lang/rust/issues/13983 where the // host vs target dylibs for rustdoc are consistently tricky to deal // with. + // + // Note that this set the host libdir for `download_rustc`, which uses a normal rust distribution. + let libdir = if builder.config.download_rustc { + builder.rustc_libdir(compiler) + } else { + builder.sysroot_libdir(compiler, target).to_path_buf() + }; let mut dylib_path = dylib_path(); - dylib_path.insert(0, PathBuf::from(&*builder.sysroot_libdir(compiler, target))); + dylib_path.insert(0, PathBuf::from(&*libdir)); cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap()); if !builder.config.verbose_tests { diff --git a/src/test/ui/consts/std/alloc.32bit.stderr b/src/test/ui/consts/std/alloc.32bit.stderr index 67bc3202c10..1490314a767 100644 --- a/src/test/ui/consts/std/alloc.32bit.stderr +++ b/src/test/ui/consts/std/alloc.32bit.stderr @@ -1,14 +1,25 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/alloc.rs:8:1 + --> $DIR/alloc.rs:9:1 | -LL | const LAYOUT_INVALID: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .align_: encountered 0, but expected something greater or equal to 1 +LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .align_.0.<enum-tag>: encountered 0x00000000, but expected a valid enum tag | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 8, align: 4) { 00 10 00 00 00 00 00 00 │ ........ } -error: aborting due to previous error +error[E0080]: it is undefined behavior to use this value + --> $DIR/alloc.rs:13:1 + | +LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .align_.0.<enum-tag>: encountered 0x00000003, but expected a valid enum tag + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 8, align: 4) { + 09 00 00 00 03 00 00 00 │ ........ + } + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/std/alloc.64bit.stderr b/src/test/ui/consts/std/alloc.64bit.stderr index ec89dec272d..58349feec63 100644 --- a/src/test/ui/consts/std/alloc.64bit.stderr +++ b/src/test/ui/consts/std/alloc.64bit.stderr @@ -1,14 +1,25 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/alloc.rs:8:1 + --> $DIR/alloc.rs:9:1 | -LL | const LAYOUT_INVALID: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .align_: encountered 0, but expected something greater or equal to 1 +LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .align_.0.<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: 16, align: 8) { 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ } -error: aborting due to previous error +error[E0080]: it is undefined behavior to use this value + --> $DIR/alloc.rs:13:1 + | +LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .align_.0.<enum-tag>: encountered 0x0000000000000003, but expected a valid enum tag + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 16, align: 8) { + 09 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 │ ................ + } + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/std/alloc.rs b/src/test/ui/consts/std/alloc.rs index 14eadc4487f..708b954e84a 100644 --- a/src/test/ui/consts/std/alloc.rs +++ b/src/test/ui/consts/std/alloc.rs @@ -1,11 +1,16 @@ // stderr-per-bitwidth +// ignore-debug (the debug assertions change the error) use std::alloc::Layout; // ok const LAYOUT_VALID: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x08) }; // not ok, since alignment needs to be non-zero. -const LAYOUT_INVALID: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) }; +const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) }; +//~^ ERROR it is undefined behavior to use this value + +// not ok, since alignment needs to be a power of two. +const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) }; //~^ ERROR it is undefined behavior to use this value fn main() {} diff --git a/src/test/ui/macros/macro-match-nonterminal.rs b/src/test/ui/macros/macro-match-nonterminal.rs index b23e5c71c03..5d9eb55fee0 100644 --- a/src/test/ui/macros/macro-match-nonterminal.rs +++ b/src/test/ui/macros/macro-match-nonterminal.rs @@ -2,6 +2,8 @@ macro_rules! test { ($a, $b) => { //~^ ERROR missing fragment //~| ERROR missing fragment + //~| ERROR missing fragment + //~| WARN this was previously accepted //~| WARN this was previously accepted () }; diff --git a/src/test/ui/macros/macro-match-nonterminal.stderr b/src/test/ui/macros/macro-match-nonterminal.stderr index 674ce3434aa..48b9bc6ff6a 100644 --- a/src/test/ui/macros/macro-match-nonterminal.stderr +++ b/src/test/ui/macros/macro-match-nonterminal.stderr @@ -5,14 +5,23 @@ LL | ($a, $b) => { | ^ error: missing fragment specifier + --> $DIR/macro-match-nonterminal.rs:2:8 + | +LL | ($a, $b) => { + | ^ + | + = note: `#[deny(missing_fragment_specifier)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> + +error: missing fragment specifier --> $DIR/macro-match-nonterminal.rs:2:10 | LL | ($a, $b) => { | ^^ | - = note: `#[deny(missing_fragment_specifier)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors diff --git a/src/test/ui/macros/macro-missing-fragment-deduplication.rs b/src/test/ui/macros/macro-missing-fragment-deduplication.rs new file mode 100644 index 00000000000..c1e6ba74647 --- /dev/null +++ b/src/test/ui/macros/macro-missing-fragment-deduplication.rs @@ -0,0 +1,15 @@ +// compile-flags: -Zdeduplicate-diagnostics=yes + +macro_rules! m { + ($name) => {} + //~^ ERROR missing fragment + //~| ERROR missing fragment + //~| WARN this was previously accepted +} + +fn main() { + m!(); + m!(); + m!(); + m!(); +} diff --git a/src/test/ui/macros/macro-missing-fragment-deduplication.stderr b/src/test/ui/macros/macro-missing-fragment-deduplication.stderr new file mode 100644 index 00000000000..7622ca054c8 --- /dev/null +++ b/src/test/ui/macros/macro-missing-fragment-deduplication.stderr @@ -0,0 +1,18 @@ +error: missing fragment specifier + --> $DIR/macro-missing-fragment-deduplication.rs:4:6 + | +LL | ($name) => {} + | ^^^^^ + +error: missing fragment specifier + --> $DIR/macro-missing-fragment-deduplication.rs:4:6 + | +LL | ($name) => {} + | ^^^^^ + | + = note: `#[deny(missing_fragment_specifier)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/macros/macro-missing-fragment.rs b/src/test/ui/macros/macro-missing-fragment.rs index 1d0b0889b4c..210c85ebbf2 100644 --- a/src/test/ui/macros/macro-missing-fragment.rs +++ b/src/test/ui/macros/macro-missing-fragment.rs @@ -1,7 +1,26 @@ -macro_rules! m { - ( $( any_token $field_rust_type )* ) => {}; //~ ERROR missing fragment +#![warn(missing_fragment_specifier)] + +macro_rules! used_arm { + ( $( any_token $field_rust_type )* ) => {}; + //~^ ERROR missing fragment + //~| WARN missing fragment + //~| WARN this was previously accepted +} + +macro_rules! used_macro_unused_arm { + () => {}; + ( $name ) => {}; + //~^ WARN missing fragment + //~| WARN this was previously accepted +} + +macro_rules! unused_macro { + ( $name ) => {}; + //~^ WARN missing fragment + //~| WARN this was previously accepted } fn main() { - m!(); + used_arm!(); + used_macro_unused_arm!(); } diff --git a/src/test/ui/macros/macro-missing-fragment.stderr b/src/test/ui/macros/macro-missing-fragment.stderr index b7871c0ec3a..1bf6f04ec7f 100644 --- a/src/test/ui/macros/macro-missing-fragment.stderr +++ b/src/test/ui/macros/macro-missing-fragment.stderr @@ -1,8 +1,40 @@ error: missing fragment specifier - --> $DIR/macro-missing-fragment.rs:2:20 + --> $DIR/macro-missing-fragment.rs:4:20 | LL | ( $( any_token $field_rust_type )* ) => {}; | ^^^^^^^^^^^^^^^^ -error: aborting due to previous error +warning: missing fragment specifier + --> $DIR/macro-missing-fragment.rs:4:20 + | +LL | ( $( any_token $field_rust_type )* ) => {}; + | ^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/macro-missing-fragment.rs:1:9 + | +LL | #![warn(missing_fragment_specifier)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> + +warning: missing fragment specifier + --> $DIR/macro-missing-fragment.rs:12:7 + | +LL | ( $name ) => {}; + | ^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> + +warning: missing fragment specifier + --> $DIR/macro-missing-fragment.rs:18:7 + | +LL | ( $name ) => {}; + | ^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> + +error: aborting due to previous error; 3 warnings emitted diff --git a/src/test/ui/parser/macro/issue-33569.rs b/src/test/ui/parser/macro/issue-33569.rs index 80e2d7c6545..069d181e962 100644 --- a/src/test/ui/parser/macro/issue-33569.rs +++ b/src/test/ui/parser/macro/issue-33569.rs @@ -1,6 +1,8 @@ macro_rules! foo { { $+ } => { //~ ERROR expected identifier, found `+` //~^ ERROR missing fragment specifier + //~| ERROR missing fragment specifier + //~| WARN this was previously accepted $(x)(y) //~ ERROR expected one of: `*`, `+`, or `?` } } diff --git a/src/test/ui/parser/macro/issue-33569.stderr b/src/test/ui/parser/macro/issue-33569.stderr index b4d38d3ce48..39d49fd03f1 100644 --- a/src/test/ui/parser/macro/issue-33569.stderr +++ b/src/test/ui/parser/macro/issue-33569.stderr @@ -5,7 +5,7 @@ LL | { $+ } => { | ^ error: expected one of: `*`, `+`, or `?` - --> $DIR/issue-33569.rs:4:13 + --> $DIR/issue-33569.rs:6:13 | LL | $(x)(y) | ^^^ @@ -16,5 +16,15 @@ error: missing fragment specifier LL | { $+ } => { | ^ -error: aborting due to 3 previous errors +error: missing fragment specifier + --> $DIR/issue-33569.rs:2:8 + | +LL | { $+ } => { + | ^ + | + = note: `#[deny(missing_fragment_specifier)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> + +error: aborting due to 4 previous errors |
