about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Schneider <github35764891676564198441@oli-obk.de>2018-10-01 12:52:47 +0200
committerOliver Scherer <github35764891676564198441@oli-obk.de>2018-10-25 17:20:39 +0200
commit1c5ff292fcaac24ae2bab9d24fc70e34b112cbbe (patch)
treed5b1656a87df2d9c5a1dc35d800cb56a8d4f1ab0
parentd2e682afed62b3ba7b6cea55b6f8fcea296861a7 (diff)
downloadrust-1c5ff292fcaac24ae2bab9d24fc70e34b112cbbe.tar.gz
rust-1c5ff292fcaac24ae2bab9d24fc70e34b112cbbe.zip
Rebase fallout
-rw-r--r--src/librustc_lint/builtin.rs43
-rw-r--r--src/librustc_mir/const_eval.rs13
-rw-r--r--src/test/compile-fail/const-fn-error.rs2
-rw-r--r--src/test/compile-fail/issue-52443.rs1
-rw-r--r--src/test/ui/consts/const-call.stderr8
-rw-r--r--src/test/ui/consts/const-eval/conditional_array_execution.nll.stderr29
-rw-r--r--src/test/ui/consts/const-eval/issue-43197.nll.stderr43
-rw-r--r--src/test/ui/consts/const-eval/issue-43197.stderr8
-rw-r--r--src/test/ui/consts/const-eval/issue-44578.nll.stderr15
-rw-r--r--src/test/ui/consts/const-eval/issue-52442.stderr2
-rw-r--r--src/test/ui/consts/const-eval/issue-52443.stderr49
-rw-r--r--src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.nll.stderr14
-rw-r--r--src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr21
-rw-r--r--src/test/ui/consts/const-eval/ref_to_int_match.stderr2
-rw-r--r--src/test/ui/consts/const-eval/transmute-const.rs2
-rw-r--r--src/test/ui/consts/const-eval/ub-nonnull.rs6
-rw-r--r--src/test/ui/consts/const-eval/ub-nonnull.stderr6
-rw-r--r--src/test/ui/consts/const-eval/ub-ref.rs10
-rw-r--r--src/test/ui/consts/const-eval/ub-ref.stderr10
-rw-r--r--src/test/ui/consts/const-eval/ub-uninhabit.rs6
-rw-r--r--src/test/ui/consts/const-eval/ub-uninhabit.stderr6
-rw-r--r--src/test/ui/consts/const-eval/ub-upvars.rs2
-rw-r--r--src/test/ui/consts/const-eval/ub-upvars.stderr4
-rw-r--r--src/test/ui/consts/const-eval/union-ice.rs2
-rw-r--r--src/test/ui/consts/const-eval/union-ice.stderr4
-rw-r--r--src/test/ui/consts/const-fn-error.stderr41
-rw-r--r--src/test/ui/infinite/infinite-recursion-const-fn.stderr2
-rw-r--r--src/test/ui/issues/issue-39559-2.stderr14
-rw-r--r--src/test/ui/issues/issue-43105.rs3
-rw-r--r--src/test/ui/issues/issue-43105.stderr18
-rw-r--r--src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr2
31 files changed, 69 insertions, 319 deletions
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs
index c50f57e6c90..1632af6d3dd 100644
--- a/src/librustc_lint/builtin.rs
+++ b/src/librustc_lint/builtin.rs
@@ -1547,49 +1547,6 @@ impl LintPass for UnusedBrokenConst {
         lint_array!()
     }
 }
-
-fn validate_const<'a, 'tcx>(
-    tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
-    constant: &ty::Const<'tcx>,
-    param_env: ty::ParamEnv<'tcx>,
-    gid: ::rustc::mir::interpret::GlobalId<'tcx>,
-    what: &str,
-) {
-    let ecx = ::rustc_mir::const_eval::mk_eval_cx(tcx, gid.instance, param_env).unwrap();
-    let result = (|| {
-        let op = ecx.const_to_op(constant)?;
-        let mut ref_tracking = ::rustc_mir::interpret::RefTracking::new(op);
-        while let Some((op, mut path)) = ref_tracking.todo.pop() {
-            ecx.validate_operand(
-                op,
-                &mut path,
-                Some(&mut ref_tracking),
-                /* const_mode */ true,
-            )?;
-        }
-        Ok(())
-    })();
-    if let Err(err) = result {
-        let (trace, span) = ecx.generate_stacktrace(None);
-        let err = ::rustc::mir::interpret::ConstEvalErr {
-            error: err,
-            stacktrace: trace,
-            span,
-        };
-        let err = err.struct_error(
-            tcx.at(span),
-            &format!("this {} likely exhibits undefined behavior", what),
-        );
-        if let Some(mut err) = err {
-            err.note("The rules on what exactly is undefined behavior aren't clear, \
-                so this check might be overzealous. Please open an issue on the rust compiler \
-                repository if you believe it should not be considered undefined behavior",
-            );
-            err.emit();
-        }
-    }
-}
-
 fn check_const(cx: &LateContext, body_id: hir::BodyId) {
     let def_id = cx.tcx.hir.body_owner_def_id(body_id);
     let is_static = cx.tcx.is_static(def_id).is_some();
diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs
index c501ef8eceb..830f2fb089a 100644
--- a/src/librustc_mir/const_eval.rs
+++ b/src/librustc_mir/const_eval.rs
@@ -24,7 +24,6 @@ use rustc::ty::{self, Ty, TyCtxt, Instance, query::TyCtxtAt};
 use rustc::ty::layout::{self, Size, LayoutOf, TyLayout};
 use rustc::ty::subst::Subst;
 use rustc::traits::Reveal;
-use rustc::util::nodemap::FxHashSet;
 use rustc_data_structures::indexed_vec::IndexVec;
 use rustc_data_structures::fx::FxHashMap;
 use rustc::util::common::ErrorReported;
@@ -36,7 +35,7 @@ use interpret::{self,
     PlaceTy, MemPlace, OpTy, Operand, Value, Pointer, Scalar, ConstValue,
     EvalResult, EvalError, EvalErrorKind, GlobalId, EvalContext, StackPopCleanup,
     Allocation, AllocId, MemoryKind,
-    snapshot,
+    snapshot, RefTracking,
 };
 
 /// Number of steps until the detector even starts doing anything.
@@ -542,15 +541,13 @@ fn validate_const<'a, 'tcx>(
     let ecx = mk_eval_cx(tcx, cid.instance, key.param_env).unwrap();
     let val = (|| {
         let op = ecx.const_to_op(constant)?;
-        let mut todo = vec![(op, Vec::new())];
-        let mut seen = FxHashSet();
-        seen.insert(op);
-        while let Some((op, mut path)) = todo.pop() {
+        let mut ref_tracking = RefTracking::new(op);
+        while let Some((op, mut path)) = ref_tracking.todo.pop() {
             ecx.validate_operand(
                 op,
                 &mut path,
-                &mut seen,
-                &mut todo,
+                Some(&mut ref_tracking),
+                /* const_mode */ true,
             )?;
         }
         Ok(constant)
diff --git a/src/test/compile-fail/const-fn-error.rs b/src/test/compile-fail/const-fn-error.rs
index 0eee0b4c7b8..83f2735aa9d 100644
--- a/src/test/compile-fail/const-fn-error.rs
+++ b/src/test/compile-fail/const-fn-error.rs
@@ -16,7 +16,7 @@ const fn f(x: usize) -> usize {
     let mut sum = 0;
     //~^ let bindings in constant functions are unstable
     //~| statements in constant functions are unstable
-    for i in 0..x { //~ ERROR E0080
+    for i in 0..x {
         //~^ ERROR E0015
         //~| ERROR E0019
         sum += i;
diff --git a/src/test/compile-fail/issue-52443.rs b/src/test/compile-fail/issue-52443.rs
index 1ed513033fd..fc42f87ccbf 100644
--- a/src/test/compile-fail/issue-52443.rs
+++ b/src/test/compile-fail/issue-52443.rs
@@ -14,5 +14,4 @@ fn main() {
     [(); {while true {break}; 0}]; //~ ERROR constant contains unimplemented expression type
     [(); { for _ in 0usize.. {}; 0}]; //~ ERROR calls in constants are limited to constant functions
     //~^ ERROR constant contains unimplemented expression type
-    //~| ERROR evaluation of constant value failed
 }
diff --git a/src/test/ui/consts/const-call.stderr b/src/test/ui/consts/const-call.stderr
index e0427d0d04c..81be93e916e 100644
--- a/src/test/ui/consts/const-call.stderr
+++ b/src/test/ui/consts/const-call.stderr
@@ -4,12 +4,6 @@ error[E0015]: calls in constants are limited to constant functions, tuple struct
 LL |     let _ = [0; f(2)];
    |                 ^^^^
 
-error[E0080]: evaluation of constant value failed
-  --> $DIR/const-call.rs:16:17
-   |
-LL |     let _ = [0; f(2)];
-   |                 ^^^^ calling non-const fn `f`
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0015`.
diff --git a/src/test/ui/consts/const-eval/conditional_array_execution.nll.stderr b/src/test/ui/consts/const-eval/conditional_array_execution.nll.stderr
deleted file mode 100644
index b6c35b8ebbd..00000000000
--- a/src/test/ui/consts/const-eval/conditional_array_execution.nll.stderr
+++ /dev/null
@@ -1,29 +0,0 @@
-warning: any use of this value will cause an error
-  --> $DIR/conditional_array_execution.rs:15:1
-   |
-LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
-   | ^^^^^^^^^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |                   |
-   |                   attempt to subtract with overflow
-   |
-note: lint level defined here
-  --> $DIR/conditional_array_execution.rs:11:9
-   |
-LL | #![warn(const_err)]
-   |         ^^^^^^^^^
-
-error[E0080]: evaluation of constant expression failed
-  --> $DIR/conditional_array_execution.rs:19:14
-   |
-LL |     println!("{}", FOO);
-   |              ^^^^  --- referenced constant has errors
-
-error[E0080]: evaluation of constant expression failed
-  --> $DIR/conditional_array_execution.rs:19:20
-   |
-LL |     println!("{}", FOO);
-   |                    ^^^ referenced constant has errors
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/issue-43197.nll.stderr b/src/test/ui/consts/const-eval/issue-43197.nll.stderr
deleted file mode 100644
index 86a86922d3b..00000000000
--- a/src/test/ui/consts/const-eval/issue-43197.nll.stderr
+++ /dev/null
@@ -1,43 +0,0 @@
-warning: any use of this value will cause an error
-  --> $DIR/issue-43197.rs:20:5
-   |
-LL |     const X: u32 = 0-1;
-   |     ^^^^^^^^^^^^^^^---^
-   |                    |
-   |                    attempt to subtract with overflow
-   |
-note: lint level defined here
-  --> $DIR/issue-43197.rs:11:9
-   |
-LL | #![warn(const_err)]
-   |         ^^^^^^^^^
-
-warning: any use of this value will cause an error
-  --> $DIR/issue-43197.rs:22:5
-   |
-LL |     const Y: u32 = foo(0-1);
-   |     ^^^^^^^^^^^^^^^^^^^---^^
-   |                        |
-   |                        attempt to subtract with overflow
-
-error[E0080]: evaluation of constant expression failed
-  --> $DIR/issue-43197.rs:24:14
-   |
-LL |     println!("{} {}", X, Y);
-   |              ^^^^^^^  - referenced constant has errors
-
-error[E0080]: evaluation of constant expression failed
-  --> $DIR/issue-43197.rs:24:26
-   |
-LL |     println!("{} {}", X, Y);
-   |                          ^ referenced constant has errors
-
-error[E0080]: evaluation of constant expression failed
-  --> $DIR/issue-43197.rs:24:23
-   |
-LL |     println!("{} {}", X, Y);
-   |                       ^ referenced constant has errors
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/issue-43197.stderr b/src/test/ui/consts/const-eval/issue-43197.stderr
index 95d43581830..eaaebc5d75a 100644
--- a/src/test/ui/consts/const-eval/issue-43197.stderr
+++ b/src/test/ui/consts/const-eval/issue-43197.stderr
@@ -1,5 +1,5 @@
 warning: any use of this value will cause an error
-  --> $DIR/issue-43197.rs:20:5
+  --> $DIR/issue-43197.rs:18:5
    |
 LL |     const X: u32 = 0-1;
    |     ^^^^^^^^^^^^^^^---^
@@ -13,7 +13,7 @@ LL | #![warn(const_err)]
    |         ^^^^^^^^^
 
 warning: any use of this value will cause an error
-  --> $DIR/issue-43197.rs:22:5
+  --> $DIR/issue-43197.rs:20:5
    |
 LL |     const Y: u32 = foo(0-1);
    |     ^^^^^^^^^^^^^^^^^^^---^^
@@ -21,13 +21,13 @@ LL |     const Y: u32 = foo(0-1);
    |                        attempt to subtract with overflow
 
 error[E0080]: evaluation of constant expression failed
-  --> $DIR/issue-43197.rs:24:26
+  --> $DIR/issue-43197.rs:22:26
    |
 LL |     println!("{} {}", X, Y);
    |                          ^ referenced constant has errors
 
 error[E0080]: evaluation of constant expression failed
-  --> $DIR/issue-43197.rs:24:23
+  --> $DIR/issue-43197.rs:22:23
    |
 LL |     println!("{} {}", X, Y);
    |                       ^ referenced constant has errors
diff --git a/src/test/ui/consts/const-eval/issue-44578.nll.stderr b/src/test/ui/consts/const-eval/issue-44578.nll.stderr
deleted file mode 100644
index 71e06e36361..00000000000
--- a/src/test/ui/consts/const-eval/issue-44578.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0080]: evaluation of constant expression failed
-  --> $DIR/issue-44578.rs:35:14
-   |
-LL |     println!("{}", <Bar<u16, u8> as Foo>::AMT);
-   |              ^^^^  -------------------------- referenced constant has errors
-
-error[E0080]: evaluation of constant expression failed
-  --> $DIR/issue-44578.rs:35:20
-   |
-LL |     println!("{}", <Bar<u16, u8> as Foo>::AMT);
-   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/issue-52442.stderr b/src/test/ui/consts/const-eval/issue-52442.stderr
index 93fc4bea5ca..3075be9e28b 100644
--- a/src/test/ui/consts/const-eval/issue-52442.stderr
+++ b/src/test/ui/consts/const-eval/issue-52442.stderr
@@ -8,7 +8,7 @@ error[E0080]: it is undefined behavior to use this value
   --> $DIR/issue-52442.rs:12:11
    |
 LL |     [();  { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type
-   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected the type usize
+   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain bits
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
diff --git a/src/test/ui/consts/const-eval/issue-52443.stderr b/src/test/ui/consts/const-eval/issue-52443.stderr
deleted file mode 100644
index 807a70dd201..00000000000
--- a/src/test/ui/consts/const-eval/issue-52443.stderr
+++ /dev/null
@@ -1,49 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/issue-52443.rs:12:10
-   |
-LL |     [(); & { loop { continue } } ]; //~ ERROR mismatched types
-   |          ^^^^^^^^^^^^^^^^^^^^^^^
-   |          |
-   |          expected usize, found reference
-   |          help: consider removing the borrow: `{ loop { continue } }`
-   |
-   = note: expected type `usize`
-              found type `&_`
-
-error[E0308]: mismatched types
-  --> $DIR/issue-52443.rs:13:17
-   |
-LL |     [(); loop { break }]; //~ ERROR mismatched types
-   |                 ^^^^^ expected (), found usize
-   |
-   = note: expected type `()`
-              found type `usize`
-
-error[E0019]: constant contains unimplemented expression type
-  --> $DIR/issue-52443.rs:14:11
-   |
-LL |     [(); {while true {break}; 0}]; //~ ERROR constant contains unimplemented expression type
-   |           ^^^^^^^^^^^^^^^^^^
-
-error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
-  --> $DIR/issue-52443.rs:15:21
-   |
-LL |     [(); { for _ in 0usize.. {}; 0}]; //~ ERROR calls in constants are limited to constant functions
-   |                     ^^^^^^^^
-
-error[E0019]: constant contains unimplemented expression type
-  --> $DIR/issue-52443.rs:15:21
-   |
-LL |     [(); { for _ in 0usize.. {}; 0}]; //~ ERROR calls in constants are limited to constant functions
-   |                     ^^^^^^^^
-
-error[E0080]: evaluation of constant value failed
-  --> $DIR/issue-52443.rs:15:21
-   |
-LL |     [(); { for _ in 0usize.. {}; 0}]; //~ ERROR calls in constants are limited to constant functions
-   |                     ^^^^^^^^ calling non-const fn `<I as std::iter::IntoIterator><std::ops::RangeFrom<usize>>::into_iter`
-
-error: aborting due to 6 previous errors
-
-Some errors occurred: E0015, E0019, E0080, E0308.
-For more information about an error, try `rustc --explain E0015`.
diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.nll.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.nll.stderr
new file mode 100644
index 00000000000..c6b3dd242e9
--- /dev/null
+++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.nll.stderr
@@ -0,0 +1,14 @@
+error[E0716]: temporary value dropped while borrowed
+  --> $DIR/promoted_const_fn_fail_deny_const_err.rs:31:27
+   |
+LL |     let x: &'static u8 = &(bar() + 1);
+   |            -----------    ^^^^^^^^^^^ creates a temporary which is freed while still in use
+   |            |
+   |            type annotation requires that borrow lasts for `'static`
+...
+LL | }
+   | - temporary value is freed at the end of this statement
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0716`.
diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr
index c44acf9f1f8..728ff39f579 100644
--- a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr
+++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr
@@ -1,19 +1,14 @@
-error: reaching this expression at runtime will panic or abort
-  --> $DIR/promoted_const_fn_fail_deny_const_err.rs:31:26
+error[E0597]: borrowed value does not live long enough
+  --> $DIR/promoted_const_fn_fail_deny_const_err.rs:31:27
    |
-LL |         Bar { a: &42 }.b as u8
-   |         ---------------------- a raw memory access tried to access part of a pointer value as raw bytes
-...
 LL |     let x: &'static u8 = &(bar() + 1);
-   |                          ^^-----^^^^^
-   |                            |
-   |                            inside call to `bar`
-   |
-note: lint level defined here
-  --> $DIR/promoted_const_fn_fail_deny_const_err.rs:13:9
+   |                           ^^^^^^^^^^^ temporary value does not live long enough
+...
+LL | }
+   | - temporary value only lives until here
    |
-LL | #![deny(const_err)]
-   |         ^^^^^^^^^
+   = note: borrowed value must be valid for the static lifetime...
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/consts/const-eval/ref_to_int_match.stderr b/src/test/ui/consts/const-eval/ref_to_int_match.stderr
index 1e65a871de4..d55c1c2c70b 100644
--- a/src/test/ui/consts/const-eval/ref_to_int_match.stderr
+++ b/src/test/ui/consts/const-eval/ref_to_int_match.stderr
@@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value
   --> $DIR/ref_to_int_match.rs:33:1
    |
 LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; //~ ERROR it is undefined behavior to use this value
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected the type u64
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain bits
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
diff --git a/src/test/ui/consts/const-eval/transmute-const.rs b/src/test/ui/consts/const-eval/transmute-const.rs
index 477e7119ba9..1d0ac4c98f5 100644
--- a/src/test/ui/consts/const-eval/transmute-const.rs
+++ b/src/test/ui/consts/const-eval/transmute-const.rs
@@ -13,6 +13,6 @@
 use std::mem;
 
 static FOO: bool = unsafe { mem::transmute(3u8) };
-//~^ ERROR this static likely exhibits undefined behavior
+//~^ ERROR it is undefined behavior to use this value
 
 fn main() {}
diff --git a/src/test/ui/consts/const-eval/ub-nonnull.rs b/src/test/ui/consts/const-eval/ub-nonnull.rs
index 2b07eee3ccb..6d6ad38afdb 100644
--- a/src/test/ui/consts/const-eval/ub-nonnull.rs
+++ b/src/test/ui/consts/const-eval/ub-nonnull.rs
@@ -15,11 +15,11 @@ use std::ptr::NonNull;
 use std::num::{NonZeroU8, NonZeroUsize};
 
 const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
-//~^ ERROR this constant likely exhibits undefined behavior
+//~^ ERROR it is undefined behavior to use this value
 
 const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
-//~^ ERROR this constant likely exhibits undefined behavior
+//~^ ERROR it is undefined behavior to use this value
 const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
-//~^ ERROR this constant likely exhibits undefined behavior
+//~^ ERROR it is undefined behavior to use this value
 
 fn main() {}
diff --git a/src/test/ui/consts/const-eval/ub-nonnull.stderr b/src/test/ui/consts/const-eval/ub-nonnull.stderr
index 8d1ca885b5a..1fdea3f38d3 100644
--- a/src/test/ui/consts/const-eval/ub-nonnull.stderr
+++ b/src/test/ui/consts/const-eval/ub-nonnull.stderr
@@ -1,4 +1,4 @@
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/ub-nonnull.rs:17:1
    |
 LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
@@ -6,7 +6,7 @@ LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/ub-nonnull.rs:20:1
    |
 LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
@@ -14,7 +14,7 @@ LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/ub-nonnull.rs:22:1
    |
 LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
diff --git a/src/test/ui/consts/const-eval/ub-ref.rs b/src/test/ui/consts/const-eval/ub-ref.rs
index 584dc069169..2c2abd91275 100644
--- a/src/test/ui/consts/const-eval/ub-ref.rs
+++ b/src/test/ui/consts/const-eval/ub-ref.rs
@@ -13,18 +13,18 @@
 use std::mem;
 
 const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
-//~^ ERROR this constant likely exhibits undefined behavior
+//~^ ERROR it is undefined behavior to use this value
 
 const NULL: &u16 = unsafe { mem::transmute(0usize) };
-//~^ ERROR this constant likely exhibits undefined behavior
+//~^ ERROR it is undefined behavior to use this value
 
 const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
-//~^ ERROR this constant likely exhibits undefined behavior
+//~^ ERROR it is undefined behavior to use this value
 
 const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
-//~^ ERROR this constant likely exhibits undefined behavior
+//~^ ERROR it is undefined behavior to use this value
 
 const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
-//~^ ERROR this constant likely exhibits undefined behavior
+//~^ ERROR it is undefined behavior to use this value
 
 fn main() {}
diff --git a/src/test/ui/consts/const-eval/ub-ref.stderr b/src/test/ui/consts/const-eval/ub-ref.stderr
index 8bcb6d190b8..4ae4640d074 100644
--- a/src/test/ui/consts/const-eval/ub-ref.stderr
+++ b/src/test/ui/consts/const-eval/ub-ref.stderr
@@ -1,4 +1,4 @@
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/ub-ref.rs:15:1
    |
 LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
@@ -6,7 +6,7 @@ LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/ub-ref.rs:18:1
    |
 LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
@@ -14,7 +14,7 @@ LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/ub-ref.rs:21:1
    |
 LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
@@ -22,7 +22,7 @@ LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/ub-ref.rs:24:1
    |
 LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
@@ -30,7 +30,7 @@ LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/ub-ref.rs:27:1
    |
 LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
diff --git a/src/test/ui/consts/const-eval/ub-uninhabit.rs b/src/test/ui/consts/const-eval/ub-uninhabit.rs
index 99305beee52..22262fd0b97 100644
--- a/src/test/ui/consts/const-eval/ub-uninhabit.rs
+++ b/src/test/ui/consts/const-eval/ub-uninhabit.rs
@@ -16,13 +16,13 @@ use std::mem;
 enum Bar {}
 
 const BAD_BAD_BAD: Bar = unsafe { mem::transmute(()) };
-//~^ ERROR this constant likely exhibits undefined behavior
+//~^ ERROR it is undefined behavior to use this value
 
 const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
-//~^ ERROR this constant likely exhibits undefined behavior
+//~^ ERROR it is undefined behavior to use this value
 
 const BAD_BAD_ARRAY: [Bar; 1] = unsafe { mem::transmute(()) };
-//~^ ERROR this constant likely exhibits undefined behavior
+//~^ ERROR it is undefined behavior to use this value
 
 fn main() {
 }
diff --git a/src/test/ui/consts/const-eval/ub-uninhabit.stderr b/src/test/ui/consts/const-eval/ub-uninhabit.stderr
index 136d5f29199..2ac0a6e4e86 100644
--- a/src/test/ui/consts/const-eval/ub-uninhabit.stderr
+++ b/src/test/ui/consts/const-eval/ub-uninhabit.stderr
@@ -1,4 +1,4 @@
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/ub-uninhabit.rs:18:1
    |
 LL | const BAD_BAD_BAD: Bar = unsafe { mem::transmute(()) };
@@ -6,7 +6,7 @@ LL | const BAD_BAD_BAD: Bar = unsafe { mem::transmute(()) };
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/ub-uninhabit.rs:21:1
    |
 LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
@@ -14,7 +14,7 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
 
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/ub-uninhabit.rs:24:1
    |
 LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { mem::transmute(()) };
diff --git a/src/test/ui/consts/const-eval/ub-upvars.rs b/src/test/ui/consts/const-eval/ub-upvars.rs
index 309211d19d4..f591a5affe5 100644
--- a/src/test/ui/consts/const-eval/ub-upvars.rs
+++ b/src/test/ui/consts/const-eval/ub-upvars.rs
@@ -12,7 +12,7 @@
 
 use std::mem;
 
-const BAD_UPVAR: &FnOnce() = &{ //~ ERROR this constant likely exhibits undefined behavior
+const BAD_UPVAR: &FnOnce() = &{ //~ ERROR it is undefined behavior to use this value
     let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) };
     let another_var = 13;
     move || { let _ = bad_ref; let _ = another_var; }
diff --git a/src/test/ui/consts/const-eval/ub-upvars.stderr b/src/test/ui/consts/const-eval/ub-upvars.stderr
index 3ae140d6e1c..178f80f88e8 100644
--- a/src/test/ui/consts/const-eval/ub-upvars.stderr
+++ b/src/test/ui/consts/const-eval/ub-upvars.stderr
@@ -1,7 +1,7 @@
-error[E0080]: this constant likely exhibits undefined behavior
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/ub-upvars.rs:15:1
    |
-LL | / const BAD_UPVAR: &FnOnce() = &{ //~ ERROR this constant likely exhibits undefined behavior
+LL | / const BAD_UPVAR: &FnOnce() = &{ //~ ERROR it is undefined behavior to use this value
 LL | |     let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) };
 LL | |     let another_var = 13;
 LL | |     move || { let _ = bad_ref; let _ = another_var; }
diff --git a/src/test/ui/consts/const-eval/union-ice.rs b/src/test/ui/consts/const-eval/union-ice.rs
index 5a8ea711d86..0e4f1e09171 100644
--- a/src/test/ui/consts/const-eval/union-ice.rs
+++ b/src/test/ui/consts/const-eval/union-ice.rs
@@ -22,7 +22,7 @@ const UNION: DummyUnion = DummyUnion { field1: 1065353216 };
 
 const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR will cause an error
 
-const FIELD_PATH: Struct = Struct { //~ ERROR any use of this value will cause an error
+const FIELD_PATH: Struct = Struct { //~ ERROR it is undefined behavior to use this value
     a: 42,
     b: unsafe { UNION.field3 },
 };
diff --git a/src/test/ui/consts/const-eval/union-ice.stderr b/src/test/ui/consts/const-eval/union-ice.stderr
index 7f5cb731c8e..d5a20640771 100644
--- a/src/test/ui/consts/const-eval/union-ice.stderr
+++ b/src/test/ui/consts/const-eval/union-ice.stderr
@@ -6,10 +6,10 @@ LL | const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR will cause an err
    |
    = note: #[deny(const_err)] on by default
 
-error: any use of this value will cause an error
+error[E0080]: it is undefined behavior to use this value
   --> $DIR/union-ice.rs:25:1
    |
-LL | / const FIELD_PATH: Struct = Struct { //~ ERROR any use of this value will cause an error
+LL | / const FIELD_PATH: Struct = Struct { //~ ERROR it is undefined behavior to use this value
 LL | |     a: 42,
 LL | |     b: unsafe { UNION.field3 },
 LL | | };
diff --git a/src/test/ui/consts/const-fn-error.stderr b/src/test/ui/consts/const-fn-error.stderr
deleted file mode 100644
index a7b757f2d00..00000000000
--- a/src/test/ui/consts/const-fn-error.stderr
+++ /dev/null
@@ -1,41 +0,0 @@
-error[E0658]: let bindings in constant functions are unstable (see issue #48821)
-  --> $DIR/const-fn-error.rs:16:19
-   |
-LL |     let mut sum = 0;
-   |                   ^
-   |
-   = help: add #![feature(const_let)] to the crate attributes to enable
-
-error[E0658]: statements in constant functions are unstable (see issue #48821)
-  --> $DIR/const-fn-error.rs:16:19
-   |
-LL |     let mut sum = 0;
-   |                   ^
-   |
-   = help: add #![feature(const_let)] to the crate attributes to enable
-
-error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-  --> $DIR/const-fn-error.rs:19:14
-   |
-LL |     for i in 0..x { //~ ERROR E0080
-   |              ^^^^
-
-error[E0019]: constant function contains unimplemented expression type
-  --> $DIR/const-fn-error.rs:19:14
-   |
-LL |     for i in 0..x { //~ ERROR E0080
-   |              ^^^^
-
-error[E0080]: evaluation of constant value failed
-  --> $DIR/const-fn-error.rs:19:14
-   |
-LL |     for i in 0..x { //~ ERROR E0080
-   |              ^^^^ calling non-const fn `<I as std::iter::IntoIterator><std::ops::Range<usize>>::into_iter`
-...
-LL |     let a : [i32; f(X)];
-   |                   ---- inside call to `f`
-
-error: aborting due to 5 previous errors
-
-Some errors occurred: E0015, E0019, E0080, E0658.
-For more information about an error, try `rustc --explain E0015`.
diff --git a/src/test/ui/infinite/infinite-recursion-const-fn.stderr b/src/test/ui/infinite/infinite-recursion-const-fn.stderr
index 82da89f1aa7..ef35bb6d98d 100644
--- a/src/test/ui/infinite/infinite-recursion-const-fn.stderr
+++ b/src/test/ui/infinite/infinite-recursion-const-fn.stderr
@@ -1,5 +1,5 @@
 error[E0080]: evaluation of constant value failed
-  --> $DIR/infinite-recursion-const-fn.rs:14:25
+  --> $DIR/infinite-recursion-const-fn.rs:13:25
    |
 LL | const fn a() -> usize { b() } //~ ERROR evaluation of constant value failed
    |                         ^^^
diff --git a/src/test/ui/issues/issue-39559-2.stderr b/src/test/ui/issues/issue-39559-2.stderr
index d7efcc52494..ca9da096b6c 100644
--- a/src/test/ui/issues/issue-39559-2.stderr
+++ b/src/test/ui/issues/issue-39559-2.stderr
@@ -4,24 +4,12 @@ error[E0015]: calls in constants are limited to constant functions, tuple struct
 LL |     let array: [usize; Dim3::dim()]
    |                        ^^^^^^^^^^^
 
-error[E0080]: evaluation of constant value failed
-  --> $DIR/issue-39559-2.rs:24:24
-   |
-LL |     let array: [usize; Dim3::dim()]
-   |                        ^^^^^^^^^^^ calling non-const fn `<Dim3 as Dim>::dim`
-
 error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
   --> $DIR/issue-39559-2.rs:26:15
    |
 LL |         = [0; Dim3::dim()];
    |               ^^^^^^^^^^^
 
-error[E0080]: evaluation of constant value failed
-  --> $DIR/issue-39559-2.rs:27:15
-   |
-LL |         = [0; Dim3::dim()];
-   |               ^^^^^^^^^^^ calling non-const fn `<Dim3 as Dim>::dim`
-
-error: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0015`.
diff --git a/src/test/ui/issues/issue-43105.rs b/src/test/ui/issues/issue-43105.rs
index 2b0eb685497..2bddc443d5b 100644
--- a/src/test/ui/issues/issue-43105.rs
+++ b/src/test/ui/issues/issue-43105.rs
@@ -12,11 +12,10 @@ fn xyz() -> u8 { 42 }
 
 const NUM: u8 = xyz();
 //~^ ERROR calls in constants are limited to constant functions, tuple structs and tuple variants
-//~| ERROR any use of this value will cause an error
 
 fn main() {
     match 1 {
-        NUM => unimplemented!(), //~ ERROR could not evaluate constant pattern
+        NUM => unimplemented!(),
         _ => unimplemented!(),
     }
 }
diff --git a/src/test/ui/issues/issue-43105.stderr b/src/test/ui/issues/issue-43105.stderr
index aba8351186b..67a6008cd8e 100644
--- a/src/test/ui/issues/issue-43105.stderr
+++ b/src/test/ui/issues/issue-43105.stderr
@@ -4,22 +4,6 @@ error[E0015]: calls in constants are limited to constant functions, tuple struct
 LL | const NUM: u8 = xyz();
    |                 ^^^^^
 
-error: any use of this value will cause an error
-  --> $DIR/issue-43105.rs:13:1
-   |
-LL | const NUM: u8 = xyz();
-   | ^^^^^^^^^^^^^^^^-----^
-   |                 |
-   |                 calling non-const fn `xyz`
-   |
-   = note: #[deny(const_err)] on by default
-
-error: could not evaluate constant pattern
-  --> $DIR/issue-43105.rs:19:9
-   |
-LL |         NUM => unimplemented!(), //~ ERROR could not evaluate constant pattern
-   |         ^^^
-
-error: aborting due to 3 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0015`.
diff --git a/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr b/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr
index ba415d43a75..03de0efd073 100644
--- a/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr
+++ b/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr
@@ -10,7 +10,7 @@ error[E0080]: it is undefined behavior to use this value
   --> $DIR/issue-52023-array-size-pointer-cast.rs:12:17
    |
 LL |     let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to integers in constants
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected the type usize
+   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain bits
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior