From 448eeea94f7106bded3e5e967595e01c85aa10e3 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 11 Sep 2023 23:09:11 +0200 Subject: [PATCH] don't point at const usage site for resolution-time errors also share the code that emits the actual error --- compiler/rustc_codegen_cranelift/src/base.rs | 25 +++++-------- compiler/rustc_codegen_ssa/messages.ftl | 4 --- compiler/rustc_codegen_ssa/src/errors.rs | 14 -------- compiler/rustc_codegen_ssa/src/mir/mod.rs | 24 +++++-------- compiler/rustc_const_eval/messages.ftl | 3 -- compiler/rustc_const_eval/src/errors.rs | 7 ---- .../src/interpret/eval_context.rs | 14 ++------ compiler/rustc_middle/messages.ftl | 2 ++ compiler/rustc_middle/src/error.rs | 7 ++++ .../rustc_middle/src/mir/interpret/error.rs | 35 +++++++++++++++---- .../rustc_middle/src/mir/interpret/queries.rs | 18 ++++++---- compiler/rustc_middle/src/mir/mod.rs | 24 ++----------- .../suppress_lint_in_const/test.stderr | 2 +- .../tests/ui/indexing_slicing_index.stderr | 2 +- .../miri/tests/fail/const-ub-checks.stderr | 2 +- .../miri/tests/fail/erroneous_const.stderr | 2 +- .../miri/tests/fail/erroneous_const2.stderr | 4 +-- .../defaults-not-assumed-fail.stderr | 6 ++-- tests/ui/borrowck/issue-81899.stderr | 2 +- .../issue-88434-minimal-example.stderr | 2 +- ...-88434-removal-index-should-be-less.stderr | 2 +- .../const-generics/issues/issue-98629.stderr | 6 ---- tests/ui/consts/const-err-late.stderr | 6 ++-- tests/ui/consts/const-err-multi.stderr | 6 ++-- .../consts/const-eval/erroneous-const.stderr | 2 +- .../consts/const-eval/erroneous-const2.stderr | 2 +- tests/ui/consts/const-eval/issue-44578.stderr | 6 ++-- .../ui/consts/const-eval/issue-50814-2.stderr | 2 +- tests/ui/consts/const-eval/issue-50814.stderr | 2 +- .../const-eval/panic-assoc-never-type.rs | 2 +- .../const-eval/panic-assoc-never-type.stderr | 4 +-- .../consts/const-eval/raw-bytes.32bit.stderr | 6 ++-- .../consts/const-eval/raw-bytes.64bit.stderr | 6 ++-- tests/ui/consts/const-eval/ub-ref-ptr.stderr | 4 +-- tests/ui/consts/const-eval/ub-wide-ptr.stderr | 6 ++-- .../const-eval/union-const-eval-field.stderr | 4 +-- .../const-float-bits-reject-conv.stderr | 16 ++++----- ...t-len-underflow-separate-spans.next.stderr | 2 +- ...st-len-underflow-separate-spans.old.stderr | 2 +- tests/ui/consts/invalid-union.32bit.stderr | 4 +-- tests/ui/consts/invalid-union.64bit.stderr | 4 +-- .../issue-70942-trait-vs-impl-mismatch.stderr | 6 ---- .../consts/miri_unleashed/assoc_const.stderr | 4 +-- .../miri_unleashed/assoc_const_2.stderr | 4 +-- .../uninhabited-const-issue-61744.stderr | 4 +-- ...e-69602-type-err-during-codegen-ice.stderr | 8 +---- tests/ui/limits/issue-55878.stderr | 4 +-- 47 files changed, 134 insertions(+), 189 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs index e41c6b31e9c75..9b5a6b89191e1 100644 --- a/compiler/rustc_codegen_cranelift/src/base.rs +++ b/compiler/rustc_codegen_cranelift/src/base.rs @@ -2,7 +2,6 @@ use rustc_ast::InlineAsmOptions; use rustc_index::IndexVec; -use rustc_middle::mir::interpret::ErrorHandled; use rustc_middle::ty::adjustment::PointerCoercion; use rustc_middle::ty::layout::FnAbiOf; use rustc_middle::ty::print::with_no_trimmed_paths; @@ -251,21 +250,15 @@ pub(crate) fn verify_func( } fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) { - match fx.mir.post_mono_checks(fx.tcx, ty::ParamEnv::reveal_all(), |c| Ok(fx.monomorphize(c))) { - Ok(()) => {} - Err(ErrorHandled::TooGeneric(span)) => { - span_bug!(span, "codegen encountered polymorphic constant"); - } - Err(ErrorHandled::Reported(info, span)) => { - if !info.is_tainted_by_errors() { - fx.tcx.sess.span_err(span, "erroneous constant encountered"); - } - fx.bcx.append_block_params_for_function_params(fx.block_map[START_BLOCK]); - fx.bcx.switch_to_block(fx.block_map[START_BLOCK]); - // compilation should have been aborted - fx.bcx.ins().trap(TrapCode::UnreachableCodeReached); - return; - } + if let Err(err) = + fx.mir.post_mono_checks(fx.tcx, ty::ParamEnv::reveal_all(), |c| Ok(fx.monomorphize(c))) + { + err.emit_err(fx.tcx); + fx.bcx.append_block_params_for_function_params(fx.block_map[START_BLOCK]); + fx.bcx.switch_to_block(fx.block_map[START_BLOCK]); + // compilation should have been aborted + fx.bcx.ins().trap(TrapCode::UnreachableCodeReached); + return; } let arg_uninhabited = fx diff --git a/compiler/rustc_codegen_ssa/messages.ftl b/compiler/rustc_codegen_ssa/messages.ftl index 9ce13ff469cd4..d0a078505d2d4 100644 --- a/compiler/rustc_codegen_ssa/messages.ftl +++ b/compiler/rustc_codegen_ssa/messages.ftl @@ -19,8 +19,6 @@ codegen_ssa_copy_path_buf = unable to copy {$source_file} to {$output_path}: {$e codegen_ssa_create_temp_dir = couldn't create a temp dir: {$error} -codegen_ssa_erroneous_constant = erroneous constant encountered - codegen_ssa_error_creating_remark_dir = failed to create remark directory: {$error} codegen_ssa_expected_coverage_symbol = expected `coverage(off)` or `coverage(on)` @@ -174,8 +172,6 @@ codegen_ssa_no_natvis_directory = error enumerating natvis directory: {$error} codegen_ssa_option_gcc_only = option `-Z gcc-ld` is used even though linker flavor is not gcc -codegen_ssa_polymorphic_constant_too_generic = codegen encountered polymorphic constant: TooGeneric - codegen_ssa_processing_dymutil_failed = processing debug info with `dsymutil` failed: {$status} .note = {$output} diff --git a/compiler/rustc_codegen_ssa/src/errors.rs b/compiler/rustc_codegen_ssa/src/errors.rs index fa49095c9e8b2..bfd572a2eeafe 100644 --- a/compiler/rustc_codegen_ssa/src/errors.rs +++ b/compiler/rustc_codegen_ssa/src/errors.rs @@ -595,20 +595,6 @@ pub struct InvalidWindowsSubsystem { pub subsystem: Symbol, } -#[derive(Diagnostic)] -#[diag(codegen_ssa_erroneous_constant)] -pub struct ErroneousConstant { - #[primary_span] - pub span: Span, -} - -#[derive(Diagnostic)] -#[diag(codegen_ssa_polymorphic_constant_too_generic)] -pub struct PolymorphicConstantTooGeneric { - #[primary_span] - pub span: Span, -} - #[derive(Diagnostic)] #[diag(codegen_ssa_shuffle_indices_evaluation)] pub struct ShuffleIndicesEvaluation { diff --git a/compiler/rustc_codegen_ssa/src/mir/mod.rs b/compiler/rustc_codegen_ssa/src/mir/mod.rs index aece73fb3e5b0..4c80ba54c7634 100644 --- a/compiler/rustc_codegen_ssa/src/mir/mod.rs +++ b/compiler/rustc_codegen_ssa/src/mir/mod.rs @@ -1,10 +1,8 @@ use crate::base; -use crate::errors; use crate::traits::*; use rustc_index::bit_set::BitSet; use rustc_index::IndexVec; use rustc_middle::mir; -use rustc_middle::mir::interpret::ErrorHandled; use rustc_middle::mir::traversal; use rustc_middle::mir::UnwindTerminateReason; use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, TyAndLayout}; @@ -214,20 +212,14 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( fx.per_local_var_debug_info = fx.compute_per_local_var_debug_info(&mut start_bx); // Rust post-monomorphization checks; we later rely on them. - match mir.post_mono_checks(cx.tcx(), ty::ParamEnv::reveal_all(), |c| Ok(fx.monomorphize(c))) { - Ok(()) => {} - Err(ErrorHandled::TooGeneric(span)) => { - cx.tcx().sess.diagnostic().emit_bug(errors::PolymorphicConstantTooGeneric { span }); - } - Err(ErrorHandled::Reported(info, span)) => { - if !info.is_tainted_by_errors() { - cx.tcx().sess.emit_err(errors::ErroneousConstant { span }); - } - // This IR shouldn't ever be emitted, but let's try to guard against any of this code - // ever running. - start_bx.abort(); - return; - } + if let Err(err) = + mir.post_mono_checks(cx.tcx(), ty::ParamEnv::reveal_all(), |c| Ok(fx.monomorphize(c))) + { + err.emit_err(cx.tcx()); + // This IR shouldn't ever be emitted, but let's try to guard against any of this code + // ever running. + start_bx.abort(); + return; } let memory_locals = analyze::non_ssa_locals(&fx); diff --git a/compiler/rustc_const_eval/messages.ftl b/compiler/rustc_const_eval/messages.ftl index 020402fe25e99..d23e2a9f3e4e0 100644 --- a/compiler/rustc_const_eval/messages.ftl +++ b/compiler/rustc_const_eval/messages.ftl @@ -83,9 +83,6 @@ const_eval_dyn_call_vtable_mismatch = const_eval_dyn_star_call_vtable_mismatch = `dyn*` call on a pointer whose vtable does not match its type -const_eval_erroneous_constant = - erroneous constant used - const_eval_error = {$error_kind -> [static] could not evaluate static initializer [const] evaluation of constant value failed diff --git a/compiler/rustc_const_eval/src/errors.rs b/compiler/rustc_const_eval/src/errors.rs index c3c6cbe399109..b1599dd689482 100644 --- a/compiler/rustc_const_eval/src/errors.rs +++ b/compiler/rustc_const_eval/src/errors.rs @@ -239,13 +239,6 @@ pub struct LongRunningWarn { pub item_span: Span, } -#[derive(Diagnostic)] -#[diag(const_eval_erroneous_constant)] -pub(crate) struct ErroneousConstUsed { - #[primary_span] - pub span: Span, -} - #[derive(Subdiagnostic)] #[note(const_eval_non_const_impl)] pub(crate) struct NonConstImplNote { diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs index 6852780f2778b..cb14e165b5c4b 100644 --- a/compiler/rustc_const_eval/src/interpret/eval_context.rs +++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs @@ -24,7 +24,7 @@ use super::{ MemPlaceMeta, Memory, MemoryKind, OpTy, Operand, Place, PlaceTy, Pointer, PointerArithmetic, Projectable, Provenance, Scalar, StackPopJump, }; -use crate::errors::{self, ErroneousConstUsed}; +use crate::errors; use crate::util; use crate::{fluent_generated as fluent, ReportErrorExt}; @@ -1063,17 +1063,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { ) -> Result { // Use a precise span for better cycle errors. query(self.tcx.at(span.unwrap_or_else(|| self.cur_span()))).map_err(|err| { - match err { - ErrorHandled::Reported(err, reported_span) => { - // We trust the provided span more than the one that came out of the query. - let span = span.unwrap_or(reported_span); - if !err.is_tainted_by_errors() { - // To make it easier to figure out where this error comes from, also add a note at the current location. - self.tcx.sess.emit_note(ErroneousConstUsed { span }); - } - } - ErrorHandled::TooGeneric(_) => {} - } + err.emit_note(*self.tcx); err }) } diff --git a/compiler/rustc_middle/messages.ftl b/compiler/rustc_middle/messages.ftl index 108a10b506beb..82162fd85711b 100644 --- a/compiler/rustc_middle/messages.ftl +++ b/compiler/rustc_middle/messages.ftl @@ -52,6 +52,8 @@ middle_drop_check_overflow = overflow while adding drop-check rules for {$ty} .note = overflowed on {$overflow_ty} +middle_erroneous_constant = erroneous constant encountered + middle_layout_references_error = the type has an unknown layout diff --git a/compiler/rustc_middle/src/error.rs b/compiler/rustc_middle/src/error.rs index b346cd4539144..3c5536570872a 100644 --- a/compiler/rustc_middle/src/error.rs +++ b/compiler/rustc_middle/src/error.rs @@ -144,5 +144,12 @@ pub struct UnsupportedFnAbi { pub abi: &'static str, } +#[derive(Diagnostic)] +#[diag(middle_erroneous_constant)] +pub struct ErroneousConstant { + #[primary_span] + pub span: Span, +} + /// Used by `rustc_const_eval` pub use crate::fluent_generated::middle_adjust_for_foreign_abi_error; diff --git a/compiler/rustc_middle/src/mir/interpret/error.rs b/compiler/rustc_middle/src/mir/interpret/error.rs index 0a7296e7c781e..69eec25235721 100644 --- a/compiler/rustc_middle/src/mir/interpret/error.rs +++ b/compiler/rustc_middle/src/mir/interpret/error.rs @@ -1,8 +1,9 @@ use super::{AllocId, AllocRange, ConstAlloc, Pointer, Scalar}; +use crate::error; use crate::mir::interpret::ConstValue; use crate::query::TyCtxtAt; -use crate::ty::{layout, tls, Ty, ValTree}; +use crate::ty::{layout, tls, Ty, TyCtxt, ValTree}; use rustc_data_structures::sync::Lock; use rustc_errors::{ @@ -41,6 +42,32 @@ impl ErrorHandled { ErrorHandled::TooGeneric(_span) => ErrorHandled::TooGeneric(span), } } + + pub fn emit_err(&self, tcx: TyCtxt<'_>) -> ErrorGuaranteed { + match self { + &ErrorHandled::Reported(err, span) => { + if !err.is_tainted_by_errors && !span.is_dummy() { + tcx.sess.emit_err(error::ErroneousConstant { span }); + } + err.error + } + &ErrorHandled::TooGeneric(span) => tcx.sess.delay_span_bug( + span, + "encountered TooGeneric error when monomorphic data was expected", + ), + } + } + + pub fn emit_note(&self, tcx: TyCtxt<'_>) { + match self { + &ErrorHandled::Reported(err, span) => { + if !err.is_tainted_by_errors && !span.is_dummy() { + tcx.sess.emit_note(error::ErroneousConstant { span }); + } + } + &ErrorHandled::TooGeneric(_) => {} + } + } } #[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)] @@ -54,12 +81,6 @@ impl ReportedErrorInfo { pub fn tainted_by_errors(error: ErrorGuaranteed) -> ReportedErrorInfo { ReportedErrorInfo { is_tainted_by_errors: true, error } } - - /// Returns true if evaluation failed because MIR was tainted by errors. - #[inline] - pub fn is_tainted_by_errors(self) -> bool { - self.is_tainted_by_errors - } } impl From for ReportedErrorInfo { diff --git a/compiler/rustc_middle/src/mir/interpret/queries.rs b/compiler/rustc_middle/src/mir/interpret/queries.rs index 71e648bab6ad5..fbf6403eabe39 100644 --- a/compiler/rustc_middle/src/mir/interpret/queries.rs +++ b/compiler/rustc_middle/src/mir/interpret/queries.rs @@ -61,8 +61,10 @@ impl<'tcx> TyCtxt<'tcx> { let cid = GlobalId { instance, promoted: ct.promoted }; self.const_eval_global_id(param_env, cid, span) } - Ok(None) => Err(ErrorHandled::TooGeneric(span.unwrap_or(DUMMY_SP))), - Err(err) => Err(ErrorHandled::Reported(err.into(), span.unwrap_or(DUMMY_SP))), + // For errors during resolution, we deliberately do not point at the usage site of the constant, + // since for these errors the place the constant is used shouldn't matter. + Ok(None) => Err(ErrorHandled::TooGeneric(DUMMY_SP)), + Err(err) => Err(ErrorHandled::Reported(err.into(), DUMMY_SP)), } } @@ -117,8 +119,10 @@ impl<'tcx> TyCtxt<'tcx> { } }) } - Ok(None) => Err(ErrorHandled::TooGeneric(span.unwrap_or(DUMMY_SP))), - Err(err) => Err(ErrorHandled::Reported(err.into(), span.unwrap_or(DUMMY_SP))), + // For errors during resolution, we deliberately do not point at the usage site of the constant, + // since for these errors the place the constant is used shouldn't matter. + Ok(None) => Err(ErrorHandled::TooGeneric(DUMMY_SP)), + Err(err) => Err(ErrorHandled::Reported(err.into(), DUMMY_SP)), } } @@ -143,7 +147,8 @@ impl<'tcx> TyCtxt<'tcx> { // improve caching of queries. let inputs = self.erase_regions(param_env.and(cid)); if let Some(span) = span { - self.at(span).eval_to_const_value_raw(inputs) + // The query doesn't know where it is being invoked, so we need to fix the span. + self.at(span).eval_to_const_value_raw(inputs).map_err(|e| e.with_span(span)) } else { self.eval_to_const_value_raw(inputs) } @@ -162,7 +167,8 @@ impl<'tcx> TyCtxt<'tcx> { let inputs = self.erase_regions(param_env.and(cid)); debug!(?inputs); if let Some(span) = span { - self.at(span).eval_to_valtree(inputs) + // The query doesn't know where it is being invoked, so we need to fix the span. + self.at(span).eval_to_valtree(inputs).map_err(|e| e.with_span(span)) } else { self.eval_to_valtree(inputs) } diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 8615928847318..0e1188ff44a5e 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -587,28 +587,8 @@ impl<'tcx> Body<'tcx> { // For now, the only thing we have to check is is to ensure that all the constants used in // the body successfully evaluate. for &const_ in &self.required_consts { - let uv = match normalize_const(const_.literal)? { - ConstantKind::Ty(ct) => match ct.kind() { - ty::ConstKind::Unevaluated(uv) => uv.expand(), - ty::ConstKind::Value(..) => { - // These are already evaluated, so this cannot fail. - return Ok(()); - } - ty::ConstKind::Error(err) => { - return Err(ErrorHandled::Reported(err.into(), const_.span)); - } - ty::ConstKind::Param(..) - | ty::ConstKind::Infer(..) - | ty::ConstKind::Bound(..) - | ty::ConstKind::Placeholder(..) - | ty::ConstKind::Expr(..) => return Err(ErrorHandled::TooGeneric(const_.span)), - }, - ConstantKind::Unevaluated(uv, _) => uv, - ConstantKind::Val(..) => return Ok(()), - }; - tcx.const_eval_resolve(param_env, uv, Some(const_.span)).map_err(|e| - // The query results don't always have the span we want. - e.with_span(const_.span))?; + let c = normalize_const(const_.literal)?; + c.eval(tcx, param_env, Some(const_.span))?; } Ok(()) diff --git a/src/tools/clippy/tests/ui-toml/suppress_lint_in_const/test.stderr b/src/tools/clippy/tests/ui-toml/suppress_lint_in_const/test.stderr index d14974faffa67..f8ace7995939a 100644 --- a/src/tools/clippy/tests/ui-toml/suppress_lint_in_const/test.stderr +++ b/src/tools/clippy/tests/ui-toml/suppress_lint_in_const/test.stderr @@ -4,7 +4,7 @@ error[E0080]: evaluation of `main::{constant#3}` failed LL | const { &ARR[idx4()] }; // Ok, should not produce stderr, since `suppress-restriction-lint-in-const` is set true. | ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4 -note: erroneous constant used +note: erroneous constant encountered --> $DIR/test.rs:37:5 | LL | const { &ARR[idx4()] }; // Ok, should not produce stderr, since `suppress-restriction-lint-in-const` is set true. diff --git a/src/tools/clippy/tests/ui/indexing_slicing_index.stderr b/src/tools/clippy/tests/ui/indexing_slicing_index.stderr index 64facf208034b..1c34875d2b8ab 100644 --- a/src/tools/clippy/tests/ui/indexing_slicing_index.stderr +++ b/src/tools/clippy/tests/ui/indexing_slicing_index.stderr @@ -24,7 +24,7 @@ error[E0080]: evaluation of `main::{constant#3}` failed LL | const { &ARR[idx4()] }; | ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4 -note: erroneous constant used +note: erroneous constant encountered --> $DIR/indexing_slicing_index.rs:48:5 | LL | const { &ARR[idx4()] }; diff --git a/src/tools/miri/tests/fail/const-ub-checks.stderr b/src/tools/miri/tests/fail/const-ub-checks.stderr index 596a6bb4ca8d5..d2b9018cd4b8b 100644 --- a/src/tools/miri/tests/fail/const-ub-checks.stderr +++ b/src/tools/miri/tests/fail/const-ub-checks.stderr @@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed LL | ptr.read(); | ^^^^^^^^^^ accessing memory with alignment ALIGN, but alignment ALIGN is required -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-ub-checks.rs:LL:CC | LL | let _x = UNALIGNED_READ; diff --git a/src/tools/miri/tests/fail/erroneous_const.stderr b/src/tools/miri/tests/fail/erroneous_const.stderr index 209c4a932dc91..cacf866393d41 100644 --- a/src/tools/miri/tests/fail/erroneous_const.stderr +++ b/src/tools/miri/tests/fail/erroneous_const.stderr @@ -6,7 +6,7 @@ LL | const VOID: ! = panic!(); | = 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) -note: erroneous constant used +note: erroneous constant encountered --> $DIR/erroneous_const.rs:LL:CC | LL | let _ = PrintName::::VOID; diff --git a/src/tools/miri/tests/fail/erroneous_const2.stderr b/src/tools/miri/tests/fail/erroneous_const2.stderr index 9aad1fc9b023f..36e83b8f3bcf1 100644 --- a/src/tools/miri/tests/fail/erroneous_const2.stderr +++ b/src/tools/miri/tests/fail/erroneous_const2.stderr @@ -4,13 +4,13 @@ error[E0080]: evaluation of constant value failed LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; | ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow -note: erroneous constant used +note: erroneous constant encountered --> $DIR/erroneous_const2.rs:LL:CC | LL | println!("{}", FOO); | ^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/erroneous_const2.rs:LL:CC | LL | println!("{}", FOO); diff --git a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr index 9b761b0069121..d659912341aaf 100644 --- a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr +++ b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr @@ -4,13 +4,13 @@ error[E0080]: evaluation of `<() as Tr>::B` failed LL | const B: u8 = Self::A + 1; | ^^^^^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow -note: erroneous constant used +note: erroneous constant encountered --> $DIR/defaults-not-assumed-fail.rs:33:16 | LL | assert_eq!(<() as Tr>::B, 0); // causes the error above | ^^^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/defaults-not-assumed-fail.rs:33:5 | LL | assert_eq!(<() as Tr>::B, 0); // causes the error above @@ -18,7 +18,7 @@ LL | assert_eq!(<() as Tr>::B, 0); // causes the error above | = note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) -note: erroneous constant used +note: erroneous constant encountered --> $DIR/defaults-not-assumed-fail.rs:33:5 | LL | assert_eq!(<() as Tr>::B, 0); // causes the error above diff --git a/tests/ui/borrowck/issue-81899.stderr b/tests/ui/borrowck/issue-81899.stderr index 1b03bc3af9c72..63e817239c64e 100644 --- a/tests/ui/borrowck/issue-81899.stderr +++ b/tests/ui/borrowck/issue-81899.stderr @@ -16,7 +16,7 @@ LL | const _CONST: &[u8] = &f(&[], |_| {}); | ^^^^^^^^^^^^^^ = 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) -note: erroneous constant used +note: erroneous constant encountered --> $DIR/issue-81899.rs:4:23 | LL | const _CONST: &[u8] = &f(&[], |_| {}); diff --git a/tests/ui/borrowck/issue-88434-minimal-example.stderr b/tests/ui/borrowck/issue-88434-minimal-example.stderr index a5a571c6d4df0..4c887b2ad42c3 100644 --- a/tests/ui/borrowck/issue-88434-minimal-example.stderr +++ b/tests/ui/borrowck/issue-88434-minimal-example.stderr @@ -16,7 +16,7 @@ LL | const _CONST: &() = &f(&|_| {}); | ^^^^^^^^^^ = 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) -note: erroneous constant used +note: erroneous constant encountered --> $DIR/issue-88434-minimal-example.rs:3:21 | LL | const _CONST: &() = &f(&|_| {}); diff --git a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr index 00023c459a8e7..f7257817a8b2e 100644 --- a/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr +++ b/tests/ui/borrowck/issue-88434-removal-index-should-be-less.stderr @@ -16,7 +16,7 @@ LL | const _CONST: &[u8] = &f(&[], |_| {}); | ^^^^^^^^^^^^^^ = 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) -note: erroneous constant used +note: erroneous constant encountered --> $DIR/issue-88434-removal-index-should-be-less.rs:3:23 | LL | const _CONST: &[u8] = &f(&[], |_| {}); diff --git a/tests/ui/const-generics/issues/issue-98629.stderr b/tests/ui/const-generics/issues/issue-98629.stderr index e3f0926c7710d..4a248be76a9e8 100644 --- a/tests/ui/const-generics/issues/issue-98629.stderr +++ b/tests/ui/const-generics/issues/issue-98629.stderr @@ -1,9 +1,3 @@ -note: erroneous constant used - --> $DIR/issue-98629.rs:13:10 - | -LL | [(); ::N]:, - | ^^^^^^^^^^^^^^^^^ - error[E0046]: not all trait items implemented, missing: `N` --> $DIR/issue-98629.rs:8:1 | diff --git a/tests/ui/consts/const-err-late.stderr b/tests/ui/consts/const-err-late.stderr index 149d3b5236b2f..85bc56baed845 100644 --- a/tests/ui/consts/const-err-late.stderr +++ b/tests/ui/consts/const-err-late.stderr @@ -4,7 +4,7 @@ error[E0080]: evaluation of `S::::FOO` failed LL | const FOO: u8 = [5u8][1]; | ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-err-late.rs:19:16 | LL | black_box((S::::FOO, S::::FOO)); @@ -16,13 +16,13 @@ error[E0080]: evaluation of `S::::FOO` failed LL | const FOO: u8 = [5u8][1]; | ^^^^^^^^ index out of bounds: the length is 1 but the index is 1 -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-err-late.rs:19:31 | LL | black_box((S::::FOO, S::::FOO)); | ^^^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-err-late.rs:19:16 | LL | black_box((S::::FOO, S::::FOO)); diff --git a/tests/ui/consts/const-err-multi.stderr b/tests/ui/consts/const-err-multi.stderr index 28af8e5eb0918..1ad504b3a80d4 100644 --- a/tests/ui/consts/const-err-multi.stderr +++ b/tests/ui/consts/const-err-multi.stderr @@ -4,19 +4,19 @@ error[E0080]: evaluation of constant value failed LL | pub const A: i8 = -i8::MIN; | ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-err-multi.rs:3:19 | LL | pub const B: i8 = A; | ^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-err-multi.rs:5:19 | LL | pub const C: u8 = A as u8; | ^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-err-multi.rs:7:24 | LL | pub const D: i8 = 50 - A; diff --git a/tests/ui/consts/const-eval/erroneous-const.stderr b/tests/ui/consts/const-eval/erroneous-const.stderr index 770f95062ab30..0e31520fdbb06 100644 --- a/tests/ui/consts/const-eval/erroneous-const.stderr +++ b/tests/ui/consts/const-eval/erroneous-const.stderr @@ -4,7 +4,7 @@ error[E0080]: evaluation of `PrintName::::VOID` failed LL | const VOID: () = [()][2]; | ^^^^^^^ index out of bounds: the length is 1 but the index is 2 -note: erroneous constant used +note: erroneous constant encountered --> $DIR/erroneous-const.rs:13:13 | LL | PrintName::::VOID; diff --git a/tests/ui/consts/const-eval/erroneous-const2.stderr b/tests/ui/consts/const-eval/erroneous-const2.stderr index 082c2876575a6..4ca44694cd787 100644 --- a/tests/ui/consts/const-eval/erroneous-const2.stderr +++ b/tests/ui/consts/const-eval/erroneous-const2.stderr @@ -4,7 +4,7 @@ error[E0080]: evaluation of `PrintName::::VOID` failed LL | const VOID: () = [()][2]; | ^^^^^^^ index out of bounds: the length is 1 but the index is 2 -note: erroneous constant used +note: erroneous constant encountered --> $DIR/erroneous-const2.rs:13:9 | LL | PrintName::::VOID; diff --git a/tests/ui/consts/const-eval/issue-44578.stderr b/tests/ui/consts/const-eval/issue-44578.stderr index f3952809e4bb4..c7aaee9427137 100644 --- a/tests/ui/consts/const-eval/issue-44578.stderr +++ b/tests/ui/consts/const-eval/issue-44578.stderr @@ -4,13 +4,13 @@ error[E0080]: evaluation of ` as Foo>::AMT` failed 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 -note: erroneous constant used +note: erroneous constant encountered --> $DIR/issue-44578.rs:25:20 | LL | println!("{}", as Foo>::AMT); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/issue-44578.rs:25:20 | LL | println!("{}", as Foo>::AMT); @@ -18,7 +18,7 @@ LL | println!("{}", as Foo>::AMT); | = note: this note 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: erroneous constant used +note: erroneous constant encountered --> $DIR/issue-44578.rs:25:20 | LL | println!("{}", as Foo>::AMT); diff --git a/tests/ui/consts/const-eval/issue-50814-2.stderr b/tests/ui/consts/const-eval/issue-50814-2.stderr index 956f7aec9da8f..450fb00237306 100644 --- a/tests/ui/consts/const-eval/issue-50814-2.stderr +++ b/tests/ui/consts/const-eval/issue-50814-2.stderr @@ -4,7 +4,7 @@ error[E0080]: evaluation of ` as Foo<()>>::BAR` failed LL | const BAR: usize = [5, 6, 7][T::BOO]; | ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42 -note: erroneous constant used +note: erroneous constant encountered --> $DIR/issue-50814-2.rs:18:6 | LL | & as Foo>::BAR diff --git a/tests/ui/consts/const-eval/issue-50814.stderr b/tests/ui/consts/const-eval/issue-50814.stderr index 05b6271f4e4d5..48a20d0bbd083 100644 --- a/tests/ui/consts/const-eval/issue-50814.stderr +++ b/tests/ui/consts/const-eval/issue-50814.stderr @@ -4,7 +4,7 @@ error[E0080]: evaluation of ` as Unsigned>::MAX` failed LL | const MAX: u8 = A::MAX + B::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow -note: erroneous constant used +note: erroneous constant encountered --> $DIR/issue-50814.rs:20:6 | LL | &Sum::::MAX diff --git a/tests/ui/consts/const-eval/panic-assoc-never-type.rs b/tests/ui/consts/const-eval/panic-assoc-never-type.rs index 1abe708d19eb2..88ce5b0d895f3 100644 --- a/tests/ui/consts/const-eval/panic-assoc-never-type.rs +++ b/tests/ui/consts/const-eval/panic-assoc-never-type.rs @@ -11,5 +11,5 @@ impl PrintName { } fn main() { - let _ = PrintName::VOID; //~ erroneous constant used + let _ = PrintName::VOID; //~ erroneous constant encountered } diff --git a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr index 7c36a3a426e9e..4706497dbc48f 100644 --- a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr +++ b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr @@ -6,13 +6,13 @@ LL | const VOID: ! = panic!(); | = 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) -note: erroneous constant used +note: erroneous constant encountered --> $DIR/panic-assoc-never-type.rs:14:13 | LL | let _ = PrintName::VOID; | ^^^^^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/panic-assoc-never-type.rs:14:13 | LL | let _ = PrintName::VOID; diff --git a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr index e087a0ebec7f4..042e7eeb31e13 100644 --- a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr +++ b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr @@ -341,7 +341,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; ╾ALLOC_ID╼ │ ╾──╼ } -note: erroneous constant used +note: erroneous constant encountered --> $DIR/raw-bytes.rs:160:40 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; @@ -358,7 +358,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3 ╾ALLOC_ID╼ │ ╾──╼ } -note: erroneous constant used +note: erroneous constant encountered --> $DIR/raw-bytes.rs:166:42 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); @@ -375,7 +375,7 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran ╾ALLOC_ID╼ │ ╾──╼ } -note: erroneous constant used +note: erroneous constant encountered --> $DIR/raw-bytes.rs:170:42 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); diff --git a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr index 4c655161f7983..8426a95055cc3 100644 --- a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr +++ b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr @@ -341,7 +341,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; ╾ALLOC_ID╼ │ ╾──────╼ } -note: erroneous constant used +note: erroneous constant encountered --> $DIR/raw-bytes.rs:160:40 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; @@ -358,7 +358,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3 ╾ALLOC_ID╼ │ ╾──────╼ } -note: erroneous constant used +note: erroneous constant encountered --> $DIR/raw-bytes.rs:166:42 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); @@ -375,7 +375,7 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran ╾ALLOC_ID╼ │ ╾──────╼ } -note: erroneous constant used +note: erroneous constant encountered --> $DIR/raw-bytes.rs:170:42 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.stderr b/tests/ui/consts/const-eval/ub-ref-ptr.stderr index 0ee1e60877f6f..6d5c36cea7d99 100644 --- a/tests/ui/consts/const-eval/ub-ref-ptr.stderr +++ b/tests/ui/consts/const-eval/ub-ref-ptr.stderr @@ -60,7 +60,7 @@ LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; = 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: erroneous constant used +note: erroneous constant encountered --> $DIR/ub-ref-ptr.rs:36:38 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; @@ -75,7 +75,7 @@ LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[us = 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: erroneous constant used +note: erroneous constant encountered --> $DIR/ub-ref-ptr.rs:39:85 | LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.stderr b/tests/ui/consts/const-eval/ub-wide-ptr.stderr index 02bbbf5043594..d8add67fac133 100644 --- a/tests/ui/consts/const-eval/ub-wide-ptr.stderr +++ b/tests/ui/consts/const-eval/ub-wide-ptr.stderr @@ -139,7 +139,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; HEX_DUMP } -note: erroneous constant used +note: erroneous constant encountered --> $DIR/ub-wide-ptr.rs:85:40 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; @@ -156,7 +156,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3 HEX_DUMP } -note: erroneous constant used +note: erroneous constant encountered --> $DIR/ub-wide-ptr.rs:92:42 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); @@ -173,7 +173,7 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran HEX_DUMP } -note: erroneous constant used +note: erroneous constant encountered --> $DIR/ub-wide-ptr.rs:96:42 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); diff --git a/tests/ui/consts/const-eval/union-const-eval-field.stderr b/tests/ui/consts/const-eval/union-const-eval-field.stderr index 9899c56c0ec3f..ce260300fc8c7 100644 --- a/tests/ui/consts/const-eval/union-const-eval-field.stderr +++ b/tests/ui/consts/const-eval/union-const-eval-field.stderr @@ -4,13 +4,13 @@ error[E0080]: evaluation of constant value failed LL | const FIELD3: Field3 = unsafe { UNION.field3 }; | ^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory -note: erroneous constant used +note: erroneous constant encountered --> $DIR/union-const-eval-field.rs:31:5 | LL | FIELD3 | ^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/union-const-eval-field.rs:31:5 | LL | FIELD3 diff --git a/tests/ui/consts/const-float-bits-reject-conv.stderr b/tests/ui/consts/const-float-bits-reject-conv.stderr index 7ad0225209420..1511dab12b0e3 100644 --- a/tests/ui/consts/const-float-bits-reject-conv.stderr +++ b/tests/ui/consts/const-float-bits-reject-conv.stderr @@ -30,25 +30,25 @@ 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) -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-float-bits-reject-conv.rs:35:34 | LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-float-bits-reject-conv.rs:36:34 | LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-float-bits-reject-conv.rs:42:34 | LL | const_assert!(f32::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); | ^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-float-bits-reject-conv.rs:43:34 | LL | const_assert!(f32::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); @@ -86,25 +86,25 @@ LL | const MASKED_NAN2: u64 = f64::NAN.to_bits() ^ 0x0005_5555_5555_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) -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-float-bits-reject-conv.rs:57:34 | LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-float-bits-reject-conv.rs:58:34 | LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); | ^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-float-bits-reject-conv.rs:61:34 | LL | const_assert!(f64::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); | ^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-float-bits-reject-conv.rs:62:34 | LL | const_assert!(f64::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); diff --git a/tests/ui/consts/const-len-underflow-separate-spans.next.stderr b/tests/ui/consts/const-len-underflow-separate-spans.next.stderr index d9208d0706af2..b7b5b648c1241 100644 --- a/tests/ui/consts/const-len-underflow-separate-spans.next.stderr +++ b/tests/ui/consts/const-len-underflow-separate-spans.next.stderr @@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed LL | const LEN: usize = ONE - TWO; | ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-len-underflow-separate-spans.rs:14:17 | LL | let a: [i8; LEN] = unimplemented!(); diff --git a/tests/ui/consts/const-len-underflow-separate-spans.old.stderr b/tests/ui/consts/const-len-underflow-separate-spans.old.stderr index d9208d0706af2..b7b5b648c1241 100644 --- a/tests/ui/consts/const-len-underflow-separate-spans.old.stderr +++ b/tests/ui/consts/const-len-underflow-separate-spans.old.stderr @@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed LL | const LEN: usize = ONE - TWO; | ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow -note: erroneous constant used +note: erroneous constant encountered --> $DIR/const-len-underflow-separate-spans.rs:14:17 | LL | let a: [i8; LEN] = unimplemented!(); diff --git a/tests/ui/consts/invalid-union.32bit.stderr b/tests/ui/consts/invalid-union.32bit.stderr index 0dd18a55786ad..b6cf060e5aea8 100644 --- a/tests/ui/consts/invalid-union.32bit.stderr +++ b/tests/ui/consts/invalid-union.32bit.stderr @@ -9,13 +9,13 @@ LL | fn main() { ╾─alloc7──╼ │ ╾──╼ } -note: erroneous constant used +note: erroneous constant encountered --> $DIR/invalid-union.rs:43:25 | LL | let _: &'static _ = &C; | ^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/invalid-union.rs:43:25 | LL | let _: &'static _ = &C; diff --git a/tests/ui/consts/invalid-union.64bit.stderr b/tests/ui/consts/invalid-union.64bit.stderr index 07f36ee283264..e3a3ef62c4acb 100644 --- a/tests/ui/consts/invalid-union.64bit.stderr +++ b/tests/ui/consts/invalid-union.64bit.stderr @@ -9,13 +9,13 @@ LL | fn main() { ╾───────alloc7────────╼ │ ╾──────╼ } -note: erroneous constant used +note: erroneous constant encountered --> $DIR/invalid-union.rs:43:25 | LL | let _: &'static _ = &C; | ^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/invalid-union.rs:43:25 | LL | let _: &'static _ = &C; diff --git a/tests/ui/consts/issue-70942-trait-vs-impl-mismatch.stderr b/tests/ui/consts/issue-70942-trait-vs-impl-mismatch.stderr index 824c358eb70c1..1597120fb5caf 100644 --- a/tests/ui/consts/issue-70942-trait-vs-impl-mismatch.stderr +++ b/tests/ui/consts/issue-70942-trait-vs-impl-mismatch.stderr @@ -10,12 +10,6 @@ note: type in trait LL | const VALUE: usize; | ^^^^^ -note: erroneous constant used - --> $DIR/issue-70942-trait-vs-impl-mismatch.rs:13:18 - | -LL | let _: [i32; Zero::VALUE] = []; - | ^^^^^^^^^^^ - error: aborting due to previous error For more information about this error, try `rustc --explain E0326`. diff --git a/tests/ui/consts/miri_unleashed/assoc_const.stderr b/tests/ui/consts/miri_unleashed/assoc_const.stderr index d97097d352a64..274b1de7e7da1 100644 --- a/tests/ui/consts/miri_unleashed/assoc_const.stderr +++ b/tests/ui/consts/miri_unleashed/assoc_const.stderr @@ -13,13 +13,13 @@ note: inside `, String>>::F` LL | const F: u32 = (U::X, 42).1; | ^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/assoc_const.rs:29:13 | LL | let y = , String>>::F; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/assoc_const.rs:29:13 | LL | let y = , String>>::F; diff --git a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr index ae7b03fc9dde3..c8e4cab4e71bd 100644 --- a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr +++ b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr @@ -4,13 +4,13 @@ error[E0080]: evaluation of `>:: LL | const F: u32 = 100 / U::X; | ^^^^^^^^^^ attempt to divide `100_u32` by zero -note: erroneous constant used +note: erroneous constant encountered --> $DIR/assoc_const_2.rs:27:13 | LL | let y = >::F; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/assoc_const_2.rs:27:13 | LL | let y = >::F; diff --git a/tests/ui/consts/uninhabited-const-issue-61744.stderr b/tests/ui/consts/uninhabited-const-issue-61744.stderr index adefbf336c249..f48e6c4ce51c6 100644 --- a/tests/ui/consts/uninhabited-const-issue-61744.stderr +++ b/tests/ui/consts/uninhabited-const-issue-61744.stderr @@ -645,13 +645,13 @@ note: inside `::CONSTANT` LL | const CONSTANT: i32 = unsafe { fake_type() }; | ^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/uninhabited-const-issue-61744.rs:18:10 | LL | dbg!(i32::CONSTANT); | ^^^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/uninhabited-const-issue-61744.rs:18:10 | LL | dbg!(i32::CONSTANT); diff --git a/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr b/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr index 149c08a334d92..6f9302bc4a549 100644 --- a/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr +++ b/tests/ui/issues/issue-69602-type-err-during-codegen-ice.stderr @@ -13,13 +13,7 @@ LL | type MyA: TraitA; LL | impl TraitB for B { | ^^^^^^^^^^^^^^^^^ missing `MyA` in implementation -note: erroneous constant used - --> $DIR/issue-69602-type-err-during-codegen-ice.rs:12:26 - | -LL | const VALUE: usize = Self::MyA::VALUE; - | ^^^^^^^^^^^^^^^^ - -note: erroneous constant used +note: erroneous constant encountered --> $DIR/issue-69602-type-err-during-codegen-ice.rs:21:17 | LL | let _ = [0; B::VALUE]; diff --git a/tests/ui/limits/issue-55878.stderr b/tests/ui/limits/issue-55878.stderr index f0c7210dde747..93716c0b3473f 100644 --- a/tests/ui/limits/issue-55878.stderr +++ b/tests/ui/limits/issue-55878.stderr @@ -11,7 +11,7 @@ note: inside `main` LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: erroneous constant used +note: erroneous constant encountered --> $DIR/issue-55878.rs:7:26 | LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); @@ -19,7 +19,7 @@ LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); | = note: this note 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: erroneous constant used +note: erroneous constant encountered --> $DIR/issue-55878.rs:7:26 | LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());