From fd59d44f5880fea109fe68e31fab2486cd686fc6 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 21 Sep 2022 13:05:20 +0200 Subject: [PATCH] make const_err a hard error --- .../rustc_const_eval/src/const_eval/error.rs | 76 +-- .../src/const_eval/eval_queries.rs | 50 +- .../src/interpret/eval_context.rs | 3 + .../rustc_const_eval/src/interpret/intern.rs | 2 - compiler/rustc_lint/src/lib.rs | 5 + compiler/rustc_lint_defs/src/builtin.rs | 32 - .../rustc_middle/src/mir/interpret/error.rs | 19 +- .../src/const_prop_lint.rs | 35 +- library/core/tests/num/wrapping.rs | 2 - library/core/tests/slice.rs | 1 - src/test/mir-opt/remove-never-const.rs | 1 - .../ui/array-slice-vec/array_const_index-0.rs | 3 +- .../array_const_index-0.stderr | 20 +- .../ui/array-slice-vec/array_const_index-1.rs | 3 +- .../array_const_index-1.stderr | 20 +- .../defaults-not-assumed-fail.rs | 4 +- .../defaults-not-assumed-fail.stderr | 39 +- src/test/ui/borrowck/issue-81899.rs | 3 +- src/test/ui/borrowck/issue-81899.stderr | 23 +- .../borrowck/issue-88434-minimal-example.rs | 3 +- .../issue-88434-minimal-example.stderr | 23 +- ...ssue-88434-removal-index-should-be-less.rs | 3 +- ...-88434-removal-index-should-be-less.stderr | 23 +- src/test/ui/cast/cast-rfc0401.rs | 6 +- src/test/ui/closures/closure_promotion.rs | 2 - src/test/ui/consts/array-literal-index-oob.rs | 2 +- .../ui/consts/array-literal-index-oob.stderr | 6 +- src/test/ui/consts/assert-type-intrinsics.rs | 14 +- .../ui/consts/assert-type-intrinsics.stderr | 76 +-- .../ui/consts/assoc_const_generic_impl.rs | 7 +- .../ui/consts/assoc_const_generic_impl.stderr | 40 +- src/test/ui/consts/const-err-early.rs | 17 +- src/test/ui/consts/const-err-early.stderr | 126 +--- src/test/ui/consts/const-err-late.rs | 22 + src/test/ui/consts/const-err-late.stderr | 27 + src/test/ui/consts/const-err-multi.rs | 14 +- src/test/ui/consts/const-err-multi.stderr | 102 +--- src/test/ui/consts/const-err-rpass.rs | 2 - src/test/ui/consts/const-err.rs | 19 - src/test/ui/consts/const-err.stderr | 44 -- .../const-eval/conditional_array_execution.rs | 10 +- .../conditional_array_execution.stderr | 63 +- .../const-eval/const-eval-overflow-2.rs | 4 +- .../const-eval/const-eval-overflow-2.stderr | 24 +- .../consts/const-eval/const-eval-overflow2.rs | 26 +- .../const-eval/const-eval-overflow2.stderr | 226 +------ .../const-eval/const-eval-overflow2b.rs | 26 +- .../const-eval/const-eval-overflow2b.stderr | 226 +------ .../const-eval/const-eval-overflow2c.rs | 26 +- .../const-eval/const-eval-overflow2c.stderr | 226 +------ .../const-eval/const-eval-query-stack.rs | 10 +- .../const-eval/const-eval-query-stack.stderr | 64 +- ...inter-values-in-various-types.64bit.stderr | 570 +++--------------- .../const-pointer-values-in-various-types.rs | 81 +-- .../consts/const-eval/const_fn_ptr_fail2.rs | 7 +- .../const-eval/const_fn_ptr_fail2.stderr | 92 +-- .../ui/consts/const-eval/erroneous-const.rs | 6 +- .../consts/const-eval/erroneous-const.stderr | 45 +- .../ui/consts/const-eval/erroneous-const2.rs | 6 +- .../consts/const-eval/erroneous-const2.stderr | 41 +- src/test/ui/consts/const-eval/format.rs | 4 - src/test/ui/consts/const-eval/format.stderr | 78 +-- .../index-out-of-bounds-never-type.rs | 6 +- .../index-out-of-bounds-never-type.stderr | 38 +- src/test/ui/consts/const-eval/issue-43197.rs | 16 +- .../ui/consts/const-eval/issue-43197.stderr | 119 +--- src/test/ui/consts/const-eval/issue-44578.rs | 5 +- .../ui/consts/const-eval/issue-44578.stderr | 43 +- .../ui/consts/const-eval/issue-50814-2.rs | 3 +- .../ui/consts/const-eval/issue-50814-2.stderr | 23 +- src/test/ui/consts/const-eval/issue-50814.rs | 3 +- .../ui/consts/const-eval/issue-50814.stderr | 23 +- .../const-eval/panic-assoc-never-type.rs | 1 - .../const-eval/panic-assoc-never-type.stderr | 6 +- .../ui/consts/const-eval/panic-never-type.rs | 1 - .../consts/const-eval/panic-never-type.stderr | 4 +- .../const-eval/partial_ptr_overwrite.rs | 3 +- .../const-eval/partial_ptr_overwrite.stderr | 25 +- .../const-eval/promoted_const_fn_fail.rs | 2 - .../const-eval/promoted_const_fn_fail.stderr | 2 +- .../promoted_const_fn_fail_deny_const_err.rs | 2 - ...omoted_const_fn_fail_deny_const_err.stderr | 2 +- .../const-eval/promoted_errors.noopt.stderr | 93 +-- .../const-eval/promoted_errors.opt.stderr | 95 +-- ...ted_errors.opt_with_overflow_checks.stderr | 93 +-- .../ui/consts/const-eval/promoted_errors.rs | 25 +- .../ui/consts/const-eval/pub_const_err.rs | 10 - .../ui/consts/const-eval/pub_const_err.stderr | 31 - .../ui/consts/const-eval/pub_const_err_bin.rs | 10 - .../const-eval/pub_const_err_bin.stderr | 31 - .../const-eval/ref_to_int_match.32bit.stderr | 21 +- .../const-eval/ref_to_int_match.64bit.stderr | 21 +- .../ui/consts/const-eval/ref_to_int_match.rs | 3 +- .../ui/consts/const-eval/ub-enum.32bit.stderr | 108 +--- .../ui/consts/const-eval/ub-enum.64bit.stderr | 108 +--- src/test/ui/consts/const-eval/ub-enum.rs | 15 +- .../const-eval/ub-int-array.32bit.stderr | 6 +- .../const-eval/ub-int-array.64bit.stderr | 6 +- src/test/ui/consts/const-eval/ub-int-array.rs | 1 - .../consts/const-eval/ub-nonnull.32bit.stderr | 12 +- .../consts/const-eval/ub-nonnull.64bit.stderr | 12 +- src/test/ui/consts/const-eval/ub-nonnull.rs | 3 +- .../consts/const-eval/ub-ref-ptr.32bit.stderr | 114 +--- .../consts/const-eval/ub-ref-ptr.64bit.stderr | 114 +--- src/test/ui/consts/const-eval/ub-ref-ptr.rs | 15 +- .../const-eval/ub-uninhabit.32bit.stderr | 6 +- .../const-eval/ub-uninhabit.64bit.stderr | 6 +- src/test/ui/consts/const-eval/ub-uninhabit.rs | 1 - src/test/ui/consts/const-eval/ub-upvars.rs | 2 +- .../const-eval/ub-wide-ptr.32bit.stderr | 187 ++---- .../const-eval/ub-wide-ptr.64bit.stderr | 187 ++---- src/test/ui/consts/const-eval/ub-wide-ptr.rs | 24 +- .../consts/const-eval/union-ub.32bit.stderr | 4 +- .../consts/const-eval/union-ub.64bit.stderr | 4 +- src/test/ui/consts/const-eval/union-ub.rs | 1 - .../ui/consts/const-eval/union_promotion.rs | 2 - .../consts/const-eval/union_promotion.stderr | 2 +- .../consts/const-eval/unused-broken-const.rs | 3 +- .../const-eval/unused-broken-const.stderr | 20 +- src/test/ui/consts/const-eval/valid-const.rs | 1 - .../validate_uninhabited_zsts.32bit.stderr | 6 +- .../validate_uninhabited_zsts.64bit.stderr | 6 +- .../const-eval/validate_uninhabited_zsts.rs | 2 - .../consts/const-external-macro-const-err.rs | 3 +- .../const-external-macro-const-err.stderr | 18 +- .../ui/consts/const-float-bits-reject-conv.rs | 24 +- .../const-float-bits-reject-conv.stderr | 199 +----- .../consts/const-int-arithmetic-overflow.rs | 1 - .../const-len-underflow-separate-spans.rs | 3 +- .../const-len-underflow-separate-spans.stderr | 21 +- src/test/ui/consts/const-negation.rs | 2 - .../consts/const-prop-read-static-in-const.rs | 3 +- .../const-prop-read-static-in-const.stderr | 20 +- ...st-size_of_val-align_of_val-extern-type.rs | 6 +- ...ize_of_val-align_of_val-extern-type.stderr | 40 +- src/test/ui/consts/const-slice-oob.rs | 5 +- src/test/ui/consts/const-slice-oob.stderr | 22 +- .../const_limit/const_eval_limit_reached.rs | 3 +- .../const_eval_limit_reached.stderr | 24 +- src/test/ui/consts/dangling-alloc-id-ice.rs | 1 - .../ui/consts/dangling-alloc-id-ice.stderr | 2 +- .../consts/extra-const-ub/detect-extra-ub.rs | 9 +- .../detect-extra-ub.with_flag.stderr | 75 +-- src/test/ui/consts/invalid-union.32bit.stderr | 17 +- src/test/ui/consts/invalid-union.64bit.stderr | 17 +- src/test/ui/consts/invalid-union.rs | 1 - src/test/ui/consts/issue-46553.rs | 1 - src/test/ui/consts/issue-56164.rs | 3 +- src/test/ui/consts/issue-56164.stderr | 22 +- src/test/ui/consts/issue-66693.rs | 3 +- src/test/ui/consts/issue-66693.stderr | 18 +- src/test/ui/consts/issue-miri-1910.stderr | 42 +- .../ui/consts/miri_unleashed/abi-mismatch.rs | 1 - .../consts/miri_unleashed/abi-mismatch.stderr | 8 +- .../ui/consts/miri_unleashed/assoc_const.rs | 2 - .../consts/miri_unleashed/assoc_const.stderr | 46 +- .../ui/consts/miri_unleashed/assoc_const_2.rs | 4 +- .../miri_unleashed/assoc_const_2.stderr | 25 +- src/test/ui/consts/miri_unleashed/box.rs | 1 - src/test/ui/consts/miri_unleashed/box.stderr | 10 +- .../const_refers_to_static.32bit.stderr | 81 +++ .../const_refers_to_static.64bit.stderr | 81 +++ .../miri_unleashed/const_refers_to_static.rs | 34 +- .../const_refers_to_static.stderr | 100 --- .../const_refers_to_static2.32bit.stderr | 38 -- .../const_refers_to_static2.64bit.stderr | 38 -- .../miri_unleashed/const_refers_to_static2.rs | 24 - ..._refers_to_static_cross_crate.32bit.stderr | 104 +--- ..._refers_to_static_cross_crate.64bit.stderr | 104 +--- .../const_refers_to_static_cross_crate.rs | 12 +- src/test/ui/consts/miri_unleashed/drop.rs | 1 - src/test/ui/consts/miri_unleashed/drop.stderr | 6 +- ...ure-gate-unleash_the_miri_inside_of_you.rs | 2 - ...gate-unleash_the_miri_inside_of_you.stderr | 2 +- .../ui/consts/miri_unleashed/inline_asm.rs | 1 - .../consts/miri_unleashed/inline_asm.stderr | 4 +- .../miri_unleashed/mutable_references.rs | 1 - .../miri_unleashed/mutable_references.stderr | 12 +- .../mutable_references_err.32bit.stderr | 12 +- .../mutable_references_err.64bit.stderr | 12 +- .../miri_unleashed/mutable_references_err.rs | 2 - .../consts/miri_unleashed/mutating_global.rs | 1 - .../miri_unleashed/mutating_global.stderr | 2 +- .../ui/consts/miri_unleashed/non_const_fn.rs | 2 - .../consts/miri_unleashed/non_const_fn.stderr | 4 +- .../ui/consts/miri_unleashed/ptr_arith.rs | 1 - .../ui/consts/miri_unleashed/ptr_arith.stderr | 6 +- .../miri_unleashed/raw_mutable_const.rs | 2 - .../miri_unleashed/raw_mutable_const.stderr | 4 +- src/test/ui/consts/miri_unleashed/tls.rs | 1 - src/test/ui/consts/miri_unleashed/tls.stderr | 8 +- src/test/ui/consts/promote-not.rs | 2 +- src/test/ui/consts/ptr_comparisons.rs | 6 +- src/test/ui/consts/ptr_comparisons.stderr | 41 +- src/test/ui/consts/raw-ptr-const.rs | 2 - src/test/ui/consts/raw-ptr-const.stderr | 2 +- src/test/ui/consts/recursive.rs | 3 +- src/test/ui/consts/recursive.stderr | 29 +- .../consts/uninhabited-const-issue-61744.rs | 3 +- .../uninhabited-const-issue-61744.stderr | 285 +++------ .../ui/consts/write_to_static_via_mut_ref.rs | 1 - .../consts/write_to_static_via_mut_ref.stderr | 4 +- .../intrinsic-raw_eq-const-padding.rs | 1 - .../intrinsic-raw_eq-const-padding.stderr | 2 +- .../ui/intrinsics/intrinsic-raw_eq-const.rs | 1 - src/test/ui/limits/issue-55878.stderr | 17 +- .../allowed-cli-deny-by-default-lint.rs | 12 +- .../allowed-cli-deny-by-default-lint.stderr | 23 +- .../allowed-deny-by-default-lint.rs | 14 +- .../allowed-deny-by-default-lint.stderr | 23 +- .../lint/force-warn/deny-by-default-lint.rs | 12 +- .../force-warn/deny-by-default-lint.stderr | 23 +- .../lint-exceeding-bitshifts.noopt.stderr | 2 +- .../lint/lint-exceeding-bitshifts.opt.stderr | 2 +- ...-bitshifts.opt_with_overflow_checks.stderr | 2 +- src/test/ui/lint/lint-exceeding-bitshifts.rs | 2 +- src/test/ui/lint/lint-type-overflow2.rs | 1 - src/test/ui/lint/lint-type-overflow2.stderr | 10 +- .../float-int-invalid-const-cast.rs | 2 - .../issue-8460-const.noopt.stderr | 48 +- .../issue-8460-const.opt.stderr | 48 +- ...8460-const.opt_with_overflow_checks.stderr | 48 +- .../ui/numbers-arithmetic/issue-8460-const.rs | 2 - .../numbers-arithmetic/overflowing-lsh-1.rs | 2 +- .../overflowing-lsh-1.stderr | 2 +- .../numbers-arithmetic/overflowing-lsh-2.rs | 2 +- .../overflowing-lsh-2.stderr | 2 +- .../numbers-arithmetic/overflowing-lsh-3.rs | 2 +- .../overflowing-lsh-3.stderr | 2 +- .../numbers-arithmetic/overflowing-lsh-4.rs | 2 +- .../overflowing-lsh-4.stderr | 2 +- .../numbers-arithmetic/overflowing-rsh-1.rs | 2 +- .../overflowing-rsh-1.stderr | 2 +- .../numbers-arithmetic/overflowing-rsh-2.rs | 2 +- .../overflowing-rsh-2.stderr | 2 +- .../numbers-arithmetic/overflowing-rsh-3.rs | 2 +- .../overflowing-rsh-3.stderr | 2 +- .../numbers-arithmetic/overflowing-rsh-4.rs | 2 +- .../overflowing-rsh-4.stderr | 2 +- .../numbers-arithmetic/overflowing-rsh-5.rs | 2 +- .../overflowing-rsh-5.stderr | 2 +- .../numbers-arithmetic/overflowing-rsh-6.rs | 2 +- .../overflowing-rsh-6.stderr | 2 +- .../promoted_overflow_opt.rs | 1 - .../clippy_lints/src/indexing_slicing.rs | 1 - src/tools/clippy/tests/ui/crashes/ice-9463.rs | 2 +- .../clippy/tests/ui/crashes/ice-9463.stderr | 2 +- .../clippy/tests/ui/indexing_slicing_index.rs | 2 +- .../tests/ui/indexing_slicing_index.stderr | 8 +- .../ui/out_of_bounds_indexing/issue-3102.rs | 2 +- .../tests/ui/out_of_bounds_indexing/simple.rs | 2 +- src/tools/miri/tests/fail/erroneous_const.rs | 1 - src/tools/miri/tests/fail/erroneous_const2.rs | 8 +- .../miri/tests/fail/erroneous_const2.stderr | 36 +- 254 files changed, 1379 insertions(+), 5321 deletions(-) create mode 100644 src/test/ui/consts/const-err-late.rs create mode 100644 src/test/ui/consts/const-err-late.stderr delete mode 100644 src/test/ui/consts/const-err.rs delete mode 100644 src/test/ui/consts/const-err.stderr delete mode 100644 src/test/ui/consts/const-eval/pub_const_err.rs delete mode 100644 src/test/ui/consts/const-eval/pub_const_err.stderr delete mode 100644 src/test/ui/consts/const-eval/pub_const_err_bin.rs delete mode 100644 src/test/ui/consts/const-eval/pub_const_err_bin.stderr create mode 100644 src/test/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr create mode 100644 src/test/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr delete mode 100644 src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr delete mode 100644 src/test/ui/consts/miri_unleashed/const_refers_to_static2.32bit.stderr delete mode 100644 src/test/ui/consts/miri_unleashed/const_refers_to_static2.64bit.stderr delete mode 100644 src/test/ui/consts/miri_unleashed/const_refers_to_static2.rs diff --git a/compiler/rustc_const_eval/src/const_eval/error.rs b/compiler/rustc_const_eval/src/const_eval/error.rs index 09c92ae03619d..136bfbeaad2f0 100644 --- a/compiler/rustc_const_eval/src/const_eval/error.rs +++ b/compiler/rustc_const_eval/src/const_eval/error.rs @@ -2,7 +2,6 @@ use std::error::Error; use std::fmt; use rustc_errors::Diagnostic; -use rustc_hir as hir; use rustc_middle::mir::AssertKind; use rustc_middle::ty::{layout::LayoutError, query::TyCtxtAt, ConstInt}; use rustc_span::{Span, Symbol}; @@ -23,11 +22,7 @@ pub enum ConstEvalErrKind { Abort(String), } -impl MachineStopType for ConstEvalErrKind { - fn is_hard_err(&self) -> bool { - matches!(self, Self::Panic { .. }) - } -} +impl MachineStopType for ConstEvalErrKind {} // The errors become `MachineStop` with plain strings when being raised. // `ConstEvalErr` (in `librustc_middle/mir/interpret/error.rs`) knows to @@ -87,48 +82,10 @@ impl<'tcx> ConstEvalErr<'tcx> { ConstEvalErr { error: error.into_kind(), stacktrace, span } } - pub fn struct_error( - &self, - tcx: TyCtxtAt<'tcx>, - message: &str, - decorate: impl FnOnce(&mut Diagnostic), - ) -> ErrorHandled { - self.struct_generic(tcx, message, decorate, None) - } - pub fn report_as_error(&self, tcx: TyCtxtAt<'tcx>, message: &str) -> ErrorHandled { self.struct_error(tcx, message, |_| {}) } - pub fn report_as_lint( - &self, - tcx: TyCtxtAt<'tcx>, - message: &str, - lint_root: hir::HirId, - span: Option, - ) -> ErrorHandled { - self.struct_generic( - tcx, - message, - |lint: &mut Diagnostic| { - // Apply the span. - if let Some(span) = span { - let primary_spans = lint.span.primary_spans().to_vec(); - // point at the actual error as the primary span - lint.replace_span_with(span); - // point to the `const` statement as a secondary span - // they don't have any label - for sp in primary_spans { - if sp != span { - lint.span_label(sp, ""); - } - } - } - }, - Some(lint_root), - ) - } - /// Create a diagnostic for this const eval error. /// /// Sets the message passed in via `message` and adds span labels with detailed error @@ -137,13 +94,12 @@ impl<'tcx> ConstEvalErr<'tcx> { /// /// If `lint_root.is_some()` report it as a lint, else report it as a hard error. /// (Except that for some errors, we ignore all that -- see `must_error` below.) - #[instrument(skip(self, tcx, decorate, lint_root), level = "debug")] - fn struct_generic( + #[instrument(skip(self, tcx, decorate), level = "debug")] + pub fn struct_error( &self, tcx: TyCtxtAt<'tcx>, message: &str, decorate: impl FnOnce(&mut Diagnostic), - lint_root: Option, ) -> ErrorHandled { let finish = |err: &mut Diagnostic, span_msg: Option| { trace!("reporting const eval failure at {:?}", self.span); @@ -224,27 +180,9 @@ impl<'tcx> ConstEvalErr<'tcx> { let err_msg = self.error.to_string(); - // Regular case - emit a lint. - if let Some(lint_root) = lint_root { - // Report as lint. - let hir_id = - self.stacktrace.iter().rev().find_map(|frame| frame.lint_root).unwrap_or(lint_root); - tcx.struct_span_lint_hir( - rustc_session::lint::builtin::CONST_ERR, - hir_id, - tcx.span, - message, - |lint| { - finish(lint, Some(err_msg)); - lint - }, - ); - ErrorHandled::Linted - } else { - // Report as hard error. - let mut err = struct_error(tcx, message); - finish(&mut err, Some(err_msg)); - ErrorHandled::Reported(err.emit()) - } + // Report as hard error. + let mut err = struct_error(tcx, message); + finish(&mut err, Some(err_msg)); + ErrorHandled::Reported(err.emit()) } } diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index b52cc873f2e69..1b1052fdf47a7 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -317,45 +317,23 @@ pub fn eval_to_allocation_raw_provider<'tcx>( match res.and_then(|body| eval_body_using_ecx(&mut ecx, cid, &body)) { Err(error) => { let err = ConstEvalErr::new(&ecx, error, None); - // Some CTFE errors raise just a lint, not a hard error; see - // . - let is_hard_err = if let Some(def) = def.as_local() { - // (Associated) consts only emit a lint, since they might be unused. - !matches!(tcx.def_kind(def.did.to_def_id()), DefKind::Const | DefKind::AssocConst) - // check if the inner InterpError is hard - || err.error.is_hard_err() + let msg = if is_static { + Cow::from("could not evaluate static initializer") } else { - // use of broken constant from other crate: always an error - true - }; - - if is_hard_err { - let msg = if is_static { - Cow::from("could not evaluate static initializer") + // If the current item has generics, we'd like to enrich the message with the + // instance and its substs: to show the actual compile-time values, in addition to + // the expression, leading to the const eval error. + let instance = &key.value.instance; + if !instance.substs.is_empty() { + let instance = with_no_trimmed_paths!(instance.to_string()); + let msg = format!("evaluation of `{}` failed", instance); + Cow::from(msg) } else { - // If the current item has generics, we'd like to enrich the message with the - // instance and its substs: to show the actual compile-time values, in addition to - // the expression, leading to the const eval error. - let instance = &key.value.instance; - if !instance.substs.is_empty() { - let instance = with_no_trimmed_paths!(instance.to_string()); - let msg = format!("evaluation of `{}` failed", instance); - Cow::from(msg) - } else { - Cow::from("evaluation of constant value failed") - } - }; + Cow::from("evaluation of constant value failed") + } + }; - Err(err.report_as_error(ecx.tcx.at(err.span), &msg)) - } else { - let hir_id = tcx.hir().local_def_id_to_hir_id(def.as_local().unwrap().did); - Err(err.report_as_lint( - tcx.at(tcx.def_span(def.did)), - "any use of this value will cause an error", - hir_id, - Some(err.span), - )) - } + Err(err.report_as_error(ecx.tcx.at(err.span), &msg)) } Ok(mplace) => { // Since evaluation had no errors, validate the resulting constant. diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs index bdebfbb3ff510..d2e0a0dd240e8 100644 --- a/compiler/rustc_const_eval/src/interpret/eval_context.rs +++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs @@ -258,6 +258,9 @@ impl<'tcx> fmt::Display for FrameInfo<'tcx> { { write!(f, "inside closure")?; } else { + // Note: this triggers a `good_path_bug` state, which means that if we ever get here + // we must emit a diagnostic. We should never display a `FrameInfo` unless we + // actually want to emit a warning or error to the user. write!(f, "inside `{}`", self.instance)?; } if !self.span.is_dummy() { diff --git a/compiler/rustc_const_eval/src/interpret/intern.rs b/compiler/rustc_const_eval/src/interpret/intern.rs index 24dbc769529c3..f72ae7413e301 100644 --- a/compiler/rustc_const_eval/src/interpret/intern.rs +++ b/compiler/rustc_const_eval/src/interpret/intern.rs @@ -332,8 +332,6 @@ pub enum InternKind { /// /// This *cannot raise an interpreter error*. Doing so is left to validation, which /// tracks where in the value we are and thus can show much better error messages. -/// Any errors here would anyway be turned into `const_err` lints, whereas validation failures -/// are hard errors. #[instrument(level = "debug", skip(ecx))] pub fn intern_const_alloc_recursive< 'mir, diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index 9148c42195fbe..070cccd141b56 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -522,6 +522,11 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) { "now allowed, see issue #59159 \ for more information", ); + store.register_removed( + "const_err", + "converted into hard error, see issue #71800 \ + for more information", + ); } fn register_internals(store: &mut LintStore) { diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index e5dfda24dc701..4e30aa5eaba8a 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -263,37 +263,6 @@ declare_lint! { "operation will cause a panic at runtime" } -declare_lint! { - /// The `const_err` lint detects an erroneous expression while doing - /// constant evaluation. - /// - /// ### Example - /// - /// ```rust,compile_fail - /// #![allow(unconditional_panic)] - /// const C: i32 = 1/0; - /// ``` - /// - /// {{produces}} - /// - /// ### Explanation - /// - /// This lint detects constants that fail to evaluate. Allowing the lint will accept the - /// constant declaration, but any use of this constant will still lead to a hard error. This is - /// a future incompatibility lint; the plan is to eventually entirely forbid even declaring - /// constants that cannot be evaluated. See [issue #71800] for more details. - /// - /// [issue #71800]: https://github.com/rust-lang/rust/issues/71800 - pub CONST_ERR, - Deny, - "constant evaluation encountered erroneous expression", - @future_incompatible = FutureIncompatibleInfo { - reference: "issue #71800 ", - reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow, - }; - report_in_external_macro -} - declare_lint! { /// The `unused_imports` lint detects imports that are never used. /// @@ -3295,7 +3264,6 @@ declare_lint_pass! { EXPORTED_PRIVATE_DEPENDENCIES, PUB_USE_OF_PRIVATE_EXTERN_CRATE, INVALID_TYPE_PARAM_DEFAULT, - CONST_ERR, RENAMED_AND_REMOVED_LINTS, UNALIGNED_REFERENCES, CONST_ITEM_MUTATION, diff --git a/compiler/rustc_middle/src/mir/interpret/error.rs b/compiler/rustc_middle/src/mir/interpret/error.rs index e4039cc7c685a..b5a50cc1527a7 100644 --- a/compiler/rustc_middle/src/mir/interpret/error.rs +++ b/compiler/rustc_middle/src/mir/interpret/error.rs @@ -479,12 +479,7 @@ impl AsAny for T { } /// A trait for machine-specific errors (or other "machine stop" conditions). -pub trait MachineStopType: AsAny + fmt::Display + Send { - /// If `true`, emit a hard error instead of going through the `CONST_ERR` lint - fn is_hard_err(&self) -> bool { - false - } -} +pub trait MachineStopType: AsAny + fmt::Display + Send {} impl dyn MachineStopType { #[inline(always)] @@ -543,16 +538,4 @@ impl InterpError<'_> { | InterpError::UndefinedBehavior(UndefinedBehaviorInfo::Ub(_)) ) } - - /// Should this error be reported as a hard error, preventing compilation, or a soft error, - /// causing a deny-by-default lint? - pub fn is_hard_err(&self) -> bool { - use InterpError::*; - match *self { - MachineStop(ref err) => err.is_hard_err(), - UndefinedBehavior(_) => true, - ResourceExhaustion(ResourceExhaustionInfo::MemoryExhausted) => true, - _ => false, - } - } } diff --git a/compiler/rustc_mir_transform/src/const_prop_lint.rs b/compiler/rustc_mir_transform/src/const_prop_lint.rs index cda3702c83d1c..6bddbdb8e6aa5 100644 --- a/compiler/rustc_mir_transform/src/const_prop_lint.rs +++ b/compiler/rustc_mir_transform/src/const_prop_lint.rs @@ -16,9 +16,9 @@ use rustc_index::bit_set::BitSet; use rustc_index::vec::IndexVec; use rustc_middle::mir::visit::Visitor; use rustc_middle::mir::{ - self, AssertKind, BinOp, Body, Constant, ConstantKind, Local, LocalDecl, Location, Operand, - Place, Rvalue, SourceInfo, SourceScope, SourceScopeData, Statement, StatementKind, Terminator, - TerminatorKind, UnOp, RETURN_PLACE, + AssertKind, BinOp, Body, Constant, Local, LocalDecl, Location, Operand, Place, Rvalue, + SourceInfo, SourceScope, SourceScopeData, Statement, StatementKind, Terminator, TerminatorKind, + UnOp, RETURN_PLACE, }; use rustc_middle::ty::layout::{LayoutError, LayoutOf, LayoutOfHelpers, TyAndLayout}; use rustc_middle::ty::InternalSubsts; @@ -286,7 +286,11 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { } /// Returns the value, if any, of evaluating `c`. - fn eval_constant(&mut self, c: &Constant<'tcx>, source_info: SourceInfo) -> Option> { + fn eval_constant( + &mut self, + c: &Constant<'tcx>, + _source_info: SourceInfo, + ) -> Option> { // FIXME we need to revisit this for #67176 if c.needs_subst() { return None; @@ -297,28 +301,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { Err(error) => { let tcx = self.ecx.tcx.at(c.span); let err = ConstEvalErr::new(&self.ecx, error, Some(c.span)); - if let Some(lint_root) = self.lint_root(source_info) { - let lint_only = match c.literal { - ConstantKind::Ty(ct) => ct.needs_subst(), - ConstantKind::Unevaluated( - mir::UnevaluatedConst { def: _, substs: _, promoted: Some(_) }, - _, - ) => { - // Promoteds must lint and not error as the user didn't ask for them - true - } - ConstantKind::Unevaluated(..) | ConstantKind::Val(..) => c.needs_subst(), - }; - if lint_only { - // Out of backwards compatibility we cannot report hard errors in unused - // generic functions using associated constants of the generic parameters. - err.report_as_lint(tcx, "erroneous constant used", lint_root, Some(c.span)); - } else { - err.report_as_error(tcx, "erroneous constant used"); - } - } else { - err.report_as_error(tcx, "erroneous constant used"); - } + err.report_as_error(tcx, "erroneous constant used"); None } } diff --git a/library/core/tests/num/wrapping.rs b/library/core/tests/num/wrapping.rs index 8ded139a1809f..c5a7198839517 100644 --- a/library/core/tests/num/wrapping.rs +++ b/library/core/tests/num/wrapping.rs @@ -75,8 +75,6 @@ wrapping_test!(test_wrapping_u64, u64, u64::MIN, u64::MAX); wrapping_test!(test_wrapping_u128, u128, u128::MIN, u128::MAX); wrapping_test!(test_wrapping_usize, usize, usize::MIN, usize::MAX); -// Don't warn about overflowing ops on 32-bit platforms -#[cfg_attr(target_pointer_width = "32", allow(const_err))] #[test] fn wrapping_int_api() { assert_eq!(i8::MAX.wrapping_add(1), i8::MIN); diff --git a/library/core/tests/slice.rs b/library/core/tests/slice.rs index b8f6fe6961a8e..9e1fbea79148c 100644 --- a/library/core/tests/slice.rs +++ b/library/core/tests/slice.rs @@ -1284,7 +1284,6 @@ fn test_windows_zip() { } #[test] -#[allow(const_err)] fn test_iter_ref_consistency() { use std::fmt::Debug; diff --git a/src/test/mir-opt/remove-never-const.rs b/src/test/mir-opt/remove-never-const.rs index 017746647ab0d..16095cfdd7dc0 100644 --- a/src/test/mir-opt/remove-never-const.rs +++ b/src/test/mir-opt/remove-never-const.rs @@ -6,7 +6,6 @@ // compile-flags: --emit mir,link #![feature(never_type)] -#![warn(const_err)] struct PrintName(T); diff --git a/src/test/ui/array-slice-vec/array_const_index-0.rs b/src/test/ui/array-slice-vec/array_const_index-0.rs index 9ff7e2c569ab9..96755802ec7f1 100644 --- a/src/test/ui/array-slice-vec/array_const_index-0.rs +++ b/src/test/ui/array-slice-vec/array_const_index-0.rs @@ -1,8 +1,7 @@ const A: &'static [i32] = &[]; const B: i32 = (&A)[1]; //~^ index out of bounds: the length is 0 but the index is 1 -//~| ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~| ERROR evaluation of constant value failed fn main() { let _ = B; diff --git a/src/test/ui/array-slice-vec/array_const_index-0.stderr b/src/test/ui/array-slice-vec/array_const_index-0.stderr index 154872915d6bd..3b92cc76687b4 100644 --- a/src/test/ui/array-slice-vec/array_const_index-0.stderr +++ b/src/test/ui/array-slice-vec/array_const_index-0.stderr @@ -1,23 +1,9 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/array_const_index-0.rs:2:16 | LL | const B: i32 = (&A)[1]; - | ------------ ^^^^^^^ index out of bounds: the length is 0 but the index is 1 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default + | ^^^^^^^ index out of bounds: the length is 0 but the index is 1 error: aborting due to previous error -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/array_const_index-0.rs:2:16 - | -LL | const B: i32 = (&A)[1]; - | ------------ ^^^^^^^ index out of bounds: the length is 0 but the index is 1 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/array-slice-vec/array_const_index-1.rs b/src/test/ui/array-slice-vec/array_const_index-1.rs index f4326189c1917..625bf06a745e9 100644 --- a/src/test/ui/array-slice-vec/array_const_index-1.rs +++ b/src/test/ui/array-slice-vec/array_const_index-1.rs @@ -1,8 +1,7 @@ const A: [i32; 0] = []; const B: i32 = A[1]; //~^ index out of bounds: the length is 0 but the index is 1 -//~| ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~| ERROR evaluation of constant value failed fn main() { let _ = B; diff --git a/src/test/ui/array-slice-vec/array_const_index-1.stderr b/src/test/ui/array-slice-vec/array_const_index-1.stderr index a13b5b4ccc189..591db268a9943 100644 --- a/src/test/ui/array-slice-vec/array_const_index-1.stderr +++ b/src/test/ui/array-slice-vec/array_const_index-1.stderr @@ -1,23 +1,9 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/array_const_index-1.rs:2:16 | LL | const B: i32 = A[1]; - | ------------ ^^^^ index out of bounds: the length is 0 but the index is 1 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default + | ^^^^ index out of bounds: the length is 0 but the index is 1 error: aborting due to previous error -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/array_const_index-1.rs:2:16 - | -LL | const B: i32 = A[1]; - | ------------ ^^^^ index out of bounds: the length is 0 but the index is 1 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/associated-consts/defaults-not-assumed-fail.rs b/src/test/ui/associated-consts/defaults-not-assumed-fail.rs index 3936e6a3bc722..6762d7583fb2d 100644 --- a/src/test/ui/associated-consts/defaults-not-assumed-fail.rs +++ b/src/test/ui/associated-consts/defaults-not-assumed-fail.rs @@ -6,8 +6,7 @@ trait Tr { // This should not be a constant evaluation error (overflow). The value of // `Self::A` must not be assumed to hold inside the trait. const B: u8 = Self::A + 1; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of `<() as Tr>::B` failed } // An impl that doesn't override any constant will NOT cause a const eval error @@ -34,7 +33,6 @@ fn main() { assert_eq!(<() as Tr>::B, 0); // causes the error above //~^ ERROR evaluation of constant value failed //~| ERROR erroneous constant used - //~| WARN this was previously accepted by the compiler but is being phased out assert_eq!(::A, 254); assert_eq!(::B, 255); diff --git a/src/test/ui/associated-consts/defaults-not-assumed-fail.stderr b/src/test/ui/associated-consts/defaults-not-assumed-fail.stderr index 8a7c16e611752..aa130f438a877 100644 --- a/src/test/ui/associated-consts/defaults-not-assumed-fail.stderr +++ b/src/test/ui/associated-consts/defaults-not-assumed-fail.stderr @@ -1,52 +1,23 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of `<() as Tr>::B` failed --> $DIR/defaults-not-assumed-fail.rs:8:19 | LL | const B: u8 = Self::A + 1; - | ----------- ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default + | ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow error[E0080]: evaluation of constant value failed - --> $DIR/defaults-not-assumed-fail.rs:34:16 + --> $DIR/defaults-not-assumed-fail.rs:33:16 | LL | assert_eq!(<() as Tr>::B, 0); // causes the error above | ^^^^^^^^^^^^^ referenced constant has errors -error: erroneous constant used - --> $DIR/defaults-not-assumed-fail.rs:34:5 +error[E0080]: erroneous constant used + --> $DIR/defaults-not-assumed-fail.rs:33:5 | LL | assert_eq!(<() as Tr>::B, 0); // causes the error above | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/defaults-not-assumed-fail.rs:8:19 - | -LL | const B: u8 = Self::A + 1; - | ----------- ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: erroneous constant used - --> $DIR/defaults-not-assumed-fail.rs:34:5 - | -LL | assert_eq!(<() as Tr>::B, 0); // causes the error above - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) - diff --git a/src/test/ui/borrowck/issue-81899.rs b/src/test/ui/borrowck/issue-81899.rs index 9b60612037dd6..24b20b6507b11 100644 --- a/src/test/ui/borrowck/issue-81899.rs +++ b/src/test/ui/borrowck/issue-81899.rs @@ -2,8 +2,7 @@ // The `panic!()` below is important to trigger the fixed ICE. const _CONST: &[u8] = &f(&[], |_| {}); -//~^ ERROR any use of this value -//~| WARNING this was previously +//~^ ERROR constant const fn f(_: &[u8], _: F) -> &[u8] where diff --git a/src/test/ui/borrowck/issue-81899.stderr b/src/test/ui/borrowck/issue-81899.stderr index 19cd323ce5748..12e80b9df8289 100644 --- a/src/test/ui/borrowck/issue-81899.stderr +++ b/src/test/ui/borrowck/issue-81899.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant value failed - --> $DIR/issue-81899.rs:12:5 + --> $DIR/issue-81899.rs:11:5 | LL | const _CONST: &[u8] = &f(&[], |_| {}); | -------------- inside `_CONST` at $DIR/issue-81899.rs:4:24 @@ -7,32 +7,17 @@ LL | const _CONST: &[u8] = &f(&[], |_| {}); LL | panic!() | ^^^^^^^^ | | - | the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:12:5 + | the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:11:5 | inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/issue-81899.rs:4:23 | LL | const _CONST: &[u8] = &f(&[], |_| {}); - | ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default + | ^^^^^^^^^^^^^^^ referenced constant has errors error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/issue-81899.rs:4:23 - | -LL | const _CONST: &[u8] = &f(&[], |_| {}); - | ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/borrowck/issue-88434-minimal-example.rs b/src/test/ui/borrowck/issue-88434-minimal-example.rs index 7618d001e86ee..983a023105229 100644 --- a/src/test/ui/borrowck/issue-88434-minimal-example.rs +++ b/src/test/ui/borrowck/issue-88434-minimal-example.rs @@ -1,8 +1,7 @@ // Regression test related to issue 88434 const _CONST: &() = &f(&|_| {}); -//~^ ERROR any use of this value -//~| WARNING this was previously +//~^ ERROR constant const fn f(_: &F) where diff --git a/src/test/ui/borrowck/issue-88434-minimal-example.stderr b/src/test/ui/borrowck/issue-88434-minimal-example.stderr index 4492af7ec6bfb..dc87c4c2b077b 100644 --- a/src/test/ui/borrowck/issue-88434-minimal-example.stderr +++ b/src/test/ui/borrowck/issue-88434-minimal-example.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant value failed - --> $DIR/issue-88434-minimal-example.rs:11:5 + --> $DIR/issue-88434-minimal-example.rs:10:5 | LL | const _CONST: &() = &f(&|_| {}); | ---------- inside `_CONST` at $DIR/issue-88434-minimal-example.rs:3:22 @@ -7,32 +7,17 @@ LL | const _CONST: &() = &f(&|_| {}); LL | panic!() | ^^^^^^^^ | | - | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:11:5 + | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:10:5 | inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28]>` at $SRC_DIR/std/src/panic.rs:LL:COL | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/issue-88434-minimal-example.rs:3:21 | LL | const _CONST: &() = &f(&|_| {}); - | ----------------- ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default + | ^^^^^^^^^^^ referenced constant has errors error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/issue-88434-minimal-example.rs:3:21 - | -LL | const _CONST: &() = &f(&|_| {}); - | ----------------- ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs b/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs index b1fc1615ece77..a99c5b76a4e47 100644 --- a/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs +++ b/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs @@ -1,8 +1,7 @@ // Regression test for issue 88434 const _CONST: &[u8] = &f(&[], |_| {}); -//~^ ERROR any use of this value will cause an error -//~| WARNING this was previously +//~^ ERROR constant const fn f(_: &[u8], _: F) -> &[u8] where diff --git a/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr b/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr index a889e67f4ea00..4b4a25d7be121 100644 --- a/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr +++ b/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant value failed - --> $DIR/issue-88434-removal-index-should-be-less.rs:11:5 + --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | const _CONST: &[u8] = &f(&[], |_| {}); | -------------- inside `_CONST` at $DIR/issue-88434-removal-index-should-be-less.rs:3:24 @@ -7,32 +7,17 @@ LL | const _CONST: &[u8] = &f(&[], |_| {}); LL | panic!() | ^^^^^^^^ | | - | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:11:5 + | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/issue-88434-removal-index-should-be-less.rs:3:23 | LL | const _CONST: &[u8] = &f(&[], |_| {}); - | ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default + | ^^^^^^^^^^^^^^^ referenced constant has errors error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/issue-88434-removal-index-should-be-less.rs:3:23 - | -LL | const _CONST: &[u8] = &f(&[], |_| {}); - | ------------------- ^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/cast/cast-rfc0401.rs b/src/test/ui/cast/cast-rfc0401.rs index 996fa013feddc..9a98754161544 100644 --- a/src/test/ui/cast/cast-rfc0401.rs +++ b/src/test/ui/cast/cast-rfc0401.rs @@ -159,11 +159,7 @@ fn main() assert!(foo as usize != bar as usize); // Taking a few bits of a function's address is totally pointless and we detect that - // Disabling the lint to ensure that the assertion can still be run - #[allow(const_err)] - { - assert_eq!(foo as i16, foo as usize as i16); - } + assert_eq!(foo as i16, foo as usize as i16); // fptr-ptr-cast diff --git a/src/test/ui/closures/closure_promotion.rs b/src/test/ui/closures/closure_promotion.rs index db36985afe7a8..47a8fc0902d3e 100644 --- a/src/test/ui/closures/closure_promotion.rs +++ b/src/test/ui/closures/closure_promotion.rs @@ -1,7 +1,5 @@ // build-pass (FIXME(62277): could be check-pass?) -#![allow(const_err)] - fn main() { let x: &'static _ = &|| { let z = 3; z }; } diff --git a/src/test/ui/consts/array-literal-index-oob.rs b/src/test/ui/consts/array-literal-index-oob.rs index 9b3f735b1f849..67b49b1ba2be2 100644 --- a/src/test/ui/consts/array-literal-index-oob.rs +++ b/src/test/ui/consts/array-literal-index-oob.rs @@ -1,7 +1,7 @@ // build-pass // ignore-pass (test emits codegen-time warnings and verifies that they are not errors) -#![warn(const_err, unconditional_panic)] +#![warn(unconditional_panic)] fn main() { &{ [1, 2, 3][4] }; diff --git a/src/test/ui/consts/array-literal-index-oob.stderr b/src/test/ui/consts/array-literal-index-oob.stderr index f96b8d48b3e7c..54bf3af81e8ff 100644 --- a/src/test/ui/consts/array-literal-index-oob.stderr +++ b/src/test/ui/consts/array-literal-index-oob.stderr @@ -5,10 +5,10 @@ LL | &{ [1, 2, 3][4] }; | ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 | note: the lint level is defined here - --> $DIR/array-literal-index-oob.rs:4:20 + --> $DIR/array-literal-index-oob.rs:4:9 | -LL | #![warn(const_err, unconditional_panic)] - | ^^^^^^^^^^^^^^^^^^^ +LL | #![warn(unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: 1 warning emitted diff --git a/src/test/ui/consts/assert-type-intrinsics.rs b/src/test/ui/consts/assert-type-intrinsics.rs index 6b5612dda90a7..263d1ae6a3ec7 100644 --- a/src/test/ui/consts/assert-type-intrinsics.rs +++ b/src/test/ui/consts/assert-type-intrinsics.rs @@ -1,5 +1,3 @@ -// error-pattern: any use of this value will cause an error - #![feature(never_type)] #![feature(const_assert_type2)] #![feature(core_intrinsics)] @@ -11,15 +9,15 @@ fn main() { use std::mem::MaybeUninit; const _BAD1: () = unsafe { - intrinsics::assert_inhabited::(); //~ERROR: any use of this value will cause an error - //~^WARN: previously accepted + MaybeUninit::::uninit().assume_init(); + //~^ERROR: evaluation of constant value failed }; const _BAD2: () = { - intrinsics::assert_uninit_valid::(); //~ERROR: any use of this value will cause an error - //~^WARN: previously accepted + intrinsics::assert_uninit_valid::<&'static i32>(); + //~^ERROR: evaluation of constant value failed }; const _BAD3: () = { - intrinsics::assert_zero_valid::<&'static i32>(); //~ERROR: any use of this value will cause an error - //~^WARN: previously accepted + intrinsics::assert_zero_valid::<&'static i32>(); + //~^ERROR: evaluation of constant value failed }; } diff --git a/src/test/ui/consts/assert-type-intrinsics.stderr b/src/test/ui/consts/assert-type-intrinsics.stderr index 9f97d8367056f..f92f9fda069ad 100644 --- a/src/test/ui/consts/assert-type-intrinsics.stderr +++ b/src/test/ui/consts/assert-type-intrinsics.stderr @@ -1,75 +1,21 @@ -error: any use of this value will cause an error - --> $DIR/assert-type-intrinsics.rs:14:9 +error[E0080]: evaluation of constant value failed + --> $DIR/assert-type-intrinsics.rs:12:9 | -LL | const _BAD1: () = unsafe { - | --------------- -LL | intrinsics::assert_inhabited::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!` - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default +LL | MaybeUninit::::uninit().assume_init(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!` -error: any use of this value will cause an error - --> $DIR/assert-type-intrinsics.rs:18:9 - | -LL | const _BAD2: () = { - | --------------- -LL | intrinsics::assert_uninit_valid::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!` +error[E0080]: evaluation of constant value failed + --> $DIR/assert-type-intrinsics.rs:16:9 | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 +LL | intrinsics::assert_uninit_valid::<&'static i32>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to leave type `&i32` uninitialized, which is invalid -error: any use of this value will cause an error - --> $DIR/assert-type-intrinsics.rs:22:9 +error[E0080]: evaluation of constant value failed + --> $DIR/assert-type-intrinsics.rs:20:9 | -LL | const _BAD3: () = { - | --------------- LL | intrinsics::assert_zero_valid::<&'static i32>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to zero-initialize type `&i32`, which is invalid - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 error: aborting due to 3 previous errors -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/assert-type-intrinsics.rs:14:9 - | -LL | const _BAD1: () = unsafe { - | --------------- -LL | intrinsics::assert_inhabited::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!` - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/assert-type-intrinsics.rs:18:9 - | -LL | const _BAD2: () = { - | --------------- -LL | intrinsics::assert_uninit_valid::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!` - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/assert-type-intrinsics.rs:22:9 - | -LL | const _BAD3: () = { - | --------------- -LL | intrinsics::assert_zero_valid::<&'static i32>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to zero-initialize type `&i32`, which is invalid - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/assoc_const_generic_impl.rs b/src/test/ui/consts/assoc_const_generic_impl.rs index 71d947b0c2c70..3475c862bfc2d 100644 --- a/src/test/ui/consts/assoc_const_generic_impl.rs +++ b/src/test/ui/consts/assoc_const_generic_impl.rs @@ -1,17 +1,14 @@ // build-fail -#![warn(const_err)] - trait ZeroSized: Sized { const I_AM_ZERO_SIZED: (); fn requires_zero_size(self); } impl ZeroSized for T { - const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::()]; //~ WARN any use of this value - //~| WARN this was previously accepted by the compiler but is being phased out + const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::()]; //~ ERROR evaluation of `::I_AM_ZERO_SIZED` failed fn requires_zero_size(self) { - let () = Self::I_AM_ZERO_SIZED; //~ ERROR erroneous constant encountered + let () = Self::I_AM_ZERO_SIZED; println!("requires_zero_size called"); } } diff --git a/src/test/ui/consts/assoc_const_generic_impl.stderr b/src/test/ui/consts/assoc_const_generic_impl.stderr index ca6db350c75f4..854b9ce5b223b 100644 --- a/src/test/ui/consts/assoc_const_generic_impl.stderr +++ b/src/test/ui/consts/assoc_const_generic_impl.stderr @@ -1,37 +1,15 @@ -warning: any use of this value will cause an error - --> $DIR/assoc_const_generic_impl.rs:11:34 +error[E0080]: evaluation of `::I_AM_ZERO_SIZED` failed + --> $DIR/assoc_const_generic_impl.rs:9:34 | LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::()]; - | ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/assoc_const_generic_impl.rs:3:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4 -error: erroneous constant encountered - --> $DIR/assoc_const_generic_impl.rs:14:18 +note: the above error was encountered while instantiating `fn ::requires_zero_size` + --> $DIR/assoc_const_generic_impl.rs:18:5 | -LL | let () = Self::I_AM_ZERO_SIZED; - | ^^^^^^^^^^^^^^^^^^^^^ +LL | 42_u32.requires_zero_size(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error; 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/assoc_const_generic_impl.rs:11:34 - | -LL | const I_AM_ZERO_SIZED: () = [()][std::mem::size_of::()]; - | ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/assoc_const_generic_impl.rs:3:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ +error: aborting due to previous error +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-err-early.rs b/src/test/ui/consts/const-err-early.rs index d8f7635fe9bbe..a3105b4fc4a37 100644 --- a/src/test/ui/consts/const-err-early.rs +++ b/src/test/ui/consts/const-err-early.rs @@ -1,15 +1,8 @@ -#![deny(const_err)] - -pub const A: i8 = -i8::MIN; //~ ERROR const_err -//~| WARN this was previously accepted by the compiler but is being phased out -pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err -//~| WARN this was previously accepted by the compiler but is being phased out -pub const C: u8 = 200u8 * 4; //~ ERROR const_err -//~| WARN this was previously accepted by the compiler but is being phased out -pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err -//~| WARN this was previously accepted by the compiler but is being phased out -pub const E: u8 = [5u8][1]; //~ ERROR const_err -//~| WARN this was previously accepted by the compiler but is being phased out +pub const A: i8 = -i8::MIN; //~ ERROR constant +pub const B: u8 = 200u8 + 200u8; //~ ERROR constant +pub const C: u8 = 200u8 * 4; //~ ERROR constant +pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR constant +pub const E: u8 = [5u8][1]; //~ ERROR constant fn main() { let _a = A; diff --git a/src/test/ui/consts/const-err-early.stderr b/src/test/ui/consts/const-err-early.stderr index fce8f05106146..59bf637b7adbd 100644 --- a/src/test/ui/consts/const-err-early.stderr +++ b/src/test/ui/consts/const-err-early.stderr @@ -1,127 +1,33 @@ -error: any use of this value will cause an error - --> $DIR/const-err-early.rs:3:19 +error[E0080]: evaluation of constant value failed + --> $DIR/const-err-early.rs:1:19 | LL | pub const A: i8 = -i8::MIN; - | --------------- ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-err-early.rs:1:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ + | ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow -error: any use of this value will cause an error - --> $DIR/const-err-early.rs:5:19 +error[E0080]: evaluation of constant value failed + --> $DIR/const-err-early.rs:2:19 | LL | pub const B: u8 = 200u8 + 200u8; - | --------------- ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow -error: any use of this value will cause an error - --> $DIR/const-err-early.rs:7:19 +error[E0080]: evaluation of constant value failed + --> $DIR/const-err-early.rs:3:19 | LL | pub const C: u8 = 200u8 * 4; - | --------------- ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow -error: any use of this value will cause an error - --> $DIR/const-err-early.rs:9:19 +error[E0080]: evaluation of constant value failed + --> $DIR/const-err-early.rs:4:19 | LL | pub const D: u8 = 42u8 - (42u8 + 1); - | --------------- ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow -error: any use of this value will cause an error - --> $DIR/const-err-early.rs:11:19 +error[E0080]: evaluation of constant value failed + --> $DIR/const-err-early.rs:5:19 | LL | pub const E: u8 = [5u8][1]; - | --------------- ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 error: aborting due to 5 previous errors -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-err-early.rs:3:19 - | -LL | pub const A: i8 = -i8::MIN; - | --------------- ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-err-early.rs:1:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-err-early.rs:5:19 - | -LL | pub const B: u8 = 200u8 + 200u8; - | --------------- ^^^^^^^^^^^^^ attempt to compute `200_u8 + 200_u8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-err-early.rs:1:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-err-early.rs:7:19 - | -LL | pub const C: u8 = 200u8 * 4; - | --------------- ^^^^^^^^^ attempt to compute `200_u8 * 4_u8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-err-early.rs:1:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-err-early.rs:9:19 - | -LL | pub const D: u8 = 42u8 - (42u8 + 1); - | --------------- ^^^^^^^^^^^^^^^^^ attempt to compute `42_u8 - 43_u8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-err-early.rs:1:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-err-early.rs:11:19 - | -LL | pub const E: u8 = [5u8][1]; - | --------------- ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-err-early.rs:1:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-err-late.rs b/src/test/ui/consts/const-err-late.rs new file mode 100644 index 0000000000000..a20ae702586c4 --- /dev/null +++ b/src/test/ui/consts/const-err-late.rs @@ -0,0 +1,22 @@ +// build-fail +// compile-flags: -C overflow-checks=on + +#![allow(arithmetic_overflow, unconditional_panic)] + +fn black_box(_: T) { + unimplemented!() +} + +struct S(T); + +impl S { + const FOO: u8 = [5u8][1]; + //~^ ERROR evaluation of `S::::FOO` failed + //~| ERROR evaluation of `S::::FOO` failed +} + +fn main() { + black_box((S::::FOO, S::::FOO)); + //~^ ERROR erroneous constant + //~| ERROR erroneous constant +} diff --git a/src/test/ui/consts/const-err-late.stderr b/src/test/ui/consts/const-err-late.stderr new file mode 100644 index 0000000000000..3a8b103175b6b --- /dev/null +++ b/src/test/ui/consts/const-err-late.stderr @@ -0,0 +1,27 @@ +error[E0080]: evaluation of `S::::FOO` failed + --> $DIR/const-err-late.rs:13:21 + | +LL | const FOO: u8 = [5u8][1]; + | ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 + +error[E0080]: erroneous constant used + --> $DIR/const-err-late.rs:19:16 + | +LL | black_box((S::::FOO, S::::FOO)); + | ^^^^^^^^^^^^^ referenced constant has errors + +error[E0080]: evaluation of `S::::FOO` failed + --> $DIR/const-err-late.rs:13:21 + | +LL | const FOO: u8 = [5u8][1]; + | ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 + +error[E0080]: erroneous constant used + --> $DIR/const-err-late.rs:19:31 + | +LL | black_box((S::::FOO, S::::FOO)); + | ^^^^^^^^^^^^^ referenced constant has errors + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-err-multi.rs b/src/test/ui/consts/const-err-multi.rs index 62552e1476ce2..fb26e8aac10ff 100644 --- a/src/test/ui/consts/const-err-multi.rs +++ b/src/test/ui/consts/const-err-multi.rs @@ -1,17 +1,11 @@ -#![deny(const_err)] - pub const A: i8 = -i8::MIN; -//~^ ERROR const_err -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR constant pub const B: i8 = A; -//~^ ERROR const_err -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR constant pub const C: u8 = A as u8; -//~^ ERROR const_err -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR constant pub const D: i8 = 50 - A; -//~^ ERROR const_err -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR constant fn main() { let _ = (A, B, C, D); diff --git a/src/test/ui/consts/const-err-multi.stderr b/src/test/ui/consts/const-err-multi.stderr index 16b912695a64c..fca9e227068ff 100644 --- a/src/test/ui/consts/const-err-multi.stderr +++ b/src/test/ui/consts/const-err-multi.stderr @@ -1,103 +1,27 @@ -error: any use of this value will cause an error - --> $DIR/const-err-multi.rs:3:19 +error[E0080]: evaluation of constant value failed + --> $DIR/const-err-multi.rs:1:19 | LL | pub const A: i8 = -i8::MIN; - | --------------- ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-err-multi.rs:1:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ + | ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow -error: any use of this value will cause an error - --> $DIR/const-err-multi.rs:6:19 +error[E0080]: evaluation of constant value failed + --> $DIR/const-err-multi.rs:3:19 | LL | pub const B: i8 = A; - | --------------- ^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^ referenced constant has errors -error: any use of this value will cause an error - --> $DIR/const-err-multi.rs:9:19 +error[E0080]: evaluation of constant value failed + --> $DIR/const-err-multi.rs:5:19 | LL | pub const C: u8 = A as u8; - | --------------- ^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^ referenced constant has errors -error: any use of this value will cause an error - --> $DIR/const-err-multi.rs:12:24 +error[E0080]: evaluation of constant value failed + --> $DIR/const-err-multi.rs:7:24 | LL | pub const D: i8 = 50 - A; - | --------------- ^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^ referenced constant has errors error: aborting due to 4 previous errors -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-err-multi.rs:3:19 - | -LL | pub const A: i8 = -i8::MIN; - | --------------- ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-err-multi.rs:1:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-err-multi.rs:6:19 - | -LL | pub const B: i8 = A; - | --------------- ^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-err-multi.rs:1:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-err-multi.rs:9:19 - | -LL | pub const C: u8 = A as u8; - | --------------- ^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-err-multi.rs:1:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-err-multi.rs:12:24 - | -LL | pub const D: i8 = 50 - A; - | --------------- ^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-err-multi.rs:1:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-err-rpass.rs b/src/test/ui/consts/const-err-rpass.rs index 9851f1c58be30..e7fa10a2a11a3 100644 --- a/src/test/ui/consts/const-err-rpass.rs +++ b/src/test/ui/consts/const-err-rpass.rs @@ -2,8 +2,6 @@ #![allow(dead_code)] // check for const_err regressions -#![deny(const_err)] - const X: *const u8 = b"" as _; const Y: bool = 'A' == 'B'; const Z: char = 'A'; diff --git a/src/test/ui/consts/const-err.rs b/src/test/ui/consts/const-err.rs deleted file mode 100644 index a8633fd87b5e2..0000000000000 --- a/src/test/ui/consts/const-err.rs +++ /dev/null @@ -1,19 +0,0 @@ -// build-fail -// compile-flags: -C overflow-checks=on - -#![allow(arithmetic_overflow)] -#![warn(const_err)] - -fn black_box(_: T) { - unimplemented!() -} - -const FOO: u8 = [5u8][1]; -//~^ WARN any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out - -fn main() { - black_box((FOO, FOO)); - //~^ ERROR erroneous constant used - //~| ERROR erroneous constant -} diff --git a/src/test/ui/consts/const-err.stderr b/src/test/ui/consts/const-err.stderr deleted file mode 100644 index f83a2cbb1908a..0000000000000 --- a/src/test/ui/consts/const-err.stderr +++ /dev/null @@ -1,44 +0,0 @@ -warning: any use of this value will cause an error - --> $DIR/const-err.rs:11:17 - | -LL | const FOO: u8 = [5u8][1]; - | ------------- ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-err.rs:5:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ - -error[E0080]: erroneous constant used - --> $DIR/const-err.rs:16:16 - | -LL | black_box((FOO, FOO)); - | ^^^ referenced constant has errors - -error[E0080]: erroneous constant used - --> $DIR/const-err.rs:16:21 - | -LL | black_box((FOO, FOO)); - | ^^^ referenced constant has errors - -error: aborting due to 2 previous errors; 1 warning emitted - -For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/const-err.rs:11:17 - | -LL | const FOO: u8 = [5u8][1]; - | ------------- ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-err.rs:5:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ - diff --git a/src/test/ui/consts/const-eval/conditional_array_execution.rs b/src/test/ui/consts/const-eval/conditional_array_execution.rs index bd517e568eae9..27d5383d6d47f 100644 --- a/src/test/ui/consts/const-eval/conditional_array_execution.rs +++ b/src/test/ui/consts/const-eval/conditional_array_execution.rs @@ -1,16 +1,8 @@ -// build-fail - -#![warn(const_err)] - const X: u32 = 5; const Y: u32 = 6; const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; -//~^ WARN any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR constant fn main() { println!("{}", FOO); - //~^ ERROR evaluation of constant value failed - //~| WARN erroneous constant used [const_err] - //~| WARN this was previously accepted by the compiler but is being phased out } diff --git a/src/test/ui/consts/const-eval/conditional_array_execution.stderr b/src/test/ui/consts/const-eval/conditional_array_execution.stderr index 84061e52d318a..c3401fbaefeee 100644 --- a/src/test/ui/consts/const-eval/conditional_array_execution.stderr +++ b/src/test/ui/consts/const-eval/conditional_array_execution.stderr @@ -1,64 +1,9 @@ -warning: any use of this value will cause an error - --> $DIR/conditional_array_execution.rs:7:19 - | -LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; - | -------------- ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/conditional_array_execution.rs:3:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ - error[E0080]: evaluation of constant value failed - --> $DIR/conditional_array_execution.rs:12:20 - | -LL | println!("{}", FOO); - | ^^^ referenced constant has errors - -warning: erroneous constant used - --> $DIR/conditional_array_execution.rs:12:20 - | -LL | println!("{}", FOO); - | ^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to previous error; 2 warnings emitted - -For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/conditional_array_execution.rs:7:19 + --> $DIR/conditional_array_execution.rs:3:19 | LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; - | -------------- ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/conditional_array_execution.rs:3:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ + | ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow -Future breakage diagnostic: -warning: erroneous constant used - --> $DIR/conditional_array_execution.rs:12:20 - | -LL | println!("{}", FOO); - | ^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/conditional_array_execution.rs:3:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ - = note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) +error: aborting due to previous error +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-2.rs b/src/test/ui/consts/const-eval/const-eval-overflow-2.rs index 9300d9576de1d..535d91359163f 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-2.rs +++ b/src/test/ui/consts/const-eval/const-eval-overflow-2.rs @@ -1,14 +1,14 @@ // Evaluation of constants in refutable patterns goes through // different compiler control-flow paths. -#![allow(unused_imports, warnings, const_err)] +#![allow(unused_imports, warnings)] use std::fmt; use std::{i8, i16, i32, i64, isize}; use std::{u8, u16, u32, u64, usize}; const NEG_128: i8 = -128; -const NEG_NEG_128: i8 = -NEG_128; +const NEG_NEG_128: i8 = -NEG_128; //~ ERROR constant fn main() { match -128i8 { diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-2.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-2.stderr index b6d0898bb9229..7b1fe49d4346e 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-2.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow-2.stderr @@ -1,3 +1,9 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow-2.rs:11:25 + | +LL | const NEG_NEG_128: i8 = -NEG_128; + | ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow + error: could not evaluate constant pattern --> $DIR/const-eval-overflow-2.rs:15:9 | @@ -10,20 +16,6 @@ error: could not evaluate constant pattern LL | NEG_NEG_128 => println!("A"), | ^^^^^^^^^^^ -error: aborting due to 2 previous errors - -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/const-eval-overflow-2.rs:11:25 - | -LL | const NEG_NEG_128: i8 = -NEG_128; - | --------------------- ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow-2.rs:4:36 - | -LL | #![allow(unused_imports, warnings, const_err)] - | ^^^^^^^^^ +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/const-eval-overflow2.rs b/src/test/ui/consts/const-eval/const-eval-overflow2.rs index b11f7d6983bfa..1676f7c2af65a 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2.rs +++ b/src/test/ui/consts/const-eval/const-eval-overflow2.rs @@ -5,63 +5,53 @@ // change this warn to a deny, then the compiler will exit before // those errors are detected. -#![deny(const_err)] - use std::fmt; const VALS_I8: (i8,) = ( i8::MIN - 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_I16: (i16,) = ( i16::MIN - 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_I32: (i32,) = ( i32::MIN - 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_I64: (i64,) = ( i64::MIN - 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_U8: (u8,) = ( u8::MIN - 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_U16: (u16,) = ( u16::MIN - 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_U32: (u32,) = ( u32::MIN - 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_U64: (u64,) = ( u64::MIN - 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed fn main() { foo(VALS_I8); diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr index 8e3028c50f31f..341c15daf65b5 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr @@ -1,243 +1,51 @@ -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:14:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2.rs:12:6 | -LL | const VALS_I8: (i8,) = - | -------------------- -LL | ( LL | i8::MIN - 1, | ^^^^^^^^^^^ attempt to compute `i8::MIN - 1_i8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:21:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2.rs:18:6 | -LL | const VALS_I16: (i16,) = - | ---------------------- -LL | ( LL | i16::MIN - 1, | ^^^^^^^^^^^^ attempt to compute `i16::MIN - 1_i16`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:28:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2.rs:24:6 | -LL | const VALS_I32: (i32,) = - | ---------------------- -LL | ( LL | i32::MIN - 1, | ^^^^^^^^^^^^ attempt to compute `i32::MIN - 1_i32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:35:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2.rs:30:6 | -LL | const VALS_I64: (i64,) = - | ---------------------- -LL | ( LL | i64::MIN - 1, | ^^^^^^^^^^^^ attempt to compute `i64::MIN - 1_i64`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:42:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2.rs:36:6 | -LL | const VALS_U8: (u8,) = - | -------------------- -LL | ( LL | u8::MIN - 1, | ^^^^^^^^^^^ attempt to compute `0_u8 - 1_u8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:48:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2.rs:41:6 | -LL | const VALS_U16: (u16,) = ( - | ---------------------- LL | u16::MIN - 1, | ^^^^^^^^^^^^ attempt to compute `0_u16 - 1_u16`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:54:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2.rs:46:6 | -LL | const VALS_U32: (u32,) = ( - | ---------------------- LL | u32::MIN - 1, | ^^^^^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:61:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2.rs:52:6 | -LL | const VALS_U64: (u64,) = - | ---------------------- -LL | ( LL | u64::MIN - 1, | ^^^^^^^^^^^^ attempt to compute `0_u64 - 1_u64`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 error: aborting due to 8 previous errors -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:14:6 - | -LL | const VALS_I8: (i8,) = - | -------------------- -LL | ( -LL | i8::MIN - 1, - | ^^^^^^^^^^^ attempt to compute `i8::MIN - 1_i8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:21:6 - | -LL | const VALS_I16: (i16,) = - | ---------------------- -LL | ( -LL | i16::MIN - 1, - | ^^^^^^^^^^^^ attempt to compute `i16::MIN - 1_i16`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:28:6 - | -LL | const VALS_I32: (i32,) = - | ---------------------- -LL | ( -LL | i32::MIN - 1, - | ^^^^^^^^^^^^ attempt to compute `i32::MIN - 1_i32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:35:6 - | -LL | const VALS_I64: (i64,) = - | ---------------------- -LL | ( -LL | i64::MIN - 1, - | ^^^^^^^^^^^^ attempt to compute `i64::MIN - 1_i64`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:42:6 - | -LL | const VALS_U8: (u8,) = - | -------------------- -LL | ( -LL | u8::MIN - 1, - | ^^^^^^^^^^^ attempt to compute `0_u8 - 1_u8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:48:6 - | -LL | const VALS_U16: (u16,) = ( - | ---------------------- -LL | u16::MIN - 1, - | ^^^^^^^^^^^^ attempt to compute `0_u16 - 1_u16`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:54:6 - | -LL | const VALS_U32: (u32,) = ( - | ---------------------- -LL | u32::MIN - 1, - | ^^^^^^^^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:61:6 - | -LL | const VALS_U64: (u64,) = - | ---------------------- -LL | ( -LL | u64::MIN - 1, - | ^^^^^^^^^^^^ attempt to compute `0_u64 - 1_u64`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2b.rs b/src/test/ui/consts/const-eval/const-eval-overflow2b.rs index 9c3ad8ef9b44e..59d1df5680deb 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2b.rs +++ b/src/test/ui/consts/const-eval/const-eval-overflow2b.rs @@ -5,63 +5,53 @@ // change this warn to a deny, then the compiler will exit before // those errors are detected. -#![deny(const_err)] - use std::fmt; const VALS_I8: (i8,) = ( i8::MAX + 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_I16: (i16,) = ( i16::MAX + 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_I32: (i32,) = ( i32::MAX + 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_I64: (i64,) = ( i64::MAX + 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_U8: (u8,) = ( u8::MAX + 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_U16: (u16,) = ( u16::MAX + 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_U32: (u32,) = ( u32::MAX + 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_U64: (u64,) = ( u64::MAX + 1, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed fn main() { foo(VALS_I8); diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr index b6dc85f416b17..e661836b4b951 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr @@ -1,243 +1,51 @@ -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:14:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2b.rs:12:6 | -LL | const VALS_I8: (i8,) = - | -------------------- -LL | ( LL | i8::MAX + 1, | ^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2b.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:21:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2b.rs:18:6 | -LL | const VALS_I16: (i16,) = - | ---------------------- -LL | ( LL | i16::MAX + 1, | ^^^^^^^^^^^^ attempt to compute `i16::MAX + 1_i16`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:28:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2b.rs:24:6 | -LL | const VALS_I32: (i32,) = - | ---------------------- -LL | ( LL | i32::MAX + 1, | ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:35:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2b.rs:30:6 | -LL | const VALS_I64: (i64,) = - | ---------------------- -LL | ( LL | i64::MAX + 1, | ^^^^^^^^^^^^ attempt to compute `i64::MAX + 1_i64`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:42:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2b.rs:36:6 | -LL | const VALS_U8: (u8,) = - | -------------------- -LL | ( LL | u8::MAX + 1, | ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:48:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2b.rs:41:6 | -LL | const VALS_U16: (u16,) = ( - | ---------------------- LL | u16::MAX + 1, | ^^^^^^^^^^^^ attempt to compute `u16::MAX + 1_u16`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:54:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2b.rs:46:6 | -LL | const VALS_U32: (u32,) = ( - | ---------------------- LL | u32::MAX + 1, | ^^^^^^^^^^^^ attempt to compute `u32::MAX + 1_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:61:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2b.rs:52:6 | -LL | const VALS_U64: (u64,) = - | ---------------------- -LL | ( LL | u64::MAX + 1, | ^^^^^^^^^^^^ attempt to compute `u64::MAX + 1_u64`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 error: aborting due to 8 previous errors -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:14:6 - | -LL | const VALS_I8: (i8,) = - | -------------------- -LL | ( -LL | i8::MAX + 1, - | ^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2b.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:21:6 - | -LL | const VALS_I16: (i16,) = - | ---------------------- -LL | ( -LL | i16::MAX + 1, - | ^^^^^^^^^^^^ attempt to compute `i16::MAX + 1_i16`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2b.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:28:6 - | -LL | const VALS_I32: (i32,) = - | ---------------------- -LL | ( -LL | i32::MAX + 1, - | ^^^^^^^^^^^^ attempt to compute `i32::MAX + 1_i32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2b.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:35:6 - | -LL | const VALS_I64: (i64,) = - | ---------------------- -LL | ( -LL | i64::MAX + 1, - | ^^^^^^^^^^^^ attempt to compute `i64::MAX + 1_i64`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2b.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:42:6 - | -LL | const VALS_U8: (u8,) = - | -------------------- -LL | ( -LL | u8::MAX + 1, - | ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2b.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:48:6 - | -LL | const VALS_U16: (u16,) = ( - | ---------------------- -LL | u16::MAX + 1, - | ^^^^^^^^^^^^ attempt to compute `u16::MAX + 1_u16`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2b.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:54:6 - | -LL | const VALS_U32: (u32,) = ( - | ---------------------- -LL | u32::MAX + 1, - | ^^^^^^^^^^^^ attempt to compute `u32::MAX + 1_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2b.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:61:6 - | -LL | const VALS_U64: (u64,) = - | ---------------------- -LL | ( -LL | u64::MAX + 1, - | ^^^^^^^^^^^^ attempt to compute `u64::MAX + 1_u64`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2b.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2c.rs b/src/test/ui/consts/const-eval/const-eval-overflow2c.rs index bac4d042e23c9..33b892601153a 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2c.rs +++ b/src/test/ui/consts/const-eval/const-eval-overflow2c.rs @@ -5,63 +5,53 @@ // change this warn to a deny, then the compiler will exit before // those errors are detected. -#![deny(const_err)] - use std::fmt; const VALS_I8: (i8,) = ( i8::MIN * 2, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_I16: (i16,) = ( i16::MIN * 2, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_I32: (i32,) = ( i32::MIN * 2, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_I64: (i64,) = ( i64::MIN * 2, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_U8: (u8,) = ( u8::MAX * 2, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_U16: (u16,) = ( u16::MAX * 2, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_U32: (u32,) = ( u32::MAX * 2, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed const VALS_U64: (u64,) = ( u64::MAX * 2, ); - //~^^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^^ ERROR evaluation of constant value failed fn main() { foo(VALS_I8); diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr index df66fe1e5dee5..1fad15492fb82 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr @@ -1,243 +1,51 @@ -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:14:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2c.rs:12:6 | -LL | const VALS_I8: (i8,) = - | -------------------- -LL | ( LL | i8::MIN * 2, | ^^^^^^^^^^^ attempt to compute `i8::MIN * 2_i8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2c.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:21:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2c.rs:18:6 | -LL | const VALS_I16: (i16,) = - | ---------------------- -LL | ( LL | i16::MIN * 2, | ^^^^^^^^^^^^ attempt to compute `i16::MIN * 2_i16`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:28:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2c.rs:24:6 | -LL | const VALS_I32: (i32,) = - | ---------------------- -LL | ( LL | i32::MIN * 2, | ^^^^^^^^^^^^ attempt to compute `i32::MIN * 2_i32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:35:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2c.rs:30:6 | -LL | const VALS_I64: (i64,) = - | ---------------------- -LL | ( LL | i64::MIN * 2, | ^^^^^^^^^^^^ attempt to compute `i64::MIN * 2_i64`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:42:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2c.rs:36:6 | -LL | const VALS_U8: (u8,) = - | -------------------- -LL | ( LL | u8::MAX * 2, | ^^^^^^^^^^^ attempt to compute `u8::MAX * 2_u8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:48:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2c.rs:41:6 | -LL | const VALS_U16: (u16,) = ( - | ---------------------- LL | u16::MAX * 2, | ^^^^^^^^^^^^ attempt to compute `u16::MAX * 2_u16`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:54:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2c.rs:46:6 | -LL | const VALS_U32: (u32,) = ( - | ---------------------- LL | u32::MAX * 2, | ^^^^^^^^^^^^ attempt to compute `u32::MAX * 2_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:61:6 +error[E0080]: evaluation of constant value failed + --> $DIR/const-eval-overflow2c.rs:52:6 | -LL | const VALS_U64: (u64,) = - | ---------------------- -LL | ( LL | u64::MAX * 2, | ^^^^^^^^^^^^ attempt to compute `u64::MAX * 2_u64`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 error: aborting due to 8 previous errors -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:14:6 - | -LL | const VALS_I8: (i8,) = - | -------------------- -LL | ( -LL | i8::MIN * 2, - | ^^^^^^^^^^^ attempt to compute `i8::MIN * 2_i8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2c.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:21:6 - | -LL | const VALS_I16: (i16,) = - | ---------------------- -LL | ( -LL | i16::MIN * 2, - | ^^^^^^^^^^^^ attempt to compute `i16::MIN * 2_i16`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2c.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:28:6 - | -LL | const VALS_I32: (i32,) = - | ---------------------- -LL | ( -LL | i32::MIN * 2, - | ^^^^^^^^^^^^ attempt to compute `i32::MIN * 2_i32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2c.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:35:6 - | -LL | const VALS_I64: (i64,) = - | ---------------------- -LL | ( -LL | i64::MIN * 2, - | ^^^^^^^^^^^^ attempt to compute `i64::MIN * 2_i64`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2c.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:42:6 - | -LL | const VALS_U8: (u8,) = - | -------------------- -LL | ( -LL | u8::MAX * 2, - | ^^^^^^^^^^^ attempt to compute `u8::MAX * 2_u8`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2c.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:48:6 - | -LL | const VALS_U16: (u16,) = ( - | ---------------------- -LL | u16::MAX * 2, - | ^^^^^^^^^^^^ attempt to compute `u16::MAX * 2_u16`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2c.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:54:6 - | -LL | const VALS_U32: (u32,) = ( - | ---------------------- -LL | u32::MAX * 2, - | ^^^^^^^^^^^^ attempt to compute `u32::MAX * 2_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2c.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:61:6 - | -LL | const VALS_U64: (u64,) = - | ---------------------- -LL | ( -LL | u64::MAX * 2, - | ^^^^^^^^^^^^ attempt to compute `u64::MAX * 2_u64`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-overflow2c.rs:8:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/const-eval-query-stack.rs b/src/test/ui/consts/const-eval/const-eval-query-stack.rs index c9460498951fd..8f8a8cee3a0cc 100644 --- a/src/test/ui/consts/const-eval/const-eval-query-stack.rs +++ b/src/test/ui/consts/const-eval/const-eval-query-stack.rs @@ -1,5 +1,4 @@ -// compile-flags: -Ztreat-err-as-bug=2 -// build-fail +// compile-flags: -Ztreat-err-as-bug=1 // failure-status: 101 // rustc-env:RUST_BACKTRACE=1 // normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> "" @@ -15,14 +14,9 @@ #![allow(unconditional_panic)] -#[warn(const_err)] -const X: i32 = 1 / 0; //~WARN any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +const X: i32 = 1 / 0; //~ERROR constant fn main() { let x: &'static i32 = &X; - //~^ ERROR evaluation of constant value failed - //~| ERROR erroneous constant used - //~| WARNING this was previously accepted by the compiler println!("x={}", x); } diff --git a/src/test/ui/consts/const-eval/const-eval-query-stack.stderr b/src/test/ui/consts/const-eval/const-eval-query-stack.stderr index 67d290bbcaa49..b97975c4cd9e5 100644 --- a/src/test/ui/consts/const-eval/const-eval-query-stack.stderr +++ b/src/test/ui/consts/const-eval/const-eval-query-stack.stderr @@ -1,61 +1,13 @@ -warning: any use of this value will cause an error - --> $DIR/const-eval-query-stack.rs:19:16 - | -LL | const X: i32 = 1 / 0; - | ------------ ^^^^^ attempt to divide `1_i32` by zero - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-query-stack.rs:18:8 - | -LL | #[warn(const_err)] - | ^^^^^^^^^ - error[E0080]: evaluation of constant value failed - --> $DIR/const-eval-query-stack.rs:23:28 + --> $DIR/const-eval-query-stack.rs:17:16 | -LL | let x: &'static i32 = &X; - | ^ referenced constant has errors - -error: erroneous constant used - --> $DIR/const-eval-query-stack.rs:23:27 - | -LL | let x: &'static i32 = &X; - | ^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default +LL | const X: i32 = 1 / 0; + | ^^^^^ attempt to divide `1_i32` by zero query stack during panic: -#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `main` -#1 [optimized_mir] optimizing MIR for `main` -#2 [collect_and_partition_mono_items] collect_and_partition_mono_items +#0 [eval_to_allocation_raw] const-evaluating + checking `X` +#1 [eval_to_const_value_raw] simplifying constant for the type system `X` +#2 [eval_to_const_value_raw] simplifying constant for the type system `X` +#3 [lint_mod] linting top-level module +#4 [analysis] running analysis passes on this crate end of query stack -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/const-eval-query-stack.rs:19:16 - | -LL | const X: i32 = 1 / 0; - | ------------ ^^^^^ attempt to divide `1_i32` by zero - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const-eval-query-stack.rs:18:8 - | -LL | #[warn(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -error: erroneous constant used - --> $DIR/const-eval-query-stack.rs:23:27 - | -LL | let x: &'static i32 = &X; - | ^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr b/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr index de717899dd8fa..bf98d03946d81 100644 --- a/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr +++ b/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr @@ -1,664 +1,258 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const-pointer-values-in-various-types.rs:26:49 | LL | const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u }; - | -------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:30:43 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:29:43 | LL | const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:34:45 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:32:45 | LL | const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:38:45 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:35:45 | LL | const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:42:45 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:38:45 | LL | const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: evaluation of constant value failed - --> $DIR/const-pointer-values-in-various-types.rs:46:47 + --> $DIR/const-pointer-values-in-various-types.rs:41:47 | LL | const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:50:43 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:45:43 | LL | const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:54:45 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:48:45 | LL | const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:58:45 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:51:45 | LL | const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:62:45 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:54:45 | LL | const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: evaluation of constant value failed - --> $DIR/const-pointer-values-in-various-types.rs:66:47 + --> $DIR/const-pointer-values-in-various-types.rs:57:47 | LL | const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:70:45 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:61:45 | LL | const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:74:45 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:64:45 | LL | const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:78:47 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:67:47 | LL | const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey }; - | ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:82:47 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:70:47 | LL | const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character }; - | ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:86:39 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:73:39 | LL | const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 }; - | ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:90:41 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:76:41 | LL | const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:94:41 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:79:41 | LL | const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:98:41 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:82:41 | LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:102:43 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:85:43 | LL | const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:106:39 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:88:39 | LL | const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 }; - | ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:110:41 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:91:41 | LL | const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:114:41 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:94:41 | LL | const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:118:41 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:97:41 | LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:122:43 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:100:43 | LL | const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:126:41 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:103:41 | LL | const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:130:41 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:106:41 | LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:134:43 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:109:43 | LL | const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:138:43 +error[E0080]: evaluation of constant value failed + --> $DIR/const-pointer-values-in-various-types.rs:112:43 | LL | const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: aborting due to 29 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:26:49 - | -LL | const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u }; - | -------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:30:43 - | -LL | const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:34:45 - | -LL | const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:38:45 - | -LL | const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:42:45 - | -LL | const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:50:43 - | -LL | const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:54:45 - | -LL | const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:58:45 - | -LL | const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:62:45 - | -LL | const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:70:45 - | -LL | const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:74:45 - | -LL | const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 }; - | ---------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:78:47 - | -LL | const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey }; - | ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:82:47 - | -LL | const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character }; - | ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:86:39 - | -LL | const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 }; - | ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:90:41 - | -LL | const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:94:41 - | -LL | const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:98:41 - | -LL | const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:102:43 - | -LL | const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:106:39 - | -LL | const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 }; - | ---------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:110:41 - | -LL | const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:114:41 - | -LL | const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:118:41 - | -LL | const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:122:43 - | -LL | const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:126:41 - | -LL | const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:130:41 - | -LL | const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 }; - | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:134:43 - | -LL | const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-pointer-values-in-various-types.rs:138:43 - | -LL | const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.rs b/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.rs index f6a5e4d3c2b7d..45eed9d842a9b 100644 --- a/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.rs +++ b/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.rs @@ -24,118 +24,91 @@ union Nonsense { fn main() { const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 }; //~^ ERROR evaluation of constant value failed //~| uninitialized const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 }; //~^ ERROR evaluation of constant value failed //~| uninitialized const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character }; - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed } 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 804ebf660086d..b873940c4b3b4 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 @@ -1,8 +1,5 @@ -// build-fail // compile-flags: -Zunleash-the-miri-inside-of-you -#![allow(const_err)] - fn double(x: usize) -> usize { x * 2 } @@ -10,6 +7,8 @@ const X: fn(usize) -> usize = double; const fn bar(x: fn(usize) -> usize, y: usize) -> usize { x(y) + //~^ ERROR evaluation of constant value failed + //~| ERROR evaluation of constant value failed } const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday @@ -17,7 +16,5 @@ const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday fn main() { assert_eq!(Y, 4); - //~^ ERROR evaluation of constant value failed assert_eq!(Z, 4); - //~^ ERROR evaluation of constant value failed } 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 6aacc6cffc97f..3784a3861c3de 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,99 +1,35 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const_fn_ptr_fail2.rs:19:16 - | -LL | assert_eq!(Y, 4); - | ^ referenced constant has errors - -error[E0080]: evaluation of constant value failed - --> $DIR/const_fn_ptr_fail2.rs:21:16 - | -LL | assert_eq!(Z, 4); - | ^ referenced constant has errors - -warning: skipping const checks - | -help: skipping check that does not even have a feature gate - --> $DIR/const_fn_ptr_fail2.rs:12:5 - | -LL | x(y) - | ^^^^ - -error: aborting due to 2 previous errors; 1 warning emitted - -For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/const_fn_ptr_fail2.rs:12:5 + --> $DIR/const_fn_ptr_fail2.rs:9:5 | LL | x(y) | ^^^^ | | | calling non-const function `double` - | inside `bar` at $DIR/const_fn_ptr_fail2.rs:12:5 - | inside `Y` at $DIR/const_fn_ptr_fail2.rs:15:18 + | inside `bar` at $DIR/const_fn_ptr_fail2.rs:9:5 ... LL | const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday - | -------------- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const_fn_ptr_fail2.rs:4:10 - | -LL | #![allow(const_err)] - | ^^^^^^^^^ + | --------- inside `Y` at $DIR/const_fn_ptr_fail2.rs:14:18 -Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/const_fn_ptr_fail2.rs:12:5 +error[E0080]: evaluation of constant value failed + --> $DIR/const_fn_ptr_fail2.rs:9:5 | LL | x(y) | ^^^^ | | | calling non-const function `double` - | inside `bar` at $DIR/const_fn_ptr_fail2.rs:12:5 - | inside `Z` at $DIR/const_fn_ptr_fail2.rs:16:18 + | inside `bar` at $DIR/const_fn_ptr_fail2.rs:9:5 ... LL | const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday - | -------------- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const_fn_ptr_fail2.rs:4:10 - | -LL | #![allow(const_err)] - | ^^^^^^^^^ + | -------------- inside `Z` at $DIR/const_fn_ptr_fail2.rs:15:18 -Future breakage diagnostic: -warning: erroneous constant used - --> $DIR/const_fn_ptr_fail2.rs:19:5 - | -LL | assert_eq!(Y, 4); - | ^^^^^^^^^^^^^^^^ referenced constant has errors +warning: skipping const checks | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const_fn_ptr_fail2.rs:4:10 +help: skipping check that does not even have a feature gate + --> $DIR/const_fn_ptr_fail2.rs:9:5 | -LL | #![allow(const_err)] - | ^^^^^^^^^ - = note: this warning originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) +LL | x(y) + | ^^^^ -Future breakage diagnostic: -warning: erroneous constant used - --> $DIR/const_fn_ptr_fail2.rs:21:5 - | -LL | assert_eq!(Z, 4); - | ^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const_fn_ptr_fail2.rs:4:10 - | -LL | #![allow(const_err)] - | ^^^^^^^^^ - = note: this warning originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) +error: aborting due to 2 previous errors; 1 warning emitted +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/erroneous-const.rs b/src/test/ui/consts/const-eval/erroneous-const.rs index bee5a7cb3ba72..cf11531ba62ae 100644 --- a/src/test/ui/consts/const-eval/erroneous-const.rs +++ b/src/test/ui/consts/const-eval/erroneous-const.rs @@ -1,11 +1,9 @@ //! Make sure we error on erroneous consts even if they are unused. -#![warn(const_err, unconditional_panic)] +#![allow(unconditional_panic)] struct PrintName(T); impl PrintName { - const VOID: () = [()][2]; //~WARN any use of this value will cause an error - //~^ WARN this operation will panic at runtime - //~| WARN this was previously accepted by the compiler but is being phased out + const VOID: () = [()][2]; //~ERROR evaluation of `PrintName::::VOID` failed } const fn no_codegen() { diff --git a/src/test/ui/consts/const-eval/erroneous-const.stderr b/src/test/ui/consts/const-eval/erroneous-const.stderr index 24428732a42b9..33579135d7c4e 100644 --- a/src/test/ui/consts/const-eval/erroneous-const.stderr +++ b/src/test/ui/consts/const-eval/erroneous-const.stderr @@ -1,56 +1,21 @@ -warning: this operation will panic at runtime +error[E0080]: evaluation of `PrintName::::VOID` failed --> $DIR/erroneous-const.rs:6:22 | LL | const VOID: () = [()][2]; | ^^^^^^^ index out of bounds: the length is 1 but the index is 2 - | -note: the lint level is defined here - --> $DIR/erroneous-const.rs:2:20 - | -LL | #![warn(const_err, unconditional_panic)] - | ^^^^^^^^^^^^^^^^^^^ - -warning: any use of this value will cause an error - --> $DIR/erroneous-const.rs:6:22 - | -LL | const VOID: () = [()][2]; - | -------------- ^^^^^^^ index out of bounds: the length is 1 but the index is 2 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/erroneous-const.rs:2:9 - | -LL | #![warn(const_err, unconditional_panic)] - | ^^^^^^^^^ error[E0080]: could not evaluate static initializer - --> $DIR/erroneous-const.rs:15:17 + --> $DIR/erroneous-const.rs:13:17 | LL | let _ = PrintName::::VOID; | ^^^^^^^^^^^^^^^^^^^^ | | | referenced constant has errors - | inside `no_codegen::` at $DIR/erroneous-const.rs:15:17 + | inside `no_codegen::` at $DIR/erroneous-const.rs:13:17 ... LL | pub static FOO: () = no_codegen::(); - | ------------------- inside `FOO` at $DIR/erroneous-const.rs:19:22 + | ------------------- inside `FOO` at $DIR/erroneous-const.rs:17:22 -error: aborting due to previous error; 2 warnings emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/erroneous-const.rs:6:22 - | -LL | const VOID: () = [()][2]; - | -------------- ^^^^^^^ index out of bounds: the length is 1 but the index is 2 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/erroneous-const.rs:2:9 - | -LL | #![warn(const_err, unconditional_panic)] - | ^^^^^^^^^ - diff --git a/src/test/ui/consts/const-eval/erroneous-const2.rs b/src/test/ui/consts/const-eval/erroneous-const2.rs index aa0f093bf6293..2fbf7be883535 100644 --- a/src/test/ui/consts/const-eval/erroneous-const2.rs +++ b/src/test/ui/consts/const-eval/erroneous-const2.rs @@ -1,11 +1,9 @@ //! Make sure we error on erroneous consts even if they are unused. -#![warn(const_err, unconditional_panic)] +#![allow(unconditional_panic)] struct PrintName(T); impl PrintName { - const VOID: () = [()][2]; //~WARN any use of this value will cause an error - //~^ WARN this operation will panic at runtime - //~| WARN this was previously accepted by the compiler but is being phased out + const VOID: () = [()][2]; //~ERROR evaluation of `PrintName::::VOID` failed } pub static FOO: () = { diff --git a/src/test/ui/consts/const-eval/erroneous-const2.stderr b/src/test/ui/consts/const-eval/erroneous-const2.stderr index 0eea5648a64c9..630b1cf16aec9 100644 --- a/src/test/ui/consts/const-eval/erroneous-const2.stderr +++ b/src/test/ui/consts/const-eval/erroneous-const2.stderr @@ -1,50 +1,15 @@ -warning: this operation will panic at runtime +error[E0080]: evaluation of `PrintName::::VOID` failed --> $DIR/erroneous-const2.rs:6:22 | LL | const VOID: () = [()][2]; | ^^^^^^^ index out of bounds: the length is 1 but the index is 2 - | -note: the lint level is defined here - --> $DIR/erroneous-const2.rs:2:20 - | -LL | #![warn(const_err, unconditional_panic)] - | ^^^^^^^^^^^^^^^^^^^ - -warning: any use of this value will cause an error - --> $DIR/erroneous-const2.rs:6:22 - | -LL | const VOID: () = [()][2]; - | -------------- ^^^^^^^ index out of bounds: the length is 1 but the index is 2 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/erroneous-const2.rs:2:9 - | -LL | #![warn(const_err, unconditional_panic)] - | ^^^^^^^^^ error[E0080]: could not evaluate static initializer - --> $DIR/erroneous-const2.rs:15:17 + --> $DIR/erroneous-const2.rs:13:17 | LL | let _ = PrintName::::VOID; | ^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors -error: aborting due to previous error; 2 warnings emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/erroneous-const2.rs:6:22 - | -LL | const VOID: () = [()][2]; - | -------------- ^^^^^^^ index out of bounds: the length is 1 but the index is 2 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/erroneous-const2.rs:2:9 - | -LL | #![warn(const_err, unconditional_panic)] - | ^^^^^^^^^ - diff --git a/src/test/ui/consts/const-eval/format.rs b/src/test/ui/consts/const-eval/format.rs index e43633da3ccb9..3eef0d6c3d4d0 100644 --- a/src/test/ui/consts/const-eval/format.rs +++ b/src/test/ui/consts/const-eval/format.rs @@ -3,8 +3,6 @@ const fn failure() { //~^ ERROR cannot call non-const formatting macro in constant functions //~| ERROR erroneous constant used //~| ERROR erroneous constant used - //~| WARN this was previously accepted by the compiler - //~| WARN this was previously accepted by the compiler } const fn print() { @@ -14,8 +12,6 @@ const fn print() { //~| ERROR cannot call non-const fn `_print` in constant functions //~| ERROR erroneous constant used //~| ERROR erroneous constant used - //~| WARN this was previously accepted by the compiler - //~| WARN this was previously accepted by the compiler } fn main() {} diff --git a/src/test/ui/consts/const-eval/format.stderr b/src/test/ui/consts/const-eval/format.stderr index f3f6f2bb028de..64c7696486f78 100644 --- a/src/test/ui/consts/const-eval/format.stderr +++ b/src/test/ui/consts/const-eval/format.stderr @@ -8,7 +8,7 @@ LL | panic!("{:?}", 0); = note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const formatting macro in constant functions - --> $DIR/format.rs:11:22 + --> $DIR/format.rs:9:22 | LL | println!("{:?}", 0); | ^ @@ -17,7 +17,7 @@ LL | println!("{:?}", 0); = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: `Arguments::<'a>::new_v1` is not yet stable as a const fn - --> $DIR/format.rs:11:5 + --> $DIR/format.rs:9:5 | LL | println!("{:?}", 0); | ^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | println!("{:?}", 0); = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const fn `_print` in constant functions - --> $DIR/format.rs:11:5 + --> $DIR/format.rs:9:5 | LL | println!("{:?}", 0); | ^^^^^^^^^^^^^^^^^^^ @@ -34,91 +34,35 @@ LL | println!("{:?}", 0); = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -error: erroneous constant used +error[E0080]: erroneous constant used --> $DIR/format.rs:2:12 | LL | panic!("{:?}", 0); | ^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default -error: erroneous constant used +error[E0080]: erroneous constant used --> $DIR/format.rs:2:20 | LL | panic!("{:?}", 0); | ^ referenced constant has errors | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) -error: erroneous constant used - --> $DIR/format.rs:11:14 +error[E0080]: erroneous constant used + --> $DIR/format.rs:9:14 | LL | println!("{:?}", 0); | ^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: erroneous constant used - --> $DIR/format.rs:11:22 +error[E0080]: erroneous constant used + --> $DIR/format.rs:9:22 | LL | println!("{:?}", 0); | ^ referenced constant has errors | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 8 previous errors -For more information about this error, try `rustc --explain E0015`. -Future incompatibility report: Future breakage diagnostic: -error: erroneous constant used - --> $DIR/format.rs:2:12 - | -LL | panic!("{:?}", 0); - | ^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: erroneous constant used - --> $DIR/format.rs:2:20 - | -LL | panic!("{:?}", 0); - | ^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - = note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) - -Future breakage diagnostic: -error: erroneous constant used - --> $DIR/format.rs:11:14 - | -LL | println!("{:?}", 0); - | ^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: erroneous constant used - --> $DIR/format.rs:11:22 - | -LL | println!("{:?}", 0); - | ^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) - +Some errors have detailed explanations: E0015, E0080. +For more information about an error, try `rustc --explain E0015`. diff --git a/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.rs b/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.rs index 8064cc49359ee..bc2ea3f18faf2 100644 --- a/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.rs +++ b/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.rs @@ -1,21 +1,19 @@ // build-fail // Regression test for #66975 -#![warn(const_err, unconditional_panic)] +#![warn(unconditional_panic)] #![feature(never_type)] struct PrintName(T); impl PrintName { const VOID: ! = { let x = 0 * std::mem::size_of::(); [][x] }; - //~^ WARN any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of `PrintName::<()>::VOID` failed } fn f() { let _ = PrintName::::VOID; - //~^ ERROR erroneous constant encountered } pub fn main() { diff --git a/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr b/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr index 3f4739c56f028..8bcd030059819 100644 --- a/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr +++ b/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr @@ -1,37 +1,15 @@ -warning: any use of this value will cause an error +error[E0080]: evaluation of `PrintName::<()>::VOID` failed --> $DIR/index-out-of-bounds-never-type.rs:10:61 | LL | const VOID: ! = { let x = 0 * std::mem::size_of::(); [][x] }; - | ------------- ^^^^^ index out of bounds: the length is 0 but the index is 0 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/index-out-of-bounds-never-type.rs:4:9 - | -LL | #![warn(const_err, unconditional_panic)] - | ^^^^^^^^^ + | ^^^^^ index out of bounds: the length is 0 but the index is 0 -error: erroneous constant encountered - --> $DIR/index-out-of-bounds-never-type.rs:17:13 +note: the above error was encountered while instantiating `fn f::<()>` + --> $DIR/index-out-of-bounds-never-type.rs:20:5 | -LL | let _ = PrintName::::VOID; - | ^^^^^^^^^^^^^^^^^^^^ +LL | f::<()>(); + | ^^^^^^^^^ -error: aborting due to previous error; 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/index-out-of-bounds-never-type.rs:10:61 - | -LL | const VOID: ! = { let x = 0 * std::mem::size_of::(); [][x] }; - | ------------- ^^^^^ index out of bounds: the length is 0 but the index is 0 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/index-out-of-bounds-never-type.rs:4:9 - | -LL | #![warn(const_err, unconditional_panic)] - | ^^^^^^^^^ +error: aborting due to previous error +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/issue-43197.rs b/src/test/ui/consts/const-eval/issue-43197.rs index e15f8771dd73b..145463f0ae298 100644 --- a/src/test/ui/consts/const-eval/issue-43197.rs +++ b/src/test/ui/consts/const-eval/issue-43197.rs @@ -1,23 +1,11 @@ -// build-fail - -#![warn(const_err)] - const fn foo(x: u32) -> u32 { x } fn main() { const X: u32 = 0 - 1; - //~^ WARN any use of this value will cause - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR constant const Y: u32 = foo(0 - 1); - //~^ WARN any use of this value will cause - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR constant println!("{} {}", X, Y); - //~^ ERROR evaluation of constant value failed - //~| ERROR evaluation of constant value failed - //~| WARN erroneous constant used [const_err] - //~| WARN erroneous constant used [const_err] - //~| WARN this was previously accepted by the compiler but is being phased out - //~| WARN this was previously accepted by the compiler but is being phased out } diff --git a/src/test/ui/consts/const-eval/issue-43197.stderr b/src/test/ui/consts/const-eval/issue-43197.stderr index ceeaa1baece65..c59f13e488828 100644 --- a/src/test/ui/consts/const-eval/issue-43197.stderr +++ b/src/test/ui/consts/const-eval/issue-43197.stderr @@ -1,120 +1,15 @@ -warning: any use of this value will cause an error - --> $DIR/issue-43197.rs:10:20 - | -LL | const X: u32 = 0 - 1; - | ------------ ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/issue-43197.rs:3:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ - -warning: any use of this value will cause an error - --> $DIR/issue-43197.rs:13:24 - | -LL | const Y: u32 = foo(0 - 1); - | ------------ ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - error[E0080]: evaluation of constant value failed - --> $DIR/issue-43197.rs:16:23 - | -LL | println!("{} {}", X, Y); - | ^ referenced constant has errors - -warning: erroneous constant used - --> $DIR/issue-43197.rs:16:23 - | -LL | println!("{} {}", X, Y); - | ^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0080]: evaluation of constant value failed - --> $DIR/issue-43197.rs:16:26 - | -LL | println!("{} {}", X, Y); - | ^ referenced constant has errors - -warning: erroneous constant used - --> $DIR/issue-43197.rs:16:26 - | -LL | println!("{} {}", X, Y); - | ^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 2 previous errors; 4 warnings emitted - -For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/issue-43197.rs:10:20 + --> $DIR/issue-43197.rs:6:20 | LL | const X: u32 = 0 - 1; - | ------------ ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/issue-43197.rs:3:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ + | ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow -Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/issue-43197.rs:13:24 +error[E0080]: evaluation of constant value failed + --> $DIR/issue-43197.rs:8:24 | LL | const Y: u32 = foo(0 - 1); - | ------------ ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/issue-43197.rs:3:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ + | ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow -Future breakage diagnostic: -warning: erroneous constant used - --> $DIR/issue-43197.rs:16:23 - | -LL | println!("{} {}", X, Y); - | ^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/issue-43197.rs:3:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ - = note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) - -Future breakage diagnostic: -warning: erroneous constant used - --> $DIR/issue-43197.rs:16:26 - | -LL | println!("{} {}", X, Y); - | ^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/issue-43197.rs:3:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ - = note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) +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-44578.rs b/src/test/ui/consts/const-eval/issue-44578.rs index a88e2197048d5..2dbe1c2bd161b 100644 --- a/src/test/ui/consts/const-eval/issue-44578.rs +++ b/src/test/ui/consts/const-eval/issue-44578.rs @@ -1,7 +1,5 @@ // build-fail -#![allow(const_err)] - trait Foo { const AMT: usize; } @@ -12,7 +10,7 @@ enum Bar { } impl Foo for Bar { - const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize]; + const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize]; //~ERROR evaluation of ` as Foo>::AMT` failed } impl Foo for u8 { @@ -26,4 +24,5 @@ impl Foo for u16 { fn main() { println!("{}", as Foo>::AMT); //~^ ERROR evaluation of constant value failed + //~| ERROR erroneous constant used } diff --git a/src/test/ui/consts/const-eval/issue-44578.stderr b/src/test/ui/consts/const-eval/issue-44578.stderr index c3a794d2fe301..963381b587093 100644 --- a/src/test/ui/consts/const-eval/issue-44578.stderr +++ b/src/test/ui/consts/const-eval/issue-44578.stderr @@ -1,40 +1,23 @@ +error[E0080]: evaluation of ` as Foo>::AMT` failed + --> $DIR/issue-44578.rs:13:24 + | +LL | const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1 + error[E0080]: evaluation of constant value failed - --> $DIR/issue-44578.rs:27:20 + --> $DIR/issue-44578.rs:25:20 | LL | println!("{}", as Foo>::AMT); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/issue-44578.rs:15:24 - | -LL | const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize]; - | ---------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/issue-44578.rs:3:10 - | -LL | #![allow(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -warning: erroneous constant used - --> $DIR/issue-44578.rs:27:20 +error[E0080]: erroneous constant used + --> $DIR/issue-44578.rs:25:20 | LL | println!("{}", as Foo>::AMT); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/issue-44578.rs:3:10 - | -LL | #![allow(const_err)] - | ^^^^^^^^^ - = note: this warning originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) + +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-50814-2.rs b/src/test/ui/consts/const-eval/issue-50814-2.rs index 15f4de0ae1b67..49d1d8ff0805e 100644 --- a/src/test/ui/consts/const-eval/issue-50814-2.rs +++ b/src/test/ui/consts/const-eval/issue-50814-2.rs @@ -11,8 +11,7 @@ trait Foo { struct A(T); impl Foo for A { - const BAR: usize = [5, 6, 7][T::BOO]; //~ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + const BAR: usize = [5, 6, 7][T::BOO]; //~ ERROR evaluation of ` as Foo<()>>::BAR` failed } fn foo() -> &'static usize { diff --git a/src/test/ui/consts/const-eval/issue-50814-2.stderr b/src/test/ui/consts/const-eval/issue-50814-2.stderr index bd86019772059..6604f2b9f8b5e 100644 --- a/src/test/ui/consts/const-eval/issue-50814-2.stderr +++ b/src/test/ui/consts/const-eval/issue-50814-2.stderr @@ -1,21 +1,17 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of ` as Foo<()>>::BAR` failed --> $DIR/issue-50814-2.rs:14:24 | LL | const BAR: usize = [5, 6, 7][T::BOO]; - | ---------------- ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default + | ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42 error[E0080]: evaluation of `foo::<()>` failed - --> $DIR/issue-50814-2.rs:19:6 + --> $DIR/issue-50814-2.rs:18:6 | LL | & as Foo>::BAR | ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors note: the above error was encountered while instantiating `fn foo::<()>` - --> $DIR/issue-50814-2.rs:31:22 + --> $DIR/issue-50814-2.rs:30:22 | LL | println!("{:x}", foo::<()>() as *const usize as usize); | ^^^^^^^^^^^ @@ -23,14 +19,3 @@ LL | println!("{:x}", foo::<()>() as *const usize as usize); error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/issue-50814-2.rs:14:24 - | -LL | const BAR: usize = [5, 6, 7][T::BOO]; - | ---------------- ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/const-eval/issue-50814.rs b/src/test/ui/consts/const-eval/issue-50814.rs index 98229f919dd13..5a587701f787a 100644 --- a/src/test/ui/consts/const-eval/issue-50814.rs +++ b/src/test/ui/consts/const-eval/issue-50814.rs @@ -13,8 +13,7 @@ struct Sum(A,B); impl Unsigned for Sum { const MAX: u8 = A::MAX + B::MAX; - //~^ ERROR any use of this value will cause an error [const_err] - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of ` as Unsigned>::MAX` failed } fn foo(_: T) -> &'static u8 { diff --git a/src/test/ui/consts/const-eval/issue-50814.stderr b/src/test/ui/consts/const-eval/issue-50814.stderr index c8e5a169ff97b..46dd2b89fa2ac 100644 --- a/src/test/ui/consts/const-eval/issue-50814.stderr +++ b/src/test/ui/consts/const-eval/issue-50814.stderr @@ -1,21 +1,17 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of ` as Unsigned>::MAX` failed --> $DIR/issue-50814.rs:15:21 | LL | const MAX: u8 = A::MAX + B::MAX; - | ------------- ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default + | ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow error[E0080]: evaluation of `foo::` failed - --> $DIR/issue-50814.rs:21:6 + --> $DIR/issue-50814.rs:20:6 | LL | &Sum::::MAX | ^^^^^^^^^^^^^^^^^ referenced constant has errors note: the above error was encountered while instantiating `fn foo::` - --> $DIR/issue-50814.rs:26:5 + --> $DIR/issue-50814.rs:25:5 | LL | foo(0); | ^^^^^^ @@ -23,14 +19,3 @@ LL | foo(0); error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/issue-50814.rs:15:21 - | -LL | const MAX: u8 = A::MAX + B::MAX; - | ------------- ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.rs b/src/test/ui/consts/const-eval/panic-assoc-never-type.rs index 80b0a1432fbbb..d2a840932a5d1 100644 --- a/src/test/ui/consts/const-eval/panic-assoc-never-type.rs +++ b/src/test/ui/consts/const-eval/panic-assoc-never-type.rs @@ -1,7 +1,6 @@ // build-fail // Regression test for #66975 -#![warn(const_err)] #![feature(never_type)] struct PrintName; diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr index b26286411d2d6..4204d302bf83c 100644 --- a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr +++ b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr @@ -1,13 +1,13 @@ error[E0080]: evaluation of constant value failed - --> $DIR/panic-assoc-never-type.rs:10:21 + --> $DIR/panic-assoc-never-type.rs:9:21 | LL | const VOID: ! = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:10:21 + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:9:21 | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: erroneous constant used - --> $DIR/panic-assoc-never-type.rs:15:13 + --> $DIR/panic-assoc-never-type.rs:14:13 | LL | let _ = PrintName::VOID; | ^^^^^^^^^^^^^^^ referenced constant has errors diff --git a/src/test/ui/consts/const-eval/panic-never-type.rs b/src/test/ui/consts/const-eval/panic-never-type.rs index a74d3ba297189..a9e9026d9bc07 100644 --- a/src/test/ui/consts/const-eval/panic-never-type.rs +++ b/src/test/ui/consts/const-eval/panic-never-type.rs @@ -1,5 +1,4 @@ // Regression test for #66975 -#![warn(const_err)] #![feature(never_type)] const VOID: ! = panic!(); diff --git a/src/test/ui/consts/const-eval/panic-never-type.stderr b/src/test/ui/consts/const-eval/panic-never-type.stderr index 9728aed07223c..6bff14a45b1c5 100644 --- a/src/test/ui/consts/const-eval/panic-never-type.stderr +++ b/src/test/ui/consts/const-eval/panic-never-type.stderr @@ -1,8 +1,8 @@ error[E0080]: evaluation of constant value failed - --> $DIR/panic-never-type.rs:5:17 + --> $DIR/panic-never-type.rs:4:17 | LL | const VOID: ! = panic!(); - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:5:17 + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:4:17 | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/partial_ptr_overwrite.rs b/src/test/ui/consts/const-eval/partial_ptr_overwrite.rs index 07bca7d64ff69..d6c76886853f4 100644 --- a/src/test/ui/consts/const-eval/partial_ptr_overwrite.rs +++ b/src/test/ui/consts/const-eval/partial_ptr_overwrite.rs @@ -5,9 +5,8 @@ const PARTIAL_OVERWRITE: () = { let mut p = &42; unsafe { let ptr: *mut _ = &mut p; - *(ptr as *mut u8) = 123; //~ ERROR any use of this value + *(ptr as *mut u8) = 123; //~ ERROR constant //~| unable to overwrite parts of a pointer - //~| WARN previously accepted } let x = *p; }; diff --git a/src/test/ui/consts/const-eval/partial_ptr_overwrite.stderr b/src/test/ui/consts/const-eval/partial_ptr_overwrite.stderr index f41fa1c1ee03d..13ca4379b7bd8 100644 --- a/src/test/ui/consts/const-eval/partial_ptr_overwrite.stderr +++ b/src/test/ui/consts/const-eval/partial_ptr_overwrite.stderr @@ -1,33 +1,12 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/partial_ptr_overwrite.rs:8:9 | -LL | const PARTIAL_OVERWRITE: () = { - | --------------------------- -... LL | *(ptr as *mut u8) = 123; | ^^^^^^^^^^^^^^^^^^^^^^^ unable to overwrite parts of a pointer in memory at alloc4 | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default error: aborting due to previous error -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/partial_ptr_overwrite.rs:8:9 - | -LL | const PARTIAL_OVERWRITE: () = { - | --------------------------- -... -LL | *(ptr as *mut u8) = 123; - | ^^^^^^^^^^^^^^^^^^^^^^^ unable to overwrite parts of a pointer in memory at alloc4 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.rs b/src/test/ui/consts/const-eval/promoted_const_fn_fail.rs index 1fc7af63765c8..656dd33e1d084 100644 --- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.rs +++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail.rs @@ -1,5 +1,3 @@ -#![allow(const_err)] - #[repr(C)] union Bar { a: &'static u8, diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr index c6ca30e09bd3f..596fa090d976f 100644 --- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr +++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/promoted_const_fn_fail.rs:19:27 + --> $DIR/promoted_const_fn_fail.rs:17:27 | LL | let x: &'static u8 = &(bar() + 1); | ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs index c53424664f258..5009dbcb9bd9c 100644 --- a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs +++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs @@ -1,5 +1,3 @@ -#![deny(const_err)] - #[repr(C)] union Bar { a: &'static u8, 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 c6275a835e544..63dc43a41a8fc 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,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/promoted_const_fn_fail_deny_const_err.rs:20:27 + --> $DIR/promoted_const_fn_fail_deny_const_err.rs:18:27 | LL | let x: &'static u8 = &(bar() + 1); | ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr b/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr index d5f73dcd11f9b..2a254bfde8204 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr @@ -5,111 +5,40 @@ LL | 0 - 1 | ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow | note: the lint level is defined here - --> $DIR/promoted_errors.rs:11:20 + --> $DIR/promoted_errors.rs:11:9 | -LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] - | ^^^^^^^^^^^^^^^^^^^ +LL | #![warn(arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: this operation will panic at runtime - --> $DIR/promoted_errors.rs:21:5 + --> $DIR/promoted_errors.rs:19:5 | LL | 1 / 0 | ^^^^^ attempt to divide `1_i32` by zero | note: the lint level is defined here - --> $DIR/promoted_errors.rs:11:41 + --> $DIR/promoted_errors.rs:11:30 | -LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] - | ^^^^^^^^^^^^^^^^^^^ +LL | #![warn(arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: this operation will panic at runtime - --> $DIR/promoted_errors.rs:27:5 + --> $DIR/promoted_errors.rs:23:5 | LL | 1 / (1 - 1) | ^^^^^^^^^^^ attempt to divide `1_i32` by zero warning: this operation will panic at runtime - --> $DIR/promoted_errors.rs:31:5 + --> $DIR/promoted_errors.rs:27:5 | LL | 1 / (false as i32) | ^^^^^^^^^^^^^^^^^^ attempt to divide `1_i32` by zero warning: this operation will panic at runtime - --> $DIR/promoted_errors.rs:35:5 + --> $DIR/promoted_errors.rs:31:5 | LL | [1, 2, 3][4] | ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:15:5 - | -LL | 0 - 1 - | ^^^^^ - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow - | inside `overflow` at $DIR/promoted_errors.rs:15:5 - | inside `X` at $DIR/promoted_errors.rs:43:29 -... -LL | const X: () = { - | ----------- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/promoted_errors.rs:11:9 - | -LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] - | ^^^^^^^^^ - -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:43:28 - | -LL | const X: () = { - | ----------- -LL | let _x: &'static u32 = &overflow(); - | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - -warning: 7 warnings emitted - -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:15:5 - | -LL | 0 - 1 - | ^^^^^ - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow - | inside `overflow` at $DIR/promoted_errors.rs:15:5 - | inside `X` at $DIR/promoted_errors.rs:43:29 -... -LL | const X: () = { - | ----------- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/promoted_errors.rs:11:9 - | -LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] - | ^^^^^^^^^ - -Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:43:28 - | -LL | const X: () = { - | ----------- -LL | let _x: &'static u32 = &overflow(); - | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/promoted_errors.rs:11:9 - | -LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] - | ^^^^^^^^^ +warning: 5 warnings emitted diff --git a/src/test/ui/consts/const-eval/promoted_errors.opt.stderr b/src/test/ui/consts/const-eval/promoted_errors.opt.stderr index 423103276926b..2a254bfde8204 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.opt.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.opt.stderr @@ -5,113 +5,40 @@ LL | 0 - 1 | ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow | note: the lint level is defined here - --> $DIR/promoted_errors.rs:11:20 + --> $DIR/promoted_errors.rs:11:9 | -LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] - | ^^^^^^^^^^^^^^^^^^^ +LL | #![warn(arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: this operation will panic at runtime - --> $DIR/promoted_errors.rs:21:5 + --> $DIR/promoted_errors.rs:19:5 | LL | 1 / 0 | ^^^^^ attempt to divide `1_i32` by zero | note: the lint level is defined here - --> $DIR/promoted_errors.rs:11:41 + --> $DIR/promoted_errors.rs:11:30 | -LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] - | ^^^^^^^^^^^^^^^^^^^ +LL | #![warn(arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: this operation will panic at runtime - --> $DIR/promoted_errors.rs:27:5 + --> $DIR/promoted_errors.rs:23:5 | LL | 1 / (1 - 1) | ^^^^^^^^^^^ attempt to divide `1_i32` by zero warning: this operation will panic at runtime - --> $DIR/promoted_errors.rs:31:5 + --> $DIR/promoted_errors.rs:27:5 | LL | 1 / (false as i32) | ^^^^^^^^^^^^^^^^^^ attempt to divide `1_i32` by zero warning: this operation will panic at runtime - --> $DIR/promoted_errors.rs:35:5 + --> $DIR/promoted_errors.rs:31:5 | LL | [1, 2, 3][4] | ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:21:5 - | -LL | 1 / 0 - | ^^^^^ - | | - | attempt to divide `1_i32` by zero - | inside `div_by_zero1` at $DIR/promoted_errors.rs:21:5 - | inside `X` at $DIR/promoted_errors.rs:46:29 -... -LL | const X: () = { - | ----------- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/promoted_errors.rs:11:9 - | -LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] - | ^^^^^^^^^ - -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:46:28 - | -LL | const X: () = { - | ----------- -... -LL | let _x: &'static i32 = &div_by_zero1(); - | ^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - -warning: 7 warnings emitted - -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:21:5 - | -LL | 1 / 0 - | ^^^^^ - | | - | attempt to divide `1_i32` by zero - | inside `div_by_zero1` at $DIR/promoted_errors.rs:21:5 - | inside `X` at $DIR/promoted_errors.rs:46:29 -... -LL | const X: () = { - | ----------- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/promoted_errors.rs:11:9 - | -LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] - | ^^^^^^^^^ - -Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:46:28 - | -LL | const X: () = { - | ----------- -... -LL | let _x: &'static i32 = &div_by_zero1(); - | ^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/promoted_errors.rs:11:9 - | -LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] - | ^^^^^^^^^ +warning: 5 warnings emitted diff --git a/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr b/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr index d5f73dcd11f9b..2a254bfde8204 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr @@ -5,111 +5,40 @@ LL | 0 - 1 | ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow | note: the lint level is defined here - --> $DIR/promoted_errors.rs:11:20 + --> $DIR/promoted_errors.rs:11:9 | -LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] - | ^^^^^^^^^^^^^^^^^^^ +LL | #![warn(arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: this operation will panic at runtime - --> $DIR/promoted_errors.rs:21:5 + --> $DIR/promoted_errors.rs:19:5 | LL | 1 / 0 | ^^^^^ attempt to divide `1_i32` by zero | note: the lint level is defined here - --> $DIR/promoted_errors.rs:11:41 + --> $DIR/promoted_errors.rs:11:30 | -LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] - | ^^^^^^^^^^^^^^^^^^^ +LL | #![warn(arithmetic_overflow, unconditional_panic)] + | ^^^^^^^^^^^^^^^^^^^ warning: this operation will panic at runtime - --> $DIR/promoted_errors.rs:27:5 + --> $DIR/promoted_errors.rs:23:5 | LL | 1 / (1 - 1) | ^^^^^^^^^^^ attempt to divide `1_i32` by zero warning: this operation will panic at runtime - --> $DIR/promoted_errors.rs:31:5 + --> $DIR/promoted_errors.rs:27:5 | LL | 1 / (false as i32) | ^^^^^^^^^^^^^^^^^^ attempt to divide `1_i32` by zero warning: this operation will panic at runtime - --> $DIR/promoted_errors.rs:35:5 + --> $DIR/promoted_errors.rs:31:5 | LL | [1, 2, 3][4] | ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:15:5 - | -LL | 0 - 1 - | ^^^^^ - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow - | inside `overflow` at $DIR/promoted_errors.rs:15:5 - | inside `X` at $DIR/promoted_errors.rs:43:29 -... -LL | const X: () = { - | ----------- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/promoted_errors.rs:11:9 - | -LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] - | ^^^^^^^^^ - -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:43:28 - | -LL | const X: () = { - | ----------- -LL | let _x: &'static u32 = &overflow(); - | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - -warning: 7 warnings emitted - -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:15:5 - | -LL | 0 - 1 - | ^^^^^ - | | - | attempt to compute `0_u32 - 1_u32`, which would overflow - | inside `overflow` at $DIR/promoted_errors.rs:15:5 - | inside `X` at $DIR/promoted_errors.rs:43:29 -... -LL | const X: () = { - | ----------- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/promoted_errors.rs:11:9 - | -LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] - | ^^^^^^^^^ - -Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/promoted_errors.rs:43:28 - | -LL | const X: () = { - | ----------- -LL | let _x: &'static u32 = &overflow(); - | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/promoted_errors.rs:11:9 - | -LL | #![warn(const_err, arithmetic_overflow, unconditional_panic)] - | ^^^^^^^^^ +warning: 5 warnings emitted diff --git a/src/test/ui/consts/const-eval/promoted_errors.rs b/src/test/ui/consts/const-eval/promoted_errors.rs index eb891de33c498..2c42d035629a0 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.rs +++ b/src/test/ui/consts/const-eval/promoted_errors.rs @@ -8,20 +8,16 @@ //! This test ensures that when we promote code that fails to evaluate, the build still succeeds. -#![warn(const_err, arithmetic_overflow, unconditional_panic)] +#![warn(arithmetic_overflow, unconditional_panic)] // The only way to have promoteds that fail is in `const fn` called from `const`/`static`. const fn overflow() -> u32 { 0 - 1 - //[opt_with_overflow_checks,noopt]~^ WARN any use of this value will cause an error - //[opt_with_overflow_checks,noopt]~| WARN this was previously accepted by the compiler - //~^^^ WARN this arithmetic operation will overflow + //~^ WARN this arithmetic operation will overflow } const fn div_by_zero1() -> i32 { 1 / 0 - //[opt]~^ WARN any use of this value will cause an error - //[opt]~| WARN this was previously accepted by the compiler but is being phased out - //~^^^ WARN this operation will panic at runtime + //~^ WARN this operation will panic at runtime } const fn div_by_zero2() -> i32 { 1 / (1 - 1) @@ -36,21 +32,6 @@ const fn oob() -> i32 { //~^ WARN this operation will panic at runtime } -// An unused constant containing failing promoteds. -// This should work as long as `const_err` can be turned into just a warning; -// once it turns into a hard error, just remove `X`. -const X: () = { - let _x: &'static u32 = &overflow(); - //[opt_with_overflow_checks,noopt]~^ WARN any use of this value will cause an error - //[opt_with_overflow_checks,noopt]~| WARN this was previously accepted by the compiler - let _x: &'static i32 = &div_by_zero1(); - //[opt]~^ WARN any use of this value will cause an error - //[opt]~| WARN this was previously accepted by the compiler but is being phased out - let _x: &'static i32 = &div_by_zero2(); - let _x: &'static i32 = &div_by_zero3(); - let _x: &'static i32 = &oob(); -}; - const fn mk_false() -> bool { false } // An actually used constant referencing failing promoteds in dead code. diff --git a/src/test/ui/consts/const-eval/pub_const_err.rs b/src/test/ui/consts/const-eval/pub_const_err.rs deleted file mode 100644 index 5faacd556d479..0000000000000 --- a/src/test/ui/consts/const-eval/pub_const_err.rs +++ /dev/null @@ -1,10 +0,0 @@ -// check-pass -#![warn(const_err)] - -#![crate_type = "lib"] - -pub const Z: u32 = 0 - 1; -//~^ WARN any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out - -pub type Foo = [i32; 0 - 1]; diff --git a/src/test/ui/consts/const-eval/pub_const_err.stderr b/src/test/ui/consts/const-eval/pub_const_err.stderr deleted file mode 100644 index d1081f9c2caa3..0000000000000 --- a/src/test/ui/consts/const-eval/pub_const_err.stderr +++ /dev/null @@ -1,31 +0,0 @@ -warning: any use of this value will cause an error - --> $DIR/pub_const_err.rs:6:20 - | -LL | pub const Z: u32 = 0 - 1; - | ---------------- ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/pub_const_err.rs:2:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ - -warning: 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/pub_const_err.rs:6:20 - | -LL | pub const Z: u32 = 0 - 1; - | ---------------- ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/pub_const_err.rs:2:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ - diff --git a/src/test/ui/consts/const-eval/pub_const_err_bin.rs b/src/test/ui/consts/const-eval/pub_const_err_bin.rs deleted file mode 100644 index 82eae25121e41..0000000000000 --- a/src/test/ui/consts/const-eval/pub_const_err_bin.rs +++ /dev/null @@ -1,10 +0,0 @@ -// check-pass -#![warn(const_err)] - -pub const Z: u32 = 0 - 1; -//~^ WARN any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out - -pub type Foo = [i32; 0 - 1]; - -fn main() {} diff --git a/src/test/ui/consts/const-eval/pub_const_err_bin.stderr b/src/test/ui/consts/const-eval/pub_const_err_bin.stderr deleted file mode 100644 index 93362a9375cc9..0000000000000 --- a/src/test/ui/consts/const-eval/pub_const_err_bin.stderr +++ /dev/null @@ -1,31 +0,0 @@ -warning: any use of this value will cause an error - --> $DIR/pub_const_err_bin.rs:4:20 - | -LL | pub const Z: u32 = 0 - 1; - | ---------------- ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/pub_const_err_bin.rs:2:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ - -warning: 1 warning emitted - -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/pub_const_err_bin.rs:4:20 - | -LL | pub const Z: u32 = 0 - 1; - | ---------------- ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/pub_const_err_bin.rs:2:9 - | -LL | #![warn(const_err)] - | ^^^^^^^^^ - diff --git a/src/test/ui/consts/const-eval/ref_to_int_match.32bit.stderr b/src/test/ui/consts/const-eval/ref_to_int_match.32bit.stderr index 02feb6a7832cd..032ceb2467c24 100644 --- a/src/test/ui/consts/const-eval/ref_to_int_match.32bit.stderr +++ b/src/test/ui/consts/const-eval/ref_to_int_match.32bit.stderr @@ -1,14 +1,11 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/ref_to_int_match.rs:25:27 | LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; - | -------------- ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default error: could not evaluate constant pattern --> $DIR/ref_to_int_match.rs:7:14 @@ -24,16 +21,4 @@ LL | 10..=BAR => {}, error: aborting due to 3 previous errors -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ref_to_int_match.rs:25:27 - | -LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; - | -------------- ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/ref_to_int_match.64bit.stderr b/src/test/ui/consts/const-eval/ref_to_int_match.64bit.stderr index 02feb6a7832cd..032ceb2467c24 100644 --- a/src/test/ui/consts/const-eval/ref_to_int_match.64bit.stderr +++ b/src/test/ui/consts/const-eval/ref_to_int_match.64bit.stderr @@ -1,14 +1,11 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/ref_to_int_match.rs:25:27 | LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; - | -------------- ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default error: could not evaluate constant pattern --> $DIR/ref_to_int_match.rs:7:14 @@ -24,16 +21,4 @@ LL | 10..=BAR => {}, error: aborting due to 3 previous errors -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ref_to_int_match.rs:25:27 - | -LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; - | -------------- ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/ref_to_int_match.rs b/src/test/ui/consts/const-eval/ref_to_int_match.rs index 3f342d9165dc1..70c6e7d94ae01 100644 --- a/src/test/ui/consts/const-eval/ref_to_int_match.rs +++ b/src/test/ui/consts/const-eval/ref_to_int_match.rs @@ -23,5 +23,4 @@ type Int = u64; type Int = u32; const BAR: Int = unsafe { Foo { r: &42 }.f }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR constant diff --git a/src/test/ui/consts/const-eval/ub-enum.32bit.stderr b/src/test/ui/consts/const-eval/ub-enum.32bit.stderr index ddfe1d5909fa0..93bc96e676749 100644 --- a/src/test/ui/consts/const-eval/ub-enum.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-enum.32bit.stderr @@ -9,31 +9,26 @@ LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) }; 01 00 00 00 │ .... } -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/ub-enum.rs:27:1 | LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) }; | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:31:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-enum.rs:30:1 | LL | const BAD_ENUM_WRAPPED: Wrap = unsafe { mem::transmute(&1) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:44:1 + --> $DIR/ub-enum.rs:42:1 | LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) }; | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .: encountered 0x00000000, but expected a valid enum tag @@ -43,47 +38,41 @@ LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) }; 00 00 00 00 │ .... } -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:46:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-enum.rs:44:1 | LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:50:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-enum.rs:47:1 | LL | const BAD_ENUM2_WRAPPED: Wrap = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: evaluation of constant value failed - --> $DIR/ub-enum.rs:60:42 + --> $DIR/ub-enum.rs:56:42 | LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:65:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-enum.rs:61:1 | LL | const BAD_ENUM2_OPTION_PTR: Option = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:83:1 + --> $DIR/ub-enum.rs:78:1 | LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered a value of the never type `!` @@ -94,7 +83,7 @@ LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:85:1 + --> $DIR/ub-enum.rs:80:1 | LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered a value of uninhabited type Never @@ -105,7 +94,7 @@ LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:93:1 + --> $DIR/ub-enum.rs:88:1 | LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) @@ -116,13 +105,13 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran } error[E0080]: evaluation of constant value failed - --> $DIR/ub-enum.rs:98:77 + --> $DIR/ub-enum.rs:93:77 | LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) }; | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type error[E0080]: evaluation of constant value failed - --> $DIR/ub-enum.rs:100:77 + --> $DIR/ub-enum.rs:95:77 | LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) }; | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type @@ -130,68 +119,3 @@ LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { error: aborting due to 13 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:27:1 - | -LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:31:1 - | -LL | const BAD_ENUM_WRAPPED: Wrap = unsafe { mem::transmute(&1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:46:1 - | -LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:50:1 - | -LL | const BAD_ENUM2_WRAPPED: Wrap = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:65:1 - | -LL | const BAD_ENUM2_OPTION_PTR: Option = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/const-eval/ub-enum.64bit.stderr b/src/test/ui/consts/const-eval/ub-enum.64bit.stderr index 930f8130bc347..280ba25a83ca8 100644 --- a/src/test/ui/consts/const-eval/ub-enum.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-enum.64bit.stderr @@ -9,31 +9,26 @@ LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) }; 01 00 00 00 00 00 00 00 │ ........ } -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/ub-enum.rs:27:1 | LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) }; | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:31:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-enum.rs:30:1 | LL | const BAD_ENUM_WRAPPED: Wrap = unsafe { mem::transmute(&1) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:44:1 + --> $DIR/ub-enum.rs:42:1 | LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) }; | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .: encountered 0x0000000000000000, but expected a valid enum tag @@ -43,47 +38,41 @@ LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) }; 00 00 00 00 00 00 00 00 │ ........ } -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:46:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-enum.rs:44:1 | LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:50:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-enum.rs:47:1 | LL | const BAD_ENUM2_WRAPPED: Wrap = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: evaluation of constant value failed - --> $DIR/ub-enum.rs:60:42 + --> $DIR/ub-enum.rs:56:42 | LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:65:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-enum.rs:61:1 | LL | const BAD_ENUM2_OPTION_PTR: Option = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:83:1 + --> $DIR/ub-enum.rs:78:1 | LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered a value of the never type `!` @@ -94,7 +83,7 @@ LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:85:1 + --> $DIR/ub-enum.rs:80:1 | LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered a value of uninhabited type Never @@ -105,7 +94,7 @@ LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:93:1 + --> $DIR/ub-enum.rs:88:1 | LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) @@ -116,13 +105,13 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran } error[E0080]: evaluation of constant value failed - --> $DIR/ub-enum.rs:98:77 + --> $DIR/ub-enum.rs:93:77 | LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) }; | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type error[E0080]: evaluation of constant value failed - --> $DIR/ub-enum.rs:100:77 + --> $DIR/ub-enum.rs:95:77 | LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) }; | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type @@ -130,68 +119,3 @@ LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { error: aborting due to 13 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:27:1 - | -LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:31:1 - | -LL | const BAD_ENUM_WRAPPED: Wrap = unsafe { mem::transmute(&1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:46:1 - | -LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:50:1 - | -LL | const BAD_ENUM2_WRAPPED: Wrap = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-enum.rs:65:1 - | -LL | const BAD_ENUM2_OPTION_PTR: Option = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/const-eval/ub-enum.rs b/src/test/ui/consts/const-eval/ub-enum.rs index 9e1c28e2351a8..6935be2f92fe6 100644 --- a/src/test/ui/consts/const-eval/ub-enum.rs +++ b/src/test/ui/consts/const-eval/ub-enum.rs @@ -25,12 +25,10 @@ const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) }; //~^ ERROR is undefined behavior const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const BAD_ENUM_WRAPPED: Wrap = unsafe { mem::transmute(&1) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // # simple enum with discriminant 2 @@ -44,12 +42,10 @@ enum Enum2 { const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) }; //~^ ERROR is undefined behavior const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // something wrapping the enum so that we test layout first, not enum const BAD_ENUM2_WRAPPED: Wrap = unsafe { mem::transmute(&0) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // Undef enum discriminant. #[repr(C)] @@ -63,8 +59,7 @@ const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init }; // Pointer value in an enum with a niche that is not just 0. const BAD_ENUM2_OPTION_PTR: Option = unsafe { mem::transmute(&0) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // # valid discriminant for uninhabited variant diff --git a/src/test/ui/consts/const-eval/ub-int-array.32bit.stderr b/src/test/ui/consts/const-eval/ub-int-array.32bit.stderr index 6100a98d161e2..edcde13b0e037 100644 --- a/src/test/ui/consts/const-eval/ub-int-array.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-int-array.32bit.stderr @@ -1,17 +1,17 @@ error[E0080]: evaluation of constant value failed - --> $DIR/ub-int-array.rs:16:9 + --> $DIR/ub-int-array.rs:15:9 | LL | MaybeUninit { uninit: () }.init, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: evaluation of constant value failed - --> $DIR/ub-int-array.rs:31:13 + --> $DIR/ub-int-array.rs:30:13 | LL | MaybeUninit { uninit: () }.init, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: evaluation of constant value failed - --> $DIR/ub-int-array.rs:57:13 + --> $DIR/ub-int-array.rs:56:13 | LL | MaybeUninit { uninit: () }.init, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory diff --git a/src/test/ui/consts/const-eval/ub-int-array.64bit.stderr b/src/test/ui/consts/const-eval/ub-int-array.64bit.stderr index 6100a98d161e2..edcde13b0e037 100644 --- a/src/test/ui/consts/const-eval/ub-int-array.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-int-array.64bit.stderr @@ -1,17 +1,17 @@ error[E0080]: evaluation of constant value failed - --> $DIR/ub-int-array.rs:16:9 + --> $DIR/ub-int-array.rs:15:9 | LL | MaybeUninit { uninit: () }.init, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: evaluation of constant value failed - --> $DIR/ub-int-array.rs:31:13 + --> $DIR/ub-int-array.rs:30:13 | LL | MaybeUninit { uninit: () }.init, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: evaluation of constant value failed - --> $DIR/ub-int-array.rs:57:13 + --> $DIR/ub-int-array.rs:56:13 | LL | MaybeUninit { uninit: () }.init, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory diff --git a/src/test/ui/consts/const-eval/ub-int-array.rs b/src/test/ui/consts/const-eval/ub-int-array.rs index cb85e3b016a98..a68d3fb17bcfc 100644 --- a/src/test/ui/consts/const-eval/ub-int-array.rs +++ b/src/test/ui/consts/const-eval/ub-int-array.rs @@ -1,4 +1,3 @@ -#![allow(const_err)] // make sure we cannot allow away the errors tested here // stderr-per-bitwidth //! Test the "array of int" fast path in validity checking, and in particular whether it //! points at the right array element. diff --git a/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr b/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr index 693c0e99bfd95..dbd05b8f4249a 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr @@ -10,13 +10,13 @@ LL | const NULL_PTR: NonNull = unsafe { mem::transmute(0usize) }; } error[E0080]: evaluation of constant value failed - --> $DIR/ub-nonnull.rs:19:30 + --> $DIR/ub-nonnull.rs:18:30 | LL | let out_of_bounds_ptr = &ptr[255]; | ^^^^^^^^ dereferencing pointer failed: alloc11 has size 1, so pointer to 256 bytes starting at offset 0 is out-of-bounds error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:23:1 + --> $DIR/ub-nonnull.rs:22:1 | LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 @@ -27,7 +27,7 @@ LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:25:1 + --> $DIR/ub-nonnull.rs:24:1 | LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 @@ -38,13 +38,13 @@ LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; } error[E0080]: evaluation of constant value failed - --> $DIR/ub-nonnull.rs:33:36 + --> $DIR/ub-nonnull.rs:32:36 | LL | const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:42:1 + --> $DIR/ub-nonnull.rs:41:1 | LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30 @@ -55,7 +55,7 @@ LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:48:1 + --> $DIR/ub-nonnull.rs:47:1 | LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30 diff --git a/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr b/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr index d22191213ac36..5a1ac09bd35ac 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr @@ -10,13 +10,13 @@ LL | const NULL_PTR: NonNull = unsafe { mem::transmute(0usize) }; } error[E0080]: evaluation of constant value failed - --> $DIR/ub-nonnull.rs:19:30 + --> $DIR/ub-nonnull.rs:18:30 | LL | let out_of_bounds_ptr = &ptr[255]; | ^^^^^^^^ dereferencing pointer failed: alloc11 has size 1, so pointer to 256 bytes starting at offset 0 is out-of-bounds error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:23:1 + --> $DIR/ub-nonnull.rs:22:1 | LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 @@ -27,7 +27,7 @@ LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:25:1 + --> $DIR/ub-nonnull.rs:24:1 | LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 @@ -38,13 +38,13 @@ LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; } error[E0080]: evaluation of constant value failed - --> $DIR/ub-nonnull.rs:33:36 + --> $DIR/ub-nonnull.rs:32:36 | LL | const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:42:1 + --> $DIR/ub-nonnull.rs:41:1 | LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30 @@ -55,7 +55,7 @@ LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:48:1 + --> $DIR/ub-nonnull.rs:47:1 | LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30 diff --git a/src/test/ui/consts/const-eval/ub-nonnull.rs b/src/test/ui/consts/const-eval/ub-nonnull.rs index 777c6d9880e1b..d22a99cd01e68 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.rs +++ b/src/test/ui/consts/const-eval/ub-nonnull.rs @@ -1,6 +1,6 @@ // stderr-per-bitwidth #![feature(rustc_attrs)] -#![allow(const_err, invalid_value)] // make sure we cannot allow away the errors tested here +#![allow(invalid_value)] // make sure we cannot allow away the errors tested here use std::mem; use std::ptr::NonNull; @@ -12,7 +12,6 @@ const NON_NULL_PTR: NonNull = unsafe { mem::transmute(&1) }; const NULL_PTR: NonNull = unsafe { mem::transmute(0usize) }; //~^ ERROR it is undefined behavior to use this value -#[deny(const_err)] // this triggers a `const_err` so validation does not even happen const OUT_OF_BOUNDS_PTR: NonNull = { unsafe { let ptr: &[u8; 256] = mem::transmute(&0u8); // &0 gets promoted so it does not dangle // Use address-of-element for pointer arithmetic. This could wrap around to null! diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr b/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr index 66b993764e933..6f5c028cbcab6 100644 --- a/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr @@ -42,60 +42,47 @@ LL | const NULL_BOX: Box = unsafe { mem::transmute(0usize) }; 00 00 00 00 │ .... } -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/ub-ref-ptr.rs:31:1 | LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:35:39 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-ref-ptr.rs:34:39 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:35:38 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-ref-ptr.rs:34:38 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:41:86 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-ref-ptr.rs:38:86 | LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:41:85 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-ref-ptr.rs:38:85 | LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:47:1 + --> $DIR/ub-ref-ptr.rs:42:1 | LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated) @@ -106,7 +93,7 @@ LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:50:1 + --> $DIR/ub-ref-ptr.rs:45:1 | LL | const USIZE_AS_BOX: Box = unsafe { mem::transmute(1337usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated) @@ -117,13 +104,13 @@ LL | const USIZE_AS_BOX: Box = unsafe { mem::transmute(1337usize) }; } error[E0080]: evaluation of constant value failed - --> $DIR/ub-ref-ptr.rs:53:41 + --> $DIR/ub-ref-ptr.rs:48:41 | LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:57:1 + --> $DIR/ub-ref-ptr.rs:52:1 | LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer @@ -134,13 +121,13 @@ LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) }; } error[E0080]: evaluation of constant value failed - --> $DIR/ub-ref-ptr.rs:59:38 + --> $DIR/ub-ref-ptr.rs:54:38 | LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:62:1 + --> $DIR/ub-ref-ptr.rs:57:1 | LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer @@ -151,7 +138,7 @@ LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:64:1 + --> $DIR/ub-ref-ptr.rs:59:1 | LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered alloc41, but expected a function pointer @@ -164,64 +151,3 @@ LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) }; error: aborting due to 16 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:31:1 - | -LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:35:39 - | -LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:35:38 - | -LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:41:86 - | -LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:41:85 - | -LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr b/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr index cbf120a397ecf..5ffb710d45683 100644 --- a/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr @@ -42,60 +42,47 @@ LL | const NULL_BOX: Box = unsafe { mem::transmute(0usize) }; 00 00 00 00 00 00 00 00 │ ........ } -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/ub-ref-ptr.rs:31:1 | LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:35:39 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-ref-ptr.rs:34:39 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:35:38 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-ref-ptr.rs:34:38 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:41:86 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-ref-ptr.rs:38:86 | LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:41:85 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-ref-ptr.rs:38:85 | LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:47:1 + --> $DIR/ub-ref-ptr.rs:42:1 | LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated) @@ -106,7 +93,7 @@ LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:50:1 + --> $DIR/ub-ref-ptr.rs:45:1 | LL | const USIZE_AS_BOX: Box = unsafe { mem::transmute(1337usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated) @@ -117,13 +104,13 @@ LL | const USIZE_AS_BOX: Box = unsafe { mem::transmute(1337usize) }; } error[E0080]: evaluation of constant value failed - --> $DIR/ub-ref-ptr.rs:53:41 + --> $DIR/ub-ref-ptr.rs:48:41 | LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:57:1 + --> $DIR/ub-ref-ptr.rs:52:1 | LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer @@ -134,13 +121,13 @@ LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) }; } error[E0080]: evaluation of constant value failed - --> $DIR/ub-ref-ptr.rs:59:38 + --> $DIR/ub-ref-ptr.rs:54:38 | LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:62:1 + --> $DIR/ub-ref-ptr.rs:57:1 | LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer @@ -151,7 +138,7 @@ LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:64:1 + --> $DIR/ub-ref-ptr.rs:59:1 | LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered alloc41, but expected a function pointer @@ -164,64 +151,3 @@ LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) }; error: aborting due to 16 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:31:1 - | -LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:35:39 - | -LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:35:38 - | -LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; - | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:41:86 - | -LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-ref-ptr.rs:41:85 - | -LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; - | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.rs b/src/test/ui/consts/const-eval/ub-ref-ptr.rs index c62848f70db04..92049d4c1792f 100644 --- a/src/test/ui/consts/const-eval/ub-ref-ptr.rs +++ b/src/test/ui/consts/const-eval/ub-ref-ptr.rs @@ -29,20 +29,15 @@ const NULL_BOX: Box = unsafe { mem::transmute(0usize) }; // but that would fail to compile; so we ended up breaking user code that would // have worked fine had we not promoted. const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out -//~| ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed +//~| ERROR evaluation of constant value failed const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out -//~| ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed +//~| ERROR evaluation of constant value failed const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) }; //~^ ERROR it is undefined behavior to use this value diff --git a/src/test/ui/consts/const-eval/ub-uninhabit.32bit.stderr b/src/test/ui/consts/const-eval/ub-uninhabit.32bit.stderr index 7f0feb1300494..7d32322574162 100644 --- a/src/test/ui/consts/const-eval/ub-uninhabit.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-uninhabit.32bit.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-uninhabit.rs:15:1 + --> $DIR/ub-uninhabit.rs:14:1 | LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type Bar @@ -8,7 +8,7 @@ LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init }; = note: the raw bytes of the constant (size: 0, align: 1) {} error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-uninhabit.rs:18:1 + --> $DIR/ub-uninhabit.rs:17:1 | LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar @@ -19,7 +19,7 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-uninhabit.rs:21:1 + --> $DIR/ub-uninhabit.rs:20:1 | LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered a value of uninhabited type Bar diff --git a/src/test/ui/consts/const-eval/ub-uninhabit.64bit.stderr b/src/test/ui/consts/const-eval/ub-uninhabit.64bit.stderr index 4dcbbc2f5e41b..2b7659f5d107e 100644 --- a/src/test/ui/consts/const-eval/ub-uninhabit.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-uninhabit.64bit.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-uninhabit.rs:15:1 + --> $DIR/ub-uninhabit.rs:14:1 | LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type Bar @@ -8,7 +8,7 @@ LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init }; = note: the raw bytes of the constant (size: 0, align: 1) {} error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-uninhabit.rs:18:1 + --> $DIR/ub-uninhabit.rs:17:1 | LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar @@ -19,7 +19,7 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-uninhabit.rs:21:1 + --> $DIR/ub-uninhabit.rs:20:1 | LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered a value of uninhabited type Bar diff --git a/src/test/ui/consts/const-eval/ub-uninhabit.rs b/src/test/ui/consts/const-eval/ub-uninhabit.rs index 33fbd14c4726e..213f15b79174e 100644 --- a/src/test/ui/consts/const-eval/ub-uninhabit.rs +++ b/src/test/ui/consts/const-eval/ub-uninhabit.rs @@ -1,5 +1,4 @@ // stderr-per-bitwidth -#![allow(const_err)] // make sure we cannot allow away the errors tested here use std::mem; diff --git a/src/test/ui/consts/const-eval/ub-upvars.rs b/src/test/ui/consts/const-eval/ub-upvars.rs index 57dd7b9e58132..ceac5987031a4 100644 --- a/src/test/ui/consts/const-eval/ub-upvars.rs +++ b/src/test/ui/consts/const-eval/ub-upvars.rs @@ -1,5 +1,5 @@ // stderr-per-bitwidth -#![allow(const_err, invalid_value)] // make sure we cannot allow away the errors tested here +#![allow(invalid_value)] // make sure we cannot allow away the errors tested here use std::mem; diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr b/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr index 2d4218a94f549..c8b46608d6bac 100644 --- a/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:37:1 + --> $DIR/ub-wide-ptr.rs:36:1 | LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation) @@ -10,7 +10,7 @@ LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:39:1 + --> $DIR/ub-wide-ptr.rs:38:1 | LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, usize::MAX)) },); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid reference metadata: slice is bigger than largest supported object @@ -20,31 +20,26 @@ LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, us ╾─allocN─╼ ff ff ff ff │ ╾──╼.... } -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:42:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:41:1 | LL | const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:46:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:44:1 | LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:49:1 + --> $DIR/ub-wide-ptr.rs:46:1 | LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize::MAX)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object @@ -55,7 +50,7 @@ LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize: } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:53:1 + --> $DIR/ub-wide-ptr.rs:50:1 | LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit:: { uninit: () }]) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .: encountered uninitialized data in `str` @@ -66,7 +61,7 @@ LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit: } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:56:1 + --> $DIR/ub-wide-ptr.rs:53:1 | LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit:: { uninit: () }]) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered uninitialized data in `str` @@ -77,13 +72,13 @@ LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUni } error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:63:1 + --> $DIR/ub-wide-ptr.rs:60:1 | LL | const SLICE_LENGTH_UNINIT: &[u8] = unsafe { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:70:1 + --> $DIR/ub-wide-ptr.rs:67:1 | LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation) @@ -94,7 +89,7 @@ LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:73:1 + --> $DIR/ub-wide-ptr.rs:70:1 | LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize::MAX)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object @@ -104,19 +99,17 @@ LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, is ╾─allocN─╼ ff ff ff 7f │ ╾──╼.... } -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:76:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:73:1 | LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:80:1 + --> $DIR/ub-wide-ptr.rs:76:1 | LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (going beyond the bounds of its allocation) @@ -126,19 +119,17 @@ LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999us ╾─allocN─╼ e7 03 00 00 │ ╾──╼.... } -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:83:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:79:1 | LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:88:1 + --> $DIR/ub-wide-ptr.rs:83:1 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .[0]: encountered 0x03, but expected a boolean @@ -148,17 +139,14 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; ╾─allocN─╼ │ ╾──╼ } -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:88:40 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:83:40 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; - | ------------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:96:1 + --> $DIR/ub-wide-ptr.rs:90:1 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered 0x03, but expected a boolean @@ -168,17 +156,14 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3 ╾allocN─╼ │ ╾──╼ } -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:96:42 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:90:42 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); - | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:101:1 + --> $DIR/ub-wide-ptr.rs:94:1 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..1[0]: encountered 0x03, but expected a boolean @@ -188,23 +173,20 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran ╾allocN─╼ │ ╾──╼ } -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:101:42 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:94:42 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); - | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:110:1 + --> $DIR/ub-wide-ptr.rs:102:1 | LL | const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:119:1 + --> $DIR/ub-wide-ptr.rs:111:1 | LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer @@ -215,7 +197,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W(( } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:123:1 + --> $DIR/ub-wide-ptr.rs:115:1 | LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer @@ -226,7 +208,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W(( } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:127:1 + --> $DIR/ub-wide-ptr.rs:119:1 | LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0x4[noalloc], but expected a vtable pointer @@ -237,25 +219,25 @@ LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u } error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:130:57 + --> $DIR/ub-wide-ptr.rs:122:57 | LL | const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, &[0u8; 128])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:133:57 + --> $DIR/ub-wide-ptr.rs:125:57 | LL | const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:136:56 + --> $DIR/ub-wide-ptr.rs:128:56 | LL | const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:139:1 + --> $DIR/ub-wide-ptr.rs:131:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer @@ -266,7 +248,7 @@ LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::trans } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:144:1 + --> $DIR/ub-wide-ptr.rs:136:1 | LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..: encountered 0x03, but expected a boolean @@ -277,7 +259,7 @@ LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:149:1 + --> $DIR/ub-wide-ptr.rs:141:1 | LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer @@ -288,7 +270,7 @@ LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:151:1 + --> $DIR/ub-wide-ptr.rs:143:1 | LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a vtable pointer @@ -299,13 +281,13 @@ LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transm } error[E0080]: could not evaluate static initializer - --> $DIR/ub-wide-ptr.rs:157:5 + --> $DIR/ub-wide-ptr.rs:149:5 | LL | mem::transmute::<_, &dyn Trait>((&92u8, 0usize)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance) error[E0080]: could not evaluate static initializer - --> $DIR/ub-wide-ptr.rs:161:5 + --> $DIR/ub-wide-ptr.rs:153:5 | LL | mem::transmute::<_, &dyn Trait>((&92u8, &3u64)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable @@ -313,88 +295,3 @@ LL | mem::transmute::<_, &dyn Trait>((&92u8, &3u64)) error: aborting due to 32 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:42:1 - | -LL | const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:46:1 - | -LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:76:1 - | -LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:83:1 - | -LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:88:40 - | -LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; - | ------------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:96:42 - | -LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); - | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:101:42 - | -LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); - | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr b/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr index 9997b8fe5f225..70574d2dc3b5f 100644 --- a/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:37:1 + --> $DIR/ub-wide-ptr.rs:36:1 | LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation) @@ -10,7 +10,7 @@ LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:39:1 + --> $DIR/ub-wide-ptr.rs:38:1 | LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, usize::MAX)) },); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid reference metadata: slice is bigger than largest supported object @@ -20,31 +20,26 @@ LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, us ╾───────allocN───────╼ ff ff ff ff ff ff ff ff │ ╾──────╼........ } -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:42:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:41:1 | LL | const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:46:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:44:1 | LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:49:1 + --> $DIR/ub-wide-ptr.rs:46:1 | LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize::MAX)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object @@ -55,7 +50,7 @@ LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize: } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:53:1 + --> $DIR/ub-wide-ptr.rs:50:1 | LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit:: { uninit: () }]) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .: encountered uninitialized data in `str` @@ -66,7 +61,7 @@ LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit: } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:56:1 + --> $DIR/ub-wide-ptr.rs:53:1 | LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit:: { uninit: () }]) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered uninitialized data in `str` @@ -77,13 +72,13 @@ LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUni } error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:63:1 + --> $DIR/ub-wide-ptr.rs:60:1 | LL | const SLICE_LENGTH_UNINIT: &[u8] = unsafe { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:70:1 + --> $DIR/ub-wide-ptr.rs:67:1 | LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation) @@ -94,7 +89,7 @@ LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:73:1 + --> $DIR/ub-wide-ptr.rs:70:1 | LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize::MAX)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object @@ -104,19 +99,17 @@ LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, is ╾───────allocN───────╼ ff ff ff ff ff ff ff 7f │ ╾──────╼........ } -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:76:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:73:1 | LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:80:1 + --> $DIR/ub-wide-ptr.rs:76:1 | LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (going beyond the bounds of its allocation) @@ -126,19 +119,17 @@ LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999us ╾───────allocN───────╼ e7 03 00 00 00 00 00 00 │ ╾──────╼........ } -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:83:1 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:79:1 | LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:88:1 + --> $DIR/ub-wide-ptr.rs:83:1 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .[0]: encountered 0x03, but expected a boolean @@ -148,17 +139,14 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; ╾───────allocN───────╼ │ ╾──────╼ } -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:88:40 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:83:40 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; - | ------------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:96:1 + --> $DIR/ub-wide-ptr.rs:90:1 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered 0x03, but expected a boolean @@ -168,17 +156,14 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3 ╾──────allocN───────╼ │ ╾──────╼ } -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:96:42 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:90:42 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); - | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:101:1 + --> $DIR/ub-wide-ptr.rs:94:1 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..1[0]: encountered 0x03, but expected a boolean @@ -188,23 +173,20 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran ╾──────allocN───────╼ │ ╾──────╼ } -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:101:42 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-wide-ptr.rs:94:42 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); - | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:110:1 + --> $DIR/ub-wide-ptr.rs:102:1 | LL | const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:119:1 + --> $DIR/ub-wide-ptr.rs:111:1 | LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer @@ -215,7 +197,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W(( } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:123:1 + --> $DIR/ub-wide-ptr.rs:115:1 | LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer @@ -226,7 +208,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W(( } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:127:1 + --> $DIR/ub-wide-ptr.rs:119:1 | LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0x4[noalloc], but expected a vtable pointer @@ -237,25 +219,25 @@ LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u } error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:130:57 + --> $DIR/ub-wide-ptr.rs:122:57 | LL | const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, &[0u8; 128])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:133:57 + --> $DIR/ub-wide-ptr.rs:125:57 | LL | const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:136:56 + --> $DIR/ub-wide-ptr.rs:128:56 | LL | const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:139:1 + --> $DIR/ub-wide-ptr.rs:131:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer @@ -266,7 +248,7 @@ LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::trans } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:144:1 + --> $DIR/ub-wide-ptr.rs:136:1 | LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..: encountered 0x03, but expected a boolean @@ -277,7 +259,7 @@ LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:149:1 + --> $DIR/ub-wide-ptr.rs:141:1 | LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer @@ -288,7 +270,7 @@ LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:151:1 + --> $DIR/ub-wide-ptr.rs:143:1 | LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a vtable pointer @@ -299,13 +281,13 @@ LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transm } error[E0080]: could not evaluate static initializer - --> $DIR/ub-wide-ptr.rs:157:5 + --> $DIR/ub-wide-ptr.rs:149:5 | LL | mem::transmute::<_, &dyn Trait>((&92u8, 0usize)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance) error[E0080]: could not evaluate static initializer - --> $DIR/ub-wide-ptr.rs:161:5 + --> $DIR/ub-wide-ptr.rs:153:5 | LL | mem::transmute::<_, &dyn Trait>((&92u8, &3u64)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable @@ -313,88 +295,3 @@ LL | mem::transmute::<_, &dyn Trait>((&92u8, &3u64)) error: aborting due to 32 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:42:1 - | -LL | const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:46:1 - | -LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:76:1 - | -LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:83:1 - | -LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:88:40 - | -LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; - | ------------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:96:42 - | -LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); - | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ub-wide-ptr.rs:101:42 - | -LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); - | -------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.rs b/src/test/ui/consts/const-eval/ub-wide-ptr.rs index 788403a6df67a..65f6f023528d0 100644 --- a/src/test/ui/consts/const-eval/ub-wide-ptr.rs +++ b/src/test/ui/consts/const-eval/ub-wide-ptr.rs @@ -9,8 +9,7 @@ use std::mem; // normalize-stderr-test "size \d+" -> "size N" /// A newtype wrapper to prevent MIR generation from inserting reborrows that would affect the error -/// message. Use this whenever the message is "any use of this value will cause an error" instead of -/// "it is undefined behavior to use this value". +/// message. #[repr(transparent)] struct W(T); @@ -40,12 +39,10 @@ const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, usize:: //~^ ERROR it is undefined behavior to use this value // bad str const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // bad str in user-defined unsized type const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize::MAX)) }; //~^ ERROR it is undefined behavior to use this value @@ -74,34 +71,29 @@ const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize:: //~^ ERROR it is undefined behavior to use this value // bad slice: length not an int const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // bad slice box: length too big const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) }; //~^ ERROR it is undefined behavior to use this value // bad slice box: length not an int const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) }; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed // bad data *inside* the slice const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; //~^ ERROR it is undefined behavior to use this value -//~| ERROR any use of this value will cause an error -//~| WARNING this was previously accepted +//~| ERROR evaluation of constant value failed // good MySliceBool const MYSLICE_GOOD: &MySliceBool = &MySlice(true, [false]); // bad: sized field is not okay const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); //~^ ERROR it is undefined behavior to use this value -//~| ERROR any use of this value will cause an error -//~| WARNING this was previously accepted +//~| ERROR evaluation of constant value failed // bad: unsized part is not okay const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); //~^ ERROR it is undefined behavior to use this value -//~| ERROR any use of this value will cause an error -//~| WARNING this was previously accepted +//~| ERROR evaluation of constant value failed // # raw slice const RAW_SLICE_VALID: *const [u8] = unsafe { mem::transmute((&42u8, 1usize)) }; // ok diff --git a/src/test/ui/consts/const-eval/union-ub.32bit.stderr b/src/test/ui/consts/const-eval/union-ub.32bit.stderr index 38ded4d65cfb6..e5c8f88be98a7 100644 --- a/src/test/ui/consts/const-eval/union-ub.32bit.stderr +++ b/src/test/ui/consts/const-eval/union-ub.32bit.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub.rs:33:1 + --> $DIR/union-ub.rs:32:1 | LL | const BAD_BOOL: bool = unsafe { DummyUnion { u8: 42 }.bool}; | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x2a, but expected a boolean @@ -10,7 +10,7 @@ LL | const BAD_BOOL: bool = unsafe { DummyUnion { u8: 42 }.bool}; } error[E0080]: evaluation of constant value failed - --> $DIR/union-ub.rs:35:36 + --> $DIR/union-ub.rs:34:36 | LL | const UNINIT_BOOL: bool = unsafe { DummyUnion { unit: () }.bool}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory diff --git a/src/test/ui/consts/const-eval/union-ub.64bit.stderr b/src/test/ui/consts/const-eval/union-ub.64bit.stderr index 38ded4d65cfb6..e5c8f88be98a7 100644 --- a/src/test/ui/consts/const-eval/union-ub.64bit.stderr +++ b/src/test/ui/consts/const-eval/union-ub.64bit.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub.rs:33:1 + --> $DIR/union-ub.rs:32:1 | LL | const BAD_BOOL: bool = unsafe { DummyUnion { u8: 42 }.bool}; | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x2a, but expected a boolean @@ -10,7 +10,7 @@ LL | const BAD_BOOL: bool = unsafe { DummyUnion { u8: 42 }.bool}; } error[E0080]: evaluation of constant value failed - --> $DIR/union-ub.rs:35:36 + --> $DIR/union-ub.rs:34:36 | LL | const UNINIT_BOOL: bool = unsafe { DummyUnion { unit: () }.bool}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory diff --git a/src/test/ui/consts/const-eval/union-ub.rs b/src/test/ui/consts/const-eval/union-ub.rs index bb29edcf8b011..043870c9c25dc 100644 --- a/src/test/ui/consts/const-eval/union-ub.rs +++ b/src/test/ui/consts/const-eval/union-ub.rs @@ -1,5 +1,4 @@ // stderr-per-bitwidth -#![allow(const_err)] // make sure we cannot allow away the errors tested here #[repr(C)] union DummyUnion { diff --git a/src/test/ui/consts/const-eval/union_promotion.rs b/src/test/ui/consts/const-eval/union_promotion.rs index 7167f88a1185b..18894c45fd822 100644 --- a/src/test/ui/consts/const-eval/union_promotion.rs +++ b/src/test/ui/consts/const-eval/union_promotion.rs @@ -1,5 +1,3 @@ -#![allow(const_err)] - #[repr(C)] union Foo { a: &'static u32, diff --git a/src/test/ui/consts/const-eval/union_promotion.stderr b/src/test/ui/consts/const-eval/union_promotion.stderr index ed186e3ebd2f5..70808c520d3f9 100644 --- a/src/test/ui/consts/const-eval/union_promotion.stderr +++ b/src/test/ui/consts/const-eval/union_promotion.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/union_promotion.rs:10:29 + --> $DIR/union_promotion.rs:8:29 | LL | let x: &'static bool = &unsafe { | ____________-------------____^ diff --git a/src/test/ui/consts/const-eval/unused-broken-const.rs b/src/test/ui/consts/const-eval/unused-broken-const.rs index 3b4523681002e..0d2776bc2e3a6 100644 --- a/src/test/ui/consts/const-eval/unused-broken-const.rs +++ b/src/test/ui/consts/const-eval/unused-broken-const.rs @@ -3,7 +3,6 @@ // compile-flags: --emit=dep-info,metadata const FOO: i32 = [][0]; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR evaluation of constant value failed fn main() {} diff --git a/src/test/ui/consts/const-eval/unused-broken-const.stderr b/src/test/ui/consts/const-eval/unused-broken-const.stderr index cdc1e9d97f4c6..fbb10feb76b16 100644 --- a/src/test/ui/consts/const-eval/unused-broken-const.stderr +++ b/src/test/ui/consts/const-eval/unused-broken-const.stderr @@ -1,23 +1,9 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/unused-broken-const.rs:5:18 | LL | const FOO: i32 = [][0]; - | -------------- ^^^^^ index out of bounds: the length is 0 but the index is 0 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default + | ^^^^^ index out of bounds: the length is 0 but the index is 0 error: aborting due to previous error -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/unused-broken-const.rs:5:18 - | -LL | const FOO: i32 = [][0]; - | -------------- ^^^^^ index out of bounds: the length is 0 but the index is 0 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/valid-const.rs b/src/test/ui/consts/const-eval/valid-const.rs index 9e4707182d596..5f47d1c4f5c31 100644 --- a/src/test/ui/consts/const-eval/valid-const.rs +++ b/src/test/ui/consts/const-eval/valid-const.rs @@ -1,7 +1,6 @@ // check-pass // Some constants that *are* valid -#![deny(const_err)] use std::mem; use std::ptr::NonNull; diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr index dd948f9adb379..63639729a2a91 100644 --- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr +++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr @@ -20,10 +20,10 @@ LL | unsafe { std::mem::transmute(()) } | inside `foo` at $DIR/validate_uninhabited_zsts.rs:4:14 ... LL | const FOO: [empty::Empty; 3] = [foo(); 3]; - | ----- inside `FOO` at $DIR/validate_uninhabited_zsts.rs:20:33 + | ----- inside `FOO` at $DIR/validate_uninhabited_zsts.rs:19:33 error[E0080]: it is undefined behavior to use this value - --> $DIR/validate_uninhabited_zsts.rs:23:1 + --> $DIR/validate_uninhabited_zsts.rs:21:1 | LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0].0: encountered a value of uninhabited type empty::Void @@ -32,7 +32,7 @@ LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; = note: the raw bytes of the constant (size: 0, align: 1) {} warning: the type `empty::Empty` does not permit zero-initialization - --> $DIR/validate_uninhabited_zsts.rs:23:42 + --> $DIR/validate_uninhabited_zsts.rs:21:42 | LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr index dd948f9adb379..63639729a2a91 100644 --- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr +++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr @@ -20,10 +20,10 @@ LL | unsafe { std::mem::transmute(()) } | inside `foo` at $DIR/validate_uninhabited_zsts.rs:4:14 ... LL | const FOO: [empty::Empty; 3] = [foo(); 3]; - | ----- inside `FOO` at $DIR/validate_uninhabited_zsts.rs:20:33 + | ----- inside `FOO` at $DIR/validate_uninhabited_zsts.rs:19:33 error[E0080]: it is undefined behavior to use this value - --> $DIR/validate_uninhabited_zsts.rs:23:1 + --> $DIR/validate_uninhabited_zsts.rs:21:1 | LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0].0: encountered a value of uninhabited type empty::Void @@ -32,7 +32,7 @@ LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; = note: the raw bytes of the constant (size: 0, align: 1) {} warning: the type `empty::Empty` does not permit zero-initialization - --> $DIR/validate_uninhabited_zsts.rs:23:42 + --> $DIR/validate_uninhabited_zsts.rs:21:42 | LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs index 96f3312758292..c0b3262150575 100644 --- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs +++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs @@ -16,10 +16,8 @@ pub mod empty { pub struct Empty(Void); } -#[warn(const_err)] const FOO: [empty::Empty; 3] = [foo(); 3]; -#[warn(const_err)] const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3]; //~^ ERROR it is undefined behavior to use this value //~| WARN the type `empty::Empty` does not permit zero-initialization diff --git a/src/test/ui/consts/const-external-macro-const-err.rs b/src/test/ui/consts/const-external-macro-const-err.rs index 440c42e32ef39..5bd84330bb79f 100644 --- a/src/test/ui/consts/const-external-macro-const-err.rs +++ b/src/test/ui/consts/const-external-macro-const-err.rs @@ -9,6 +9,5 @@ extern crate external_macro; use external_macro::static_assert; fn main() { - static_assert!(2 + 2 == 5); //~ ERROR - //~| WARN this was previously accepted by the compiler but is being phased out + static_assert!(2 + 2 == 5); //~ ERROR constant } diff --git a/src/test/ui/consts/const-external-macro-const-err.stderr b/src/test/ui/consts/const-external-macro-const-err.stderr index b57615e9a7cf0..81f6c09ffb86a 100644 --- a/src/test/ui/consts/const-external-macro-const-err.stderr +++ b/src/test/ui/consts/const-external-macro-const-err.stderr @@ -1,25 +1,11 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const-external-macro-const-err.rs:12:5 | LL | static_assert!(2 + 2 == 5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1 | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default = note: this error originates in the macro `static_assert` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-external-macro-const-err.rs:12:5 - | -LL | static_assert!(2 + 2 == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - = note: this error originates in the macro `static_assert` (in Nightly builds, run with -Z macro-backtrace for more info) - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-float-bits-reject-conv.rs b/src/test/ui/consts/const-float-bits-reject-conv.rs index b156ded4a6c2a..5bf54fdbb3fd6 100644 --- a/src/test/ui/consts/const-float-bits-reject-conv.rs +++ b/src/test/ui/consts/const-float-bits-reject-conv.rs @@ -28,22 +28,18 @@ fn f32() { const MASKED_NAN2: u32 = f32::NAN.to_bits() ^ 0x0055_5555; const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); - //~^ ERROR any use of this value will cause an error - //~| WARNING this was previously accepted + //~^ ERROR evaluation of constant value failed const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); - //~^ ERROR any use of this value will cause an error - //~| WARNING this was previously accepted + //~^ ERROR evaluation of constant value failed // LLVM does not guarantee that loads and stores of NaNs preserve their exact bit pattern. // In practice, this seems to only cause a problem on x86, since the most widely used calling // convention mandates that floating point values are returned on the x87 FPU stack. See #73328. if !cfg!(target_arch = "x86") { const_assert!(f32::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); - //~^ ERROR any use of this value will cause an error - //~| WARNING this was previously accepted + //~^ ERROR evaluation of constant value failed const_assert!(f32::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); - //~^ ERROR any use of this value will cause an error - //~| WARNING this was previously accepted + //~^ ERROR evaluation of constant value failed } } @@ -55,20 +51,16 @@ fn f64() { const MASKED_NAN2: u64 = f64::NAN.to_bits() ^ 0x0005_5555_5555_5555; const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); - //~^ ERROR any use of this value will cause an error - //~| WARNING this was previously accepted + //~^ ERROR evaluation of constant value failed const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); - //~^ ERROR any use of this value will cause an error - //~| WARNING this was previously accepted + //~^ ERROR evaluation of constant value failed // See comment above. if !cfg!(target_arch = "x86") { const_assert!(f64::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); - //~^ ERROR any use of this value will cause an error - //~| WARNING this was previously accepted + //~^ ERROR evaluation of constant value failed const_assert!(f64::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); - //~^ ERROR any use of this value will cause an error - //~| WARNING this was previously accepted + //~^ ERROR evaluation of constant value failed } } diff --git a/src/test/ui/consts/const-float-bits-reject-conv.stderr b/src/test/ui/consts/const-float-bits-reject-conv.stderr index 908fef7265df1..b3575f64153ae 100644 --- a/src/test/ui/consts/const-float-bits-reject-conv.stderr +++ b/src/test/ui/consts/const-float-bits-reject-conv.stderr @@ -36,54 +36,29 @@ LL | const MASKED_NAN2: u32 = f32::NAN.to_bits() ^ 0x0055_5555; | = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const-float-bits-reject-conv.rs:30:34 | -LL | const _: () = assert!($a); - | ----------- -... LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default -error: any use of this value will cause an error - --> $DIR/const-float-bits-reject-conv.rs:33:34 +error[E0080]: evaluation of constant value failed + --> $DIR/const-float-bits-reject-conv.rs:32:34 | -LL | const _: () = assert!($a); - | ----------- -... LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-float-bits-reject-conv.rs:41:38 +error[E0080]: evaluation of constant value failed + --> $DIR/const-float-bits-reject-conv.rs:39:38 | -LL | const _: () = assert!($a == $b); - | ----------- -... LL | const_assert!(f32::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-float-bits-reject-conv.rs:44:38 +error[E0080]: evaluation of constant value failed + --> $DIR/const-float-bits-reject-conv.rs:41:38 | -LL | const _: () = assert!($a == $b); - | ----------- -... LL | const_assert!(f32::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/num/f64.rs:LL:COL @@ -97,10 +72,10 @@ LL | panic!("const-eval error: cannot use f64::to_bits on a LL | unsafe { intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64) } | -------------------------------------------------------------------- inside `core::f64::::to_bits` at $SRC_DIR/core/src/num/f64.rs:LL:COL | - ::: $DIR/const-float-bits-reject-conv.rs:54:30 + ::: $DIR/const-float-bits-reject-conv.rs:50:30 | LL | const MASKED_NAN1: u64 = f64::NAN.to_bits() ^ 0x000A_AAAA_AAAA_AAAA; - | ------------------ inside `f64::MASKED_NAN1` at $DIR/const-float-bits-reject-conv.rs:54:30 + | ------------------ inside `f64::MASKED_NAN1` at $DIR/const-float-bits-reject-conv.rs:50:30 | = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -116,173 +91,37 @@ LL | panic!("const-eval error: cannot use f64::to_bits on a LL | unsafe { intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64) } | -------------------------------------------------------------------- inside `core::f64::::to_bits` at $SRC_DIR/core/src/num/f64.rs:LL:COL | - ::: $DIR/const-float-bits-reject-conv.rs:55:30 + ::: $DIR/const-float-bits-reject-conv.rs:51:30 | LL | const MASKED_NAN2: u64 = f64::NAN.to_bits() ^ 0x0005_5555_5555_5555; - | ------------------ inside `f64::MASKED_NAN2` at $DIR/const-float-bits-reject-conv.rs:55:30 + | ------------------ inside `f64::MASKED_NAN2` at $DIR/const-float-bits-reject-conv.rs:51:30 | = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) -error: any use of this value will cause an error - --> $DIR/const-float-bits-reject-conv.rs:57:34 +error[E0080]: evaluation of constant value failed + --> $DIR/const-float-bits-reject-conv.rs:53:34 | -LL | const _: () = assert!($a); - | ----------- -... LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-float-bits-reject-conv.rs:60:34 +error[E0080]: evaluation of constant value failed + --> $DIR/const-float-bits-reject-conv.rs:55:34 | -LL | const _: () = assert!($a); - | ----------- -... LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-float-bits-reject-conv.rs:66:38 +error[E0080]: evaluation of constant value failed + --> $DIR/const-float-bits-reject-conv.rs:60:38 | -LL | const _: () = assert!($a == $b); - | ----------- -... LL | const_assert!(f64::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -error: any use of this value will cause an error - --> $DIR/const-float-bits-reject-conv.rs:69:38 +error[E0080]: evaluation of constant value failed + --> $DIR/const-float-bits-reject-conv.rs:62:38 | -LL | const _: () = assert!($a == $b); - | ----------- -... LL | const_assert!(f64::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 error: aborting due to 12 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-float-bits-reject-conv.rs:30:34 - | -LL | const _: () = assert!($a); - | ----------- -... -LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); - | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-float-bits-reject-conv.rs:33:34 - | -LL | const _: () = assert!($a); - | ----------- -... -LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); - | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-float-bits-reject-conv.rs:41:38 - | -LL | const _: () = assert!($a == $b); - | ----------- -... -LL | const_assert!(f32::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); - | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-float-bits-reject-conv.rs:44:38 - | -LL | const _: () = assert!($a == $b); - | ----------- -... -LL | const_assert!(f32::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); - | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-float-bits-reject-conv.rs:57:34 - | -LL | const _: () = assert!($a); - | ----------- -... -LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); - | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-float-bits-reject-conv.rs:60:34 - | -LL | const _: () = assert!($a); - | ----------- -... -LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); - | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-float-bits-reject-conv.rs:66:38 - | -LL | const _: () = assert!($a == $b); - | ----------- -... -LL | const_assert!(f64::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); - | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-float-bits-reject-conv.rs:69:38 - | -LL | const _: () = assert!($a == $b); - | ----------- -... -LL | const_assert!(f64::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); - | ^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/const-int-arithmetic-overflow.rs b/src/test/ui/consts/const-int-arithmetic-overflow.rs index 99bbeaafda5c4..6446e94513cd7 100644 --- a/src/test/ui/consts/const-int-arithmetic-overflow.rs +++ b/src/test/ui/consts/const-int-arithmetic-overflow.rs @@ -1,6 +1,5 @@ // run-pass // compile-flags: -O -#![allow(const_err)] // Make sure arithmetic unary/binary ops actually return the right result, even when overflowing. // We have to put them in `const fn` and turn on optimizations to avoid overflow checks. diff --git a/src/test/ui/consts/const-len-underflow-separate-spans.rs b/src/test/ui/consts/const-len-underflow-separate-spans.rs index 7c3d1f320f2f6..478761aef2faa 100644 --- a/src/test/ui/consts/const-len-underflow-separate-spans.rs +++ b/src/test/ui/consts/const-len-underflow-separate-spans.rs @@ -5,8 +5,7 @@ const ONE: usize = 1; const TWO: usize = 2; const LEN: usize = ONE - TWO; -//~^ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~^ ERROR constant fn main() { let a: [i8; LEN] = unimplemented!(); diff --git a/src/test/ui/consts/const-len-underflow-separate-spans.stderr b/src/test/ui/consts/const-len-underflow-separate-spans.stderr index 56645980b0573..1416e695e4c6e 100644 --- a/src/test/ui/consts/const-len-underflow-separate-spans.stderr +++ b/src/test/ui/consts/const-len-underflow-separate-spans.stderr @@ -1,15 +1,11 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const-len-underflow-separate-spans.rs:7:20 | LL | const LEN: usize = ONE - TWO; - | ---------------- ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default + | ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow error[E0080]: evaluation of constant value failed - --> $DIR/const-len-underflow-separate-spans.rs:12:17 + --> $DIR/const-len-underflow-separate-spans.rs:11:17 | LL | let a: [i8; LEN] = unimplemented!(); | ^^^ referenced constant has errors @@ -17,14 +13,3 @@ LL | let a: [i8; LEN] = unimplemented!(); error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-len-underflow-separate-spans.rs:7:20 - | -LL | const LEN: usize = ONE - TWO; - | ---------------- ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/const-negation.rs b/src/test/ui/consts/const-negation.rs index 26c3c0b836bec..18bcdfb0130a9 100644 --- a/src/test/ui/consts/const-negation.rs +++ b/src/test/ui/consts/const-negation.rs @@ -1,8 +1,6 @@ // run-pass #![allow(overflowing_literals)] -#[deny(const_err)] - fn main() { #[cfg(target_pointer_width = "32")] const I: isize = -2147483648isize; diff --git a/src/test/ui/consts/const-prop-read-static-in-const.rs b/src/test/ui/consts/const-prop-read-static-in-const.rs index a65b707f012d0..21426205955be 100644 --- a/src/test/ui/consts/const-prop-read-static-in-const.rs +++ b/src/test/ui/consts/const-prop-read-static-in-const.rs @@ -2,8 +2,7 @@ #![allow(dead_code)] -const TEST: u8 = MY_STATIC; //~ ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +const TEST: u8 = MY_STATIC; //~ ERROR constant static MY_STATIC: u8 = 4; 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 3894133100361..793da62858770 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,12 +1,8 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const-prop-read-static-in-const.rs:5:18 | LL | const TEST: u8 = MY_STATIC; - | -------------- ^^^^^^^^^ constant accesses static - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default + | ^^^^^^^^^ constant accesses static warning: skipping const checks | @@ -18,14 +14,4 @@ LL | const TEST: u8 = MY_STATIC; error: aborting due to previous error; 1 warning emitted -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-prop-read-static-in-const.rs:5:18 - | -LL | const TEST: u8 = MY_STATIC; - | -------------- ^^^^^^^^^ constant accesses static - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.rs b/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.rs index 6653717778ba5..4df3a793b4c38 100644 --- a/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.rs +++ b/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.rs @@ -8,9 +8,7 @@ extern "C" { type Opaque; } -const _SIZE: usize = unsafe { size_of_val(&4 as *const i32 as *const Opaque) }; //~ ERROR -//~| WARN this was previously accepted by the compiler but is being phased out -const _ALIGN: usize = unsafe { min_align_of_val(&4 as *const i32 as *const Opaque) }; //~ ERROR -//~| WARN this was previously accepted by the compiler but is being phased out +const _SIZE: usize = unsafe { size_of_val(&4 as *const i32 as *const Opaque) }; //~ ERROR constant +const _ALIGN: usize = unsafe { min_align_of_val(&4 as *const i32 as *const Opaque) }; //~ ERROR constant fn main() {} diff --git a/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.stderr b/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.stderr index 0ed09ff834167..ad2de0f4d3129 100644 --- a/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.stderr +++ b/src/test/ui/consts/const-size_of_val-align_of_val-extern-type.stderr @@ -1,43 +1,15 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const-size_of_val-align_of_val-extern-type.rs:11:31 | LL | const _SIZE: usize = unsafe { size_of_val(&4 as *const i32 as *const Opaque) }; - | ------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `extern type` does not have known layout - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `extern type` does not have known layout -error: any use of this value will cause an error - --> $DIR/const-size_of_val-align_of_val-extern-type.rs:13:32 +error[E0080]: evaluation of constant value failed + --> $DIR/const-size_of_val-align_of_val-extern-type.rs:12:32 | LL | const _ALIGN: usize = unsafe { min_align_of_val(&4 as *const i32 as *const Opaque) }; - | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `extern type` does not have known layout - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `extern type` does not have known layout error: aborting due to 2 previous errors -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-size_of_val-align_of_val-extern-type.rs:11:31 - | -LL | const _SIZE: usize = unsafe { size_of_val(&4 as *const i32 as *const Opaque) }; - | ------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `extern type` does not have known layout - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-size_of_val-align_of_val-extern-type.rs:13:32 - | -LL | const _ALIGN: usize = unsafe { min_align_of_val(&4 as *const i32 as *const Opaque) }; - | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `extern type` does not have known layout - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-slice-oob.rs b/src/test/ui/consts/const-slice-oob.rs index 35e5a4d2233fe..429b978213214 100644 --- a/src/test/ui/consts/const-slice-oob.rs +++ b/src/test/ui/consts/const-slice-oob.rs @@ -1,10 +1,7 @@ -#[deny(const_err)] - const FOO: &'static[u32] = &[1, 2, 3]; const BAR: u32 = FOO[5]; //~^ index out of bounds: the length is 3 but the index is 5 -//~| ERROR any use of this value will cause an error -//~| WARN this was previously accepted by the compiler but is being phased out +//~| ERROR evaluation of constant value failed fn main() { let _ = BAR; diff --git a/src/test/ui/consts/const-slice-oob.stderr b/src/test/ui/consts/const-slice-oob.stderr index 167564549740b..746883a79a65b 100644 --- a/src/test/ui/consts/const-slice-oob.stderr +++ b/src/test/ui/consts/const-slice-oob.stderr @@ -1,23 +1,9 @@ -error: any use of this value will cause an error - --> $DIR/const-slice-oob.rs:4:18 +error[E0080]: evaluation of constant value failed + --> $DIR/const-slice-oob.rs:2:18 | LL | const BAR: u32 = FOO[5]; - | -------------- ^^^^^^ index out of bounds: the length is 3 but the index is 5 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default + | ^^^^^^ index out of bounds: the length is 3 but the index is 5 error: aborting due to previous error -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const-slice-oob.rs:4:18 - | -LL | const BAR: u32 = FOO[5]; - | -------------- ^^^^^^ index out of bounds: the length is 3 but the index is 5 - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const_limit/const_eval_limit_reached.rs b/src/test/ui/consts/const_limit/const_eval_limit_reached.rs index 773640b72e6ea..3ce038c1d3f77 100644 --- a/src/test/ui/consts/const_limit/const_eval_limit_reached.rs +++ b/src/test/ui/consts/const_limit/const_eval_limit_reached.rs @@ -4,8 +4,7 @@ const X: usize = { let mut x = 0; while x != 1000 { - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler but is being phased out + //~^ ERROR evaluation of constant value failed x += 1; } diff --git a/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr b/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr index 0f7d93a3be3ed..850aebdfb2a6d 100644 --- a/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr +++ b/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr @@ -1,29 +1,9 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/const_eval_limit_reached.rs:6:11 | -LL | const X: usize = { - | -------------- -LL | let mut x = 0; LL | while x != 1000 { | ^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default error: aborting due to previous error -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/const_eval_limit_reached.rs:6:11 - | -LL | const X: usize = { - | -------------- -LL | let mut x = 0; -LL | while x != 1000 { - | ^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/dangling-alloc-id-ice.rs b/src/test/ui/consts/dangling-alloc-id-ice.rs index 95acacdb78795..d591bfc731ce4 100644 --- a/src/test/ui/consts/dangling-alloc-id-ice.rs +++ b/src/test/ui/consts/dangling-alloc-id-ice.rs @@ -1,5 +1,4 @@ // https://github.com/rust-lang/rust/issues/55223 -#![allow(const_err)] union Foo<'a> { y: &'a (), diff --git a/src/test/ui/consts/dangling-alloc-id-ice.stderr b/src/test/ui/consts/dangling-alloc-id-ice.stderr index 8410034c041da..0a1cca4ca4d47 100644 --- a/src/test/ui/consts/dangling-alloc-id-ice.stderr +++ b/src/test/ui/consts/dangling-alloc-id-ice.stderr @@ -1,5 +1,5 @@ error: encountered dangling pointer in final constant - --> $DIR/dangling-alloc-id-ice.rs:9:1 + --> $DIR/dangling-alloc-id-ice.rs:8:1 | LL | const FOO: &() = { | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/extra-const-ub/detect-extra-ub.rs b/src/test/ui/consts/extra-const-ub/detect-extra-ub.rs index 86fbadb946d53..159cdf257b19c 100644 --- a/src/test/ui/consts/extra-const-ub/detect-extra-ub.rs +++ b/src/test/ui/consts/extra-const-ub/detect-extra-ub.rs @@ -13,15 +13,13 @@ const INVALID_BOOL: () = unsafe { const INVALID_PTR_IN_INT: () = unsafe { let _x: usize = transmute(&3u8); - //[with_flag]~^ ERROR: any use of this value will cause an error - //[with_flag]~| previously accepted + //[with_flag]~^ ERROR: evaluation of constant value failed }; const INVALID_SLICE_TO_USIZE_TRANSMUTE: () = unsafe { let x: &[u8] = &[0; 32]; let _x: (usize, usize) = transmute(x); - //[with_flag]~^ ERROR: any use of this value will cause an error - //[with_flag]~| previously accepted + //[with_flag]~^ ERROR: evaluation of constant value failed }; const UNALIGNED_PTR: () = unsafe { @@ -31,8 +29,7 @@ const UNALIGNED_PTR: () = unsafe { }; const UNALIGNED_READ: () = { - INNER; //[with_flag]~ERROR any use of this value will cause an error - //[with_flag]~| previously accepted + INNER; //[with_flag]~ERROR evaluation of constant value failed // There is an error here but its span is in the standard library so we cannot match it... // so we have this in a *nested* const, such that the *outer* const fails to use it. const INNER: () = unsafe { diff --git a/src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr b/src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr index a2d881f396e2f..3e119582291d3 100644 --- a/src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr +++ b/src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr @@ -4,36 +4,26 @@ error[E0080]: evaluation of constant value failed LL | let _x: bool = transmute(3u8); | ^^^^^^^^^^^^^^ constructing invalid value: encountered 0x03, but expected a boolean -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/detect-extra-ub.rs:15:21 | -LL | const INVALID_PTR_IN_INT: () = unsafe { - | ---------------------------- LL | let _x: usize = transmute(&3u8); | ^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default -error: any use of this value will cause an error - --> $DIR/detect-extra-ub.rs:22:30 +error[E0080]: evaluation of constant value failed + --> $DIR/detect-extra-ub.rs:21:30 | -LL | const INVALID_SLICE_TO_USIZE_TRANSMUTE: () = unsafe { - | ------------------------------------------ -LL | let x: &[u8] = &[0; 32]; LL | let _x: (usize, usize) = transmute(x); | ^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: evaluation of constant value failed - --> $DIR/detect-extra-ub.rs:28:20 + --> $DIR/detect-extra-ub.rs:26:20 | LL | let _x: &u32 = transmute(&[0u8; 4]); | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 4 byte alignment but found 1) @@ -52,66 +42,17 @@ LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); LL | unsafe { read(self) } | ---------- inside `ptr::const_ptr::::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - ::: $DIR/detect-extra-ub.rs:41:9 + ::: $DIR/detect-extra-ub.rs:38:9 | LL | ptr.read(); - | ---------- inside `INNER` at $DIR/detect-extra-ub.rs:41:9 + | ---------- inside `INNER` at $DIR/detect-extra-ub.rs:38:9 -error: any use of this value will cause an error - --> $DIR/detect-extra-ub.rs:34:5 +error[E0080]: evaluation of constant value failed + --> $DIR/detect-extra-ub.rs:32:5 | -LL | const UNALIGNED_READ: () = { - | ------------------------ LL | INNER; | ^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/detect-extra-ub.rs:15:21 - | -LL | const INVALID_PTR_IN_INT: () = unsafe { - | ---------------------------- -LL | let _x: usize = transmute(&3u8); - | ^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/detect-extra-ub.rs:22:30 - | -LL | const INVALID_SLICE_TO_USIZE_TRANSMUTE: () = unsafe { - | ------------------------------------------ -LL | let x: &[u8] = &[0; 32]; -LL | let _x: (usize, usize) = transmute(x); - | ^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/detect-extra-ub.rs:34:5 - | -LL | const UNALIGNED_READ: () = { - | ------------------------ -LL | INNER; - | ^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/invalid-union.32bit.stderr b/src/test/ui/consts/invalid-union.32bit.stderr index f4d69c801abdd..bad07989e4035 100644 --- a/src/test/ui/consts/invalid-union.32bit.stderr +++ b/src/test/ui/consts/invalid-union.32bit.stderr @@ -9,27 +9,12 @@ LL | fn main() { ╾─alloc7──╼ │ ╾──╼ } -error: erroneous constant used +error[E0080]: erroneous constant used --> $DIR/invalid-union.rs:42:25 | LL | let _: &'static _ = &C; | ^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: erroneous constant used - --> $DIR/invalid-union.rs:42:25 - | -LL | let _: &'static _ = &C; - | ^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/invalid-union.64bit.stderr b/src/test/ui/consts/invalid-union.64bit.stderr index 69b63d3ff9242..a209f0038ccaf 100644 --- a/src/test/ui/consts/invalid-union.64bit.stderr +++ b/src/test/ui/consts/invalid-union.64bit.stderr @@ -9,27 +9,12 @@ LL | fn main() { ╾───────alloc7────────╼ │ ╾──────╼ } -error: erroneous constant used +error[E0080]: erroneous constant used --> $DIR/invalid-union.rs:42:25 | LL | let _: &'static _ = &C; | ^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: erroneous constant used - --> $DIR/invalid-union.rs:42:25 - | -LL | let _: &'static _ = &C; - | ^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/invalid-union.rs b/src/test/ui/consts/invalid-union.rs index efeddf75cb557..435d26d6e995e 100644 --- a/src/test/ui/consts/invalid-union.rs +++ b/src/test/ui/consts/invalid-union.rs @@ -40,5 +40,4 @@ const C: S = { fn main() { //~ ERROR it is undefined behavior to use this value let _: &'static _ = &C; //~ ERROR erroneous constant used - //~^ WARN this was previously accepted } diff --git a/src/test/ui/consts/issue-46553.rs b/src/test/ui/consts/issue-46553.rs index 9438df1937bdd..abeaf10f2b524 100644 --- a/src/test/ui/consts/issue-46553.rs +++ b/src/test/ui/consts/issue-46553.rs @@ -1,5 +1,4 @@ // run-pass -#![deny(const_err)] pub struct Data { function: fn() -> T, diff --git a/src/test/ui/consts/issue-56164.rs b/src/test/ui/consts/issue-56164.rs index fd02d2154805c..df3e3bf902809 100644 --- a/src/test/ui/consts/issue-56164.rs +++ b/src/test/ui/consts/issue-56164.rs @@ -1,7 +1,6 @@ const fn foo() { (||{})() } //~^ ERROR cannot call non-const closure -//~| ERROR erroneous constant -//~| WARN this was previously accepted +//~| ERROR erroneous constant used const fn bad(input: fn()) { input() diff --git a/src/test/ui/consts/issue-56164.stderr b/src/test/ui/consts/issue-56164.stderr index b672f5690da3e..c5b2c57fbee3d 100644 --- a/src/test/ui/consts/issue-56164.stderr +++ b/src/test/ui/consts/issue-56164.stderr @@ -8,32 +8,18 @@ LL | const fn foo() { (||{})() } = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants error: function pointer calls are not allowed in constant functions - --> $DIR/issue-56164.rs:7:5 + --> $DIR/issue-56164.rs:6:5 | LL | input() | ^^^^^^^ -error: erroneous constant used +error[E0080]: erroneous constant used --> $DIR/issue-56164.rs:1:18 | LL | const fn foo() { (||{})() } | ^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0015`. -Future incompatibility report: Future breakage diagnostic: -error: erroneous constant used - --> $DIR/issue-56164.rs:1:18 - | -LL | const fn foo() { (||{})() } - | ^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - +Some errors have detailed explanations: E0015, E0080. +For more information about an error, try `rustc --explain E0015`. diff --git a/src/test/ui/consts/issue-66693.rs b/src/test/ui/consts/issue-66693.rs index 99d28eb773f84..1ff250be1b02e 100644 --- a/src/test/ui/consts/issue-66693.rs +++ b/src/test/ui/consts/issue-66693.rs @@ -10,8 +10,7 @@ static _FOO: () = panic!(true); const fn _foo() { panic!(&1); //~^ ERROR: argument to `panic!()` in a const context must have type `&str` - //~| ERROR: erroneous constant used [const_err] - //~| WARNING: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + //~| ERROR: erroneous constant used } // ensure that conforming panics don't cause an error diff --git a/src/test/ui/consts/issue-66693.stderr b/src/test/ui/consts/issue-66693.stderr index 5320da005620c..911374f507ec8 100644 --- a/src/test/ui/consts/issue-66693.stderr +++ b/src/test/ui/consts/issue-66693.stderr @@ -22,26 +22,12 @@ LL | panic!(&1); | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) -error: erroneous constant used +error[E0080]: erroneous constant used --> $DIR/issue-66693.rs:11:12 | LL | panic!(&1); | ^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default error: aborting due to 4 previous errors -Future incompatibility report: Future breakage diagnostic: -error: erroneous constant used - --> $DIR/issue-66693.rs:11:12 - | -LL | panic!(&1); - | ^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/issue-miri-1910.stderr b/src/test/ui/consts/issue-miri-1910.stderr index bfd5421a93c55..3872e3d4f0dec 100644 --- a/src/test/ui/consts/issue-miri-1910.stderr +++ b/src/test/ui/consts/issue-miri-1910.stderr @@ -1,4 +1,4 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); @@ -6,42 +6,20 @@ LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); | | | unable to copy parts of a pointer from memory at ALLOC | inside `std::ptr::read::` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | inside `ptr::const_ptr::::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `C` at $DIR/issue-miri-1910.rs:8:5 | - ::: $DIR/issue-miri-1910.rs:5:1 + ::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | const C: () = unsafe { - | ----------- +LL | unsafe { read(self) } + | ---------- inside `ptr::const_ptr::::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -error: aborting due to previous error - -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL + ::: $DIR/issue-miri-1910.rs:8:5 | -LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | unable to copy parts of a pointer from memory at ALLOC - | inside `std::ptr::read::` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | inside `ptr::const_ptr::::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `C` at $DIR/issue-miri-1910.rs:8:5 - | - ::: $DIR/issue-miri-1910.rs:5:1 +LL | (&foo as *const _ as *const u8).add(one_and_a_half_pointers).read(); + | ------------------------------------------------------------------- inside `C` at $DIR/issue-miri-1910.rs:8:5 | -LL | const C: () = unsafe { - | ----------- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/miri_unleashed/abi-mismatch.rs b/src/test/ui/consts/miri_unleashed/abi-mismatch.rs index 3360e9cacda65..205f7183b75e9 100644 --- a/src/test/ui/consts/miri_unleashed/abi-mismatch.rs +++ b/src/test/ui/consts/miri_unleashed/abi-mismatch.rs @@ -2,7 +2,6 @@ // compile-flags: -Z unleash-the-miri-inside-of-you #![feature(const_extern_fn)] -#![allow(const_err)] const extern "C" fn c_fn() {} diff --git a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr b/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr index aaba19c2c8b0e..840d698ebbfaf 100644 --- a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr +++ b/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr @@ -1,19 +1,19 @@ error[E0080]: could not evaluate static initializer - --> $DIR/abi-mismatch.rs:10:5 + --> $DIR/abi-mismatch.rs:9:5 | LL | my_fn(); | ^^^^^^^ | | | calling a function with calling convention C using calling convention Rust - | inside `call_rust_fn` at $DIR/abi-mismatch.rs:10:5 + | inside `call_rust_fn` at $DIR/abi-mismatch.rs:9:5 ... LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) }); - | --------------------------------------------------------------------- inside `VAL` at $DIR/abi-mismatch.rs:16:18 + | --------------------------------------------------------------------- inside `VAL` at $DIR/abi-mismatch.rs:15:18 warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/abi-mismatch.rs:10:5 + --> $DIR/abi-mismatch.rs:9:5 | LL | my_fn(); | ^^^^^^^ diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.rs b/src/test/ui/consts/miri_unleashed/assoc_const.rs index 5f520c2cfdbce..76ed667a514ff 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const.rs +++ b/src/test/ui/consts/miri_unleashed/assoc_const.rs @@ -1,8 +1,6 @@ // build-fail // compile-flags: -Zunleash-the-miri-inside-of-you -#![allow(const_err)] - // a test demonstrating why we do need to run static const qualification on associated constants // instead of just checking the final constant diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.stderr b/src/test/ui/consts/miri_unleashed/assoc_const.stderr index c64107ee26e18..519bd0748e2b7 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const.stderr +++ b/src/test/ui/consts/miri_unleashed/assoc_const.stderr @@ -1,22 +1,4 @@ -error[E0080]: erroneous constant used - --> $DIR/assoc_const.rs:31:13 - | -LL | let y = , String>>::F; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - -warning: skipping const checks - | -help: skipping check that does not even have a feature gate - --> $DIR/assoc_const.rs:14:20 - | -LL | const F: u32 = (U::X, 42).1; - | ^^^^^^^^^^ - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error +error[E0080]: evaluation of `, std::string::String>>::F` failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | LL | pub unsafe fn drop_in_place(to_drop: *mut T) { @@ -25,18 +7,26 @@ LL | pub unsafe fn drop_in_place(to_drop: *mut T) { | calling non-const function ` as Drop>::drop` | inside `std::ptr::drop_in_place::> - shim(Some(Vec))` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL | inside `std::ptr::drop_in_place::<(Vec, u32)> - shim(Some((Vec, u32)))` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | inside `, String>>::F` at $DIR/assoc_const.rs:14:31 | - ::: $DIR/assoc_const.rs:14:5 + ::: $DIR/assoc_const.rs:12:31 | LL | const F: u32 = (U::X, 42).1; - | ------------ + | - inside `, String>>::F` at $DIR/assoc_const.rs:12:31 + +error[E0080]: erroneous constant used + --> $DIR/assoc_const.rs:29:13 | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/assoc_const.rs:4:10 +LL | let y = , String>>::F; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + +warning: skipping const checks | -LL | #![allow(const_err)] - | ^^^^^^^^^ +help: skipping check that does not even have a feature gate + --> $DIR/assoc_const.rs:12:20 + | +LL | const F: u32 = (U::X, 42).1; + | ^^^^^^^^^^ + +error: aborting due to 2 previous errors; 1 warning emitted +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/miri_unleashed/assoc_const_2.rs b/src/test/ui/consts/miri_unleashed/assoc_const_2.rs index 30dd2a51585c5..8377141ea5e12 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const_2.rs +++ b/src/test/ui/consts/miri_unleashed/assoc_const_2.rs @@ -1,7 +1,5 @@ // build-fail -#![allow(const_err)] - // a test demonstrating that const qualification cannot prevent monomorphization time errors trait Foo { @@ -9,7 +7,7 @@ trait Foo { } trait Bar { - const F: u32 = 100 / U::X; + const F: u32 = 100 / U::X; //~ ERROR evaluation of `>::F` failed } impl Foo for () { diff --git a/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr b/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr index 950c3db1b7e46..2bf753c2ba3df 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr +++ b/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr @@ -1,24 +1,15 @@ +error[E0080]: evaluation of `>::F` failed + --> $DIR/assoc_const_2.rs:10:20 + | +LL | const F: u32 = 100 / U::X; + | ^^^^^^^^^^ attempt to divide `100_u32` by zero + error[E0080]: erroneous constant used - --> $DIR/assoc_const_2.rs:29:13 + --> $DIR/assoc_const_2.rs:27:13 | LL | let y = >::F; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/assoc_const_2.rs:12:20 - | -LL | const F: u32 = 100 / U::X; - | ------------ ^^^^^^^^^^ attempt to divide `100_u32` by zero - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/assoc_const_2.rs:3:10 - | -LL | #![allow(const_err)] - | ^^^^^^^^^ - diff --git a/src/test/ui/consts/miri_unleashed/box.rs b/src/test/ui/consts/miri_unleashed/box.rs index 32796c67229a7..c2a260aa13c29 100644 --- a/src/test/ui/consts/miri_unleashed/box.rs +++ b/src/test/ui/consts/miri_unleashed/box.rs @@ -1,6 +1,5 @@ // compile-flags: -Zunleash-the-miri-inside-of-you #![feature(box_syntax)] -#![allow(const_err)] use std::mem::ManuallyDrop; diff --git a/src/test/ui/consts/miri_unleashed/box.stderr b/src/test/ui/consts/miri_unleashed/box.stderr index 05d9858dc09f0..bc5d4a2576eb8 100644 --- a/src/test/ui/consts/miri_unleashed/box.stderr +++ b/src/test/ui/consts/miri_unleashed/box.stderr @@ -1,5 +1,5 @@ error[E0080]: could not evaluate static initializer - --> $DIR/box.rs:10:11 + --> $DIR/box.rs:9:11 | LL | &mut *(box 0) | ^^^^^^^ calling non-const function `alloc::alloc::exchange_malloc` @@ -7,22 +7,22 @@ LL | &mut *(box 0) warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/box.rs:10:11 + --> $DIR/box.rs:9:11 | LL | &mut *(box 0) | ^^^^^^^ help: skipping check for `const_mut_refs` feature - --> $DIR/box.rs:10:16 + --> $DIR/box.rs:9:16 | LL | &mut *(box 0) | ^ help: skipping check for `const_mut_refs` feature - --> $DIR/box.rs:10:5 + --> $DIR/box.rs:9:5 | LL | &mut *(box 0) | ^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/box.rs:10:5 + --> $DIR/box.rs:9:5 | LL | &mut *(box 0) | ^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr new file mode 100644 index 0000000000000..a6f467b9ef489 --- /dev/null +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr @@ -0,0 +1,81 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/const_refers_to_static.rs:9:5 + | +LL | FOO.fetch_add(1, Ordering::Relaxed) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `AtomicUsize::fetch_add` + +error[E0080]: evaluation of constant value failed + --> $DIR/const_refers_to_static.rs:14:14 + | +LL | unsafe { *(&FOO as *const _ as *const usize) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static + +error[E0080]: evaluation of constant value failed + --> $DIR/const_refers_to_static.rs:18:32 + | +LL | const READ_MUT: u32 = unsafe { MUTABLE }; + | ^^^^^^^ constant accesses static + +error[E0080]: it is undefined behavior to use this value + --> $DIR/const_refers_to_static.rs:20:1 + | +LL | const REF_INTERIOR_MUT: &usize = { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 4, align: 4) { + ╾─alloc4──╼ │ ╾──╼ + } + +error[E0080]: it is undefined behavior to use this value + --> $DIR/const_refers_to_static.rs:27:1 + | +LL | const READ_IMMUT: &usize = { + | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 4, align: 4) { + ╾─alloc5──╼ │ ╾──╼ + } + +warning: skipping const checks + | +help: skipping check that does not even have a feature gate + --> $DIR/const_refers_to_static.rs:9:5 + | +LL | FOO.fetch_add(1, Ordering::Relaxed) + | ^^^ +help: skipping check that does not even have a feature gate + --> $DIR/const_refers_to_static.rs:9:5 + | +LL | FOO.fetch_add(1, Ordering::Relaxed) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: skipping check that does not even have a feature gate + --> $DIR/const_refers_to_static.rs:14:17 + | +LL | unsafe { *(&FOO as *const _ as *const usize) } + | ^^^ +help: skipping check that does not even have a feature gate + --> $DIR/const_refers_to_static.rs:18:32 + | +LL | const READ_MUT: u32 = unsafe { MUTABLE }; + | ^^^^^^^ +help: skipping check that does not even have a feature gate + --> $DIR/const_refers_to_static.rs:18:32 + | +LL | const READ_MUT: u32 = unsafe { MUTABLE }; + | ^^^^^^^ +help: skipping check that does not even have a feature gate + --> $DIR/const_refers_to_static.rs:23:18 + | +LL | unsafe { &*(&FOO as *const _ as *const usize) } + | ^^^ +help: skipping check that does not even have a feature gate + --> $DIR/const_refers_to_static.rs:30:6 + | +LL | &FOO + | ^^^ + +error: aborting due to 5 previous errors; 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.64bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr new file mode 100644 index 0000000000000..cfaf31a6e0c43 --- /dev/null +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr @@ -0,0 +1,81 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/const_refers_to_static.rs:9:5 + | +LL | FOO.fetch_add(1, Ordering::Relaxed) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `AtomicUsize::fetch_add` + +error[E0080]: evaluation of constant value failed + --> $DIR/const_refers_to_static.rs:14:14 + | +LL | unsafe { *(&FOO as *const _ as *const usize) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static + +error[E0080]: evaluation of constant value failed + --> $DIR/const_refers_to_static.rs:18:32 + | +LL | const READ_MUT: u32 = unsafe { MUTABLE }; + | ^^^^^^^ constant accesses static + +error[E0080]: it is undefined behavior to use this value + --> $DIR/const_refers_to_static.rs:20:1 + | +LL | const REF_INTERIOR_MUT: &usize = { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 8, align: 8) { + ╾───────alloc4────────╼ │ ╾──────╼ + } + +error[E0080]: it is undefined behavior to use this value + --> $DIR/const_refers_to_static.rs:27:1 + | +LL | const READ_IMMUT: &usize = { + | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 8, align: 8) { + ╾───────alloc5────────╼ │ ╾──────╼ + } + +warning: skipping const checks + | +help: skipping check that does not even have a feature gate + --> $DIR/const_refers_to_static.rs:9:5 + | +LL | FOO.fetch_add(1, Ordering::Relaxed) + | ^^^ +help: skipping check that does not even have a feature gate + --> $DIR/const_refers_to_static.rs:9:5 + | +LL | FOO.fetch_add(1, Ordering::Relaxed) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: skipping check that does not even have a feature gate + --> $DIR/const_refers_to_static.rs:14:17 + | +LL | unsafe { *(&FOO as *const _ as *const usize) } + | ^^^ +help: skipping check that does not even have a feature gate + --> $DIR/const_refers_to_static.rs:18:32 + | +LL | const READ_MUT: u32 = unsafe { MUTABLE }; + | ^^^^^^^ +help: skipping check that does not even have a feature gate + --> $DIR/const_refers_to_static.rs:18:32 + | +LL | const READ_MUT: u32 = unsafe { MUTABLE }; + | ^^^^^^^ +help: skipping check that does not even have a feature gate + --> $DIR/const_refers_to_static.rs:23:18 + | +LL | unsafe { &*(&FOO as *const _ as *const usize) } + | ^^^ +help: skipping check that does not even have a feature gate + --> $DIR/const_refers_to_static.rs:30:6 + | +LL | &FOO + | ^^^ + +error: aborting due to 5 previous errors; 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 c9dc1de515b90..7ed5a48d996c6 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,31 +1,33 @@ -// build-fail // compile-flags: -Zunleash-the-miri-inside-of-you -#![allow(const_err)] +// stderr-per-bitwidth use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering; -// These fail during CTFE (as they read a static), so they only cause an error -// when *using* the const. - const MUTATE_INTERIOR_MUT: usize = { static FOO: AtomicUsize = AtomicUsize::new(0); - FOO.fetch_add(1, Ordering::Relaxed) + FOO.fetch_add(1, Ordering::Relaxed) //~ERROR evaluation of constant value failed }; const READ_INTERIOR_MUT: usize = { static FOO: AtomicUsize = AtomicUsize::new(0); - unsafe { *(&FOO as *const _ as *const usize) } + unsafe { *(&FOO as *const _ as *const usize) } //~ERROR evaluation of constant value failed }; static mut MUTABLE: u32 = 0; -const READ_MUT: u32 = unsafe { MUTABLE }; +const READ_MUT: u32 = unsafe { MUTABLE }; //~ERROR evaluation of constant value failed + +const REF_INTERIOR_MUT: &usize = { //~ ERROR undefined behavior to use this value +//~| encountered a reference pointing to a static variable + static FOO: AtomicUsize = AtomicUsize::new(0); + unsafe { &*(&FOO as *const _ as *const usize) } +}; + +// ok some day perhaps +const READ_IMMUT: &usize = { //~ ERROR it is undefined behavior to use this value +//~| encountered a reference pointing to a static variable + static FOO: usize = 0; + &FOO +}; -fn main() { - MUTATE_INTERIOR_MUT; - //~^ ERROR: erroneous constant used - READ_INTERIOR_MUT; - //~^ ERROR: erroneous constant used - READ_MUT; - //~^ ERROR: erroneous constant used -} +fn main() {} 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 deleted file mode 100644 index 03359e62264e5..0000000000000 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr +++ /dev/null @@ -1,100 +0,0 @@ -error[E0080]: erroneous constant used - --> $DIR/const_refers_to_static.rs:25:5 - | -LL | MUTATE_INTERIOR_MUT; - | ^^^^^^^^^^^^^^^^^^^ referenced constant has errors - -error[E0080]: erroneous constant used - --> $DIR/const_refers_to_static.rs:27:5 - | -LL | READ_INTERIOR_MUT; - | ^^^^^^^^^^^^^^^^^ referenced constant has errors - -error[E0080]: erroneous constant used - --> $DIR/const_refers_to_static.rs:29:5 - | -LL | READ_MUT; - | ^^^^^^^^ referenced constant has errors - -warning: skipping const checks - | -help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static.rs:13:5 - | -LL | FOO.fetch_add(1, Ordering::Relaxed) - | ^^^ -help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static.rs:13:5 - | -LL | FOO.fetch_add(1, Ordering::Relaxed) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static.rs:18:17 - | -LL | unsafe { *(&FOO as *const _ as *const usize) } - | ^^^ -help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static.rs:22:32 - | -LL | const READ_MUT: u32 = unsafe { MUTABLE }; - | ^^^^^^^ -help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static.rs:22:32 - | -LL | const READ_MUT: u32 = unsafe { MUTABLE }; - | ^^^^^^^ - -error: aborting due to 3 previous errors; 1 warning emitted - -For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/const_refers_to_static.rs:13:5 - | -LL | const MUTATE_INTERIOR_MUT: usize = { - | -------------------------------- -LL | static FOO: AtomicUsize = AtomicUsize::new(0); -LL | FOO.fetch_add(1, Ordering::Relaxed) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `AtomicUsize::fetch_add` - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const_refers_to_static.rs:3:10 - | -LL | #![allow(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/const_refers_to_static.rs:18:14 - | -LL | const READ_INTERIOR_MUT: usize = { - | ------------------------------ -LL | static FOO: AtomicUsize = AtomicUsize::new(0); -LL | unsafe { *(&FOO as *const _ as *const usize) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const_refers_to_static.rs:3:10 - | -LL | #![allow(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/const_refers_to_static.rs:22:32 - | -LL | const READ_MUT: u32 = unsafe { MUTABLE }; - | ------------------- ^^^^^^^ constant accesses static - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const_refers_to_static.rs:3:10 - | -LL | #![allow(const_err)] - | ^^^^^^^^^ - diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.32bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.32bit.stderr deleted file mode 100644 index 14173ac9f69b4..0000000000000 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.32bit.stderr +++ /dev/null @@ -1,38 +0,0 @@ -error[E0080]: it is undefined behavior to use this value - --> $DIR/const_refers_to_static2.rs:11:1 - | -LL | const REF_INTERIOR_MUT: &usize = { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 4, align: 4) { - ╾─alloc1──╼ │ ╾──╼ - } - -error[E0080]: it is undefined behavior to use this value - --> $DIR/const_refers_to_static2.rs:18:1 - | -LL | const READ_IMMUT: &usize = { - | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 4, align: 4) { - ╾─alloc2──╼ │ ╾──╼ - } - -warning: skipping const checks - | -help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static2.rs:14:18 - | -LL | unsafe { &*(&FOO as *const _ as *const usize) } - | ^^^ -help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static2.rs:21:6 - | -LL | &FOO - | ^^^ - -error: aborting due to 2 previous errors; 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_static2.64bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.64bit.stderr deleted file mode 100644 index e7e51a41856e2..0000000000000 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.64bit.stderr +++ /dev/null @@ -1,38 +0,0 @@ -error[E0080]: it is undefined behavior to use this value - --> $DIR/const_refers_to_static2.rs:11:1 - | -LL | const REF_INTERIOR_MUT: &usize = { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 8, align: 8) { - ╾───────alloc1────────╼ │ ╾──────╼ - } - -error[E0080]: it is undefined behavior to use this value - --> $DIR/const_refers_to_static2.rs:18:1 - | -LL | const READ_IMMUT: &usize = { - | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 8, align: 8) { - ╾───────alloc2────────╼ │ ╾──────╼ - } - -warning: skipping const checks - | -help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static2.rs:14:18 - | -LL | unsafe { &*(&FOO as *const _ as *const usize) } - | ^^^ -help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static2.rs:21:6 - | -LL | &FOO - | ^^^ - -error: aborting due to 2 previous errors; 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_static2.rs b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.rs deleted file mode 100644 index 8b8e262fb9dca..0000000000000 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.rs +++ /dev/null @@ -1,24 +0,0 @@ -// compile-flags: -Zunleash-the-miri-inside-of-you -// stderr-per-bitwidth -#![allow(const_err)] - -use std::sync::atomic::AtomicUsize; -use std::sync::atomic::Ordering; - -// These only fail during validation (they do not use but just create a reference to a static), -// so they cause an immediate error when *defining* the const. - -const REF_INTERIOR_MUT: &usize = { //~ ERROR undefined behavior to use this value -//~| encountered a reference pointing to a static variable - static FOO: AtomicUsize = AtomicUsize::new(0); - unsafe { &*(&FOO as *const _ as *const usize) } -}; - -// ok some day perhaps -const READ_IMMUT: &usize = { //~ ERROR it is undefined behavior to use this value -//~| encountered a reference pointing to a static variable - static FOO: usize = 0; - &FOO -}; - -fn main() {} diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr index f66a96ae3f1ee..6df2fe3d03b9d 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/const_refers_to_static_cross_crate.rs:12:1 + --> $DIR/const_refers_to_static_cross_crate.rs:10:1 | LL | const SLICE_MUT: &[u8; 1] = { | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant @@ -10,13 +10,13 @@ LL | const SLICE_MUT: &[u8; 1] = { } error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:40:9 + --> $DIR/const_refers_to_static_cross_crate.rs:34:9 | LL | SLICE_MUT => true, | ^^^^^^^^^ error[E0080]: it is undefined behavior to use this value - --> $DIR/const_refers_to_static_cross_crate.rs:17:1 + --> $DIR/const_refers_to_static_cross_crate.rs:15:1 | LL | const U8_MUT: &u8 = { | ^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant @@ -27,75 +27,55 @@ LL | const U8_MUT: &u8 = { } error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:49:9 + --> $DIR/const_refers_to_static_cross_crate.rs:43:9 | LL | U8_MUT => true, | ^^^^^^ -warning: any use of this value will cause an error - --> $DIR/const_refers_to_static_cross_crate.rs:25:15 +error[E0080]: evaluation of constant value failed + --> $DIR/const_refers_to_static_cross_crate.rs:22:15 | -LL | const U8_MUT2: &u8 = { - | ------------------ LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const_refers_to_static_cross_crate.rs:23:8 - | -LL | #[warn(const_err)] - | ^^^^^^^^^ error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:60:9 + --> $DIR/const_refers_to_static_cross_crate.rs:54:9 | LL | U8_MUT2 => true, | ^^^^^^^ -warning: any use of this value will cause an error - --> $DIR/const_refers_to_static_cross_crate.rs:32:20 +error[E0080]: evaluation of constant value failed + --> $DIR/const_refers_to_static_cross_crate.rs:27:20 | -LL | const U8_MUT3: &u8 = { - | ------------------ LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const_refers_to_static_cross_crate.rs:30:8 - | -LL | #[warn(const_err)] - | ^^^^^^^^^ error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:68:9 + --> $DIR/const_refers_to_static_cross_crate.rs:62:9 | LL | U8_MUT3 => true, | ^^^^^^^ error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:40:9 + --> $DIR/const_refers_to_static_cross_crate.rs:34:9 | LL | SLICE_MUT => true, | ^^^^^^^^^ error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:49:9 + --> $DIR/const_refers_to_static_cross_crate.rs:43:9 | LL | U8_MUT => true, | ^^^^^^ error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:60:9 + --> $DIR/const_refers_to_static_cross_crate.rs:54:9 | LL | U8_MUT2 => true, | ^^^^^^^ error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:68:9 + --> $DIR/const_refers_to_static_cross_crate.rs:62:9 | LL | U8_MUT3 => true, | ^^^^^^^ @@ -103,90 +83,56 @@ LL | U8_MUT3 => true, warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:14:15 + --> $DIR/const_refers_to_static_cross_crate.rs:12:15 | LL | unsafe { &static_cross_crate::ZERO } | ^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:14:15 + --> $DIR/const_refers_to_static_cross_crate.rs:12:15 | LL | unsafe { &static_cross_crate::ZERO } | ^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:19:15 + --> $DIR/const_refers_to_static_cross_crate.rs:17:15 | LL | unsafe { &static_cross_crate::ZERO[0] } | ^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:19:15 + --> $DIR/const_refers_to_static_cross_crate.rs:17:15 | LL | unsafe { &static_cross_crate::ZERO[0] } | ^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:19:15 + --> $DIR/const_refers_to_static_cross_crate.rs:17:15 | LL | unsafe { &static_cross_crate::ZERO[0] } | ^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:25:17 + --> $DIR/const_refers_to_static_cross_crate.rs:22:17 | LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:32:20 + --> $DIR/const_refers_to_static_cross_crate.rs:27:20 | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:32:20 + --> $DIR/const_refers_to_static_cross_crate.rs:27:20 | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:32:20 + --> $DIR/const_refers_to_static_cross_crate.rs:27:20 | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:32:20 + --> $DIR/const_refers_to_static_cross_crate.rs:27:20 | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 10 previous errors; 3 warnings emitted +error: aborting due to 12 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/const_refers_to_static_cross_crate.rs:25:15 - | -LL | const U8_MUT2: &u8 = { - | ------------------ -LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const_refers_to_static_cross_crate.rs:23:8 - | -LL | #[warn(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/const_refers_to_static_cross_crate.rs:32:20 - | -LL | const U8_MUT3: &u8 = { - | ------------------ -LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const_refers_to_static_cross_crate.rs:30:8 - | -LL | #[warn(const_err)] - | ^^^^^^^^^ - diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr index f919c36431035..8802f3adacae2 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/const_refers_to_static_cross_crate.rs:12:1 + --> $DIR/const_refers_to_static_cross_crate.rs:10:1 | LL | const SLICE_MUT: &[u8; 1] = { | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant @@ -10,13 +10,13 @@ LL | const SLICE_MUT: &[u8; 1] = { } error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:40:9 + --> $DIR/const_refers_to_static_cross_crate.rs:34:9 | LL | SLICE_MUT => true, | ^^^^^^^^^ error[E0080]: it is undefined behavior to use this value - --> $DIR/const_refers_to_static_cross_crate.rs:17:1 + --> $DIR/const_refers_to_static_cross_crate.rs:15:1 | LL | const U8_MUT: &u8 = { | ^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant @@ -27,75 +27,55 @@ LL | const U8_MUT: &u8 = { } error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:49:9 + --> $DIR/const_refers_to_static_cross_crate.rs:43:9 | LL | U8_MUT => true, | ^^^^^^ -warning: any use of this value will cause an error - --> $DIR/const_refers_to_static_cross_crate.rs:25:15 +error[E0080]: evaluation of constant value failed + --> $DIR/const_refers_to_static_cross_crate.rs:22:15 | -LL | const U8_MUT2: &u8 = { - | ------------------ LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const_refers_to_static_cross_crate.rs:23:8 - | -LL | #[warn(const_err)] - | ^^^^^^^^^ error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:60:9 + --> $DIR/const_refers_to_static_cross_crate.rs:54:9 | LL | U8_MUT2 => true, | ^^^^^^^ -warning: any use of this value will cause an error - --> $DIR/const_refers_to_static_cross_crate.rs:32:20 +error[E0080]: evaluation of constant value failed + --> $DIR/const_refers_to_static_cross_crate.rs:27:20 | -LL | const U8_MUT3: &u8 = { - | ------------------ LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const_refers_to_static_cross_crate.rs:30:8 - | -LL | #[warn(const_err)] - | ^^^^^^^^^ error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:68:9 + --> $DIR/const_refers_to_static_cross_crate.rs:62:9 | LL | U8_MUT3 => true, | ^^^^^^^ error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:40:9 + --> $DIR/const_refers_to_static_cross_crate.rs:34:9 | LL | SLICE_MUT => true, | ^^^^^^^^^ error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:49:9 + --> $DIR/const_refers_to_static_cross_crate.rs:43:9 | LL | U8_MUT => true, | ^^^^^^ error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:60:9 + --> $DIR/const_refers_to_static_cross_crate.rs:54:9 | LL | U8_MUT2 => true, | ^^^^^^^ error: could not evaluate constant pattern - --> $DIR/const_refers_to_static_cross_crate.rs:68:9 + --> $DIR/const_refers_to_static_cross_crate.rs:62:9 | LL | U8_MUT3 => true, | ^^^^^^^ @@ -103,90 +83,56 @@ LL | U8_MUT3 => true, warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:14:15 + --> $DIR/const_refers_to_static_cross_crate.rs:12:15 | LL | unsafe { &static_cross_crate::ZERO } | ^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:14:15 + --> $DIR/const_refers_to_static_cross_crate.rs:12:15 | LL | unsafe { &static_cross_crate::ZERO } | ^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:19:15 + --> $DIR/const_refers_to_static_cross_crate.rs:17:15 | LL | unsafe { &static_cross_crate::ZERO[0] } | ^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:19:15 + --> $DIR/const_refers_to_static_cross_crate.rs:17:15 | LL | unsafe { &static_cross_crate::ZERO[0] } | ^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:19:15 + --> $DIR/const_refers_to_static_cross_crate.rs:17:15 | LL | unsafe { &static_cross_crate::ZERO[0] } | ^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:25:17 + --> $DIR/const_refers_to_static_cross_crate.rs:22:17 | LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:32:20 + --> $DIR/const_refers_to_static_cross_crate.rs:27:20 | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:32:20 + --> $DIR/const_refers_to_static_cross_crate.rs:27:20 | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:32:20 + --> $DIR/const_refers_to_static_cross_crate.rs:27:20 | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/const_refers_to_static_cross_crate.rs:32:20 + --> $DIR/const_refers_to_static_cross_crate.rs:27:20 | LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 10 previous errors; 3 warnings emitted +error: aborting due to 12 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/const_refers_to_static_cross_crate.rs:25:15 - | -LL | const U8_MUT2: &u8 = { - | ------------------ -LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const_refers_to_static_cross_crate.rs:23:8 - | -LL | #[warn(const_err)] - | ^^^^^^^^^ - -Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/const_refers_to_static_cross_crate.rs:32:20 - | -LL | const U8_MUT3: &u8 = { - | ------------------ -LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 -note: the lint level is defined here - --> $DIR/const_refers_to_static_cross_crate.rs:30:8 - | -LL | #[warn(const_err)] - | ^^^^^^^^^ - 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 4638d73fcbfc5..64b13ebb76013 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 @@ -1,8 +1,6 @@ // compile-flags: -Zunleash-the-miri-inside-of-you // aux-build:static_cross_crate.rs // stderr-per-bitwidth -#![allow(const_err)] - #![feature(exclusive_range_pattern, half_open_range_patterns)] extern crate static_cross_crate; @@ -19,20 +17,16 @@ const U8_MUT: &u8 = { //~ ERROR undefined behavior to use this value unsafe { &static_cross_crate::ZERO[0] } }; -// Also test indirection that reads from other static. This causes a const_err. -#[warn(const_err)] +// Also test indirection that reads from other static. const U8_MUT2: &u8 = { unsafe { &(*static_cross_crate::ZERO_REF)[0] } - //~^ WARN [const_err] + //~^ ERROR evaluation of constant value failed //~| constant accesses static - //~| WARN this was previously accepted by the compiler but is being phased out }; -#[warn(const_err)] const U8_MUT3: &u8 = { unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } } - //~^ WARN [const_err] + //~^ ERROR evaluation of constant value failed //~| constant accesses static - //~| WARN this was previously accepted by the compiler but is being phased out }; pub fn test(x: &[u8; 1]) -> bool { diff --git a/src/test/ui/consts/miri_unleashed/drop.rs b/src/test/ui/consts/miri_unleashed/drop.rs index 4afa954d901f8..3942e7ef73433 100644 --- a/src/test/ui/consts/miri_unleashed/drop.rs +++ b/src/test/ui/consts/miri_unleashed/drop.rs @@ -1,6 +1,5 @@ // compile-flags: -Zunleash-the-miri-inside-of-you // error-pattern: calling non-const function ` as Drop>::drop` -#![allow(const_err)] use std::mem::ManuallyDrop; diff --git a/src/test/ui/consts/miri_unleashed/drop.stderr b/src/test/ui/consts/miri_unleashed/drop.stderr index 36db6b7865af2..a3a502723d223 100644 --- a/src/test/ui/consts/miri_unleashed/drop.stderr +++ b/src/test/ui/consts/miri_unleashed/drop.stderr @@ -7,15 +7,15 @@ LL | pub unsafe fn drop_in_place(to_drop: *mut T) { | calling non-const function ` as Drop>::drop` | inside `std::ptr::drop_in_place::> - shim(Some(Vec))` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL | - ::: $DIR/drop.rs:18:1 + ::: $DIR/drop.rs:17:1 | LL | }; - | - inside `TEST_BAD` at $DIR/drop.rs:18:1 + | - inside `TEST_BAD` at $DIR/drop.rs:17:1 warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/drop.rs:17:9 + --> $DIR/drop.rs:16:9 | LL | let _v: Vec = Vec::new(); | ^^ diff --git a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs index 4466f097ef4a1..c24d3338e6ab9 100644 --- a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs +++ b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs @@ -1,5 +1,3 @@ -#![allow(const_err)] - // a test demonstrating why we do need to run static const qualification on associated constants // instead of just checking the final constant diff --git a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr index c91c72d1fbf16..45ed88b1bb078 100644 --- a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr +++ b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr @@ -1,5 +1,5 @@ error[E0493]: destructor of `(T, u32)` cannot be evaluated at compile-time - --> $DIR/feature-gate-unleash_the_miri_inside_of_you.rs:11:20 + --> $DIR/feature-gate-unleash_the_miri_inside_of_you.rs:9:20 | LL | const F: u32 = (U::X, 42).1; | ^^^^^^^^^^ - value is dropped here diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.rs b/src/test/ui/consts/miri_unleashed/inline_asm.rs index 6971170337d41..6fd52ceb24ca6 100644 --- a/src/test/ui/consts/miri_unleashed/inline_asm.rs +++ b/src/test/ui/consts/miri_unleashed/inline_asm.rs @@ -1,6 +1,5 @@ // compile-flags: -Zunleash-the-miri-inside-of-you // only-x86_64 -#![allow(const_err)] use std::arch::asm; diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.stderr b/src/test/ui/consts/miri_unleashed/inline_asm.stderr index 595b859cbcebb..6317cd882678a 100644 --- a/src/test/ui/consts/miri_unleashed/inline_asm.stderr +++ b/src/test/ui/consts/miri_unleashed/inline_asm.stderr @@ -1,5 +1,5 @@ error[E0080]: could not evaluate static initializer - --> $DIR/inline_asm.rs:11:14 + --> $DIR/inline_asm.rs:10:14 | LL | unsafe { asm!("nop"); } | ^^^^^^^^^^^ inline assembly is not supported @@ -7,7 +7,7 @@ LL | unsafe { asm!("nop"); } warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/inline_asm.rs:11:14 + --> $DIR/inline_asm.rs:10:14 | LL | unsafe { asm!("nop"); } | ^^^^^^^^^^^ diff --git a/src/test/ui/consts/miri_unleashed/mutable_references.rs b/src/test/ui/consts/miri_unleashed/mutable_references.rs index ca927ef4a518b..4e996464705f8 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references.rs +++ b/src/test/ui/consts/miri_unleashed/mutable_references.rs @@ -1,5 +1,4 @@ // compile-flags: -Zunleash-the-miri-inside-of-you -#![allow(const_err)] use std::cell::UnsafeCell; diff --git a/src/test/ui/consts/miri_unleashed/mutable_references.stderr b/src/test/ui/consts/miri_unleashed/mutable_references.stderr index c6180c1e0041c..3ed96701ab0ad 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_references.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `*OH_YES`, as `OH_YES` is an immutable static item - --> $DIR/mutable_references.rs:36:5 + --> $DIR/mutable_references.rs:35:5 | LL | *OH_YES = 99; | ^^^^^^^^^^^^ cannot assign @@ -7,27 +7,27 @@ LL | *OH_YES = 99; warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/mutable_references.rs:9:26 + --> $DIR/mutable_references.rs:8:26 | LL | static FOO: &&mut u32 = &&mut 42; | ^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references.rs:13:23 + --> $DIR/mutable_references.rs:12:23 | LL | static BAR: &mut () = &mut (); | ^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references.rs:18:28 + --> $DIR/mutable_references.rs:17:28 | LL | static BOO: &mut Foo<()> = &mut Foo(()); | ^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references.rs:26:8 + --> $DIR/mutable_references.rs:25:8 | LL | x: &UnsafeCell::new(42), | ^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references.rs:30:27 + --> $DIR/mutable_references.rs:29:27 | LL | static OH_YES: &mut i32 = &mut 42; | ^^^^^^^ diff --git a/src/test/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr b/src/test/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr index 7ea35f70d108e..0ea1792409b8b 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/mutable_references_err.rs:17:1 + --> $DIR/mutable_references_err.rs:15:1 | LL | const MUH: Meh = Meh { | ^^^^^^^^^^^^^^ constructing invalid value at .x.: encountered `UnsafeCell` in a `const` @@ -10,7 +10,7 @@ LL | const MUH: Meh = Meh { } error[E0080]: it is undefined behavior to use this value - --> $DIR/mutable_references_err.rs:27:1 + --> $DIR/mutable_references_err.rs:25:1 | LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ...x: encountered `UnsafeCell` in a `const` @@ -21,7 +21,7 @@ LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/mutable_references_err.rs:31:1 + --> $DIR/mutable_references_err.rs:29:1 | LL | const BLUNT: &mut i32 = &mut 42; | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference in a `const` @@ -34,17 +34,17 @@ LL | const BLUNT: &mut i32 = &mut 42; warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:18:8 + --> $DIR/mutable_references_err.rs:16:8 | LL | x: &UnsafeCell::new(42), | ^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:27:27 + --> $DIR/mutable_references_err.rs:25:27 | LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:31:25 + --> $DIR/mutable_references_err.rs:29:25 | LL | const BLUNT: &mut i32 = &mut 42; | ^^^^^^^ diff --git a/src/test/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr b/src/test/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr index 5ad3989308909..67959d25634a3 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/mutable_references_err.rs:17:1 + --> $DIR/mutable_references_err.rs:15:1 | LL | const MUH: Meh = Meh { | ^^^^^^^^^^^^^^ constructing invalid value at .x.: encountered `UnsafeCell` in a `const` @@ -10,7 +10,7 @@ LL | const MUH: Meh = Meh { } error[E0080]: it is undefined behavior to use this value - --> $DIR/mutable_references_err.rs:27:1 + --> $DIR/mutable_references_err.rs:25:1 | LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ...x: encountered `UnsafeCell` in a `const` @@ -21,7 +21,7 @@ LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/mutable_references_err.rs:31:1 + --> $DIR/mutable_references_err.rs:29:1 | LL | const BLUNT: &mut i32 = &mut 42; | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference in a `const` @@ -34,17 +34,17 @@ LL | const BLUNT: &mut i32 = &mut 42; warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:18:8 + --> $DIR/mutable_references_err.rs:16:8 | LL | x: &UnsafeCell::new(42), | ^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:27:27 + --> $DIR/mutable_references_err.rs:25:27 | LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:31:25 + --> $DIR/mutable_references_err.rs:29:25 | LL | const BLUNT: &mut i32 = &mut 42; | ^^^^^^^ diff --git a/src/test/ui/consts/miri_unleashed/mutable_references_err.rs b/src/test/ui/consts/miri_unleashed/mutable_references_err.rs index 722b9cf94e859..6399b122bb1fb 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references_err.rs +++ b/src/test/ui/consts/miri_unleashed/mutable_references_err.rs @@ -1,8 +1,6 @@ // stderr-per-bitwidth // compile-flags: -Zunleash-the-miri-inside-of-you -#![allow(const_err)] - use std::cell::UnsafeCell; // this test ensures that our mutability story is sound diff --git a/src/test/ui/consts/miri_unleashed/mutating_global.rs b/src/test/ui/consts/miri_unleashed/mutating_global.rs index 902fe0aa1e7e4..231f4af0a2045 100644 --- a/src/test/ui/consts/miri_unleashed/mutating_global.rs +++ b/src/test/ui/consts/miri_unleashed/mutating_global.rs @@ -1,5 +1,4 @@ // compile-flags: -Zunleash-the-miri-inside-of-you -#![allow(const_err)] // Make sure we cannot mutate globals. diff --git a/src/test/ui/consts/miri_unleashed/mutating_global.stderr b/src/test/ui/consts/miri_unleashed/mutating_global.stderr index ba9dd56190ac1..c8770c8d76ad0 100644 --- a/src/test/ui/consts/miri_unleashed/mutating_global.stderr +++ b/src/test/ui/consts/miri_unleashed/mutating_global.stderr @@ -1,5 +1,5 @@ error[E0080]: could not evaluate static initializer - --> $DIR/mutating_global.rs:10:9 + --> $DIR/mutating_global.rs:9:9 | LL | GLOBAL = 99 | ^^^^^^^^^^^ modifying a static's initial value from another static's initializer diff --git a/src/test/ui/consts/miri_unleashed/non_const_fn.rs b/src/test/ui/consts/miri_unleashed/non_const_fn.rs index 70da94df7a265..44ab60dcabca6 100644 --- a/src/test/ui/consts/miri_unleashed/non_const_fn.rs +++ b/src/test/ui/consts/miri_unleashed/non_const_fn.rs @@ -1,7 +1,5 @@ // compile-flags: -Zunleash-the-miri-inside-of-you -#![allow(const_err)] - // A test demonstrating that we prevent calling non-const fn during CTFE. fn foo() {} 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 3e9658ad88ec0..57836f7966df2 100644 --- a/src/test/ui/consts/miri_unleashed/non_const_fn.stderr +++ b/src/test/ui/consts/miri_unleashed/non_const_fn.stderr @@ -1,5 +1,5 @@ error[E0080]: could not evaluate static initializer - --> $DIR/non_const_fn.rs:9:16 + --> $DIR/non_const_fn.rs:7:16 | LL | static C: () = foo(); | ^^^^^ calling non-const function `foo` @@ -7,7 +7,7 @@ LL | static C: () = foo(); warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/non_const_fn.rs:9:16 + --> $DIR/non_const_fn.rs:7:16 | LL | static C: () = foo(); | ^^^^^ diff --git a/src/test/ui/consts/miri_unleashed/ptr_arith.rs b/src/test/ui/consts/miri_unleashed/ptr_arith.rs index 6a19b294585ae..4d12960b86ba3 100644 --- a/src/test/ui/consts/miri_unleashed/ptr_arith.rs +++ b/src/test/ui/consts/miri_unleashed/ptr_arith.rs @@ -1,6 +1,5 @@ // compile-flags: -Zunleash-the-miri-inside-of-you #![feature(core_intrinsics)] -#![allow(const_err)] // During CTFE, we prevent pointer-to-int casts. // Pointer comparisons are prevented in the trait system. diff --git a/src/test/ui/consts/miri_unleashed/ptr_arith.stderr b/src/test/ui/consts/miri_unleashed/ptr_arith.stderr index e0c4fa17585a9..30fd3a55e85be 100644 --- a/src/test/ui/consts/miri_unleashed/ptr_arith.stderr +++ b/src/test/ui/consts/miri_unleashed/ptr_arith.stderr @@ -1,11 +1,11 @@ error[E0080]: could not evaluate static initializer - --> $DIR/ptr_arith.rs:9:13 + --> $DIR/ptr_arith.rs:8:13 | LL | let x = &0 as *const _ as usize; | ^^^^^^^^^^^^^^^^^^^^^^^ exposing pointers is not possible at compile-time error[E0080]: could not evaluate static initializer - --> $DIR/ptr_arith.rs:17:14 + --> $DIR/ptr_arith.rs:16:14 | LL | let _v = x + 0; | ^ unable to turn pointer into raw bytes @@ -16,7 +16,7 @@ LL | let _v = x + 0; warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/ptr_arith.rs:9:13 + --> $DIR/ptr_arith.rs:8:13 | LL | let x = &0 as *const _ as usize; | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/miri_unleashed/raw_mutable_const.rs b/src/test/ui/consts/miri_unleashed/raw_mutable_const.rs index cabd754e01ac3..5f8ec4e6e294d 100644 --- a/src/test/ui/consts/miri_unleashed/raw_mutable_const.rs +++ b/src/test/ui/consts/miri_unleashed/raw_mutable_const.rs @@ -1,7 +1,5 @@ // compile-flags: -Zunleash-the-miri-inside-of-you -#![allow(const_err)] - use std::cell::UnsafeCell; const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; diff --git a/src/test/ui/consts/miri_unleashed/raw_mutable_const.stderr b/src/test/ui/consts/miri_unleashed/raw_mutable_const.stderr index e145f6dd2ef58..f8dc11d695f11 100644 --- a/src/test/ui/consts/miri_unleashed/raw_mutable_const.stderr +++ b/src/test/ui/consts/miri_unleashed/raw_mutable_const.stderr @@ -1,5 +1,5 @@ error: untyped pointers are not allowed in constant - --> $DIR/raw_mutable_const.rs:7:1 + --> $DIR/raw_mutable_const.rs:5:1 | LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *m warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/raw_mutable_const.rs:7:38 + --> $DIR/raw_mutable_const.rs:5:38 | LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/miri_unleashed/tls.rs b/src/test/ui/consts/miri_unleashed/tls.rs index 7d4f8962a192c..d06d7cf19f7ee 100644 --- a/src/test/ui/consts/miri_unleashed/tls.rs +++ b/src/test/ui/consts/miri_unleashed/tls.rs @@ -1,6 +1,5 @@ // compile-flags: -Zunleash-the-miri-inside-of-you #![feature(thread_local)] -#![allow(const_err)] use std::thread; diff --git a/src/test/ui/consts/miri_unleashed/tls.stderr b/src/test/ui/consts/miri_unleashed/tls.stderr index a49e50a3eaa60..436c5112360e7 100644 --- a/src/test/ui/consts/miri_unleashed/tls.stderr +++ b/src/test/ui/consts/miri_unleashed/tls.stderr @@ -1,11 +1,11 @@ error[E0080]: could not evaluate static initializer - --> $DIR/tls.rs:12:25 + --> $DIR/tls.rs:11:25 | LL | unsafe { let _val = A; } | ^ cannot access thread local static (DefId(0:6 ~ tls[78b0]::A)) error[E0080]: could not evaluate static initializer - --> $DIR/tls.rs:19:26 + --> $DIR/tls.rs:18:26 | LL | unsafe { let _val = &A; } | ^ cannot access thread local static (DefId(0:6 ~ tls[78b0]::A)) @@ -13,12 +13,12 @@ LL | unsafe { let _val = &A; } warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/tls.rs:12:25 + --> $DIR/tls.rs:11:25 | LL | unsafe { let _val = A; } | ^ help: skipping check that does not even have a feature gate - --> $DIR/tls.rs:19:26 + --> $DIR/tls.rs:18:26 | LL | unsafe { let _val = &A; } | ^ diff --git a/src/test/ui/consts/promote-not.rs b/src/test/ui/consts/promote-not.rs index 6830b23cfa345..907617052f119 100644 --- a/src/test/ui/consts/promote-not.rs +++ b/src/test/ui/consts/promote-not.rs @@ -1,6 +1,6 @@ // ignore-tidy-linelength // Test various things that we do not want to promote. -#![allow(unconditional_panic, const_err)] +#![allow(unconditional_panic)] use std::cell::Cell; diff --git a/src/test/ui/consts/ptr_comparisons.rs b/src/test/ui/consts/ptr_comparisons.rs index 0a3c2d4bedcbd..f442e61383973 100644 --- a/src/test/ui/consts/ptr_comparisons.rs +++ b/src/test/ui/consts/ptr_comparisons.rs @@ -55,11 +55,9 @@ const _: *const u8 = //~| out-of-bounds const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 }; -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed //~| unable to turn pointer into raw bytes -//~| WARN this was previously accepted by the compiler but is being phased out const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 }; -//~^ ERROR any use of this value will cause an error +//~^ ERROR evaluation of constant value failed //~| unable to turn pointer into raw bytes -//~| WARN this was previously accepted by the compiler but is being phased out diff --git a/src/test/ui/consts/ptr_comparisons.stderr b/src/test/ui/consts/ptr_comparisons.stderr index df9a8bf51b0eb..b71964b92c773 100644 --- a/src/test/ui/consts/ptr_comparisons.stderr +++ b/src/test/ui/consts/ptr_comparisons.stderr @@ -18,55 +18,24 @@ error[E0080]: evaluation of constant value failed LL | unsafe { std::ptr::addr_of!((*(FOO as *const usize as *const [u8; 1000]))[999]) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: alloc3 has size $WORD, so pointer to 1000 bytes starting at offset 0 is out-of-bounds -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/ptr_comparisons.rs:57:27 | LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 }; - | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default -error: any use of this value will cause an error - --> $DIR/ptr_comparisons.rs:62:27 +error[E0080]: evaluation of constant value failed + --> $DIR/ptr_comparisons.rs:61:27 | LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 }; - | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ptr_comparisons.rs:57:27 - | -LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 }; - | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - -Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/ptr_comparisons.rs:62:27 - | -LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 }; - | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = help: this code performed an operation that depends on the underlying bytes representing a pointer - = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/raw-ptr-const.rs b/src/test/ui/consts/raw-ptr-const.rs index 00fad046b557d..b9c542d03d5a9 100644 --- a/src/test/ui/consts/raw-ptr-const.rs +++ b/src/test/ui/consts/raw-ptr-const.rs @@ -1,5 +1,3 @@ -#![allow(const_err)] // make sure we hit the `delay_span_bug` - // This is a regression test for a `delay_span_bug` during interning when a constant // evaluates to a (non-dangling) raw pointer. For now this errors; potentially it // could also be allowed. diff --git a/src/test/ui/consts/raw-ptr-const.stderr b/src/test/ui/consts/raw-ptr-const.stderr index 0ebe1e95ca3ef..f7b53433b6994 100644 --- a/src/test/ui/consts/raw-ptr-const.stderr +++ b/src/test/ui/consts/raw-ptr-const.stderr @@ -1,5 +1,5 @@ error: untyped pointers are not allowed in constant - --> $DIR/raw-ptr-const.rs:7:1 + --> $DIR/raw-ptr-const.rs:5:1 | LL | const CONST_RAW: *const Vec = &Vec::new() as *const _; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/recursive.rs b/src/test/ui/consts/recursive.rs index 664940c52cfc5..5d736e31bcb46 100644 --- a/src/test/ui/consts/recursive.rs +++ b/src/test/ui/consts/recursive.rs @@ -2,8 +2,7 @@ const fn f(x: T) { //~ WARN function cannot return without recursing f(x); - //~^ ERROR any use of this value will cause an error - //~| WARN this was previously accepted by the compiler + //~^ ERROR evaluation of constant value failed } const X: () = f(1); diff --git a/src/test/ui/consts/recursive.stderr b/src/test/ui/consts/recursive.stderr index 65fb2a69d8f92..14fa3da7ab0f2 100644 --- a/src/test/ui/consts/recursive.stderr +++ b/src/test/ui/consts/recursive.stderr @@ -9,7 +9,7 @@ LL | f(x); = help: a `loop` may express intention better if this is on purpose = note: `#[warn(unconditional_recursion)]` on by default -error: any use of this value will cause an error +error[E0080]: evaluation of constant value failed --> $DIR/recursive.rs:4:5 | LL | f(x); @@ -18,33 +18,10 @@ LL | f(x); | reached the configured maximum number of stack frames | inside `f::` at $DIR/recursive.rs:4:5 | [... 126 additional calls inside `f::` at $DIR/recursive.rs:4:5 ...] - | inside `X` at $DIR/recursive.rs:9:15 ... LL | const X: () = f(1); - | ----------- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default + | ---- inside `X` at $DIR/recursive.rs:8:15 error: aborting due to previous error; 1 warning emitted -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/recursive.rs:4:5 - | -LL | f(x); - | ^^^^ - | | - | reached the configured maximum number of stack frames - | inside `f::` at $DIR/recursive.rs:4:5 - | [... 126 additional calls inside `f::` at $DIR/recursive.rs:4:5 ...] - | inside `X` at $DIR/recursive.rs:9:15 -... -LL | const X: () = f(1); - | ----------- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/uninhabited-const-issue-61744.rs b/src/test/ui/consts/uninhabited-const-issue-61744.rs index 860628c39c371..a07c39882774e 100644 --- a/src/test/ui/consts/uninhabited-const-issue-61744.rs +++ b/src/test/ui/consts/uninhabited-const-issue-61744.rs @@ -1,8 +1,7 @@ // build-fail pub const unsafe fn fake_type() -> T { - hint_unreachable() //~ ERROR any use of this value will cause an error [const_err] - //~| WARN this was previously accepted by the compiler but is being phased out + hint_unreachable() //~ ERROR evaluation of `::CONSTANT` failed } pub const unsafe fn hint_unreachable() -> ! { diff --git a/src/test/ui/consts/uninhabited-const-issue-61744.stderr b/src/test/ui/consts/uninhabited-const-issue-61744.stderr index 0848fbf1968dd..9c7cc88613ebe 100644 --- a/src/test/ui/consts/uninhabited-const-issue-61744.stderr +++ b/src/test/ui/consts/uninhabited-const-issue-61744.stderr @@ -1,4 +1,4 @@ -error: any use of this value will cause an error +error[E0080]: evaluation of `::CONSTANT` failed --> $DIR/uninhabited-const-issue-61744.rs:4:5 | LL | hint_unreachable() @@ -6,143 +6,142 @@ LL | hint_unreachable() | | | reached the configured maximum number of stack frames | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `::CONSTANT` at $DIR/uninhabited-const-issue-61744.rs:13:36 +... +LL | fake_type() + | ----------- + | | + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 ... LL | const CONSTANT: i32 = unsafe { fake_type() }; - | ------------------- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default + | ----------- inside `::CONSTANT` at $DIR/uninhabited-const-issue-61744.rs:12:36 error[E0080]: erroneous constant used - --> $DIR/uninhabited-const-issue-61744.rs:19:10 + --> $DIR/uninhabited-const-issue-61744.rs:18:10 | LL | dbg!(i32::CONSTANT); | ^^^^^^^^^^^^^ referenced constant has errors @@ -150,147 +149,3 @@ LL | dbg!(i32::CONSTANT); error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: any use of this value will cause an error - --> $DIR/uninhabited-const-issue-61744.rs:4:5 - | -LL | hint_unreachable() - | ^^^^^^^^^^^^^^^^^^ - | | - | reached the configured maximum number of stack frames - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:9:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `::CONSTANT` at $DIR/uninhabited-const-issue-61744.rs:13:36 -... -LL | const CONSTANT: i32 = unsafe { fake_type() }; - | ------------------- - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - diff --git a/src/test/ui/consts/write_to_static_via_mut_ref.rs b/src/test/ui/consts/write_to_static_via_mut_ref.rs index 665c305e9617f..39b830ae4e915 100644 --- a/src/test/ui/consts/write_to_static_via_mut_ref.rs +++ b/src/test/ui/consts/write_to_static_via_mut_ref.rs @@ -1,5 +1,4 @@ #![feature(const_mut_refs)] -#![allow(const_err)] static OH_NO: &mut i32 = &mut 42; //~ ERROR mutable references are not allowed fn main() { diff --git a/src/test/ui/consts/write_to_static_via_mut_ref.stderr b/src/test/ui/consts/write_to_static_via_mut_ref.stderr index d19e998d61736..f64f0db6b25a1 100644 --- a/src/test/ui/consts/write_to_static_via_mut_ref.stderr +++ b/src/test/ui/consts/write_to_static_via_mut_ref.stderr @@ -1,11 +1,11 @@ error[E0764]: mutable references are not allowed in the final value of statics - --> $DIR/write_to_static_via_mut_ref.rs:4:26 + --> $DIR/write_to_static_via_mut_ref.rs:3:26 | LL | static OH_NO: &mut i32 = &mut 42; | ^^^^^^^ error[E0594]: cannot assign to `*OH_NO`, as `OH_NO` is an immutable static item - --> $DIR/write_to_static_via_mut_ref.rs:7:5 + --> $DIR/write_to_static_via_mut_ref.rs:6:5 | LL | *OH_NO = 43; | ^^^^^^^^^^^ cannot assign diff --git a/src/test/ui/intrinsics/intrinsic-raw_eq-const-padding.rs b/src/test/ui/intrinsics/intrinsic-raw_eq-const-padding.rs index a205a8730a0b8..a93d777d28656 100644 --- a/src/test/ui/intrinsics/intrinsic-raw_eq-const-padding.rs +++ b/src/test/ui/intrinsics/intrinsic-raw_eq-const-padding.rs @@ -1,6 +1,5 @@ #![feature(core_intrinsics)] #![feature(const_intrinsic_raw_eq)] -#![deny(const_err)] const BAD_RAW_EQ_CALL: bool = unsafe { std::intrinsics::raw_eq(&(1_u8, 2_u16), &(1_u8, 2_u16)) diff --git a/src/test/ui/intrinsics/intrinsic-raw_eq-const-padding.stderr b/src/test/ui/intrinsics/intrinsic-raw_eq-const-padding.stderr index 9322654b2928b..56d5a48573e26 100644 --- a/src/test/ui/intrinsics/intrinsic-raw_eq-const-padding.stderr +++ b/src/test/ui/intrinsics/intrinsic-raw_eq-const-padding.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant value failed - --> $DIR/intrinsic-raw_eq-const-padding.rs:6:5 + --> $DIR/intrinsic-raw_eq-const-padding.rs:5:5 | LL | std::intrinsics::raw_eq(&(1_u8, 2_u16), &(1_u8, 2_u16)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at alloc3[0x0..0x4], but memory is uninitialized at [0x1..0x2], and this operation requires initialized memory diff --git a/src/test/ui/intrinsics/intrinsic-raw_eq-const.rs b/src/test/ui/intrinsics/intrinsic-raw_eq-const.rs index 8ea954673020e..32841f5318f8c 100644 --- a/src/test/ui/intrinsics/intrinsic-raw_eq-const.rs +++ b/src/test/ui/intrinsics/intrinsic-raw_eq-const.rs @@ -2,7 +2,6 @@ #![feature(core_intrinsics)] #![feature(const_intrinsic_raw_eq)] -#![deny(const_err)] pub fn main() { use std::intrinsics::raw_eq; diff --git a/src/test/ui/limits/issue-55878.stderr b/src/test/ui/limits/issue-55878.stderr index 4f165b1d9fea6..ee6aab748e445 100644 --- a/src/test/ui/limits/issue-55878.stderr +++ b/src/test/ui/limits/issue-55878.stderr @@ -9,29 +9,14 @@ LL | intrinsics::size_of::() LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); | ---------------------------------------------- inside `main` at $DIR/issue-55878.rs:7:26 -error: erroneous constant used +error[E0080]: erroneous constant used --> $DIR/issue-55878.rs:7:26 | LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. -Future incompatibility report: Future breakage diagnostic: -error: erroneous constant used - --> $DIR/issue-55878.rs:7:26 - | -LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) - diff --git a/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.rs b/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.rs index 3a3d81176d691..257df13efe097 100644 --- a/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.rs +++ b/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.rs @@ -1,10 +1,10 @@ // --force-warn $LINT causes $LINT (which is deny-by-default) to warn // despite $LINT being allowed on command line -// compile-flags: -A const_err --force-warn const_err +// compile-flags: -A mutable_transmutes --force-warn mutable_transmutes // check-pass -const C: i32 = 1 / 0; -//~^ WARN any use of this value will cause an error -//~| WARN this was previously accepted by the compiler - -fn main() {} +fn main() { + unsafe { + let y = std::mem::transmute::<&i32, &mut i32>(&5); //~WARN: undefined behavior + } +} diff --git a/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr index 97c2dee46dd13..6a1fc76e18a18 100644 --- a/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr @@ -1,23 +1,10 @@ -warning: any use of this value will cause an error - --> $DIR/allowed-cli-deny-by-default-lint.rs:6:16 +warning: transmuting &T to &mut T is undefined behavior, even if the reference is unused, consider instead using an UnsafeCell + --> $DIR/allowed-cli-deny-by-default-lint.rs:8:17 | -LL | const C: i32 = 1 / 0; - | ------------ ^^^^^ attempt to divide `1_i32` by zero +LL | let y = std::mem::transmute::<&i32, &mut i32>(&5); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: requested on the command line with `--force-warn const-err` + = note: requested on the command line with `--force-warn mutable-transmutes` warning: 1 warning emitted -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/allowed-cli-deny-by-default-lint.rs:6:16 - | -LL | const C: i32 = 1 / 0; - | ------------ ^^^^^ attempt to divide `1_i32` by zero - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: requested on the command line with `--force-warn const-err` - diff --git a/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.rs b/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.rs index 08e75a775d0b5..0d4b468c2b337 100644 --- a/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.rs +++ b/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.rs @@ -1,11 +1,11 @@ // --force-warn $LINT causes $LINT (which is deny-by-default) to warn // despite $LINT being allowed in module -// compile-flags: --force-warn const_err +// compile-flags: --force-warn mutable_transmutes // check-pass -#![allow(const_err)] -const C: i32 = 1 / 0; -//~^ WARN any use of this value will cause an error -//~| WARN this was previously accepted by the compiler - -fn main() {} +#![allow(mutable_transmutes)] +fn main() { + unsafe { + let y = std::mem::transmute::<&i32, &mut i32>(&5); //~WARN: undefined behavior + } +} diff --git a/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr index f293b78119e46..9ef53d47eb931 100644 --- a/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr @@ -1,23 +1,10 @@ -warning: any use of this value will cause an error - --> $DIR/allowed-deny-by-default-lint.rs:7:16 +warning: transmuting &T to &mut T is undefined behavior, even if the reference is unused, consider instead using an UnsafeCell + --> $DIR/allowed-deny-by-default-lint.rs:9:17 | -LL | const C: i32 = 1 / 0; - | ------------ ^^^^^ attempt to divide `1_i32` by zero +LL | let y = std::mem::transmute::<&i32, &mut i32>(&5); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: requested on the command line with `--force-warn const-err` + = note: requested on the command line with `--force-warn mutable-transmutes` warning: 1 warning emitted -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/allowed-deny-by-default-lint.rs:7:16 - | -LL | const C: i32 = 1 / 0; - | ------------ ^^^^^ attempt to divide `1_i32` by zero - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: requested on the command line with `--force-warn const-err` - diff --git a/src/test/ui/lint/force-warn/deny-by-default-lint.rs b/src/test/ui/lint/force-warn/deny-by-default-lint.rs index e371029032fe9..c2e9377e90854 100644 --- a/src/test/ui/lint/force-warn/deny-by-default-lint.rs +++ b/src/test/ui/lint/force-warn/deny-by-default-lint.rs @@ -1,9 +1,9 @@ // --force-warn $LINT causes $LINT (which is deny-by-default) to warn -// compile-flags: --force-warn const_err +// compile-flags: --force-warn mutable_transmutes // check-pass -const C: i32 = 1 / 0; -//~^ WARN any use of this value will cause an error -//~| WARN this was previously accepted by the compiler - -fn main() {} +fn main() { + unsafe { + let y = std::mem::transmute::<&i32, &mut i32>(&5); //~WARN: undefined behavior + } +} diff --git a/src/test/ui/lint/force-warn/deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/deny-by-default-lint.stderr index 703d0afd60850..c644d0fe741ad 100644 --- a/src/test/ui/lint/force-warn/deny-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/deny-by-default-lint.stderr @@ -1,23 +1,10 @@ -warning: any use of this value will cause an error - --> $DIR/deny-by-default-lint.rs:5:16 +warning: transmuting &T to &mut T is undefined behavior, even if the reference is unused, consider instead using an UnsafeCell + --> $DIR/deny-by-default-lint.rs:7:17 | -LL | const C: i32 = 1 / 0; - | ------------ ^^^^^ attempt to divide `1_i32` by zero +LL | let y = std::mem::transmute::<&i32, &mut i32>(&5); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: requested on the command line with `--force-warn const-err` + = note: requested on the command line with `--force-warn mutable-transmutes` warning: 1 warning emitted -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/deny-by-default-lint.rs:5:16 - | -LL | const C: i32 = 1 / 0; - | ------------ ^^^^^ attempt to divide `1_i32` by zero - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: requested on the command line with `--force-warn const-err` - diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.noopt.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.noopt.stderr index d7fd514611c27..3a84c6c1fb1f9 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.noopt.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts.noopt.stderr @@ -7,7 +7,7 @@ LL | const N: i32 = T::N << 42; note: the lint level is defined here --> $DIR/lint-exceeding-bitshifts.rs:10:9 | -LL | #![warn(arithmetic_overflow, const_err)] +LL | #![warn(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ warning: this arithmetic operation will overflow diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.opt.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.opt.stderr index d7fd514611c27..3a84c6c1fb1f9 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.opt.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts.opt.stderr @@ -7,7 +7,7 @@ LL | const N: i32 = T::N << 42; note: the lint level is defined here --> $DIR/lint-exceeding-bitshifts.rs:10:9 | -LL | #![warn(arithmetic_overflow, const_err)] +LL | #![warn(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ warning: this arithmetic operation will overflow diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.opt_with_overflow_checks.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.opt_with_overflow_checks.stderr index d7fd514611c27..3a84c6c1fb1f9 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.opt_with_overflow_checks.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts.opt_with_overflow_checks.stderr @@ -7,7 +7,7 @@ LL | const N: i32 = T::N << 42; note: the lint level is defined here --> $DIR/lint-exceeding-bitshifts.rs:10:9 | -LL | #![warn(arithmetic_overflow, const_err)] +LL | #![warn(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ warning: this arithmetic operation will overflow diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.rs b/src/test/ui/lint/lint-exceeding-bitshifts.rs index d8774cb4dfae6..048c1aff8a9be 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.rs +++ b/src/test/ui/lint/lint-exceeding-bitshifts.rs @@ -7,7 +7,7 @@ // normalize-stderr-test "shift left by `(64|32)_usize`, which" -> "shift left by `%BITS%`, which" #![crate_type="lib"] -#![warn(arithmetic_overflow, const_err)] +#![warn(arithmetic_overflow)] pub trait Foo { diff --git a/src/test/ui/lint/lint-type-overflow2.rs b/src/test/ui/lint/lint-type-overflow2.rs index c1f874c079cb5..9b1eb510bbd83 100644 --- a/src/test/ui/lint/lint-type-overflow2.rs +++ b/src/test/ui/lint/lint-type-overflow2.rs @@ -1,7 +1,6 @@ // compile-flags: -O #![deny(overflowing_literals)] -#![deny(const_err)] fn main() { let x2: i8 = --128; //~ ERROR literal out of range for `i8` diff --git a/src/test/ui/lint/lint-type-overflow2.stderr b/src/test/ui/lint/lint-type-overflow2.stderr index 117bfc3ced7e1..eb593d062f218 100644 --- a/src/test/ui/lint/lint-type-overflow2.stderr +++ b/src/test/ui/lint/lint-type-overflow2.stderr @@ -1,5 +1,5 @@ error: literal out of range for `i8` - --> $DIR/lint-type-overflow2.rs:7:20 + --> $DIR/lint-type-overflow2.rs:6:20 | LL | let x2: i8 = --128; | ^^^ @@ -13,7 +13,7 @@ LL | #![deny(overflowing_literals)] | ^^^^^^^^^^^^^^^^^^^^ error: literal out of range for `f32` - --> $DIR/lint-type-overflow2.rs:9:14 + --> $DIR/lint-type-overflow2.rs:8:14 | LL | let x = -3.40282357e+38_f32; | ^^^^^^^^^^^^^^^^^^ @@ -21,7 +21,7 @@ LL | let x = -3.40282357e+38_f32; = note: the literal `3.40282357e+38_f32` does not fit into the type `f32` and will be converted to `f32::INFINITY` error: literal out of range for `f32` - --> $DIR/lint-type-overflow2.rs:10:14 + --> $DIR/lint-type-overflow2.rs:9:14 | LL | let x = 3.40282357e+38_f32; | ^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | let x = 3.40282357e+38_f32; = note: the literal `3.40282357e+38_f32` does not fit into the type `f32` and will be converted to `f32::INFINITY` error: literal out of range for `f64` - --> $DIR/lint-type-overflow2.rs:11:14 + --> $DIR/lint-type-overflow2.rs:10:14 | LL | let x = -1.7976931348623159e+308_f64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL | let x = -1.7976931348623159e+308_f64; = note: the literal `1.7976931348623159e+308_f64` does not fit into the type `f64` and will be converted to `f64::INFINITY` error: literal out of range for `f64` - --> $DIR/lint-type-overflow2.rs:12:14 + --> $DIR/lint-type-overflow2.rs:11:14 | LL | let x = 1.7976931348623159e+308_f64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/numbers-arithmetic/float-int-invalid-const-cast.rs b/src/test/ui/numbers-arithmetic/float-int-invalid-const-cast.rs index 7691149602bc6..260281d75a443 100644 --- a/src/test/ui/numbers-arithmetic/float-int-invalid-const-cast.rs +++ b/src/test/ui/numbers-arithmetic/float-int-invalid-const-cast.rs @@ -1,7 +1,5 @@ // run-pass -#![deny(const_err)] - // Forces evaluation of constants, triggering hard error fn force(_: T) {} diff --git a/src/test/ui/numbers-arithmetic/issue-8460-const.noopt.stderr b/src/test/ui/numbers-arithmetic/issue-8460-const.noopt.stderr index e2eee1ccdc98c..c4abcb784119e 100644 --- a/src/test/ui/numbers-arithmetic/issue-8460-const.noopt.stderr +++ b/src/test/ui/numbers-arithmetic/issue-8460-const.noopt.stderr @@ -1,5 +1,5 @@ error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:13:36 + --> $DIR/issue-8460-const.rs:11:36 | LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow @@ -7,139 +7,139 @@ LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:15:36 + --> $DIR/issue-8460-const.rs:13:36 | LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:17:36 + --> $DIR/issue-8460-const.rs:15:36 | LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:19:36 + --> $DIR/issue-8460-const.rs:17:36 | LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:21:36 + --> $DIR/issue-8460-const.rs:19:36 | LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:23:36 + --> $DIR/issue-8460-const.rs:21:36 | LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:25:36 + --> $DIR/issue-8460-const.rs:23:36 | LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); | ^^^^^^^^^^ attempt to divide `1_isize` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:27:36 + --> $DIR/issue-8460-const.rs:25:36 | LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); | ^^^^^^^ attempt to divide `1_i8` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:29:36 + --> $DIR/issue-8460-const.rs:27:36 | LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); | ^^^^^^^^ attempt to divide `1_i16` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:31:36 + --> $DIR/issue-8460-const.rs:29:36 | LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); | ^^^^^^^^ attempt to divide `1_i32` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:33:36 + --> $DIR/issue-8460-const.rs:31:36 | LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); | ^^^^^^^^ attempt to divide `1_i64` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:35:36 + --> $DIR/issue-8460-const.rs:33:36 | LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); | ^^^^^^^^^ attempt to divide `1_i128` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:37:36 + --> $DIR/issue-8460-const.rs:35:36 | LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:39:36 + --> $DIR/issue-8460-const.rs:37:36 | LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:41:36 + --> $DIR/issue-8460-const.rs:39:36 | LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:43:36 + --> $DIR/issue-8460-const.rs:41:36 | LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:45:36 + --> $DIR/issue-8460-const.rs:43:36 | LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:47:36 + --> $DIR/issue-8460-const.rs:45:36 | LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:49:36 + --> $DIR/issue-8460-const.rs:47:36 | LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:51:36 + --> $DIR/issue-8460-const.rs:49:36 | LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:53:36 + --> $DIR/issue-8460-const.rs:51:36 | LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:55:36 + --> $DIR/issue-8460-const.rs:53:36 | LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:57:36 + --> $DIR/issue-8460-const.rs:55:36 | LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:59:36 + --> $DIR/issue-8460-const.rs:57:36 | LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero diff --git a/src/test/ui/numbers-arithmetic/issue-8460-const.opt.stderr b/src/test/ui/numbers-arithmetic/issue-8460-const.opt.stderr index e2eee1ccdc98c..c4abcb784119e 100644 --- a/src/test/ui/numbers-arithmetic/issue-8460-const.opt.stderr +++ b/src/test/ui/numbers-arithmetic/issue-8460-const.opt.stderr @@ -1,5 +1,5 @@ error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:13:36 + --> $DIR/issue-8460-const.rs:11:36 | LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow @@ -7,139 +7,139 @@ LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:15:36 + --> $DIR/issue-8460-const.rs:13:36 | LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:17:36 + --> $DIR/issue-8460-const.rs:15:36 | LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:19:36 + --> $DIR/issue-8460-const.rs:17:36 | LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:21:36 + --> $DIR/issue-8460-const.rs:19:36 | LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:23:36 + --> $DIR/issue-8460-const.rs:21:36 | LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:25:36 + --> $DIR/issue-8460-const.rs:23:36 | LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); | ^^^^^^^^^^ attempt to divide `1_isize` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:27:36 + --> $DIR/issue-8460-const.rs:25:36 | LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); | ^^^^^^^ attempt to divide `1_i8` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:29:36 + --> $DIR/issue-8460-const.rs:27:36 | LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); | ^^^^^^^^ attempt to divide `1_i16` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:31:36 + --> $DIR/issue-8460-const.rs:29:36 | LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); | ^^^^^^^^ attempt to divide `1_i32` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:33:36 + --> $DIR/issue-8460-const.rs:31:36 | LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); | ^^^^^^^^ attempt to divide `1_i64` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:35:36 + --> $DIR/issue-8460-const.rs:33:36 | LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); | ^^^^^^^^^ attempt to divide `1_i128` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:37:36 + --> $DIR/issue-8460-const.rs:35:36 | LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:39:36 + --> $DIR/issue-8460-const.rs:37:36 | LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:41:36 + --> $DIR/issue-8460-const.rs:39:36 | LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:43:36 + --> $DIR/issue-8460-const.rs:41:36 | LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:45:36 + --> $DIR/issue-8460-const.rs:43:36 | LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:47:36 + --> $DIR/issue-8460-const.rs:45:36 | LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:49:36 + --> $DIR/issue-8460-const.rs:47:36 | LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:51:36 + --> $DIR/issue-8460-const.rs:49:36 | LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:53:36 + --> $DIR/issue-8460-const.rs:51:36 | LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:55:36 + --> $DIR/issue-8460-const.rs:53:36 | LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:57:36 + --> $DIR/issue-8460-const.rs:55:36 | LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:59:36 + --> $DIR/issue-8460-const.rs:57:36 | LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero diff --git a/src/test/ui/numbers-arithmetic/issue-8460-const.opt_with_overflow_checks.stderr b/src/test/ui/numbers-arithmetic/issue-8460-const.opt_with_overflow_checks.stderr index e2eee1ccdc98c..c4abcb784119e 100644 --- a/src/test/ui/numbers-arithmetic/issue-8460-const.opt_with_overflow_checks.stderr +++ b/src/test/ui/numbers-arithmetic/issue-8460-const.opt_with_overflow_checks.stderr @@ -1,5 +1,5 @@ error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:13:36 + --> $DIR/issue-8460-const.rs:11:36 | LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow @@ -7,139 +7,139 @@ LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:15:36 + --> $DIR/issue-8460-const.rs:13:36 | LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:17:36 + --> $DIR/issue-8460-const.rs:15:36 | LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:19:36 + --> $DIR/issue-8460-const.rs:17:36 | LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:21:36 + --> $DIR/issue-8460-const.rs:19:36 | LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:23:36 + --> $DIR/issue-8460-const.rs:21:36 | LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:25:36 + --> $DIR/issue-8460-const.rs:23:36 | LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); | ^^^^^^^^^^ attempt to divide `1_isize` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:27:36 + --> $DIR/issue-8460-const.rs:25:36 | LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); | ^^^^^^^ attempt to divide `1_i8` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:29:36 + --> $DIR/issue-8460-const.rs:27:36 | LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); | ^^^^^^^^ attempt to divide `1_i16` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:31:36 + --> $DIR/issue-8460-const.rs:29:36 | LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); | ^^^^^^^^ attempt to divide `1_i32` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:33:36 + --> $DIR/issue-8460-const.rs:31:36 | LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); | ^^^^^^^^ attempt to divide `1_i64` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:35:36 + --> $DIR/issue-8460-const.rs:33:36 | LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); | ^^^^^^^^^ attempt to divide `1_i128` by zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:37:36 + --> $DIR/issue-8460-const.rs:35:36 | LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ attempt to compute the remainder of `isize::MIN % -1_isize`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:39:36 + --> $DIR/issue-8460-const.rs:37:36 | LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^ attempt to compute the remainder of `i8::MIN % -1_i8`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:41:36 + --> $DIR/issue-8460-const.rs:39:36 | LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute the remainder of `i16::MIN % -1_i16`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:43:36 + --> $DIR/issue-8460-const.rs:41:36 | LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:45:36 + --> $DIR/issue-8460-const.rs:43:36 | LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:47:36 + --> $DIR/issue-8460-const.rs:45:36 | LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^^ attempt to compute the remainder of `i128::MIN % -1_i128`, which would overflow error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:49:36 + --> $DIR/issue-8460-const.rs:47:36 | LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:51:36 + --> $DIR/issue-8460-const.rs:49:36 | LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:53:36 + --> $DIR/issue-8460-const.rs:51:36 | LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:55:36 + --> $DIR/issue-8460-const.rs:53:36 | LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:57:36 + --> $DIR/issue-8460-const.rs:55:36 | LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:59:36 + --> $DIR/issue-8460-const.rs:57:36 | LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero diff --git a/src/test/ui/numbers-arithmetic/issue-8460-const.rs b/src/test/ui/numbers-arithmetic/issue-8460-const.rs index 8cad6deb3db5e..02e7567dafabb 100644 --- a/src/test/ui/numbers-arithmetic/issue-8460-const.rs +++ b/src/test/ui/numbers-arithmetic/issue-8460-const.rs @@ -5,8 +5,6 @@ // build-fail -#![deny(const_err)] - use std::thread; fn main() { diff --git a/src/test/ui/numbers-arithmetic/overflowing-lsh-1.rs b/src/test/ui/numbers-arithmetic/overflowing-lsh-1.rs index e5ce80336397d..7f8b0c877600f 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-lsh-1.rs +++ b/src/test/ui/numbers-arithmetic/overflowing-lsh-1.rs @@ -1,7 +1,7 @@ // build-fail // compile-flags: -C debug-assertions -#![deny(arithmetic_overflow, const_err)] +#![deny(arithmetic_overflow)] fn main() { let _x = 1_i32 << 32; diff --git a/src/test/ui/numbers-arithmetic/overflowing-lsh-1.stderr b/src/test/ui/numbers-arithmetic/overflowing-lsh-1.stderr index 1d029939c7028..434c9d5b43daf 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-lsh-1.stderr +++ b/src/test/ui/numbers-arithmetic/overflowing-lsh-1.stderr @@ -7,7 +7,7 @@ LL | let _x = 1_i32 << 32; note: the lint level is defined here --> $DIR/overflowing-lsh-1.rs:4:9 | -LL | #![deny(arithmetic_overflow, const_err)] +LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/numbers-arithmetic/overflowing-lsh-2.rs b/src/test/ui/numbers-arithmetic/overflowing-lsh-2.rs index 7fd3407a056ef..76718ecd1fa7a 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-lsh-2.rs +++ b/src/test/ui/numbers-arithmetic/overflowing-lsh-2.rs @@ -1,7 +1,7 @@ // build-fail // compile-flags: -C debug-assertions -#![deny(arithmetic_overflow, const_err)] +#![deny(arithmetic_overflow)] fn main() { let _x = 1 << -1; diff --git a/src/test/ui/numbers-arithmetic/overflowing-lsh-2.stderr b/src/test/ui/numbers-arithmetic/overflowing-lsh-2.stderr index 8598792e08043..c3b44e5a04375 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-lsh-2.stderr +++ b/src/test/ui/numbers-arithmetic/overflowing-lsh-2.stderr @@ -7,7 +7,7 @@ LL | let _x = 1 << -1; note: the lint level is defined here --> $DIR/overflowing-lsh-2.rs:4:9 | -LL | #![deny(arithmetic_overflow, const_err)] +LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/numbers-arithmetic/overflowing-lsh-3.rs b/src/test/ui/numbers-arithmetic/overflowing-lsh-3.rs index e007eb4a2e2f7..b2bdd09bffb91 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-lsh-3.rs +++ b/src/test/ui/numbers-arithmetic/overflowing-lsh-3.rs @@ -1,7 +1,7 @@ // build-fail // compile-flags: -C debug-assertions -#![deny(arithmetic_overflow, const_err)] +#![deny(arithmetic_overflow)] fn main() { let _x = 1_u64 << 64; diff --git a/src/test/ui/numbers-arithmetic/overflowing-lsh-3.stderr b/src/test/ui/numbers-arithmetic/overflowing-lsh-3.stderr index 9c6f806f1d65c..9d6479bd7c7c6 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-lsh-3.stderr +++ b/src/test/ui/numbers-arithmetic/overflowing-lsh-3.stderr @@ -7,7 +7,7 @@ LL | let _x = 1_u64 << 64; note: the lint level is defined here --> $DIR/overflowing-lsh-3.rs:4:9 | -LL | #![deny(arithmetic_overflow, const_err)] +LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/numbers-arithmetic/overflowing-lsh-4.rs b/src/test/ui/numbers-arithmetic/overflowing-lsh-4.rs index 738d013391579..1042bfcb34d3d 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-lsh-4.rs +++ b/src/test/ui/numbers-arithmetic/overflowing-lsh-4.rs @@ -4,7 +4,7 @@ // This function is checking that our automatic truncation does not // sidestep the overflow checking. -#![deny(arithmetic_overflow, const_err)] +#![deny(arithmetic_overflow)] fn main() { // this signals overflow when checking is on diff --git a/src/test/ui/numbers-arithmetic/overflowing-lsh-4.stderr b/src/test/ui/numbers-arithmetic/overflowing-lsh-4.stderr index 08081a0b7876d..2bb5b6a6d6e09 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-lsh-4.stderr +++ b/src/test/ui/numbers-arithmetic/overflowing-lsh-4.stderr @@ -7,7 +7,7 @@ LL | let x = 1_i8 << 17; note: the lint level is defined here --> $DIR/overflowing-lsh-4.rs:7:9 | -LL | #![deny(arithmetic_overflow, const_err)] +LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/numbers-arithmetic/overflowing-rsh-1.rs b/src/test/ui/numbers-arithmetic/overflowing-rsh-1.rs index f1488cf8559a2..80593c8656f51 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-rsh-1.rs +++ b/src/test/ui/numbers-arithmetic/overflowing-rsh-1.rs @@ -1,7 +1,7 @@ // build-fail // compile-flags: -C debug-assertions -#![deny(arithmetic_overflow, const_err)] +#![deny(arithmetic_overflow)] fn main() { let _x = -1_i32 >> 32; diff --git a/src/test/ui/numbers-arithmetic/overflowing-rsh-1.stderr b/src/test/ui/numbers-arithmetic/overflowing-rsh-1.stderr index 4d726fa7fec21..b2b3114d1b4cf 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-rsh-1.stderr +++ b/src/test/ui/numbers-arithmetic/overflowing-rsh-1.stderr @@ -7,7 +7,7 @@ LL | let _x = -1_i32 >> 32; note: the lint level is defined here --> $DIR/overflowing-rsh-1.rs:4:9 | -LL | #![deny(arithmetic_overflow, const_err)] +LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/numbers-arithmetic/overflowing-rsh-2.rs b/src/test/ui/numbers-arithmetic/overflowing-rsh-2.rs index 39127b9703b6b..917352bfce417 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-rsh-2.rs +++ b/src/test/ui/numbers-arithmetic/overflowing-rsh-2.rs @@ -1,7 +1,7 @@ // build-fail // compile-flags: -C debug-assertions -#![deny(arithmetic_overflow, const_err)] +#![deny(arithmetic_overflow)] fn main() { let _x = -1_i32 >> -1; diff --git a/src/test/ui/numbers-arithmetic/overflowing-rsh-2.stderr b/src/test/ui/numbers-arithmetic/overflowing-rsh-2.stderr index 9a8349d5ddb79..ad18c3bb7f459 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-rsh-2.stderr +++ b/src/test/ui/numbers-arithmetic/overflowing-rsh-2.stderr @@ -7,7 +7,7 @@ LL | let _x = -1_i32 >> -1; note: the lint level is defined here --> $DIR/overflowing-rsh-2.rs:4:9 | -LL | #![deny(arithmetic_overflow, const_err)] +LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/numbers-arithmetic/overflowing-rsh-3.rs b/src/test/ui/numbers-arithmetic/overflowing-rsh-3.rs index 8ee6dde93eafe..1e052990a7630 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-rsh-3.rs +++ b/src/test/ui/numbers-arithmetic/overflowing-rsh-3.rs @@ -1,7 +1,7 @@ // build-fail // compile-flags: -C debug-assertions -#![deny(arithmetic_overflow, const_err)] +#![deny(arithmetic_overflow)] fn main() { let _x = -1_i64 >> 64; diff --git a/src/test/ui/numbers-arithmetic/overflowing-rsh-3.stderr b/src/test/ui/numbers-arithmetic/overflowing-rsh-3.stderr index f48b7ff6de54b..37d02e09dec34 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-rsh-3.stderr +++ b/src/test/ui/numbers-arithmetic/overflowing-rsh-3.stderr @@ -7,7 +7,7 @@ LL | let _x = -1_i64 >> 64; note: the lint level is defined here --> $DIR/overflowing-rsh-3.rs:4:9 | -LL | #![deny(arithmetic_overflow, const_err)] +LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/numbers-arithmetic/overflowing-rsh-4.rs b/src/test/ui/numbers-arithmetic/overflowing-rsh-4.rs index ce7f818e330b9..be918becd3a3a 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-rsh-4.rs +++ b/src/test/ui/numbers-arithmetic/overflowing-rsh-4.rs @@ -4,7 +4,7 @@ // This function is checking that our (type-based) automatic // truncation does not sidestep the overflow checking. -#![deny(arithmetic_overflow, const_err)] +#![deny(arithmetic_overflow)] fn main() { // this signals overflow when checking is on diff --git a/src/test/ui/numbers-arithmetic/overflowing-rsh-4.stderr b/src/test/ui/numbers-arithmetic/overflowing-rsh-4.stderr index 4816a389965d6..692602c07198b 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-rsh-4.stderr +++ b/src/test/ui/numbers-arithmetic/overflowing-rsh-4.stderr @@ -7,7 +7,7 @@ LL | let x = 2_i8 >> 17; note: the lint level is defined here --> $DIR/overflowing-rsh-4.rs:7:9 | -LL | #![deny(arithmetic_overflow, const_err)] +LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/numbers-arithmetic/overflowing-rsh-5.rs b/src/test/ui/numbers-arithmetic/overflowing-rsh-5.rs index 88928c9959666..f75e779ed158c 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-rsh-5.rs +++ b/src/test/ui/numbers-arithmetic/overflowing-rsh-5.rs @@ -1,7 +1,7 @@ // build-fail // compile-flags: -C debug-assertions -#![deny(arithmetic_overflow, const_err)] +#![deny(arithmetic_overflow)] fn main() { let _n = 1i64 >> [64][0]; diff --git a/src/test/ui/numbers-arithmetic/overflowing-rsh-5.stderr b/src/test/ui/numbers-arithmetic/overflowing-rsh-5.stderr index cd36f543d68b3..e3b5859df90fa 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-rsh-5.stderr +++ b/src/test/ui/numbers-arithmetic/overflowing-rsh-5.stderr @@ -7,7 +7,7 @@ LL | let _n = 1i64 >> [64][0]; note: the lint level is defined here --> $DIR/overflowing-rsh-5.rs:4:9 | -LL | #![deny(arithmetic_overflow, const_err)] +LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/numbers-arithmetic/overflowing-rsh-6.rs b/src/test/ui/numbers-arithmetic/overflowing-rsh-6.rs index 88928c9959666..f75e779ed158c 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-rsh-6.rs +++ b/src/test/ui/numbers-arithmetic/overflowing-rsh-6.rs @@ -1,7 +1,7 @@ // build-fail // compile-flags: -C debug-assertions -#![deny(arithmetic_overflow, const_err)] +#![deny(arithmetic_overflow)] fn main() { let _n = 1i64 >> [64][0]; diff --git a/src/test/ui/numbers-arithmetic/overflowing-rsh-6.stderr b/src/test/ui/numbers-arithmetic/overflowing-rsh-6.stderr index bec8b17df0b4c..a3475c04c28cd 100644 --- a/src/test/ui/numbers-arithmetic/overflowing-rsh-6.stderr +++ b/src/test/ui/numbers-arithmetic/overflowing-rsh-6.stderr @@ -7,7 +7,7 @@ LL | let _n = 1i64 >> [64][0]; note: the lint level is defined here --> $DIR/overflowing-rsh-6.rs:4:9 | -LL | #![deny(arithmetic_overflow, const_err)] +LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/numbers-arithmetic/promoted_overflow_opt.rs b/src/test/ui/numbers-arithmetic/promoted_overflow_opt.rs index 4785abbc55470..76279e91308e8 100644 --- a/src/test/ui/numbers-arithmetic/promoted_overflow_opt.rs +++ b/src/test/ui/numbers-arithmetic/promoted_overflow_opt.rs @@ -1,5 +1,4 @@ // run-pass -#![allow(const_err)] // compile-flags: -O diff --git a/src/tools/clippy/clippy_lints/src/indexing_slicing.rs b/src/tools/clippy/clippy_lints/src/indexing_slicing.rs index 4a375752e1d3b..af40a5a8187ee 100644 --- a/src/tools/clippy/clippy_lints/src/indexing_slicing.rs +++ b/src/tools/clippy/clippy_lints/src/indexing_slicing.rs @@ -19,7 +19,6 @@ declare_clippy_lint! { /// /// ### Example /// ```rust,no_run - /// # #![allow(const_err)] /// let x = [1, 2, 3, 4]; /// /// x[9]; diff --git a/src/tools/clippy/tests/ui/crashes/ice-9463.rs b/src/tools/clippy/tests/ui/crashes/ice-9463.rs index 41ef930d3233d..9564e77c24b1c 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-9463.rs +++ b/src/tools/clippy/tests/ui/crashes/ice-9463.rs @@ -1,4 +1,4 @@ -#![deny(arithmetic_overflow, const_err)] +#![deny(arithmetic_overflow)] fn main() { let _x = -1_i32 >> -1; let _y = 1u32 >> 10000000000000u32; diff --git a/src/tools/clippy/tests/ui/crashes/ice-9463.stderr b/src/tools/clippy/tests/ui/crashes/ice-9463.stderr index b0ce306d6838e..2b425e85a27b5 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-9463.stderr +++ b/src/tools/clippy/tests/ui/crashes/ice-9463.stderr @@ -7,7 +7,7 @@ LL | let _x = -1_i32 >> -1; note: the lint level is defined here --> $DIR/ice-9463.rs:1:9 | -LL | #![deny(arithmetic_overflow, const_err)] +LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: this arithmetic operation will overflow diff --git a/src/tools/clippy/tests/ui/indexing_slicing_index.rs b/src/tools/clippy/tests/ui/indexing_slicing_index.rs index 7ebf6ee993cbd..4476e0eb9220a 100644 --- a/src/tools/clippy/tests/ui/indexing_slicing_index.rs +++ b/src/tools/clippy/tests/ui/indexing_slicing_index.rs @@ -3,7 +3,7 @@ // We also check the out_of_bounds_indexing lint here, because it lints similar things and // we want to avoid false positives. #![warn(clippy::out_of_bounds_indexing)] -#![allow(const_err, unconditional_panic, clippy::no_effect, clippy::unnecessary_operation)] +#![allow(unconditional_panic, clippy::no_effect, clippy::unnecessary_operation)] const ARR: [i32; 2] = [1, 2]; const REF: &i32 = &ARR[idx()]; // Ok, should not produce stderr. diff --git a/src/tools/clippy/tests/ui/indexing_slicing_index.stderr b/src/tools/clippy/tests/ui/indexing_slicing_index.stderr index a8d8b38163d0d..da5bc38b3b66c 100644 --- a/src/tools/clippy/tests/ui/indexing_slicing_index.stderr +++ b/src/tools/clippy/tests/ui/indexing_slicing_index.stderr @@ -59,6 +59,12 @@ LL | v[M]; | = help: consider using `.get(n)` or `.get_mut(n)` instead -error: aborting due to 8 previous errors +error[E0080]: evaluation of constant value failed + --> $DIR/indexing_slicing_index.rs:10:24 + | +LL | const REF_ERR: &i32 = &ARR[idx4()]; // Ok, let rustc handle const contexts. + | ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4 + +error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/src/tools/clippy/tests/ui/out_of_bounds_indexing/issue-3102.rs b/src/tools/clippy/tests/ui/out_of_bounds_indexing/issue-3102.rs index f20a0ede1137c..edd2123d48a55 100644 --- a/src/tools/clippy/tests/ui/out_of_bounds_indexing/issue-3102.rs +++ b/src/tools/clippy/tests/ui/out_of_bounds_indexing/issue-3102.rs @@ -1,5 +1,5 @@ #![warn(clippy::out_of_bounds_indexing)] -#![allow(clippy::no_effect, const_err)] +#![allow(clippy::no_effect)] fn main() { let x = [1, 2, 3, 4]; diff --git a/src/tools/clippy/tests/ui/out_of_bounds_indexing/simple.rs b/src/tools/clippy/tests/ui/out_of_bounds_indexing/simple.rs index 590e578d758ea..4c541c23f5f47 100644 --- a/src/tools/clippy/tests/ui/out_of_bounds_indexing/simple.rs +++ b/src/tools/clippy/tests/ui/out_of_bounds_indexing/simple.rs @@ -1,5 +1,5 @@ #![warn(clippy::out_of_bounds_indexing)] -#![allow(clippy::no_effect, clippy::unnecessary_operation, const_err)] +#![allow(clippy::no_effect, clippy::unnecessary_operation)] fn main() { let x = [1, 2, 3, 4]; diff --git a/src/tools/miri/tests/fail/erroneous_const.rs b/src/tools/miri/tests/fail/erroneous_const.rs index c35a905035932..d14998ccba269 100644 --- a/src/tools/miri/tests/fail/erroneous_const.rs +++ b/src/tools/miri/tests/fail/erroneous_const.rs @@ -3,7 +3,6 @@ // Inlining changes the error location //@compile-flags: -Zmir-opt-level=0 #![feature(never_type)] -#![warn(warnings, const_err)] struct PrintName(T); impl PrintName { diff --git a/src/tools/miri/tests/fail/erroneous_const2.rs b/src/tools/miri/tests/fail/erroneous_const2.rs index 6628166cfacdf..9a1a970778fb4 100644 --- a/src/tools/miri/tests/fail/erroneous_const2.rs +++ b/src/tools/miri/tests/fail/erroneous_const2.rs @@ -1,13 +1,9 @@ const X: u32 = 5; const Y: u32 = 6; const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; -//~^ERROR: any use of this value -//~|WARN: previously accepted +//~^ERROR: evaluation of constant value failed #[rustfmt::skip] // rustfmt bug: https://github.com/rust-lang/rustfmt/issues/5391 fn main() { - println!("{}", FOO); //~ERROR: post-monomorphization error - //~|ERROR: evaluation of constant value failed - //~|ERROR: erroneous constant used - //~|WARN: previously accepted + println!("{}", FOO); } diff --git a/src/tools/miri/tests/fail/erroneous_const2.stderr b/src/tools/miri/tests/fail/erroneous_const2.stderr index 4d402257b8bd0..d41fcfd2302e5 100644 --- a/src/tools/miri/tests/fail/erroneous_const2.stderr +++ b/src/tools/miri/tests/fail/erroneous_const2.stderr @@ -1,39 +1,9 @@ -error: any use of this value will cause an error - --> $DIR/erroneous_const2.rs:LL:CC - | -LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; - | -------------- ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: `#[deny(const_err)]` on by default - error[E0080]: evaluation of constant value failed --> $DIR/erroneous_const2.rs:LL:CC | -LL | println!("{}", FOO); - | ^^^ referenced constant has errors - -error: erroneous constant used - --> $DIR/erroneous_const2.rs:LL:CC - | -LL | println!("{}", FOO); - | ^^^ referenced constant has errors - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 - = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: post-monomorphization error: referenced constant has errors - --> $DIR/erroneous_const2.rs:LL:CC - | -LL | println!("{}", FOO); - | ^^^ referenced constant has errors - | - = note: inside `main` at $DIR/erroneous_const2.rs:LL:CC - -note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace +LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; + | ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow -error: aborting due to 4 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0080`.