From c7eb91652fd26ccee708720ffcaf30954ac43f82 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 29 Apr 2020 09:53:22 +0200 Subject: [PATCH] deduplicate warnings --- .../transform/check_consts/validation.rs | 2 +- src/test/ui/consts/const-eval/const_fn_ptr.rs | 12 +-- .../ui/consts/const-eval/const_fn_ptr.stderr | 24 +++-- .../ui/consts/const-eval/const_fn_ptr_fail.rs | 3 +- .../const-eval/const_fn_ptr_fail.stderr | 8 +- .../consts/const-eval/const_fn_ptr_fail2.rs | 4 +- .../const-eval/const_fn_ptr_fail2.stderr | 8 +- .../ui/consts/const-points-to-static.stderr | 4 +- .../const-prop-read-static-in-const.stderr | 4 +- .../ui/consts/miri_unleashed/abi-mismatch.rs | 4 +- .../consts/miri_unleashed/abi-mismatch.stderr | 20 +++-- .../consts/miri_unleashed/assoc_const.stderr | 4 +- src/test/ui/consts/miri_unleashed/box.rs | 10 +-- src/test/ui/consts/miri_unleashed/box.stderr | 30 ++----- .../miri_unleashed/const_refers_to_static.rs | 9 +- .../const_refers_to_static.stderr | 50 +++++------ .../miri_unleashed/const_refers_to_static2.rs | 7 +- .../const_refers_to_static2.stderr | 40 +++++---- .../const_refers_to_static_cross_crate.rs | 13 ++- .../const_refers_to_static_cross_crate.stderr | 87 +++++++++++-------- src/test/ui/consts/miri_unleashed/drop.rs | 3 +- src/test/ui/consts/miri_unleashed/drop.stderr | 12 +-- .../ui/consts/miri_unleashed/inline_asm.rs | 4 +- .../consts/miri_unleashed/inline_asm.stderr | 13 +-- .../ui/consts/miri_unleashed/mutable_const.rs | 5 +- .../miri_unleashed/mutable_const.stderr | 33 +++---- .../miri_unleashed/mutable_const2.stderr | 4 +- .../miri_unleashed/mutable_references.rs | 3 +- .../miri_unleashed/mutable_references.stderr | 26 +++--- .../miri_unleashed/mutable_references_ice.rs | 4 +- .../mutable_references_ice.stderr | 8 +- .../consts/miri_unleashed/non_const_fn.stderr | 4 +- .../miri_unleashed/read_from_static.stderr | 4 +- .../caller-location-fnptr-rt-ctfe-equiv.rs | 4 +- ...caller-location-fnptr-rt-ctfe-equiv.stderr | 10 ++- 35 files changed, 244 insertions(+), 236 deletions(-) diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs index dd0df72a0c45..712f365e72b7 100644 --- a/src/librustc_mir/transform/check_consts/validation.rs +++ b/src/librustc_mir/transform/check_consts/validation.rs @@ -253,7 +253,7 @@ impl Validator<'mir, 'tcx> { let is_unleashable = O::IS_SUPPORTED_IN_MIRI; if is_unleashable && self.tcx.sess.opts.debugging_opts.unleash_the_miri_inside_of_you { - self.tcx.sess.span_warn(span, "skipping const checks"); + self.tcx.sess.span_warn(self.tcx.def_span(self.def_id), "skipping const checks"); return; } diff --git a/src/test/ui/consts/const-eval/const_fn_ptr.rs b/src/test/ui/consts/const-eval/const_fn_ptr.rs index 9b94b45f5226..4d9a5838071e 100644 --- a/src/test/ui/consts/const-eval/const_fn_ptr.rs +++ b/src/test/ui/consts/const-eval/const_fn_ptr.rs @@ -8,16 +8,16 @@ const fn double_const(x: usize) -> usize { x * 2 } const X: fn(usize) -> usize = double; const X_CONST: fn(usize) -> usize = double_const; -const fn bar(x: usize) -> usize { - X(x) //~ WARNING skipping const checks +const fn bar(x: usize) -> usize { //~ WARNING skipping const checks + X(x) } -const fn bar_const(x: usize) -> usize { - X_CONST(x) //~ WARNING skipping const checks +const fn bar_const(x: usize) -> usize { //~ WARNING skipping const checks + X_CONST(x) } -const fn foo(x: fn(usize) -> usize, y: usize) -> usize { - x(y) //~ WARNING skipping const checks +const fn foo(x: fn(usize) -> usize, y: usize) -> usize { //~ WARNING skipping const checks + x(y) } fn main() { diff --git a/src/test/ui/consts/const-eval/const_fn_ptr.stderr b/src/test/ui/consts/const-eval/const_fn_ptr.stderr index 5f1e85b0d6dc..d129954c7752 100644 --- a/src/test/ui/consts/const-eval/const_fn_ptr.stderr +++ b/src/test/ui/consts/const-eval/const_fn_ptr.stderr @@ -1,20 +1,26 @@ warning: skipping const checks - --> $DIR/const_fn_ptr.rs:12:5 + --> $DIR/const_fn_ptr.rs:11:1 | -LL | X(x) - | ^^^^ +LL | / const fn bar(x: usize) -> usize { +LL | | X(x) +LL | | } + | |_^ warning: skipping const checks - --> $DIR/const_fn_ptr.rs:16:5 + --> $DIR/const_fn_ptr.rs:15:1 | -LL | X_CONST(x) - | ^^^^^^^^^^ +LL | / const fn bar_const(x: usize) -> usize { +LL | | X_CONST(x) +LL | | } + | |_^ warning: skipping const checks - --> $DIR/const_fn_ptr.rs:20:5 + --> $DIR/const_fn_ptr.rs:19:1 | -LL | x(y) - | ^^^^ +LL | / const fn foo(x: fn(usize) -> usize, y: usize) -> usize { +LL | | x(y) +LL | | } + | |_^ warning: 3 warnings emitted diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail.rs b/src/test/ui/consts/const-eval/const_fn_ptr_fail.rs index 90d3cba07a59..23ed003db263 100644 --- a/src/test/ui/consts/const-eval/const_fn_ptr_fail.rs +++ b/src/test/ui/consts/const-eval/const_fn_ptr_fail.rs @@ -6,9 +6,8 @@ fn double(x: usize) -> usize { x * 2 } const X: fn(usize) -> usize = double; -const fn bar(x: usize) -> usize { +const fn bar(x: usize) -> usize { //~ WARNING skipping const checks X(x) // FIXME: this should error someday - //~^ WARN: skipping const checks } fn main() {} diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail.stderr b/src/test/ui/consts/const-eval/const_fn_ptr_fail.stderr index 396769659323..232ae750db28 100644 --- a/src/test/ui/consts/const-eval/const_fn_ptr_fail.stderr +++ b/src/test/ui/consts/const-eval/const_fn_ptr_fail.stderr @@ -1,8 +1,10 @@ warning: skipping const checks - --> $DIR/const_fn_ptr_fail.rs:10:5 + --> $DIR/const_fn_ptr_fail.rs:9:1 | -LL | X(x) // FIXME: this should error someday - | ^^^^ +LL | / const fn bar(x: usize) -> usize { +LL | | X(x) // FIXME: this should error someday +LL | | } + | |_^ warning: 1 warning emitted diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs index 81f53826d810..fb58b0f287d0 100644 --- a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs +++ b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs @@ -9,8 +9,8 @@ fn double(x: usize) -> usize { } const X: fn(usize) -> usize = double; -const fn bar(x: fn(usize) -> usize, y: usize) -> usize { - x(y) //~ WARN skipping const checks +const fn bar(x: fn(usize) -> usize, y: usize) -> usize { //~ WARN skipping const checks + x(y) } const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr index b980deea1e1c..28ed7566fdc4 100644 --- a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr +++ b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr @@ -1,8 +1,10 @@ warning: skipping const checks - --> $DIR/const_fn_ptr_fail2.rs:13:5 + --> $DIR/const_fn_ptr_fail2.rs:12:1 | -LL | x(y) - | ^^^^ +LL | / const fn bar(x: fn(usize) -> usize, y: usize) -> usize { +LL | | x(y) +LL | | } + | |_^ error[E0080]: evaluation of constant expression failed --> $DIR/const_fn_ptr_fail2.rs:20:5 diff --git a/src/test/ui/consts/const-points-to-static.stderr b/src/test/ui/consts/const-points-to-static.stderr index 62e59531c1e9..b31e3020b83c 100644 --- a/src/test/ui/consts/const-points-to-static.stderr +++ b/src/test/ui/consts/const-points-to-static.stderr @@ -1,8 +1,8 @@ warning: skipping const checks - --> $DIR/const-points-to-static.rs:5:20 + --> $DIR/const-points-to-static.rs:5:1 | LL | const TEST: &u8 = &MY_STATIC; - | ^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: it is undefined behavior to use this value --> $DIR/const-points-to-static.rs:5:1 diff --git a/src/test/ui/consts/const-prop-read-static-in-const.stderr b/src/test/ui/consts/const-prop-read-static-in-const.stderr index 0da2dbc888a6..953483a8add9 100644 --- a/src/test/ui/consts/const-prop-read-static-in-const.stderr +++ b/src/test/ui/consts/const-prop-read-static-in-const.stderr @@ -1,8 +1,8 @@ warning: skipping const checks - --> $DIR/const-prop-read-static-in-const.rs:5:18 + --> $DIR/const-prop-read-static-in-const.rs:5:1 | LL | const TEST: u8 = MY_STATIC; - | ^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: any use of this value will cause an error --> $DIR/const-prop-read-static-in-const.rs:5:18 diff --git a/src/test/ui/consts/miri_unleashed/abi-mismatch.rs b/src/test/ui/consts/miri_unleashed/abi-mismatch.rs index a99e6327987f..7297e91e6978 100644 --- a/src/test/ui/consts/miri_unleashed/abi-mismatch.rs +++ b/src/test/ui/consts/miri_unleashed/abi-mismatch.rs @@ -7,9 +7,9 @@ const extern "C" fn c_fn() {} const fn call_rust_fn(my_fn: extern "Rust" fn()) { +//~^ WARN skipping const checks my_fn(); - //~^ WARN skipping const checks - //~| ERROR could not evaluate static initializer + //~^ ERROR could not evaluate static initializer //~| NOTE calling a function with ABI C using caller ABI Rust //~| NOTE inside `call_rust_fn` } diff --git a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr b/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr index 674a293d2815..6f9681e39810 100644 --- a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr +++ b/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr @@ -1,23 +1,29 @@ warning: skipping const checks - --> $DIR/abi-mismatch.rs:10:5 + --> $DIR/abi-mismatch.rs:9:1 | -LL | my_fn(); - | ^^^^^^^ +LL | / const fn call_rust_fn(my_fn: extern "Rust" fn()) { +LL | | +LL | | my_fn(); +LL | | +LL | | +LL | | +LL | | } + | |_^ warning: skipping const checks - --> $DIR/abi-mismatch.rs:17:40 + --> $DIR/abi-mismatch.rs:17:1 | LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: could not evaluate static initializer - --> $DIR/abi-mismatch.rs:10:5 + --> $DIR/abi-mismatch.rs:11:5 | LL | my_fn(); | ^^^^^^^ | | | calling a function with ABI C using caller ABI Rust - | inside `call_rust_fn` at $DIR/abi-mismatch.rs:10:5 + | inside `call_rust_fn` at $DIR/abi-mismatch.rs:11:5 ... LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) }); | --------------------------------------------------------------------- inside `VAL` at $DIR/abi-mismatch.rs:17:18 diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.stderr b/src/test/ui/consts/miri_unleashed/assoc_const.stderr index 8d8d9f9ba4cd..60fec1fb092f 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const.stderr +++ b/src/test/ui/consts/miri_unleashed/assoc_const.stderr @@ -1,8 +1,8 @@ warning: skipping const checks - --> $DIR/assoc_const.rs:14:20 + --> $DIR/assoc_const.rs:14:5 | LL | const F: u32 = (U::X, 42).1; - | ^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: erroneous constant used --> $DIR/assoc_const.rs:31:13 diff --git a/src/test/ui/consts/miri_unleashed/box.rs b/src/test/ui/consts/miri_unleashed/box.rs index a8efe67c339b..98dea797b69a 100644 --- a/src/test/ui/consts/miri_unleashed/box.rs +++ b/src/test/ui/consts/miri_unleashed/box.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zunleash-the-miri-inside-of-you +// compile-flags: -Zunleash-the-miri-inside-of-you -Zdeduplicate-diagnostics #![feature(box_syntax)] #![allow(const_err)] @@ -6,12 +6,8 @@ use std::mem::ManuallyDrop; fn main() {} -static TEST_BAD: &mut i32 = { +static TEST_BAD: &mut i32 = { //~ WARN skipping const checks &mut *(box 0) - //~^ WARN skipping const check - //~| ERROR could not evaluate static initializer + //~^ ERROR could not evaluate static initializer //~| NOTE heap allocations - //~| WARN skipping const checks - //~| WARN skipping const checks - //~| WARN skipping const checks }; diff --git a/src/test/ui/consts/miri_unleashed/box.stderr b/src/test/ui/consts/miri_unleashed/box.stderr index 940dc1153d43..cf405d06b829 100644 --- a/src/test/ui/consts/miri_unleashed/box.stderr +++ b/src/test/ui/consts/miri_unleashed/box.stderr @@ -1,26 +1,12 @@ warning: skipping const checks - --> $DIR/box.rs:10:11 + --> $DIR/box.rs:9:1 | -LL | &mut *(box 0) - | ^^^^^^^ - -warning: skipping const checks - --> $DIR/box.rs:10:16 - | -LL | &mut *(box 0) - | ^ - -warning: skipping const checks - --> $DIR/box.rs:10:5 - | -LL | &mut *(box 0) - | ^^^^^^^^^^^^^ - -warning: skipping const checks - --> $DIR/box.rs:10:5 - | -LL | &mut *(box 0) - | ^^^^^^^^^^^^^ +LL | / static TEST_BAD: &mut i32 = { +LL | | &mut *(box 0) +LL | | +LL | | +LL | | }; + | |__^ error[E0080]: could not evaluate static initializer --> $DIR/box.rs:10:11 @@ -28,6 +14,6 @@ error[E0080]: could not evaluate static initializer LL | &mut *(box 0) | ^^^^^^^ "heap allocations via `box` keyword" needs an rfc before being allowed inside constants -error: aborting due to previous error; 4 warnings emitted +error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs b/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs index 1e19140bb90f..7c8cdaec4a11 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs @@ -1,5 +1,5 @@ // build-fail -// compile-flags: -Zunleash-the-miri-inside-of-you +// compile-flags: -Zunleash-the-miri-inside-of-you -Zdeduplicate-diagnostics #![allow(const_err)] use std::sync::atomic::AtomicUsize; @@ -9,23 +9,20 @@ use std::sync::atomic::Ordering; // when *using* the const. const MUTATE_INTERIOR_MUT: usize = { +//~^ WARN skipping const checks static FOO: AtomicUsize = AtomicUsize::new(0); FOO.fetch_add(1, Ordering::Relaxed) - //~^ WARN skipping const checks - //~| WARN skipping const checks }; const READ_INTERIOR_MUT: usize = { +//~^ WARN skipping const checks static FOO: AtomicUsize = AtomicUsize::new(0); unsafe { *(&FOO as *const _ as *const usize) } - //~^ WARN skipping const checks - //~| WARN skipping const checks }; static mut MUTABLE: u32 = 0; const READ_MUT: u32 = unsafe { MUTABLE }; //~^ WARN skipping const checks -//~| WARN skipping const checks fn main() { MUTATE_INTERIOR_MUT; diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr index 0097bf90803e..7e049647cfdd 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr @@ -1,57 +1,47 @@ warning: skipping const checks - --> $DIR/const_refers_to_static.rs:13:5 + --> $DIR/const_refers_to_static.rs:11:1 | -LL | FOO.fetch_add(1, Ordering::Relaxed) - | ^^^ +LL | / const MUTATE_INTERIOR_MUT: usize = { +LL | | +LL | | static FOO: AtomicUsize = AtomicUsize::new(0); +LL | | FOO.fetch_add(1, Ordering::Relaxed) +LL | | }; + | |__^ warning: skipping const checks - --> $DIR/const_refers_to_static.rs:13:5 + --> $DIR/const_refers_to_static.rs:17:1 | -LL | FOO.fetch_add(1, Ordering::Relaxed) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / const READ_INTERIOR_MUT: usize = { +LL | | +LL | | static FOO: AtomicUsize = AtomicUsize::new(0); +LL | | unsafe { *(&FOO as *const _ as *const usize) } +LL | | }; + | |__^ warning: skipping const checks - --> $DIR/const_refers_to_static.rs:20:17 - | -LL | unsafe { *(&FOO as *const _ as *const usize) } - | ^^^ - -warning: skipping const checks - --> $DIR/const_refers_to_static.rs:20:14 - | -LL | unsafe { *(&FOO as *const _ as *const usize) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: skipping const checks - --> $DIR/const_refers_to_static.rs:26:32 + --> $DIR/const_refers_to_static.rs:24:1 | LL | const READ_MUT: u32 = unsafe { MUTABLE }; - | ^^^^^^^ - -warning: skipping const checks - --> $DIR/const_refers_to_static.rs:26:32 - | -LL | const READ_MUT: u32 = unsafe { MUTABLE }; - | ^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: erroneous constant used - --> $DIR/const_refers_to_static.rs:31:5 + --> $DIR/const_refers_to_static.rs:28:5 | LL | MUTATE_INTERIOR_MUT; | ^^^^^^^^^^^^^^^^^^^ referenced constant has errors error[E0080]: erroneous constant used - --> $DIR/const_refers_to_static.rs:33:5 + --> $DIR/const_refers_to_static.rs:30:5 | LL | READ_INTERIOR_MUT; | ^^^^^^^^^^^^^^^^^ referenced constant has errors error[E0080]: erroneous constant used - --> $DIR/const_refers_to_static.rs:35:5 + --> $DIR/const_refers_to_static.rs:32:5 | LL | READ_MUT; | ^^^^^^^^ referenced constant has errors -error: aborting due to 3 previous errors; 6 warnings emitted +error: aborting due to 3 previous errors; 3 warnings emitted For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.rs b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.rs index 1cc8166ee20b..b8eccdb53eaa 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.rs +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zunleash-the-miri-inside-of-you +// compile-flags: -Zunleash-the-miri-inside-of-you -Zdeduplicate-diagnostics #![allow(const_err)] use std::sync::atomic::AtomicUsize; @@ -8,21 +8,20 @@ use std::sync::atomic::Ordering; // so they cause an immediate error when *defining* the const. const REF_INTERIOR_MUT: &usize = { //~ ERROR undefined behavior to use this value +//~^ WARN skipping const checks //~| NOTE encountered a reference pointing to a static variable //~| NOTE static FOO: AtomicUsize = AtomicUsize::new(0); unsafe { &*(&FOO as *const _ as *const usize) } - //~^ WARN skipping const checks - //~| WARN skipping const checks }; // ok some day perhaps const READ_IMMUT: &usize = { //~ ERROR it is undefined behavior to use this value +//~^ WARN skipping const checks //~| NOTE encountered a reference pointing to a static variable //~| NOTE static FOO: usize = 0; &FOO - //~^ WARN skipping const checks }; fn main() {} diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.stderr index 8b1f0d89dfc4..bb197884141a 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.stderr @@ -1,20 +1,26 @@ warning: skipping const checks - --> $DIR/const_refers_to_static2.rs:14:18 + --> $DIR/const_refers_to_static2.rs:10:1 | -LL | unsafe { &*(&FOO as *const _ as *const usize) } - | ^^^ +LL | / const REF_INTERIOR_MUT: &usize = { +LL | | +LL | | +LL | | +LL | | static FOO: AtomicUsize = AtomicUsize::new(0); +LL | | unsafe { &*(&FOO as *const _ as *const usize) } +LL | | }; + | |__^ warning: skipping const checks - --> $DIR/const_refers_to_static2.rs:14:14 + --> $DIR/const_refers_to_static2.rs:19:1 | -LL | unsafe { &*(&FOO as *const _ as *const usize) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: skipping const checks - --> $DIR/const_refers_to_static2.rs:24:6 - | -LL | &FOO - | ^^^ +LL | / const READ_IMMUT: &usize = { +LL | | +LL | | +LL | | +LL | | static FOO: usize = 0; +LL | | &FOO +LL | | }; + | |__^ error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static2.rs:10:1 @@ -22,28 +28,28 @@ error[E0080]: it is undefined behavior to use this value LL | / const REF_INTERIOR_MUT: &usize = { LL | | LL | | -LL | | static FOO: AtomicUsize = AtomicUsize::new(0); -... | LL | | +LL | | static FOO: AtomicUsize = AtomicUsize::new(0); +LL | | unsafe { &*(&FOO as *const _ as *const usize) } LL | | }; | |__^ type validation failed: encountered a reference pointing to a static variable | = 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. error[E0080]: it is undefined behavior to use this value - --> $DIR/const_refers_to_static2.rs:20:1 + --> $DIR/const_refers_to_static2.rs:19:1 | LL | / const READ_IMMUT: &usize = { LL | | LL | | +LL | | LL | | static FOO: usize = 0; LL | | &FOO -LL | | LL | | }; | |__^ type validation failed: encountered a reference pointing to a static variable | = 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. -error: aborting due to 2 previous errors; 3 warnings emitted +error: aborting due to 2 previous errors; 2 warnings emitted For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs index c8192972d3bc..81a15afed8bf 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs @@ -9,33 +9,32 @@ extern crate static_cross_crate; // Sneaky: reference to a mutable static. // Allowing this would be a disaster for pattern matching, we could violate exhaustiveness checking! const SLICE_MUT: &[u8; 1] = { //~ ERROR undefined behavior to use this value +//~^ WARN skipping const checks //~| NOTE encountered a reference pointing to a static variable //~| NOTE unsafe { &static_cross_crate::ZERO } - //~^ WARN skipping const checks }; const U8_MUT: &u8 = { //~ ERROR undefined behavior to use this value +//~^ WARN skipping const checks //~| NOTE encountered a reference pointing to a static variable //~| NOTE unsafe { &static_cross_crate::ZERO[0] } - //~^ WARN skipping const checks }; // Also test indirection that reads from other static. This causes a const_err. #[warn(const_err)] //~ NOTE const U8_MUT2: &u8 = { //~ NOTE +//~^ WARN skipping const checks unsafe { &(*static_cross_crate::ZERO_REF)[0] } - //~^ WARN skipping const checks - //~| WARN [const_err] + //~^ WARN [const_err] //~| NOTE constant accesses static }; #[warn(const_err)] //~ NOTE const U8_MUT3: &u8 = { //~ NOTE +//~^ WARN skipping const checks unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } - //~^ WARN skipping const checks - //~| WARN skipping const checks - //~| WARN [const_err] + //~^ WARN [const_err] //~| NOTE constant accesses static }; diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.stderr index afdde84a386f..ffb428506ea1 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.stderr @@ -1,8 +1,13 @@ warning: skipping const checks - --> $DIR/const_refers_to_static_cross_crate.rs:14:15 + --> $DIR/const_refers_to_static_cross_crate.rs:11:1 | -LL | unsafe { &static_cross_crate::ZERO } - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / const SLICE_MUT: &[u8; 1] = { +LL | | +LL | | +LL | | +LL | | unsafe { &static_cross_crate::ZERO } +LL | | }; + | |__^ error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static_cross_crate.rs:11:1 @@ -10,24 +15,29 @@ error[E0080]: it is undefined behavior to use this value LL | / const SLICE_MUT: &[u8; 1] = { LL | | LL | | -LL | | unsafe { &static_cross_crate::ZERO } LL | | +LL | | unsafe { &static_cross_crate::ZERO } LL | | }; | |__^ type validation failed: encountered a reference pointing to a static variable | = 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. error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:44:9 + --> $DIR/const_refers_to_static_cross_crate.rs:43:9 | LL | SLICE_MUT => true, | ^^^^^^^^^ warning: skipping const checks - --> $DIR/const_refers_to_static_cross_crate.rs:21:15 + --> $DIR/const_refers_to_static_cross_crate.rs:18:1 | -LL | unsafe { &static_cross_crate::ZERO[0] } - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / const U8_MUT: &u8 = { +LL | | +LL | | +LL | | +LL | | unsafe { &static_cross_crate::ZERO[0] } +LL | | }; + | |__^ error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static_cross_crate.rs:18:1 @@ -35,34 +45,39 @@ error[E0080]: it is undefined behavior to use this value LL | / const U8_MUT: &u8 = { LL | | LL | | -LL | | unsafe { &static_cross_crate::ZERO[0] } LL | | +LL | | unsafe { &static_cross_crate::ZERO[0] } LL | | }; | |__^ type validation failed: encountered a reference pointing to a static variable | = 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. error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:52:9 + --> $DIR/const_refers_to_static_cross_crate.rs:51:9 | LL | U8_MUT => true, | ^^^^^^ warning: skipping const checks - --> $DIR/const_refers_to_static_cross_crate.rs:28:17 - | -LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: any use of this value will cause an error - --> $DIR/const_refers_to_static_cross_crate.rs:28:14 + --> $DIR/const_refers_to_static_cross_crate.rs:27:1 | LL | / const U8_MUT2: &u8 = { +LL | | +LL | | unsafe { &(*static_cross_crate::ZERO_REF)[0] } +LL | | +LL | | +LL | | }; + | |__^ + +warning: any use of this value will cause an error + --> $DIR/const_refers_to_static_cross_crate.rs:29:14 + | +LL | / const U8_MUT2: &u8 = { +LL | | LL | | unsafe { &(*static_cross_crate::ZERO_REF)[0] } | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static LL | | LL | | -LL | | LL | | }; | |__- | @@ -73,35 +88,31 @@ LL | #[warn(const_err)] | ^^^^^^^^^ error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:62:9 + --> $DIR/const_refers_to_static_cross_crate.rs:61:9 | LL | U8_MUT2 => true, | ^^^^^^^ warning: skipping const checks - --> $DIR/const_refers_to_static_cross_crate.rs:35:20 - | -LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: skipping const checks - --> $DIR/const_refers_to_static_cross_crate.rs:35:77 - | -LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } - | ^^^^^^^^ - | - = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: any use of this value will cause an error - --> $DIR/const_refers_to_static_cross_crate.rs:35:51 + --> $DIR/const_refers_to_static_cross_crate.rs:34:1 | LL | / const U8_MUT3: &u8 = { +LL | | +LL | | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } +LL | | +LL | | +LL | | }; + | |__^ + +warning: any use of this value will cause an error + --> $DIR/const_refers_to_static_cross_crate.rs:36:51 + | +LL | / const U8_MUT3: &u8 = { +LL | | LL | | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | | ^^^^^^^^^^^ constant accesses static LL | | LL | | -LL | | -LL | | LL | | }; | |__- | @@ -112,11 +123,11 @@ LL | #[warn(const_err)] | ^^^^^^^^^ error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:69:9 + --> $DIR/const_refers_to_static_cross_crate.rs:68:9 | LL | U8_MUT3 => true, | ^^^^^^^ -error: aborting due to 6 previous errors; 7 warnings emitted +error: aborting due to 6 previous errors; 6 warnings emitted For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/miri_unleashed/drop.rs b/src/test/ui/consts/miri_unleashed/drop.rs index 3b9208dd1260..b873b9723079 100644 --- a/src/test/ui/consts/miri_unleashed/drop.rs +++ b/src/test/ui/consts/miri_unleashed/drop.rs @@ -13,7 +13,6 @@ static TEST_OK: () = { // Make sure we catch executing bad drop functions. // The actual error is tested by the error-pattern above. -static TEST_BAD: () = { +static TEST_BAD: () = { //~ WARN skipping const checks let _v: Vec = Vec::new(); - //~^ WARN skipping const check }; diff --git a/src/test/ui/consts/miri_unleashed/drop.stderr b/src/test/ui/consts/miri_unleashed/drop.stderr index 9d89836e3f8a..dfefd7f2d316 100644 --- a/src/test/ui/consts/miri_unleashed/drop.stderr +++ b/src/test/ui/consts/miri_unleashed/drop.stderr @@ -1,8 +1,10 @@ warning: skipping const checks - --> $DIR/drop.rs:17:9 + --> $DIR/drop.rs:16:1 | -LL | let _v: Vec = Vec::new(); - | ^^ +LL | / static TEST_BAD: () = { +LL | | let _v: Vec = Vec::new(); +LL | | }; + | |__^ error[E0080]: could not evaluate static initializer --> $SRC_DIR/libcore/ptr/mod.rs:LL:COL @@ -17,10 +19,10 @@ LL | | } | |_calling non-const function ` as std::ops::Drop>::drop` | inside `std::intrinsics::drop_in_place::> - shim(Some(std::vec::Vec))` at $SRC_DIR/libcore/ptr/mod.rs:LL:COL | - ::: $DIR/drop.rs:19:1 + ::: $DIR/drop.rs:18:1 | LL | }; - | - inside `TEST_BAD` at $DIR/drop.rs:19:1 + | - inside `TEST_BAD` at $DIR/drop.rs:18:1 error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.rs b/src/test/ui/consts/miri_unleashed/inline_asm.rs index ddc4767b83aa..c8c6553ed39a 100644 --- a/src/test/ui/consts/miri_unleashed/inline_asm.rs +++ b/src/test/ui/consts/miri_unleashed/inline_asm.rs @@ -6,11 +6,9 @@ fn main() {} // Make sure we catch executing inline assembly. -static TEST_BAD: () = { +static TEST_BAD: () = { //~ WARN skipping const checks unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); } //~^ ERROR could not evaluate static initializer - //~| NOTE in this expansion of llvm_asm! //~| NOTE inline assembly is not supported - //~| WARN skipping const checks //~| NOTE in this expansion of llvm_asm! }; diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.stderr b/src/test/ui/consts/miri_unleashed/inline_asm.stderr index 444a0172621e..ef11c5b1d1ab 100644 --- a/src/test/ui/consts/miri_unleashed/inline_asm.stderr +++ b/src/test/ui/consts/miri_unleashed/inline_asm.stderr @@ -1,10 +1,13 @@ warning: skipping const checks - --> $DIR/inline_asm.rs:10:14 + --> $DIR/inline_asm.rs:9:1 | -LL | unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +LL | / static TEST_BAD: () = { +LL | | unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); } +LL | | +LL | | +LL | | +LL | | }; + | |__^ error[E0080]: could not evaluate static initializer --> $DIR/inline_asm.rs:10:14 diff --git a/src/test/ui/consts/miri_unleashed/mutable_const.rs b/src/test/ui/consts/miri_unleashed/mutable_const.rs index 5b7c1d3c1377..955ba90674bf 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_const.rs +++ b/src/test/ui/consts/miri_unleashed/mutable_const.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zunleash-the-miri-inside-of-you +// compile-flags: -Zunleash-the-miri-inside-of-you -Zdeduplicate-diagnostics // normalize-stderr-test "alloc[0-9]+" -> "allocN" #![deny(const_err)] // The `allow` variant is tested by `mutable_const2`. @@ -14,12 +14,11 @@ const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; //~^ WARN: skipping const checks const MUTATING_BEHIND_RAW: () = { //~ NOTE +//~^ WARN skipping const checks // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time. unsafe { *MUTABLE_BEHIND_RAW = 99 //~ ERROR any use of this value will cause an error //~^ NOTE: which is read-only - //~| WARN skipping const checks - //~| WARN skipping const checks // FIXME would be good to match more of the error message here, but looks like we // normalize *after* checking the annoations here. } diff --git a/src/test/ui/consts/miri_unleashed/mutable_const.stderr b/src/test/ui/consts/miri_unleashed/mutable_const.stderr index 7d6264ff7096..a1d9e7f1d5f1 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_const.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_const.stderr @@ -1,25 +1,26 @@ warning: skipping const checks - --> $DIR/mutable_const.rs:13:38 + --> $DIR/mutable_const.rs:13:1 | LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: skipping const checks - --> $DIR/mutable_const.rs:19:9 - | -LL | *MUTABLE_BEHIND_RAW = 99 - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: skipping const checks - --> $DIR/mutable_const.rs:19:9 - | -LL | *MUTABLE_BEHIND_RAW = 99 - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -error: any use of this value will cause an error - --> $DIR/mutable_const.rs:19:9 + --> $DIR/mutable_const.rs:16:1 | LL | / const MUTATING_BEHIND_RAW: () = { +LL | | +LL | | // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time. +LL | | unsafe { +... | +LL | | } +LL | | }; + | |__^ + +error: any use of this value will cause an error + --> $DIR/mutable_const.rs:20:9 + | +LL | / const MUTATING_BEHIND_RAW: () = { +LL | | LL | | // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time. LL | | unsafe { LL | | *MUTABLE_BEHIND_RAW = 99 @@ -35,5 +36,5 @@ note: the lint level is defined here LL | #![deny(const_err)] // The `allow` variant is tested by `mutable_const2`. | ^^^^^^^^^ -error: aborting due to previous error; 3 warnings emitted +error: aborting due to previous error; 2 warnings emitted diff --git a/src/test/ui/consts/miri_unleashed/mutable_const2.stderr b/src/test/ui/consts/miri_unleashed/mutable_const2.stderr index a8f7d3e8b5b1..329805a48a3a 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_const2.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_const2.stderr @@ -1,8 +1,8 @@ warning: skipping const checks - --> $DIR/mutable_const2.rs:13:38 + --> $DIR/mutable_const2.rs:13:1 | LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: 1 warning emitted diff --git a/src/test/ui/consts/miri_unleashed/mutable_references.rs b/src/test/ui/consts/miri_unleashed/mutable_references.rs index 718b14f73d47..ca6b4286dc24 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references.rs +++ b/src/test/ui/consts/miri_unleashed/mutable_references.rs @@ -26,9 +26,8 @@ struct Meh { unsafe impl Sync for Meh {} -static MEH: Meh = Meh { +static MEH: Meh = Meh { //~ WARN skipping const checks x: &UnsafeCell::new(42), - //~^ WARN: skipping const checks }; // this is fine for the same reason as `BAR`. diff --git a/src/test/ui/consts/miri_unleashed/mutable_references.stderr b/src/test/ui/consts/miri_unleashed/mutable_references.stderr index 6b23bbc51295..119f1ec3d5d0 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_references.stderr @@ -1,35 +1,37 @@ warning: skipping const checks - --> $DIR/mutable_references.rs:9:26 + --> $DIR/mutable_references.rs:9:1 | LL | static FOO: &&mut u32 = &&mut 42; - | ^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: skipping const checks - --> $DIR/mutable_references.rs:14:23 + --> $DIR/mutable_references.rs:14:1 | LL | static BAR: &mut () = &mut (); - | ^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: skipping const checks - --> $DIR/mutable_references.rs:20:28 + --> $DIR/mutable_references.rs:20:1 | LL | static BOO: &mut Foo<()> = &mut Foo(()); - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: skipping const checks - --> $DIR/mutable_references.rs:30:8 + --> $DIR/mutable_references.rs:29:1 | -LL | x: &UnsafeCell::new(42), - | ^^^^^^^^^^^^^^^^^^^^ +LL | / static MEH: Meh = Meh { +LL | | x: &UnsafeCell::new(42), +LL | | }; + | |__^ warning: skipping const checks - --> $DIR/mutable_references.rs:35:27 + --> $DIR/mutable_references.rs:34:1 | LL | static OH_YES: &mut i32 = &mut 42; - | ^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0594]: cannot assign to `*OH_YES`, as `OH_YES` is an immutable static item - --> $DIR/mutable_references.rs:42:5 + --> $DIR/mutable_references.rs:41:5 | LL | *OH_YES = 99; | ^^^^^^^^^^^^ cannot assign diff --git a/src/test/ui/consts/miri_unleashed/mutable_references_ice.rs b/src/test/ui/consts/miri_unleashed/mutable_references_ice.rs index 9d8d5f513c76..0d2bb021251d 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references_ice.rs +++ b/src/test/ui/consts/miri_unleashed/mutable_references_ice.rs @@ -18,8 +18,8 @@ struct Meh { unsafe impl Sync for Meh {} // the following will never be ok! -const MUH: Meh = Meh { - x: &UnsafeCell::new(42), //~ WARN: skipping const checks +const MUH: Meh = Meh { //~ WARN skipping const checks + x: &UnsafeCell::new(42), }; fn main() { diff --git a/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr b/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr index 545a1af5c6f5..88da046ea006 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr @@ -1,8 +1,10 @@ warning: skipping const checks - --> $DIR/mutable_references_ice.rs:22:8 + --> $DIR/mutable_references_ice.rs:21:1 | -LL | x: &UnsafeCell::new(42), - | ^^^^^^^^^^^^^^^^^^^^ +LL | / const MUH: Meh = Meh { +LL | | x: &UnsafeCell::new(42), +LL | | }; + | |__^ thread 'rustc' panicked at 'assertion failed: `(left != right)` left: `Const`, diff --git a/src/test/ui/consts/miri_unleashed/non_const_fn.stderr b/src/test/ui/consts/miri_unleashed/non_const_fn.stderr index d20cd6d6f0b9..5b6077484930 100644 --- a/src/test/ui/consts/miri_unleashed/non_const_fn.stderr +++ b/src/test/ui/consts/miri_unleashed/non_const_fn.stderr @@ -1,8 +1,8 @@ warning: skipping const checks - --> $DIR/non_const_fn.rs:9:16 + --> $DIR/non_const_fn.rs:9:1 | LL | static C: () = foo(); - | ^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^ error[E0080]: could not evaluate static initializer --> $DIR/non_const_fn.rs:9:16 diff --git a/src/test/ui/consts/miri_unleashed/read_from_static.stderr b/src/test/ui/consts/miri_unleashed/read_from_static.stderr index 79c48c98f09c..13646f09a00f 100644 --- a/src/test/ui/consts/miri_unleashed/read_from_static.stderr +++ b/src/test/ui/consts/miri_unleashed/read_from_static.stderr @@ -1,8 +1,8 @@ warning: skipping const checks - --> $DIR/read_from_static.rs:5:27 + --> $DIR/read_from_static.rs:5:1 | LL | static OH_YES: &mut i32 = &mut 42; - | ^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: 1 warning emitted diff --git a/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.rs b/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.rs index fe2b92eafdb7..4b7253ce1cc0 100644 --- a/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.rs +++ b/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.rs @@ -15,10 +15,10 @@ const fn attributed() -> L { std::intrinsics::caller_location() } -const fn calling_attributed() -> L { +const fn calling_attributed() -> L { //~ WARN skipping const checks // We need `-Z unleash-the-miri-inside-of-you` for this as we don't have `const fn` pointers. let ptr: fn() -> L = attributed; - ptr() //~ WARN skipping const checks + ptr() } fn main() { diff --git a/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.stderr b/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.stderr index 3a9be6a28fab..c47638d4276a 100644 --- a/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.stderr +++ b/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.stderr @@ -1,8 +1,12 @@ warning: skipping const checks - --> $DIR/caller-location-fnptr-rt-ctfe-equiv.rs:21:5 + --> $DIR/caller-location-fnptr-rt-ctfe-equiv.rs:18:1 | -LL | ptr() - | ^^^^^ +LL | / const fn calling_attributed() -> L { +LL | | // We need `-Z unleash-the-miri-inside-of-you` for this as we don't have `const fn` pointers. +LL | | let ptr: fn() -> L = attributed; +LL | | ptr() +LL | | } + | |_^ warning: 1 warning emitted