diff options
| author | bors <bors@rust-lang.org> | 2022-09-09 06:24:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-09-09 06:24:25 +0000 |
| commit | 4a09adf99fff9b009ff517b9cf5bfce363130e16 (patch) | |
| tree | 401c2e64b2f18f4a3679e8d2d0aac5282f5166d3 /src/test | |
| parent | ab32548539ec38a939c1b58599249f3b54130026 (diff) | |
| parent | 8b78fa055e8fc79023334d1a3b32094fb64eb0b6 (diff) | |
Auto merge of #101603 - matthiaskrgr:rollup-8y6kf20, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #99207 (Enable eager checks for memory sanitizer) - #101253 (fix the suggestion of format for asm_sub_register) - #101450 (Add `const_extern_fn` to 1.62 release notes.) - #101556 (Tweak future opaque ty pretty printing) - #101563 (Link UEFI target documentation from target list) - #101593 (Cleanup themes (tooltip)) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/rustdoc-gui/code-tags.goml | 4 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/codeblock-tooltip.goml | 96 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/src/test_docs/lib.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/asm/aarch64/type-check-3.stderr | 40 | ||||
| -rw-r--r-- | src/test/ui/asm/bad-template.aarch64_mirunsafeck.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/asm/bad-template.aarch64_thirunsafeck.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/asm/bad-template.x86_64_mirunsafeck.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/asm/bad-template.x86_64_thirunsafeck.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/asm/x86_64/type-check-3.stderr | 16 | ||||
| -rw-r--r-- | src/test/ui/sanitize/memory-eager.rs | 38 | ||||
| -rw-r--r-- | src/test/ui/sanitize/memory.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr | 2 |
12 files changed, 186 insertions, 43 deletions
diff --git a/src/test/rustdoc-gui/code-tags.goml b/src/test/rustdoc-gui/code-tags.goml index 200569a28d4..8d399a9a589 100644 --- a/src/test/rustdoc-gui/code-tags.goml +++ b/src/test/rustdoc-gui/code-tags.goml @@ -1,9 +1,9 @@ // This test ensures that items and documentation code blocks are wrapped in <pre><code> goto: file://|DOC_PATH|/test_docs/fn.foo.html size: (1080, 600) -// There should be three doc codeblocks +// There should be four doc codeblocks. // Check that their content is inside <pre><code> -assert-count: (".example-wrap pre > code", 3) +assert-count: (".example-wrap pre > code", 4) // Check that function signature is inside <pre><code> assert: "pre.rust.fn > code" diff --git a/src/test/rustdoc-gui/codeblock-tooltip.goml b/src/test/rustdoc-gui/codeblock-tooltip.goml new file mode 100644 index 00000000000..a0bb40fce8e --- /dev/null +++ b/src/test/rustdoc-gui/codeblock-tooltip.goml @@ -0,0 +1,96 @@ +// Checking the colors of the codeblocks tooltips. +goto: file://|DOC_PATH|/test_docs/fn.foo.html +show-text: true + +// Dark theme. +local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"} +reload: + +// compile_fail block +assert-css: (".docblock .information .compile_fail", {"color": "rgba(255, 0, 0, 0.5)"}) +assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) + +move-cursor-to: ".docblock .information .compile_fail" + +assert-css: (".docblock .information .compile_fail", {"color": "rgb(255, 0, 0)"}) +assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"}) + +// should_panic block +assert-css: (".docblock .information .should_panic", {"color": "rgba(255, 0, 0, 0.5)"}) +assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) + +move-cursor-to: ".docblock .information .should_panic" + +assert-css: (".docblock .information .should_panic", {"color": "rgb(255, 0, 0)"}) +assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgb(255, 0, 0)"}) + +// ignore block +assert-css: (".docblock .information .ignore", {"color": "rgba(255, 142, 0, 0.6)"}) +assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"}) + +move-cursor-to: ".docblock .information .ignore" + +assert-css: (".docblock .information .ignore", {"color": "rgb(255, 142, 0)"}) +assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgb(255, 142, 0)"}) + + +// Light theme. +local-storage: {"rustdoc-theme": "light"} +reload: + +assert-css: (".docblock .information .compile_fail", {"color": "rgba(255, 0, 0, 0.5)"}) +assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) + +move-cursor-to: ".docblock .information .compile_fail" + +assert-css: (".docblock .information .compile_fail", {"color": "rgb(255, 0, 0)"}) +assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"}) + +// should_panic block +assert-css: (".docblock .information .should_panic", {"color": "rgba(255, 0, 0, 0.5)"}) +assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) + +move-cursor-to: ".docblock .information .should_panic" + +assert-css: (".docblock .information .should_panic", {"color": "rgb(255, 0, 0)"}) +assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgb(255, 0, 0)"}) + +// ignore block +assert-css: (".docblock .information .ignore", {"color": "rgba(255, 142, 0, 0.6)"}) +assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"}) + +move-cursor-to: ".docblock .information .ignore" + +assert-css: (".docblock .information .ignore", {"color": "rgb(255, 142, 0)"}) +assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgb(255, 142, 0)"}) + + +// Ayu theme. +local-storage: {"rustdoc-theme": "ayu"} +reload: + +assert-css: (".docblock .information .compile_fail", {"color": "rgba(255, 0, 0, 0.5)"}) +assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) + +move-cursor-to: ".docblock .information .compile_fail" + +assert-css: (".docblock .information .compile_fail", {"color": "rgb(255, 0, 0)"}) +assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"}) + +// should_panic block +assert-css: (".docblock .information .should_panic", {"color": "rgba(255, 0, 0, 0.5)"}) +assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"}) + +move-cursor-to: ".docblock .information .should_panic" + +assert-css: (".docblock .information .should_panic", {"color": "rgb(255, 0, 0)"}) +assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgb(255, 0, 0)"}) + +// ignore block +assert-css: (".docblock .information .ignore", {"color": "rgba(255, 142, 0, 0.6)"}) +assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"}) + +move-cursor-to: ".docblock .information .ignore" + +assert-css: (".docblock .information .ignore", {"color": "rgb(255, 142, 0)"}) +assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgb(255, 142, 0)"}) diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs index a02d5934cc2..4eedf7f15c3 100644 --- a/src/test/rustdoc-gui/src/test_docs/lib.rs +++ b/src/test/rustdoc-gui/src/test_docs/lib.rs @@ -28,6 +28,12 @@ use std::fmt; /// Let's say I'm just some text will ya? /// ``` /// +/// A failing to run one: +/// +/// ```should_panic +/// panic!("tadam"); +/// ``` +/// /// An inlined `code`! pub fn foo() {} diff --git a/src/test/ui/asm/aarch64/type-check-3.stderr b/src/test/ui/asm/aarch64/type-check-3.stderr index b320abdc01b..49292982eec 100644 --- a/src/test/ui/asm/aarch64/type-check-3.stderr +++ b/src/test/ui/asm/aarch64/type-check-3.stderr @@ -5,8 +5,8 @@ LL | asm!("{}", in(reg) 0u8); | ^^ --- for this argument | = note: `#[warn(asm_sub_register)]` on by default - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:50:15 @@ -14,8 +14,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(reg) 0u16); | ^^ ---- for this argument | - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:52:15 @@ -23,8 +23,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(reg) 0i32); | ^^ ---- for this argument | - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:54:15 @@ -32,8 +32,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(reg) 0f32); | ^^ ---- for this argument | - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:57:15 @@ -41,8 +41,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(vreg) 0i16); | ^^ ---- for this argument | - = help: use the `h` modifier to have the register formatted as `h0` - = help: or use the `v` modifier to keep the default formatting of `v0` + = help: use `{0:h}` to have the register formatted as `h0` + = help: or use `{0:v}` to keep the default formatting of `v0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:59:15 @@ -50,8 +50,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(vreg) 0f32); | ^^ ---- for this argument | - = help: use the `s` modifier to have the register formatted as `s0` - = help: or use the `v` modifier to keep the default formatting of `v0` + = help: use `{0:s}` to have the register formatted as `s0` + = help: or use `{0:v}` to keep the default formatting of `v0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:61:15 @@ -59,8 +59,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(vreg) 0f64); | ^^ ---- for this argument | - = help: use the `d` modifier to have the register formatted as `d0` - = help: or use the `v` modifier to keep the default formatting of `v0` + = help: use `{0:d}` to have the register formatted as `d0` + = help: or use `{0:v}` to keep the default formatting of `v0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:63:15 @@ -68,8 +68,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(vreg_low16) 0f64); | ^^ ---- for this argument | - = help: use the `d` modifier to have the register formatted as `d0` - = help: or use the `v` modifier to keep the default formatting of `v0` + = help: use `{0:d}` to have the register formatted as `d0` + = help: or use `{0:v}` to keep the default formatting of `v0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:66:15 @@ -77,8 +77,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{0} {0}", in(reg) 0i16); | ^^^ ^^^ ---- for this argument | - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:68:15 @@ -86,8 +86,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{0} {0:x}", in(reg) 0i16); | ^^^ ---- for this argument | - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` error: type `i128` cannot be used with this register class --> $DIR/type-check-3.rs:73:28 diff --git a/src/test/ui/asm/bad-template.aarch64_mirunsafeck.stderr b/src/test/ui/asm/bad-template.aarch64_mirunsafeck.stderr index 7ef93e15f5b..5dac693cc27 100644 --- a/src/test/ui/asm/bad-template.aarch64_mirunsafeck.stderr +++ b/src/test/ui/asm/bad-template.aarch64_mirunsafeck.stderr @@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo); | ^^^^^^ --- for this argument | = note: `#[warn(asm_sub_register)]` on by default - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` error: aborting due to 21 previous errors; 1 warning emitted diff --git a/src/test/ui/asm/bad-template.aarch64_thirunsafeck.stderr b/src/test/ui/asm/bad-template.aarch64_thirunsafeck.stderr index 7ef93e15f5b..5dac693cc27 100644 --- a/src/test/ui/asm/bad-template.aarch64_thirunsafeck.stderr +++ b/src/test/ui/asm/bad-template.aarch64_thirunsafeck.stderr @@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo); | ^^^^^^ --- for this argument | = note: `#[warn(asm_sub_register)]` on by default - = help: use the `w` modifier to have the register formatted as `w0` - = help: or use the `x` modifier to keep the default formatting of `x0` + = help: use `{0:w}` to have the register formatted as `w0` + = help: or use `{0:x}` to keep the default formatting of `x0` error: aborting due to 21 previous errors; 1 warning emitted diff --git a/src/test/ui/asm/bad-template.x86_64_mirunsafeck.stderr b/src/test/ui/asm/bad-template.x86_64_mirunsafeck.stderr index 250bc3be42e..b29b74bac80 100644 --- a/src/test/ui/asm/bad-template.x86_64_mirunsafeck.stderr +++ b/src/test/ui/asm/bad-template.x86_64_mirunsafeck.stderr @@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo); | ^^^^^^ --- for this argument | = note: `#[warn(asm_sub_register)]` on by default - = help: use the `e` modifier to have the register formatted as `eax` - = help: or use the `r` modifier to keep the default formatting of `rax` + = help: use `{0:e}` to have the register formatted as `eax` + = help: or use `{0:r}` to keep the default formatting of `rax` error: aborting due to 21 previous errors; 1 warning emitted diff --git a/src/test/ui/asm/bad-template.x86_64_thirunsafeck.stderr b/src/test/ui/asm/bad-template.x86_64_thirunsafeck.stderr index 250bc3be42e..b29b74bac80 100644 --- a/src/test/ui/asm/bad-template.x86_64_thirunsafeck.stderr +++ b/src/test/ui/asm/bad-template.x86_64_thirunsafeck.stderr @@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo); | ^^^^^^ --- for this argument | = note: `#[warn(asm_sub_register)]` on by default - = help: use the `e` modifier to have the register formatted as `eax` - = help: or use the `r` modifier to keep the default formatting of `rax` + = help: use `{0:e}` to have the register formatted as `eax` + = help: or use `{0:r}` to keep the default formatting of `rax` error: aborting due to 21 previous errors; 1 warning emitted diff --git a/src/test/ui/asm/x86_64/type-check-3.stderr b/src/test/ui/asm/x86_64/type-check-3.stderr index b38ea8cc4d8..366038fea23 100644 --- a/src/test/ui/asm/x86_64/type-check-3.stderr +++ b/src/test/ui/asm/x86_64/type-check-3.stderr @@ -45,8 +45,8 @@ LL | asm!("{0} {0}", in(reg) 0i16); | ^^^ ^^^ ---- for this argument | = note: `#[warn(asm_sub_register)]` on by default - = help: use the `x` modifier to have the register formatted as `ax` - = help: or use the `r` modifier to keep the default formatting of `rax` + = help: use `{0:x}` to have the register formatted as `ax` + = help: or use `{0:r}` to keep the default formatting of `rax` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:36:15 @@ -54,8 +54,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{0} {0:x}", in(reg) 0i16); | ^^^ ---- for this argument | - = help: use the `x` modifier to have the register formatted as `ax` - = help: or use the `r` modifier to keep the default formatting of `rax` + = help: use `{0:x}` to have the register formatted as `ax` + = help: or use `{0:r}` to keep the default formatting of `rax` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:38:15 @@ -63,8 +63,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(reg) 0i32); | ^^ ---- for this argument | - = help: use the `e` modifier to have the register formatted as `eax` - = help: or use the `r` modifier to keep the default formatting of `rax` + = help: use `{0:e}` to have the register formatted as `eax` + = help: or use `{0:r}` to keep the default formatting of `rax` warning: formatting may not be suitable for sub-register argument --> $DIR/type-check-3.rs:41:15 @@ -72,8 +72,8 @@ warning: formatting may not be suitable for sub-register argument LL | asm!("{}", in(ymm_reg) 0i64); | ^^ ---- for this argument | - = help: use the `x` modifier to have the register formatted as `xmm0` - = help: or use the `y` modifier to keep the default formatting of `ymm0` + = help: use `{0:x}` to have the register formatted as `xmm0` + = help: or use `{0:y}` to keep the default formatting of `ymm0` error: type `i8` cannot be used with this register class --> $DIR/type-check-3.rs:52:28 diff --git a/src/test/ui/sanitize/memory-eager.rs b/src/test/ui/sanitize/memory-eager.rs new file mode 100644 index 00000000000..8a0590bf16c --- /dev/null +++ b/src/test/ui/sanitize/memory-eager.rs @@ -0,0 +1,38 @@ +// needs-sanitizer-support +// needs-sanitizer-memory +// min-llvm-version: 14.0.0 +// +// revisions: unoptimized optimized +// +// [optimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O +// [unoptimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins +// +// run-fail +// error-pattern: MemorySanitizer: use-of-uninitialized-value +// error-pattern: Uninitialized value was created by an allocation +// error-pattern: in the stack frame of function 'random' +// +// This test case intentionally limits the usage of the std, +// since it will be linked with an uninstrumented version of it. + +#![feature(core_intrinsics)] +#![feature(start)] +#![feature(bench_black_box)] + +use std::hint::black_box; +use std::mem::MaybeUninit; + +#[inline(never)] +#[no_mangle] +#[allow(invalid_value)] +fn random() -> char { + let r = unsafe { MaybeUninit::uninit().assume_init() }; + // Avoid optimizing everything out. + black_box(r) +} + +#[start] +fn main(_: isize, _: *const *const u8) -> isize { + random(); + 0 +} diff --git a/src/test/ui/sanitize/memory.rs b/src/test/ui/sanitize/memory.rs index adda51f6be0..14d4de65dd3 100644 --- a/src/test/ui/sanitize/memory.rs +++ b/src/test/ui/sanitize/memory.rs @@ -1,7 +1,10 @@ // needs-sanitizer-support // needs-sanitizer-memory // -// compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O +// revisions: unoptimized optimized +// +// [optimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O +// [unoptimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins // // run-fail // error-pattern: MemorySanitizer: use-of-uninitialized-value @@ -22,9 +25,9 @@ use std::mem::MaybeUninit; #[inline(never)] #[no_mangle] fn random() -> [isize; 32] { - let r = unsafe { MaybeUninit::uninit().assume_init() }; + let r = MaybeUninit::uninit(); // Avoid optimizing everything out. - black_box(r) + unsafe { std::intrinsics::volatile_load(r.as_ptr()) } } #[inline(never)] @@ -39,6 +42,6 @@ fn xor(a: &[isize]) -> isize { #[start] fn main(_: isize, _: *const *const u8) -> isize { - let r = random(); + let r = black_box(random as fn() -> [isize; 32])(); xor(&r) } diff --git a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr index e43a4e79bfe..77cef485f30 100644 --- a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr +++ b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr @@ -91,7 +91,7 @@ LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return> | ------------------------------- the found opaque type | = note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` - found opaque type `impl Future` + found opaque type `impl Future<Output = {integer}>` help: you need to pin and box this expression | LL ~ Box::pin(async { |
