diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 2e6c1dceef98a..7a5eb28940e4c 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -1544,8 +1544,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> { Rvalue::Use(operand) | Rvalue::Repeat(operand, _) | Rvalue::UnaryOp(_ /*un_op*/, operand) - | Rvalue::Cast(_ /*cast_kind*/, operand, _ /*ty*/) - | Rvalue::ShallowInitBox(operand, _ /*ty*/) => { + | Rvalue::Cast(_ /*cast_kind*/, operand, _ /*ty*/) => { self.consume_operand(location, (operand, span), state) } diff --git a/compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs b/compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs index 99567da92ffe7..439aa1a91e068 100644 --- a/compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs +++ b/compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs @@ -297,8 +297,9 @@ impl<'a, 'tcx> LoanInvalidationsGenerator<'a, 'tcx> { Rvalue::Use(operand) | Rvalue::Repeat(operand, _) | Rvalue::UnaryOp(_ /*un_op*/, operand) - | Rvalue::Cast(_ /*cast_kind*/, operand, _ /*ty*/) - | Rvalue::ShallowInitBox(operand, _ /*ty*/) => self.consume_operand(location, operand), + | Rvalue::Cast(_ /*cast_kind*/, operand, _ /*ty*/) => { + self.consume_operand(location, operand) + } &Rvalue::Discriminant(place) => { self.access_place( diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index 7d34d7c88e629..2935559147b7e 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -1004,17 +1004,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { } } - Rvalue::ShallowInitBox(_operand, ty) => { - let trait_ref = - ty::TraitRef::new(tcx, tcx.require_lang_item(LangItem::Sized, span), [*ty]); - - self.prove_trait_ref( - trait_ref, - location.to_locations(), - ConstraintCategory::SizedBound, - ); - } - Rvalue::Cast(cast_kind, op, ty) => { match *cast_kind { CastKind::PointerCoercion( @@ -2231,7 +2220,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { | Rvalue::Ref(..) | Rvalue::RawPtr(..) | Rvalue::Cast(..) - | Rvalue::ShallowInitBox(..) | Rvalue::BinaryOp(..) | Rvalue::CopyForDeref(..) | Rvalue::UnaryOp(..) diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs index 1a916c8768243..e4865ece63b6c 100644 --- a/compiler/rustc_codegen_cranelift/src/base.rs +++ b/compiler/rustc_codegen_cranelift/src/base.rs @@ -902,7 +902,6 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt: lval.write_cvalue_transmute(fx, operand); } Rvalue::CopyForDeref(_) => bug!("`CopyForDeref` in codegen"), - Rvalue::ShallowInitBox(..) => bug!("`ShallowInitBox` in codegen"), } } StatementKind::StorageLive(_) diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs index ca8c8dd06ba61..2cb96c4ec0f59 100644 --- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs +++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs @@ -710,7 +710,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { OperandRef { val: operand.val, layout, move_annotation: None } } mir::Rvalue::CopyForDeref(_) => bug!("`CopyForDeref` in codegen"), - mir::Rvalue::ShallowInitBox(..) => bug!("`ShallowInitBox` in codegen"), } } diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs index 564f67e5b1e46..9c9a921bd62d5 100644 --- a/compiler/rustc_const_eval/src/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/check_consts/check.rs @@ -646,8 +646,6 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { Rvalue::Cast(_, _, _) => {} - Rvalue::ShallowInitBox(_, _) => {} - Rvalue::UnaryOp(op, operand) => { let ty = operand.ty(self.body, self.tcx); match op { diff --git a/compiler/rustc_const_eval/src/check_consts/qualifs.rs b/compiler/rustc_const_eval/src/check_consts/qualifs.rs index 462254f064cf3..1fbd0cd234057 100644 --- a/compiler/rustc_const_eval/src/check_consts/qualifs.rs +++ b/compiler/rustc_const_eval/src/check_consts/qualifs.rs @@ -237,8 +237,7 @@ where Rvalue::Use(operand) | Rvalue::Repeat(operand, _) | Rvalue::UnaryOp(_, operand) - | Rvalue::Cast(_, operand, _) - | Rvalue::ShallowInitBox(operand, _) => in_operand::(cx, in_local, operand), + | Rvalue::Cast(_, operand, _) => in_operand::(cx, in_local, operand), Rvalue::BinaryOp(_, box (lhs, rhs)) => { in_operand::(cx, in_local, lhs) || in_operand::(cx, in_local, rhs) diff --git a/compiler/rustc_const_eval/src/check_consts/resolver.rs b/compiler/rustc_const_eval/src/check_consts/resolver.rs index d4cc21996aea8..044b8b091b8de 100644 --- a/compiler/rustc_const_eval/src/check_consts/resolver.rs +++ b/compiler/rustc_const_eval/src/check_consts/resolver.rs @@ -192,7 +192,6 @@ where } mir::Rvalue::Cast(..) - | mir::Rvalue::ShallowInitBox(..) | mir::Rvalue::Use(..) | mir::Rvalue::CopyForDeref(..) | mir::Rvalue::ThreadLocalRef(..) diff --git a/compiler/rustc_const_eval/src/const_eval/machine.rs b/compiler/rustc_const_eval/src/const_eval/machine.rs index 57ad670c3f567..3b4f7ed3261ab 100644 --- a/compiler/rustc_const_eval/src/const_eval/machine.rs +++ b/compiler/rustc_const_eval/src/const_eval/machine.rs @@ -236,7 +236,7 @@ impl<'tcx> CompileTimeInterpCx<'tcx> { if self.tcx.is_lang_item(def_id, LangItem::PanicDisplay) || self.tcx.is_lang_item(def_id, LangItem::BeginPanic) { - let args = self.copy_fn_args(args); + let args = Self::copy_fn_args(args); // &str or &&str assert!(args.len() == 1); diff --git a/compiler/rustc_const_eval/src/interpret/call.rs b/compiler/rustc_const_eval/src/interpret/call.rs index 1ee2647d5bf78..9220fde474e4e 100644 --- a/compiler/rustc_const_eval/src/interpret/call.rs +++ b/compiler/rustc_const_eval/src/interpret/call.rs @@ -19,8 +19,8 @@ use tracing::{info, instrument, trace}; use super::{ CtfeProvenance, FnVal, ImmTy, InterpCx, InterpResult, MPlaceTy, Machine, OpTy, PlaceTy, - Projectable, Provenance, ReturnAction, ReturnContinuation, Scalar, StackPopInfo, interp_ok, - throw_ub, throw_ub_custom, + Projectable, Provenance, ReturnAction, ReturnContinuation, Scalar, interp_ok, throw_ub, + throw_ub_custom, }; use crate::enter_trace_span; use crate::interpret::EnteredTraceSpan; @@ -43,25 +43,22 @@ impl<'tcx, Prov: Provenance> FnArg<'tcx, Prov> { FnArg::InPlace(mplace) => &mplace.layout, } } -} -impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { /// Make a copy of the given fn_arg. Any `InPlace` are degenerated to copies, no protection of the /// original memory occurs. - pub fn copy_fn_arg(&self, arg: &FnArg<'tcx, M::Provenance>) -> OpTy<'tcx, M::Provenance> { - match arg { + pub fn copy_fn_arg(&self) -> OpTy<'tcx, Prov> { + match self { FnArg::Copy(op) => op.clone(), FnArg::InPlace(mplace) => mplace.clone().into(), } } +} +impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { /// Make a copy of the given fn_args. Any `InPlace` are degenerated to copies, no protection of the /// original memory occurs. - pub fn copy_fn_args( - &self, - args: &[FnArg<'tcx, M::Provenance>], - ) -> Vec> { - args.iter().map(|fn_arg| self.copy_fn_arg(fn_arg)).collect() + pub fn copy_fn_args(args: &[FnArg<'tcx, M::Provenance>]) -> Vec> { + args.iter().map(|fn_arg| fn_arg.copy_fn_arg()).collect() } /// Helper function for argument untupling. @@ -319,7 +316,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { // We work with a copy of the argument for now; if this is in-place argument passing, we // will later protect the source it comes from. This means the callee cannot observe if we // did in-place of by-copy argument passing, except for pointer equality tests. - let caller_arg_copy = self.copy_fn_arg(caller_arg); + let caller_arg_copy = caller_arg.copy_fn_arg(); if !already_live { let local = callee_arg.as_local().unwrap(); let meta = caller_arg_copy.meta(); @@ -616,7 +613,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { if let Some(fallback) = M::call_intrinsic( self, instance, - &self.copy_fn_args(args), + &Self::copy_fn_args(args), destination, target, unwind, @@ -703,7 +700,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { // An `InPlace` does nothing here, we keep the original receiver intact. We can't // really pass the argument in-place anyway, and we are constructing a new // `Immediate` receiver. - let mut receiver = self.copy_fn_arg(&args[0]); + let mut receiver = args[0].copy_fn_arg(); let receiver_place = loop { match receiver.layout.ty.kind() { ty::Ref(..) | ty::RawPtr(..) => { @@ -824,41 +821,50 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { with_caller_location: bool, ) -> InterpResult<'tcx> { trace!("init_fn_tail_call: {:#?}", fn_val); - // This is the "canonical" implementation of tails calls, // a pop of the current stack frame, followed by a normal call // which pushes a new stack frame, with the return address from // the popped stack frame. // - // Note that we are using `pop_stack_frame_raw` and not `return_from_current_stack_frame`, - // as the latter "executes" the goto to the return block, but we don't want to, + // Note that we cannot use `return_from_current_stack_frame`, + // as that "executes" the goto to the return block, but we don't want to, // only the tail called function should return to the current return block. - let StackPopInfo { return_action, return_cont, return_place } = - self.pop_stack_frame_raw(false, |_this, _return_place| { - // This function's return value is just discarded, the tail-callee will fill in the return place instead. - interp_ok(()) - })?; - assert_eq!(return_action, ReturnAction::Normal); - - // Take the "stack pop cleanup" info, and use that to initiate the next call. - let ReturnContinuation::Goto { ret, unwind } = return_cont else { - bug!("can't tailcall as root"); + // The arguments need to all be copied since the current stack frame will be removed + // before the callee even starts executing. + // FIXME(explicit_tail_calls,#144855): does this match what codegen does? + let args = args.iter().map(|fn_arg| FnArg::Copy(fn_arg.copy_fn_arg())).collect::>(); + // Remove the frame from the stack. + let frame = self.pop_stack_frame_raw()?; + // Remember where this frame would have returned to. + let ReturnContinuation::Goto { ret, unwind } = frame.return_cont() else { + bug!("can't tailcall as root of the stack"); }; - + // There's no return value to deal with! Instead, we forward the old return place + // to the new function. // FIXME(explicit_tail_calls): // we should check if both caller&callee can/n't unwind, // see + // Now push the new stack frame. self.init_fn_call( fn_val, (caller_abi, caller_fn_abi), - args, + &*args, with_caller_location, - &return_place, + frame.return_place(), ret, unwind, - ) + )?; + + // Finally, clear the local variables. Has to be done after pushing to support + // non-scalar arguments. + // FIXME(explicit_tail_calls,#144855): revisit this once codegen supports indirect + // arguments, to ensure the semantics are compatible. + let return_action = self.cleanup_stack_frame(/* unwinding */ false, frame)?; + assert_eq!(return_action, ReturnAction::Normal); + + interp_ok(()) } pub(super) fn init_drop_in_place_call( @@ -953,14 +959,18 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { // local's value out. let return_op = self.local_to_op(mir::RETURN_PLACE, None).expect("return place should always be live"); - // Do the actual pop + copy. - let stack_pop_info = self.pop_stack_frame_raw(unwinding, |this, return_place| { - this.copy_op_allow_transmute(&return_op, return_place)?; - trace!("return value: {:?}", this.dump_place(return_place)); - interp_ok(()) - })?; - - match stack_pop_info.return_action { + // Remove the frame from the stack. + let frame = self.pop_stack_frame_raw()?; + // Copy the return value and remember the return continuation. + if !unwinding { + self.copy_op_allow_transmute(&return_op, frame.return_place())?; + trace!("return value: {:?}", self.dump_place(frame.return_place())); + } + let return_cont = frame.return_cont(); + // Finish popping the stack frame. + let return_action = self.cleanup_stack_frame(unwinding, frame)?; + // Jump to the next block. + match return_action { ReturnAction::Normal => {} ReturnAction::NoJump => { // The hook already did everything. @@ -978,7 +988,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { // Normal return, figure out where to jump. if unwinding { // Follow the unwind edge. - match stack_pop_info.return_cont { + match return_cont { ReturnContinuation::Goto { unwind, .. } => { // This must be the very last thing that happens, since it can in fact push a new stack frame. self.unwind_to_block(unwind) @@ -989,7 +999,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { } } else { // Follow the normal return edge. - match stack_pop_info.return_cont { + match return_cont { ReturnContinuation::Goto { ret, .. } => self.return_to_block(ret), ReturnContinuation::Stop { .. } => { assert!( diff --git a/compiler/rustc_const_eval/src/interpret/mod.rs b/compiler/rustc_const_eval/src/interpret/mod.rs index 2f365ec77b33e..c8ffc0ed208a7 100644 --- a/compiler/rustc_const_eval/src/interpret/mod.rs +++ b/compiler/rustc_const_eval/src/interpret/mod.rs @@ -36,7 +36,7 @@ pub use self::operand::{ImmTy, Immediate, OpTy}; pub use self::place::{MPlaceTy, MemPlaceMeta, PlaceTy, Writeable}; use self::place::{MemPlace, Place}; pub use self::projection::{OffsetMode, Projectable}; -pub use self::stack::{Frame, FrameInfo, LocalState, ReturnContinuation, StackPopInfo}; +pub use self::stack::{Frame, FrameInfo, LocalState, ReturnContinuation}; pub use self::util::EnteredTraceSpan; pub(crate) use self::util::create_static_alloc; pub use self::validity::{CtfeValidationMode, RangeSet, RefTracking}; diff --git a/compiler/rustc_const_eval/src/interpret/stack.rs b/compiler/rustc_const_eval/src/interpret/stack.rs index 1b8af1c44277c..a55bea60cd6e2 100644 --- a/compiler/rustc_const_eval/src/interpret/stack.rs +++ b/compiler/rustc_const_eval/src/interpret/stack.rs @@ -81,7 +81,7 @@ pub struct Frame<'tcx, Prov: Provenance = CtfeProvenance, Extra = ()> { /// and its layout in the caller. This place is to be interpreted relative to the /// *caller's* stack frame. We use a `PlaceTy` instead of an `MPlaceTy` since this /// avoids having to move *all* return places into Miri's memory. - pub return_place: PlaceTy<'tcx, Prov>, + return_place: PlaceTy<'tcx, Prov>, /// The list of locals for this stack frame, stored in order as /// `[return_ptr, arguments..., variables..., temporaries...]`. @@ -127,19 +127,6 @@ pub enum ReturnContinuation { Stop { cleanup: bool }, } -/// Return type of [`InterpCx::pop_stack_frame_raw`]. -pub struct StackPopInfo<'tcx, Prov: Provenance> { - /// Additional information about the action to be performed when returning from the popped - /// stack frame. - pub return_action: ReturnAction, - - /// [`return_cont`](Frame::return_cont) of the popped stack frame. - pub return_cont: ReturnContinuation, - - /// [`return_place`](Frame::return_place) of the popped stack frame. - pub return_place: PlaceTy<'tcx, Prov>, -} - /// State of a local variable including a memoized layout #[derive(Clone)] pub struct LocalState<'tcx, Prov: Provenance = CtfeProvenance> { @@ -292,6 +279,14 @@ impl<'tcx, Prov: Provenance, Extra> Frame<'tcx, Prov, Extra> { self.instance } + pub fn return_place(&self) -> &PlaceTy<'tcx, Prov> { + &self.return_place + } + + pub fn return_cont(&self) -> ReturnContinuation { + self.return_cont + } + /// Return the `SourceInfo` of the current instruction. pub fn current_source_info(&self) -> Option<&mir::SourceInfo> { self.loc.left().map(|loc| self.body.source_info(loc)) @@ -417,35 +412,26 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { interp_ok(()) } - /// Low-level helper that pops a stack frame from the stack and returns some information about - /// it. - /// - /// This also deallocates locals, if necessary. - /// `copy_ret_val` gets called after the frame has been taken from the stack but before the locals have been deallocated. - /// - /// [`M::before_stack_pop`] and [`M::after_stack_pop`] are called by this function - /// automatically. - /// - /// The high-level version of this is `return_from_current_stack_frame`. - /// - /// [`M::before_stack_pop`]: Machine::before_stack_pop - /// [`M::after_stack_pop`]: Machine::after_stack_pop + /// Low-level helper that pops a stack frame from the stack without any cleanup. + /// This invokes `before_stack_pop`. + /// After calling this function, you need to deal with the return value, and then + /// invoke `cleanup_stack_frame`. pub(super) fn pop_stack_frame_raw( &mut self, - unwinding: bool, - copy_ret_val: impl FnOnce(&mut Self, &PlaceTy<'tcx, M::Provenance>) -> InterpResult<'tcx>, - ) -> InterpResult<'tcx, StackPopInfo<'tcx, M::Provenance>> { + ) -> InterpResult<'tcx, Frame<'tcx, M::Provenance, M::FrameExtra>> { M::before_stack_pop(self)?; let frame = self.stack_mut().pop().expect("tried to pop a stack frame, but there were none"); + interp_ok(frame) + } - // Copy return value (unless we are unwinding). - if !unwinding { - copy_ret_val(self, &frame.return_place)?; - } - + /// Deallocate local variables in the stack frame, and invoke `after_stack_pop`. + pub(super) fn cleanup_stack_frame( + &mut self, + unwinding: bool, + frame: Frame<'tcx, M::Provenance, M::FrameExtra>, + ) -> InterpResult<'tcx, ReturnAction> { let return_cont = frame.return_cont; - let return_place = frame.return_place.clone(); // Cleanup: deallocate locals. // Usually we want to clean up (deallocate locals), but in a few rare cases we don't. @@ -455,7 +441,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { ReturnContinuation::Stop { cleanup, .. } => cleanup, }; - let return_action = if cleanup { + if cleanup { for local in &frame.locals { self.deallocate_local(local.value)?; } @@ -466,13 +452,11 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { // Call the machine hook, which determines the next steps. let return_action = M::after_stack_pop(self, frame, unwinding)?; assert_ne!(return_action, ReturnAction::NoCleanup); - return_action + interp_ok(return_action) } else { // We also skip the machine hook when there's no cleanup. This not a real "pop" anyway. - ReturnAction::NoCleanup - }; - - interp_ok(StackPopInfo { return_action, return_cont, return_place }) + interp_ok(ReturnAction::NoCleanup) + } } /// In the current stack frame, mark all locals as live that are not arguments and don't have @@ -655,7 +639,7 @@ impl<'a, 'tcx: 'a, M: Machine<'tcx>> InterpCx<'tcx, M> { let (_idx, callee_abi) = callee_abis.next().unwrap(); assert!(self.check_argument_compat(caller_abi, callee_abi)?); // FIXME: do we have to worry about in-place argument passing? - let op = self.copy_fn_arg(fn_arg); + let op = fn_arg.copy_fn_arg(); let mplace = self.allocate(op.layout, MemoryKind::Stack)?; self.copy_op(&op, &mplace)?; diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs index 4aa9030cfe61c..0dd17f109be31 100644 --- a/compiler/rustc_const_eval/src/interpret/step.rs +++ b/compiler/rustc_const_eval/src/interpret/step.rs @@ -249,12 +249,6 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { self.write_immediate(*val, &dest)?; } - ShallowInitBox(ref operand, _) => { - let src = self.eval_operand(operand, None)?; - let v = self.read_immediate(&src)?; - self.write_immediate(*v, &dest)?; - } - Cast(cast_kind, ref operand, cast_ty) => { let src = self.eval_operand(operand, None)?; let cast_ty = diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs index 5d8ae42f5eccd..6fc8d5ef8f965 100644 --- a/compiler/rustc_const_eval/src/interpret/validity.rs +++ b/compiler/rustc_const_eval/src/interpret/validity.rs @@ -647,13 +647,8 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> { } } else { // This is not CTFE, so it's Miri with recursive checking. - // FIXME: we do *not* check behind boxes, since creating a new box first creates it uninitialized - // and then puts the value in there, so briefly we have a box with uninit contents. - // FIXME: should we also skip `UnsafeCell` behind shared references? Currently that is not + // FIXME: should we also `UnsafeCell` behind shared references? Currently that is not // needed since validation reads bypass Stacked Borrows and data race checks. - if matches!(ptr_kind, PointerKind::Box) { - return interp_ok(()); - } } let path = &self.path; ref_tracking.track(place, || { diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs index 5efaea44b3b9d..476be94efd9e4 100644 --- a/compiler/rustc_expand/src/base.rs +++ b/compiler/rustc_expand/src/base.rs @@ -2,12 +2,11 @@ use std::any::Any; use std::default::Default; use std::iter; use std::path::Component::Prefix; -use std::path::{Path, PathBuf}; +use std::path::PathBuf; use std::rc::Rc; use std::sync::Arc; use rustc_ast::attr::MarkedAttrs; -use rustc_ast::token::MetaVarKind; use rustc_ast::tokenstream::TokenStream; use rustc_ast::visit::{AssocCtxt, Visitor}; use rustc_ast::{self as ast, AttrVec, Attribute, HasAttrs, Item, NodeId, PatKind, Safety}; @@ -22,14 +21,14 @@ use rustc_hir::limit::Limit; use rustc_hir::{Stability, find_attr}; use rustc_lint_defs::RegisteredTools; use rustc_parse::MACRO_ARGUMENTS; -use rustc_parse::parser::{AllowConstBlockItems, ForceCollect, Parser}; +use rustc_parse::parser::Parser; use rustc_session::Session; use rustc_session::parse::ParseSess; use rustc_span::def_id::{CrateNum, DefId, LocalDefId}; use rustc_span::edition::Edition; use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId, MacroKind}; use rustc_span::source_map::SourceMap; -use rustc_span::{DUMMY_SP, FileName, Ident, Span, Symbol, kw, sym}; +use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw}; use smallvec::{SmallVec, smallvec}; use thin_vec::ThinVec; @@ -1421,80 +1420,3 @@ pub fn resolve_path(sess: &Session, path: impl Into, span: Span) -> PRe } } } - -/// If this item looks like a specific enums from `rental`, emit a fatal error. -/// See #73345 and #83125 for more details. -/// FIXME(#73933): Remove this eventually. -fn pretty_printing_compatibility_hack(item: &Item, psess: &ParseSess) { - if let ast::ItemKind::Enum(ident, _, enum_def) = &item.kind - && ident.name == sym::ProceduralMasqueradeDummyType - && let [variant] = &*enum_def.variants - && variant.ident.name == sym::Input - && let FileName::Real(real) = psess.source_map().span_to_filename(ident.span) - && let Some(c) = real - .local_path() - .unwrap_or(Path::new("")) - .components() - .flat_map(|c| c.as_os_str().to_str()) - .find(|c| c.starts_with("rental") || c.starts_with("allsorts-rental")) - { - let crate_matches = if c.starts_with("allsorts-rental") { - true - } else { - let mut version = c.trim_start_matches("rental-").split('.'); - version.next() == Some("0") - && version.next() == Some("5") - && version.next().and_then(|c| c.parse::().ok()).is_some_and(|v| v < 6) - }; - - if crate_matches { - psess.dcx().emit_fatal(errors::ProcMacroBackCompat { - crate_name: "rental".to_string(), - fixed_version: "0.5.6".to_string(), - }); - } - } -} - -pub(crate) fn ann_pretty_printing_compatibility_hack(ann: &Annotatable, psess: &ParseSess) { - let item = match ann { - Annotatable::Item(item) => item, - Annotatable::Stmt(stmt) => match &stmt.kind { - ast::StmtKind::Item(item) => item, - _ => return, - }, - _ => return, - }; - pretty_printing_compatibility_hack(item, psess) -} - -pub(crate) fn stream_pretty_printing_compatibility_hack( - kind: MetaVarKind, - stream: &TokenStream, - psess: &ParseSess, -) { - let item = match kind { - MetaVarKind::Item => { - let mut parser = Parser::new(psess, stream.clone(), None); - // No need to collect tokens for this simple check. - parser - .parse_item(ForceCollect::No, AllowConstBlockItems::No) - .expect("failed to reparse item") - .expect("an actual item") - } - MetaVarKind::Stmt => { - let mut parser = Parser::new(psess, stream.clone(), None); - // No need to collect tokens for this simple check. - let stmt = parser - .parse_stmt(ForceCollect::No) - .expect("failed to reparse") - .expect("an actual stmt"); - match &stmt.kind { - ast::StmtKind::Item(item) => item.clone(), - _ => return, - } - } - _ => return, - }; - pretty_printing_compatibility_hack(&item, psess) -} diff --git a/compiler/rustc_expand/src/errors.rs b/compiler/rustc_expand/src/errors.rs index b6fcc13321ee7..c7b0e0d211a4a 100644 --- a/compiler/rustc_expand/src/errors.rs +++ b/compiler/rustc_expand/src/errors.rs @@ -446,18 +446,6 @@ pub(crate) struct GlobDelegationTraitlessQpath { pub span: Span, } -// This used to be the `proc_macro_back_compat` lint (#83125). It was later -// turned into a hard error. -#[derive(Diagnostic)] -#[diag("using an old version of `{$crate_name}`")] -#[note( - "older versions of the `{$crate_name}` crate no longer compile; please update to `{$crate_name}` v{$fixed_version}, or switch to one of the `{$crate_name}` alternatives" -)] -pub(crate) struct ProcMacroBackCompat { - pub crate_name: String, - pub fixed_version: String, -} - pub(crate) use metavar_exprs::*; mod metavar_exprs { use super::*; diff --git a/compiler/rustc_expand/src/proc_macro.rs b/compiler/rustc_expand/src/proc_macro.rs index e678557008133..a892b21d76227 100644 --- a/compiler/rustc_expand/src/proc_macro.rs +++ b/compiler/rustc_expand/src/proc_macro.rs @@ -105,11 +105,6 @@ impl MultiItemModifier for DeriveProcMacro { // (e.g. `fn foo() { #[derive(Debug)] struct Bar; }`) let is_stmt = matches!(item, Annotatable::Stmt(..)); - // We used to have an alternative behaviour for crates that needed it. - // We had a lint for a long time, but now we just emit a hard error. - // Eventually we might remove the special case hard error check - // altogether. See #73345. - crate::base::ann_pretty_printing_compatibility_hack(&item, &ecx.sess.psess); let input = item.to_tokens(); let invoc_id = ecx.current_expansion.id; diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index 947b8a6e3e5ee..1da14ce0155d3 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -103,8 +103,8 @@ impl ToInternal for LitKind { } } -impl FromInternal<(TokenStream, &mut Rustc<'_, '_>)> for Vec> { - fn from_internal((stream, rustc): (TokenStream, &mut Rustc<'_, '_>)) -> Self { +impl FromInternal for Vec> { + fn from_internal(stream: TokenStream) -> Self { use rustc_ast::token::*; // Estimate the capacity as `stream.len()` rounded up to the next power @@ -115,22 +115,6 @@ impl FromInternal<(TokenStream, &mut Rustc<'_, '_>)> for Vec { - // We used to have an alternative behaviour for crates that - // needed it: a hack used to pass AST fragments to - // attribute and derive macros as a single nonterminal - // token instead of a token stream. Such token needs to be - // "unwrapped" and not represented as a delimited group. We - // had a lint for a long time, but now we just emit a hard - // error. Eventually we might remove the special case hard - // error check altogether. See #73345. - if let Delimiter::Invisible(InvisibleOrigin::MetaVar(kind)) = delim { - crate::base::stream_pretty_printing_compatibility_hack( - kind, - &stream, - rustc.psess(), - ); - } - // In `mk_delimited` we avoid nesting invisible delimited // of the same `MetaVarKind`. Here we do the same but // ignore the `MetaVarKind` because it is discarded when we @@ -687,7 +671,7 @@ impl server::Server for Rustc<'_, '_> { &mut self, stream: Self::TokenStream, ) -> Vec> { - FromInternal::from_internal((stream, self)) + FromInternal::from_internal(stream) } fn span_debug(&mut self, span: Self::Span) -> String { diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 2c2dae0fef52e..db8f459ef0451 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -1208,7 +1208,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ rustc_intrinsic_const_stable_indirect, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No, "this is an internal implementation detail", ), - gated!( + rustc_attr!( rustc_allow_const_fn_unstable, Normal, template!(Word, List: &["feat1, feat2, ..."]), DuplicatesOk, EncodeCrossCrate::No, "rustc_allow_const_fn_unstable side-steps feature gating and stability checks" diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index b810cd0db8cd1..433ccbecd7dd7 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -287,10 +287,6 @@ declare_features! ( (internal, panic_runtime, "1.10.0", Some(32837)), /// Allows using pattern types. (internal, pattern_types, "1.79.0", Some(123646)), - /// Allows using `#[rustc_allow_const_fn_unstable]`. - /// This is an attribute on `const fn` for the same - /// purpose as `#[allow_internal_unstable]`. - (internal, rustc_allow_const_fn_unstable, "1.49.0", Some(69399)), /// Allows using compiler's own crates. (unstable, rustc_private, "1.0.0", Some(27812)), /// Allows using internal rustdoc features like `doc(keyword)`. @@ -493,7 +489,7 @@ declare_features! ( /// Allows the use of `#[ffi_pure]` on foreign functions. (unstable, ffi_pure, "1.45.0", Some(58329)), /// Allows marking trait functions as `final` to prevent overriding impls - (unstable, final_associated_functions, "CURRENT_RUSTC_VERSION", Some(1)), + (unstable, final_associated_functions, "CURRENT_RUSTC_VERSION", Some(131179)), /// Controlling the behavior of fmt::Debug (unstable, fmt_debug, "1.82.0", Some(129709)), /// Allows using `#[align(...)]` on function items diff --git a/compiler/rustc_incremental/src/persist/clean.rs b/compiler/rustc_incremental/src/persist/clean.rs index 0067b38fadc75..9e974e432c399 100644 --- a/compiler/rustc_incremental/src/persist/clean.rs +++ b/compiler/rustc_incremental/src/persist/clean.rs @@ -322,7 +322,7 @@ impl<'tcx> CleanVisitor<'tcx> { if let Some(def_id) = dep_node.extract_def_id(self.tcx) { format!("{:?}({})", dep_node.kind, self.tcx.def_path_str(def_id)) } else { - format!("{:?}({:?})", dep_node.kind, dep_node.hash) + format!("{:?}({:?})", dep_node.kind, dep_node.key_fingerprint) } } diff --git a/compiler/rustc_middle/src/dep_graph/dep_node.rs b/compiler/rustc_middle/src/dep_graph/dep_node.rs index 578277bce593a..52faebcba025c 100644 --- a/compiler/rustc_middle/src/dep_graph/dep_node.rs +++ b/compiler/rustc_middle/src/dep_graph/dep_node.rs @@ -1,10 +1,10 @@ //! This module defines the [`DepNode`] type which the compiler uses to represent //! nodes in the [dependency graph]. A `DepNode` consists of a [`DepKind`] (which //! specifies the kind of thing it represents, like a piece of HIR, MIR, etc.) -//! and a [`Fingerprint`], a 128-bit hash value, the exact meaning of which -//! depends on the node's `DepKind`. Together, the kind and the fingerprint +//! and a "key fingerprint", a 128-bit hash value, the exact meaning of which +//! depends on the node's `DepKind`. Together, the kind and the key fingerprint //! fully identify a dependency node, even across multiple compilation sessions. -//! In other words, the value of the fingerprint does not depend on anything +//! In other words, the value of the key fingerprint does not depend on anything //! that is specific to a given compilation session, like an unpredictable //! interning key (e.g., `NodeId`, `DefId`, `Symbol`) or the numeric value of a //! pointer. The concept behind this could be compared to how git commit hashes @@ -41,17 +41,9 @@ //! `DepNode`s could represent global concepts with only one value. //! * Whether it is possible, in principle, to reconstruct a query key from a //! given `DepNode`. Many `DepKind`s only require a single `DefId` parameter, -//! in which case it is possible to map the node's fingerprint back to the +//! in which case it is possible to map the node's key fingerprint back to the //! `DefId` it was computed from. In other cases, too much information gets -//! lost during fingerprint computation. -//! -//! `make_compile_codegen_unit` and `make_compile_mono_items`, together with -//! `DepNode::new()`, ensure that only valid `DepNode` instances can be -//! constructed. For example, the API does not allow for constructing -//! parameterless `DepNode`s with anything other than a zeroed out fingerprint. -//! More generally speaking, it relieves the user of the `DepNode` API of -//! having to know how to compute the expected fingerprint for a given set of -//! node parameters. +//! lost when computing a key fingerprint. //! //! [dependency graph]: https://rustc-dev-guide.rust-lang.org/query.html @@ -65,7 +57,7 @@ use rustc_hir::definitions::DefPathHash; use rustc_macros::{Decodable, Encodable}; use rustc_span::Symbol; -use super::{FingerprintStyle, SerializedDepNodeIndex}; +use super::{KeyFingerprintStyle, SerializedDepNodeIndex}; use crate::ich::StableHashingContext; use crate::mir::mono::MonoItem; use crate::ty::{TyCtxt, tls}; @@ -125,10 +117,20 @@ impl fmt::Debug for DepKind { } } +/// Combination of a [`DepKind`] and a key fingerprint that uniquely identifies +/// a node in the dep graph. #[derive(Clone, Copy, PartialEq, Eq, Hash)] pub struct DepNode { pub kind: DepKind, - pub hash: PackedFingerprint, + + /// This is _typically_ a hash of the query key, but sometimes not. + /// + /// For example, `anon` nodes have a fingerprint that is derived from their + /// dependencies instead of a key. + /// + /// In some cases the key value can be reconstructed from this fingerprint; + /// see [`KeyFingerprintStyle`]. + pub key_fingerprint: PackedFingerprint, } impl DepNode { @@ -136,24 +138,23 @@ impl DepNode { /// that the DepNode corresponding to the given DepKind actually /// does not require any parameters. pub fn new_no_params<'tcx>(tcx: TyCtxt<'tcx>, kind: DepKind) -> DepNode { - debug_assert_eq!(tcx.fingerprint_style(kind), FingerprintStyle::Unit); - DepNode { kind, hash: Fingerprint::ZERO.into() } + debug_assert_eq!(tcx.key_fingerprint_style(kind), KeyFingerprintStyle::Unit); + DepNode { kind, key_fingerprint: Fingerprint::ZERO.into() } } - pub fn construct<'tcx, Key>(tcx: TyCtxt<'tcx>, kind: DepKind, arg: &Key) -> DepNode + pub fn construct<'tcx, Key>(tcx: TyCtxt<'tcx>, kind: DepKind, key: &Key) -> DepNode where Key: DepNodeKey<'tcx>, { - let hash = arg.to_fingerprint(tcx); - let dep_node = DepNode { kind, hash: hash.into() }; + let dep_node = DepNode { kind, key_fingerprint: key.to_fingerprint(tcx).into() }; #[cfg(debug_assertions)] { - if !tcx.fingerprint_style(kind).reconstructible() + if !tcx.key_fingerprint_style(kind).reconstructible() && (tcx.sess.opts.unstable_opts.incremental_info || tcx.sess.opts.unstable_opts.query_dep_graph) { - tcx.dep_graph.register_dep_node_debug_str(dep_node, || arg.to_debug_str(tcx)); + tcx.dep_graph.register_dep_node_debug_str(dep_node, || key.to_debug_str(tcx)); } } @@ -168,8 +169,8 @@ impl DepNode { def_path_hash: DefPathHash, kind: DepKind, ) -> Self { - debug_assert!(tcx.fingerprint_style(kind) == FingerprintStyle::DefPathHash); - DepNode { kind, hash: def_path_hash.0.into() } + debug_assert!(tcx.key_fingerprint_style(kind) == KeyFingerprintStyle::DefPathHash); + DepNode { kind, key_fingerprint: def_path_hash.0.into() } } } @@ -184,10 +185,10 @@ impl fmt::Debug for DepNode { } else if let Some(ref s) = tcx.dep_graph.dep_node_debug_str(*self) { write!(f, "{s}")?; } else { - write!(f, "{}", self.hash)?; + write!(f, "{}", self.key_fingerprint)?; } } else { - write!(f, "{}", self.hash)?; + write!(f, "{}", self.key_fingerprint)?; } Ok(()) })?; @@ -198,7 +199,7 @@ impl fmt::Debug for DepNode { /// Trait for query keys as seen by dependency-node tracking. pub trait DepNodeKey<'tcx>: fmt::Debug + Sized { - fn fingerprint_style() -> FingerprintStyle; + fn key_fingerprint_style() -> KeyFingerprintStyle; /// This method turns a query key into an opaque `Fingerprint` to be used /// in `DepNode`. @@ -212,7 +213,7 @@ pub trait DepNodeKey<'tcx>: fmt::Debug + Sized { /// `fingerprint_style()` is not `FingerprintStyle::Opaque`. /// It is always valid to return `None` here, in which case incremental /// compilation will treat the query as having changed instead of forcing it. - fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option; + fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option; } // Blanket impl of `DepNodeKey`, which is specialized by other impls elsewhere. @@ -221,8 +222,8 @@ where T: for<'a> HashStable> + fmt::Debug, { #[inline(always)] - default fn fingerprint_style() -> FingerprintStyle { - FingerprintStyle::Opaque + default fn key_fingerprint_style() -> KeyFingerprintStyle { + KeyFingerprintStyle::Opaque } #[inline(always)] @@ -243,7 +244,7 @@ where } #[inline(always)] - default fn recover(_: TyCtxt<'tcx>, _: &DepNode) -> Option { + default fn try_recover_key(_: TyCtxt<'tcx>, _: &DepNode) -> Option { None } } @@ -264,10 +265,11 @@ pub struct DepKindVTable<'tcx> { /// cached within one compiler invocation. pub is_eval_always: bool, - /// Indicates whether and how the query key can be recovered from its hashed fingerprint. + /// Indicates whether and how a query key can be reconstructed from the + /// key fingerprint of a dep node with this [`DepKind`]. /// /// The [`DepNodeKey`] trait determines the fingerprint style for each key type. - pub fingerprint_style: FingerprintStyle, + pub key_fingerprint_style: KeyFingerprintStyle, /// The red/green evaluation system will try to mark a specific DepNode in the /// dependency graph as green by recursively trying to mark the dependencies of @@ -279,7 +281,7 @@ pub struct DepKindVTable<'tcx> { /// `force_from_dep_node()` implements. /// /// In the general case, a `DepNode` consists of a `DepKind` and an opaque - /// GUID/fingerprint that will uniquely identify the node. This GUID/fingerprint + /// "key fingerprint" that will uniquely identify the node. This key fingerprint /// is usually constructed by computing a stable hash of the query-key that the /// `DepNode` corresponds to. Consequently, it is not in general possible to go /// back from hash to query-key (since hash functions are not reversible). For @@ -293,7 +295,7 @@ pub struct DepKindVTable<'tcx> { /// Now, if `force_from_dep_node()` would always fail, it would be pretty useless. /// Fortunately, we can use some contextual information that will allow us to /// reconstruct query-keys for certain kinds of `DepNode`s. In particular, we - /// enforce by construction that the GUID/fingerprint of certain `DepNode`s is a + /// enforce by construction that the key fingerprint of certain `DepNode`s is a /// valid `DefPathHash`. Since we also always build a huge table that maps every /// `DefPathHash` in the current codebase to the corresponding `DefId`, we have /// everything we need to re-run the query. @@ -301,7 +303,7 @@ pub struct DepKindVTable<'tcx> { /// Take the `mir_promoted` query as an example. Like many other queries, it /// just has a single parameter: the `DefId` of the item it will compute the /// validated MIR for. Now, when we call `force_from_dep_node()` on a `DepNode` - /// with kind `MirValidated`, we know that the GUID/fingerprint of the `DepNode` + /// with kind `mir_promoted`, we know that the key fingerprint of the `DepNode` /// is actually a `DefPathHash`, and can therefore just look up the corresponding /// `DefId` in `tcx.def_path_hash_to_def_id`. pub force_from_dep_node: Option< @@ -472,8 +474,8 @@ impl DepNode { /// refers to something from the previous compilation session that /// has been removed. pub fn extract_def_id(&self, tcx: TyCtxt<'_>) -> Option { - if tcx.fingerprint_style(self.kind) == FingerprintStyle::DefPathHash { - tcx.def_path_hash_to_def_id(DefPathHash(self.hash.into())) + if tcx.key_fingerprint_style(self.kind) == KeyFingerprintStyle::DefPathHash { + tcx.def_path_hash_to_def_id(DefPathHash(self.key_fingerprint.into())) } else { None } @@ -486,10 +488,10 @@ impl DepNode { ) -> Result { let kind = dep_kind_from_label_string(label)?; - match tcx.fingerprint_style(kind) { - FingerprintStyle::Opaque | FingerprintStyle::HirId => Err(()), - FingerprintStyle::Unit => Ok(DepNode::new_no_params(tcx, kind)), - FingerprintStyle::DefPathHash => { + match tcx.key_fingerprint_style(kind) { + KeyFingerprintStyle::Opaque | KeyFingerprintStyle::HirId => Err(()), + KeyFingerprintStyle::Unit => Ok(DepNode::new_no_params(tcx, kind)), + KeyFingerprintStyle::DefPathHash => { Ok(DepNode::from_def_path_hash(tcx, def_path_hash, kind)) } } diff --git a/compiler/rustc_middle/src/dep_graph/dep_node_key.rs b/compiler/rustc_middle/src/dep_graph/dep_node_key.rs index 92c135a6e7fde..c488a94712376 100644 --- a/compiler/rustc_middle/src/dep_graph/dep_node_key.rs +++ b/compiler/rustc_middle/src/dep_graph/dep_node_key.rs @@ -3,13 +3,13 @@ use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE, LocalDefId, LocalModDefId, use rustc_hir::definitions::DefPathHash; use rustc_hir::{HirId, ItemLocalId, OwnerId}; -use crate::dep_graph::{DepNode, DepNodeKey, FingerprintStyle}; +use crate::dep_graph::{DepNode, DepNodeKey, KeyFingerprintStyle}; use crate::ty::TyCtxt; impl<'tcx> DepNodeKey<'tcx> for () { #[inline(always)] - fn fingerprint_style() -> FingerprintStyle { - FingerprintStyle::Unit + fn key_fingerprint_style() -> KeyFingerprintStyle { + KeyFingerprintStyle::Unit } #[inline(always)] @@ -18,15 +18,15 @@ impl<'tcx> DepNodeKey<'tcx> for () { } #[inline(always)] - fn recover(_: TyCtxt<'tcx>, _: &DepNode) -> Option { + fn try_recover_key(_: TyCtxt<'tcx>, _: &DepNode) -> Option { Some(()) } } impl<'tcx> DepNodeKey<'tcx> for DefId { #[inline(always)] - fn fingerprint_style() -> FingerprintStyle { - FingerprintStyle::DefPathHash + fn key_fingerprint_style() -> KeyFingerprintStyle { + KeyFingerprintStyle::DefPathHash } #[inline(always)] @@ -40,15 +40,15 @@ impl<'tcx> DepNodeKey<'tcx> for DefId { } #[inline(always)] - fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option { + fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option { dep_node.extract_def_id(tcx) } } impl<'tcx> DepNodeKey<'tcx> for LocalDefId { #[inline(always)] - fn fingerprint_style() -> FingerprintStyle { - FingerprintStyle::DefPathHash + fn key_fingerprint_style() -> KeyFingerprintStyle { + KeyFingerprintStyle::DefPathHash } #[inline(always)] @@ -62,15 +62,15 @@ impl<'tcx> DepNodeKey<'tcx> for LocalDefId { } #[inline(always)] - fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option { + fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option { dep_node.extract_def_id(tcx).map(|id| id.expect_local()) } } impl<'tcx> DepNodeKey<'tcx> for OwnerId { #[inline(always)] - fn fingerprint_style() -> FingerprintStyle { - FingerprintStyle::DefPathHash + fn key_fingerprint_style() -> KeyFingerprintStyle { + KeyFingerprintStyle::DefPathHash } #[inline(always)] @@ -84,15 +84,15 @@ impl<'tcx> DepNodeKey<'tcx> for OwnerId { } #[inline(always)] - fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option { + fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option { dep_node.extract_def_id(tcx).map(|id| OwnerId { def_id: id.expect_local() }) } } impl<'tcx> DepNodeKey<'tcx> for CrateNum { #[inline(always)] - fn fingerprint_style() -> FingerprintStyle { - FingerprintStyle::DefPathHash + fn key_fingerprint_style() -> KeyFingerprintStyle { + KeyFingerprintStyle::DefPathHash } #[inline(always)] @@ -107,15 +107,15 @@ impl<'tcx> DepNodeKey<'tcx> for CrateNum { } #[inline(always)] - fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option { + fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option { dep_node.extract_def_id(tcx).map(|id| id.krate) } } impl<'tcx> DepNodeKey<'tcx> for (DefId, DefId) { #[inline(always)] - fn fingerprint_style() -> FingerprintStyle { - FingerprintStyle::Opaque + fn key_fingerprint_style() -> KeyFingerprintStyle { + KeyFingerprintStyle::Opaque } // We actually would not need to specialize the implementation of this @@ -141,8 +141,8 @@ impl<'tcx> DepNodeKey<'tcx> for (DefId, DefId) { impl<'tcx> DepNodeKey<'tcx> for HirId { #[inline(always)] - fn fingerprint_style() -> FingerprintStyle { - FingerprintStyle::HirId + fn key_fingerprint_style() -> KeyFingerprintStyle { + KeyFingerprintStyle::HirId } // We actually would not need to specialize the implementation of this @@ -166,9 +166,9 @@ impl<'tcx> DepNodeKey<'tcx> for HirId { } #[inline(always)] - fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option { - if tcx.fingerprint_style(dep_node.kind) == FingerprintStyle::HirId { - let (local_hash, local_id) = Fingerprint::from(dep_node.hash).split(); + fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option { + if tcx.key_fingerprint_style(dep_node.kind) == KeyFingerprintStyle::HirId { + let (local_hash, local_id) = Fingerprint::from(dep_node.key_fingerprint).split(); let def_path_hash = DefPathHash::new(tcx.stable_crate_id(LOCAL_CRATE), local_hash); let def_id = tcx.def_path_hash_to_def_id(def_path_hash)?.expect_local(); let local_id = local_id @@ -184,8 +184,8 @@ impl<'tcx> DepNodeKey<'tcx> for HirId { impl<'tcx> DepNodeKey<'tcx> for ModDefId { #[inline(always)] - fn fingerprint_style() -> FingerprintStyle { - FingerprintStyle::DefPathHash + fn key_fingerprint_style() -> KeyFingerprintStyle { + KeyFingerprintStyle::DefPathHash } #[inline(always)] @@ -199,15 +199,15 @@ impl<'tcx> DepNodeKey<'tcx> for ModDefId { } #[inline(always)] - fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option { - DefId::recover(tcx, dep_node).map(ModDefId::new_unchecked) + fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option { + DefId::try_recover_key(tcx, dep_node).map(ModDefId::new_unchecked) } } impl<'tcx> DepNodeKey<'tcx> for LocalModDefId { #[inline(always)] - fn fingerprint_style() -> FingerprintStyle { - FingerprintStyle::DefPathHash + fn key_fingerprint_style() -> KeyFingerprintStyle { + KeyFingerprintStyle::DefPathHash } #[inline(always)] @@ -221,7 +221,7 @@ impl<'tcx> DepNodeKey<'tcx> for LocalModDefId { } #[inline(always)] - fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option { - LocalDefId::recover(tcx, dep_node).map(LocalModDefId::new_unchecked) + fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option { + LocalDefId::try_recover_key(tcx, dep_node).map(LocalModDefId::new_unchecked) } } diff --git a/compiler/rustc_middle/src/dep_graph/graph.rs b/compiler/rustc_middle/src/dep_graph/graph.rs index 5257ec4abef21..f5787716a94e0 100644 --- a/compiler/rustc_middle/src/dep_graph/graph.rs +++ b/compiler/rustc_middle/src/dep_graph/graph.rs @@ -142,15 +142,17 @@ impl DepGraph { // Instantiate a node with zero dependencies only once for anonymous queries. let _green_node_index = current.alloc_new_node( - DepNode { kind: DepKind::ANON_ZERO_DEPS, hash: current.anon_id_seed.into() }, + DepNode { kind: DepKind::ANON_ZERO_DEPS, key_fingerprint: current.anon_id_seed.into() }, EdgesVec::new(), Fingerprint::ZERO, ); assert_eq!(_green_node_index, DepNodeIndex::SINGLETON_ZERO_DEPS_ANON_NODE); - // Instantiate a dependy-less red node only once for anonymous queries. + // Create a single always-red node, with no dependencies of its own. + // Other nodes can use the always-red node as a fake dependency, to + // ensure that their dependency list will never be all-green. let red_node_index = current.alloc_new_node( - DepNode { kind: DepKind::RED, hash: Fingerprint::ZERO.into() }, + DepNode { kind: DepKind::RED, key_fingerprint: Fingerprint::ZERO.into() }, EdgesVec::new(), Fingerprint::ZERO, ); @@ -418,7 +420,7 @@ impl DepGraphData { // Fingerprint::combine() is faster than sending Fingerprint // through the StableHasher (at least as long as StableHasher // is so slow). - hash: self.current.anon_id_seed.combine(hasher.finish()).into(), + key_fingerprint: self.current.anon_id_seed.combine(hasher.finish()).into(), }; // The DepNodes generated by the process above are not unique. 2 queries could @@ -585,7 +587,7 @@ impl DepGraph { data.current.record_edge( dep_node_index, node, - data.prev_fingerprint_of(prev_index), + data.prev_value_fingerprint_of(prev_index), ); } @@ -658,8 +660,8 @@ impl DepGraphData { } #[inline] - pub fn prev_fingerprint_of(&self, prev_index: SerializedDepNodeIndex) -> Fingerprint { - self.previous.fingerprint_by_index(prev_index) + pub fn prev_value_fingerprint_of(&self, prev_index: SerializedDepNodeIndex) -> Fingerprint { + self.previous.value_fingerprint_for_index(prev_index) } #[inline] @@ -679,7 +681,7 @@ impl DepGraphData { let dep_node_index = self.current.encoder.send_new( DepNode { kind: DepKind::SIDE_EFFECT, - hash: PackedFingerprint::from(Fingerprint::ZERO), + key_fingerprint: PackedFingerprint::from(Fingerprint::ZERO), }, Fingerprint::ZERO, // We want the side effect node to always be red so it will be forced and emit the @@ -712,7 +714,7 @@ impl DepGraphData { &self.colors, DepNode { kind: DepKind::SIDE_EFFECT, - hash: PackedFingerprint::from(Fingerprint::ZERO), + key_fingerprint: PackedFingerprint::from(Fingerprint::ZERO), }, Fingerprint::ZERO, std::iter::once(DepNodeIndex::FOREVER_RED_NODE).collect(), @@ -727,12 +729,12 @@ impl DepGraphData { &self, key: DepNode, edges: EdgesVec, - fingerprint: Option, + value_fingerprint: Option, ) -> DepNodeIndex { if let Some(prev_index) = self.previous.node_to_index_opt(&key) { // Determine the color and index of the new `DepNode`. - let is_green = if let Some(fingerprint) = fingerprint { - if fingerprint == self.previous.fingerprint_by_index(prev_index) { + let is_green = if let Some(value_fingerprint) = value_fingerprint { + if value_fingerprint == self.previous.value_fingerprint_for_index(prev_index) { // This is a green node: it existed in the previous compilation, // its query was re-executed, and it has the same result as before. true @@ -749,22 +751,22 @@ impl DepGraphData { false }; - let fingerprint = fingerprint.unwrap_or(Fingerprint::ZERO); + let value_fingerprint = value_fingerprint.unwrap_or(Fingerprint::ZERO); let dep_node_index = self.current.encoder.send_and_color( prev_index, &self.colors, key, - fingerprint, + value_fingerprint, edges, is_green, ); - self.current.record_node(dep_node_index, key, fingerprint); + self.current.record_node(dep_node_index, key, value_fingerprint); dep_node_index } else { - self.current.alloc_new_node(key, edges, fingerprint.unwrap_or(Fingerprint::ZERO)) + self.current.alloc_new_node(key, edges, value_fingerprint.unwrap_or(Fingerprint::ZERO)) } } @@ -781,7 +783,7 @@ impl DepGraphData { self.current.record_edge( dep_node_index, *self.previous.index_to_node(prev_index), - self.previous.fingerprint_by_index(prev_index), + self.previous.value_fingerprint_for_index(prev_index), ); } @@ -925,7 +927,7 @@ impl DepGraphData { if !tcx.is_eval_always(dep_dep_node.kind) { debug!( "state of dependency {:?} ({}) is unknown, trying to mark it green", - dep_dep_node, dep_dep_node.hash, + dep_dep_node, dep_dep_node.key_fingerprint, ); let node_index = self.try_mark_previous_green(tcx, parent_dep_node_index, Some(frame)); @@ -1154,10 +1156,10 @@ pub(super) struct CurrentDepGraph { encoder: GraphEncoder, anon_node_to_index: ShardedHashMap, - /// This is used to verify that fingerprints do not change between the creation of a node - /// and its recomputation. + /// This is used to verify that value fingerprints do not change between the + /// creation of a node and its recomputation. #[cfg(debug_assertions)] - fingerprints: Lock>>, + value_fingerprints: Lock>>, /// Used to trap when a specific edge is added to the graph. /// This is used for debug purposes and is only active with `debug_assertions`. @@ -1224,7 +1226,7 @@ impl CurrentDepGraph { #[cfg(debug_assertions)] forbidden_edge, #[cfg(debug_assertions)] - fingerprints: Lock::new(IndexVec::from_elem_n(None, new_node_count_estimate)), + value_fingerprints: Lock::new(IndexVec::from_elem_n(None, new_node_count_estimate)), nodes_in_current_session: new_node_dbg.then(|| { Lock::new(FxHashMap::with_capacity_and_hasher( new_node_count_estimate, @@ -1237,12 +1239,20 @@ impl CurrentDepGraph { } #[cfg(debug_assertions)] - fn record_edge(&self, dep_node_index: DepNodeIndex, key: DepNode, fingerprint: Fingerprint) { + fn record_edge( + &self, + dep_node_index: DepNodeIndex, + key: DepNode, + value_fingerprint: Fingerprint, + ) { if let Some(forbidden_edge) = &self.forbidden_edge { forbidden_edge.index_to_node.lock().insert(dep_node_index, key); } - let previous = *self.fingerprints.lock().get_or_insert_with(dep_node_index, || fingerprint); - assert_eq!(previous, fingerprint, "Unstable fingerprints for {:?}", key); + let prior_value_fingerprint = *self + .value_fingerprints + .lock() + .get_or_insert_with(dep_node_index, || value_fingerprint); + assert_eq!(prior_value_fingerprint, value_fingerprint, "Unstable fingerprints for {key:?}"); } #[inline(always)] @@ -1250,10 +1260,10 @@ impl CurrentDepGraph { &self, dep_node_index: DepNodeIndex, key: DepNode, - _current_fingerprint: Fingerprint, + _value_fingerprint: Fingerprint, ) { #[cfg(debug_assertions)] - self.record_edge(dep_node_index, key, _current_fingerprint); + self.record_edge(dep_node_index, key, _value_fingerprint); if let Some(ref nodes_in_current_session) = self.nodes_in_current_session { outline(|| { @@ -1271,11 +1281,11 @@ impl CurrentDepGraph { &self, key: DepNode, edges: EdgesVec, - current_fingerprint: Fingerprint, + value_fingerprint: Fingerprint, ) -> DepNodeIndex { - let dep_node_index = self.encoder.send_new(key, current_fingerprint, edges); + let dep_node_index = self.encoder.send_new(key, value_fingerprint, edges); - self.record_node(dep_node_index, key, current_fingerprint); + self.record_node(dep_node_index, key, value_fingerprint); dep_node_index } diff --git a/compiler/rustc_middle/src/dep_graph/mod.rs b/compiler/rustc_middle/src/dep_graph/mod.rs index 4b1faeb7d2090..dda336fcd0b09 100644 --- a/compiler/rustc_middle/src/dep_graph/mod.rs +++ b/compiler/rustc_middle/src/dep_graph/mod.rs @@ -30,7 +30,7 @@ mod serialized; /// This is mainly for determining whether and how we can reconstruct a key /// from the fingerprint. #[derive(Debug, PartialEq, Eq, Copy, Clone)] -pub enum FingerprintStyle { +pub enum KeyFingerprintStyle { /// The fingerprint is actually a DefPathHash. DefPathHash, /// The fingerprint is actually a HirId. @@ -41,14 +41,14 @@ pub enum FingerprintStyle { Opaque, } -impl FingerprintStyle { +impl KeyFingerprintStyle { #[inline] pub const fn reconstructible(self) -> bool { match self { - FingerprintStyle::DefPathHash | FingerprintStyle::Unit | FingerprintStyle::HirId => { - true - } - FingerprintStyle::Opaque => false, + KeyFingerprintStyle::DefPathHash + | KeyFingerprintStyle::Unit + | KeyFingerprintStyle::HirId => true, + KeyFingerprintStyle::Opaque => false, } } } @@ -86,8 +86,8 @@ impl<'tcx> TyCtxt<'tcx> { } #[inline(always)] - pub fn fingerprint_style(self, kind: DepKind) -> FingerprintStyle { - self.dep_kind_vtable(kind).fingerprint_style + pub fn key_fingerprint_style(self, kind: DepKind) -> KeyFingerprintStyle { + self.dep_kind_vtable(kind).key_fingerprint_style } /// Try to force a dep node to execute and see if it's green. diff --git a/compiler/rustc_middle/src/dep_graph/serialized.rs b/compiler/rustc_middle/src/dep_graph/serialized.rs index dbcd5ea070887..4da96c5c99336 100644 --- a/compiler/rustc_middle/src/dep_graph/serialized.rs +++ b/compiler/rustc_middle/src/dep_graph/serialized.rs @@ -90,9 +90,13 @@ const DEP_NODE_WIDTH_BITS: usize = DEP_NODE_SIZE / 2; pub struct SerializedDepGraph { /// The set of all DepNodes in the graph nodes: IndexVec, - /// The set of all Fingerprints in the graph. Each Fingerprint corresponds to - /// the DepNode at the same index in the nodes vector. - fingerprints: IndexVec, + /// A value fingerprint associated with each [`DepNode`] in [`Self::nodes`], + /// typically a hash of the value returned by the node's query in the + /// previous incremental-compilation session. + /// + /// Some nodes don't have a meaningful value hash (e.g. queries with `no_hash`), + /// so they store a dummy value here instead (e.g. [`Fingerprint::ZERO`]). + value_fingerprints: IndexVec, /// For each DepNode, stores the list of edges originating from that /// DepNode. Encoded as a [start, end) pair indexing into edge_list_data, /// which holds the actual DepNodeIndices of the target nodes. @@ -100,8 +104,8 @@ pub struct SerializedDepGraph { /// A flattened list of all edge targets in the graph, stored in the same /// varint encoding that we use on disk. Edge sources are implicit in edge_list_indices. edge_list_data: Vec, - /// Stores a map from fingerprints to nodes per dep node kind. - /// This is the reciprocal of `nodes`. + /// For each dep kind, stores a map from key fingerprints back to the index + /// of the corresponding node. This is the inverse of `nodes`. index: Vec>, /// The number of previous compilation sessions. This is used to generate /// unique anon dep nodes per session. @@ -138,12 +142,15 @@ impl SerializedDepGraph { #[inline] pub fn node_to_index_opt(&self, dep_node: &DepNode) -> Option { - self.index.get(dep_node.kind.as_usize())?.get(&dep_node.hash).cloned() + self.index.get(dep_node.kind.as_usize())?.get(&dep_node.key_fingerprint).copied() } #[inline] - pub fn fingerprint_by_index(&self, dep_node_index: SerializedDepNodeIndex) -> Fingerprint { - self.fingerprints[dep_node_index] + pub fn value_fingerprint_for_index( + &self, + dep_node_index: SerializedDepNodeIndex, + ) -> Fingerprint { + self.value_fingerprints[dep_node_index] } #[inline] @@ -212,10 +219,13 @@ impl SerializedDepGraph { let graph_bytes = d.len() - (3 * IntEncodedWithFixedSize::ENCODED_SIZE) - d.position(); let mut nodes = IndexVec::from_elem_n( - DepNode { kind: DepKind::NULL, hash: PackedFingerprint::from(Fingerprint::ZERO) }, + DepNode { + kind: DepKind::NULL, + key_fingerprint: PackedFingerprint::from(Fingerprint::ZERO), + }, node_max, ); - let mut fingerprints = IndexVec::from_elem_n(Fingerprint::ZERO, node_max); + let mut value_fingerprints = IndexVec::from_elem_n(Fingerprint::ZERO, node_max); let mut edge_list_indices = IndexVec::from_elem_n(EdgeHeader { repr: 0, num_edges: 0 }, node_max); @@ -243,7 +253,7 @@ impl SerializedDepGraph { assert!(node_header.node().kind != DepKind::NULL && node.kind == DepKind::NULL); *node = node_header.node(); - fingerprints[index] = node_header.fingerprint(); + value_fingerprints[index] = node_header.value_fingerprint(); // If the length of this node's edge list is small, the length is stored in the header. // If it is not, we fall back to another decoder call. @@ -275,7 +285,7 @@ impl SerializedDepGraph { let session_count = d.read_u64(); for (idx, node) in nodes.iter_enumerated() { - if index[node.kind.as_usize()].insert(node.hash, idx).is_some() { + if index[node.kind.as_usize()].insert(node.key_fingerprint, idx).is_some() { // Empty nodes and side effect nodes can have duplicates if node.kind != DepKind::NULL && node.kind != DepKind::SIDE_EFFECT { let name = node.kind.name(); @@ -291,7 +301,7 @@ impl SerializedDepGraph { Arc::new(SerializedDepGraph { nodes, - fingerprints, + value_fingerprints, edge_list_indices, edge_list_data, index, @@ -303,8 +313,8 @@ impl SerializedDepGraph { /// A packed representation of all the fixed-size fields in a `NodeInfo`. /// /// This stores in one byte array: -/// * The `Fingerprint` in the `NodeInfo` -/// * The `Fingerprint` in `DepNode` that is in this `NodeInfo` +/// * The value `Fingerprint` in the `NodeInfo` +/// * The key `Fingerprint` in `DepNode` that is in this `NodeInfo` /// * The `DepKind`'s discriminant (a u16, but not all bits are used...) /// * The byte width of the encoded edges for this node /// * In whatever bits remain, the length of the edge list for this node, if it fits @@ -323,8 +333,8 @@ struct Unpacked { bytes_per_index: usize, kind: DepKind, index: SerializedDepNodeIndex, - hash: PackedFingerprint, - fingerprint: Fingerprint, + key_fingerprint: PackedFingerprint, + value_fingerprint: Fingerprint, } // Bit fields, where @@ -345,7 +355,7 @@ impl SerializedNodeHeader { fn new( node: &DepNode, index: DepNodeIndex, - fingerprint: Fingerprint, + value_fingerprint: Fingerprint, edge_max_index: u32, edge_count: usize, ) -> Self { @@ -363,19 +373,19 @@ impl SerializedNodeHeader { head |= (edge_count as u16 + 1) << (Self::KIND_BITS + Self::WIDTH_BITS); } - let hash: Fingerprint = node.hash.into(); + let hash: Fingerprint = node.key_fingerprint.into(); // Using half-open ranges ensures an unconditional panic if we get the magic numbers wrong. let mut bytes = [0u8; 38]; bytes[..2].copy_from_slice(&head.to_le_bytes()); bytes[2..6].copy_from_slice(&index.as_u32().to_le_bytes()); bytes[6..22].copy_from_slice(&hash.to_le_bytes()); - bytes[22..].copy_from_slice(&fingerprint.to_le_bytes()); + bytes[22..].copy_from_slice(&value_fingerprint.to_le_bytes()); #[cfg(debug_assertions)] { let res = Self { bytes }; - assert_eq!(fingerprint, res.fingerprint()); + assert_eq!(value_fingerprint, res.value_fingerprint()); assert_eq!(*node, res.node()); if let Some(len) = res.len() { assert_eq!(edge_count, len as usize); @@ -388,8 +398,8 @@ impl SerializedNodeHeader { fn unpack(&self) -> Unpacked { let head = u16::from_le_bytes(self.bytes[..2].try_into().unwrap()); let index = u32::from_le_bytes(self.bytes[2..6].try_into().unwrap()); - let hash = self.bytes[6..22].try_into().unwrap(); - let fingerprint = self.bytes[22..].try_into().unwrap(); + let key_fingerprint = self.bytes[6..22].try_into().unwrap(); + let value_fingerprint = self.bytes[22..].try_into().unwrap(); let kind = head & mask(Self::KIND_BITS) as u16; let bytes_per_index = (head >> Self::KIND_BITS) & mask(Self::WIDTH_BITS) as u16; @@ -400,8 +410,8 @@ impl SerializedNodeHeader { bytes_per_index: bytes_per_index as usize + 1, kind: DepKind::new(kind), index: SerializedDepNodeIndex::from_u32(index), - hash: Fingerprint::from_le_bytes(hash).into(), - fingerprint: Fingerprint::from_le_bytes(fingerprint), + key_fingerprint: Fingerprint::from_le_bytes(key_fingerprint).into(), + value_fingerprint: Fingerprint::from_le_bytes(value_fingerprint), } } @@ -421,14 +431,14 @@ impl SerializedNodeHeader { } #[inline] - fn fingerprint(&self) -> Fingerprint { - self.unpack().fingerprint + fn value_fingerprint(&self) -> Fingerprint { + self.unpack().value_fingerprint } #[inline] fn node(&self) -> DepNode { - let Unpacked { kind, hash, .. } = self.unpack(); - DepNode { kind, hash } + let Unpacked { kind, key_fingerprint, .. } = self.unpack(); + DepNode { kind, key_fingerprint } } #[inline] @@ -443,15 +453,20 @@ impl SerializedNodeHeader { #[derive(Debug)] struct NodeInfo { node: DepNode, - fingerprint: Fingerprint, + value_fingerprint: Fingerprint, edges: EdgesVec, } impl NodeInfo { fn encode(&self, e: &mut MemEncoder, index: DepNodeIndex) { - let NodeInfo { ref node, fingerprint, ref edges } = *self; - let header = - SerializedNodeHeader::new(node, index, fingerprint, edges.max_index(), edges.len()); + let NodeInfo { ref node, value_fingerprint, ref edges } = *self; + let header = SerializedNodeHeader::new( + node, + index, + value_fingerprint, + edges.max_index(), + edges.len(), + ); e.write_array(header.bytes); if header.len().is_none() { @@ -476,7 +491,7 @@ impl NodeInfo { e: &mut MemEncoder, node: &DepNode, index: DepNodeIndex, - fingerprint: Fingerprint, + value_fingerprint: Fingerprint, prev_index: SerializedDepNodeIndex, colors: &DepNodeColorMap, previous: &SerializedDepGraph, @@ -488,7 +503,8 @@ impl NodeInfo { let edge_max = edges.clone().map(|i| colors.current(i).unwrap().as_u32()).max().unwrap_or(0); - let header = SerializedNodeHeader::new(node, index, fingerprint, edge_max, edge_count); + let header = + SerializedNodeHeader::new(node, index, value_fingerprint, edge_max, edge_count); e.write_array(header.bytes); if header.len().is_none() { @@ -676,12 +692,12 @@ impl EncoderState { local: &mut LocalEncoderState, ) { let node = self.previous.index_to_node(prev_index); - let fingerprint = self.previous.fingerprint_by_index(prev_index); + let value_fingerprint = self.previous.value_fingerprint_for_index(prev_index); let edge_count = NodeInfo::encode_promoted( &mut local.encoder, node, index, - fingerprint, + value_fingerprint, prev_index, colors, &self.previous, @@ -857,11 +873,11 @@ impl GraphEncoder { pub(crate) fn send_new( &self, node: DepNode, - fingerprint: Fingerprint, + value_fingerprint: Fingerprint, edges: EdgesVec, ) -> DepNodeIndex { let _prof_timer = self.profiler.generic_activity("incr_comp_encode_dep_graph"); - let node = NodeInfo { node, fingerprint, edges }; + let node = NodeInfo { node, value_fingerprint, edges }; let mut local = self.status.local.borrow_mut(); let index = self.status.next_index(&mut *local); self.status.bump_index(&mut *local); @@ -877,12 +893,12 @@ impl GraphEncoder { prev_index: SerializedDepNodeIndex, colors: &DepNodeColorMap, node: DepNode, - fingerprint: Fingerprint, + value_fingerprint: Fingerprint, edges: EdgesVec, is_green: bool, ) -> DepNodeIndex { let _prof_timer = self.profiler.generic_activity("incr_comp_encode_dep_graph"); - let node = NodeInfo { node, fingerprint, edges }; + let node = NodeInfo { node, value_fingerprint, edges }; let mut local = self.status.local.borrow_mut(); diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs index 2e6e96b4d8a80..e5fe01781e96d 100644 --- a/compiler/rustc_middle/src/mir/pretty.rs +++ b/compiler/rustc_middle/src/mir/pretty.rs @@ -1237,10 +1237,6 @@ impl<'tcx> Debug for Rvalue<'tcx> { } } - ShallowInitBox(ref place, ref ty) => { - with_no_trimmed_paths!(write!(fmt, "ShallowInitBox({place:?}, {ty})")) - } - WrapUnsafeBinder(ref op, ty) => { with_no_trimmed_paths!(write!(fmt, "wrap_binder!({op:?}; {ty})")) } diff --git a/compiler/rustc_middle/src/mir/statement.rs b/compiler/rustc_middle/src/mir/statement.rs index b1cb89bd37135..48dcef298d66a 100644 --- a/compiler/rustc_middle/src/mir/statement.rs +++ b/compiler/rustc_middle/src/mir/statement.rs @@ -747,11 +747,6 @@ impl<'tcx> ConstOperand<'tcx> { /////////////////////////////////////////////////////////////////////////// // Rvalues -pub enum RvalueInitializationState { - Shallow, - Deep, -} - impl<'tcx> Rvalue<'tcx> { /// Returns true if rvalue can be safely removed when the result is unused. #[inline] @@ -786,7 +781,6 @@ impl<'tcx> Rvalue<'tcx> { | Rvalue::UnaryOp(_, _) | Rvalue::Discriminant(_) | Rvalue::Aggregate(_, _) - | Rvalue::ShallowInitBox(_, _) | Rvalue::WrapUnsafeBinder(_, _) => true, } } @@ -833,21 +827,10 @@ impl<'tcx> Rvalue<'tcx> { } AggregateKind::RawPtr(ty, mutability) => Ty::new_ptr(tcx, ty, mutability), }, - Rvalue::ShallowInitBox(_, ty) => Ty::new_box(tcx, ty), Rvalue::CopyForDeref(ref place) => place.ty(local_decls, tcx).ty, Rvalue::WrapUnsafeBinder(_, ty) => ty, } } - - #[inline] - /// Returns `true` if this rvalue is deeply initialized (most rvalues) or - /// whether its only shallowly initialized (`Rvalue::Box`). - pub fn initialization_state(&self) -> RvalueInitializationState { - match *self { - Rvalue::ShallowInitBox(_, _) => RvalueInitializationState::Shallow, - _ => RvalueInitializationState::Deep, - } - } } impl BorrowKind { diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs index 6ec874fb15f71..35f67460f51c0 100644 --- a/compiler/rustc_middle/src/mir/syntax.rs +++ b/compiler/rustc_middle/src/mir/syntax.rs @@ -1458,13 +1458,6 @@ pub enum Rvalue<'tcx> { /// coroutine lowering, `Coroutine` aggregate kinds are disallowed too. Aggregate(Box>, IndexVec>), - /// Transmutes a `*mut u8` into shallow-initialized `Box`. - /// - /// This is different from a normal transmute because dataflow analysis will treat the box as - /// initialized but its content as uninitialized. Like other pointer casts, this in general - /// affects alias analysis. - ShallowInitBox(Operand<'tcx>, Ty<'tcx>), - /// A CopyForDeref is equivalent to a read from a place at the /// codegen level, but is treated specially by drop elaboration. When such a read happens, it /// is guaranteed (via nature of the mir_opt `Derefer` in rustc_mir_transform/src/deref_separator) diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs index 07a36aef43201..16a8743a6d67b 100644 --- a/compiler/rustc_middle/src/mir/visit.rs +++ b/compiler/rustc_middle/src/mir/visit.rs @@ -810,11 +810,6 @@ macro_rules! make_mir_visitor { } } - Rvalue::ShallowInitBox(operand, ty) => { - self.visit_operand(operand, location); - self.visit_ty($(& $mutability)? *ty, TyContext::Location(location)); - } - Rvalue::WrapUnsafeBinder(op, ty) => { self.visit_operand(op, location); self.visit_ty($(& $mutability)? *ty, TyContext::Location(location)); diff --git a/compiler/rustc_middle/src/query/caches.rs b/compiler/rustc_middle/src/query/caches.rs index c1f5e5b670856..2adcecc5aaef1 100644 --- a/compiler/rustc_middle/src/query/caches.rs +++ b/compiler/rustc_middle/src/query/caches.rs @@ -67,7 +67,7 @@ where #[inline] fn complete(&self, key: K, value: V, index: DepNodeIndex) { // We may be overwriting another value. This is all right, since the dep-graph - // will check that the fingerprint matches. + // will check that the value fingerprint matches. self.cache.insert(key, (value, index)); } diff --git a/compiler/rustc_middle/src/verify_ich.rs b/compiler/rustc_middle/src/verify_ich.rs index ff3c5bb5a9d6b..a1ab4d8cc4d00 100644 --- a/compiler/rustc_middle/src/verify_ich.rs +++ b/compiler/rustc_middle/src/verify_ich.rs @@ -25,7 +25,7 @@ pub fn incremental_verify_ich<'tcx, V>( tcx.with_stable_hashing_context(|mut hcx| f(&mut hcx, result)) }); - let old_hash = dep_graph_data.prev_fingerprint_of(prev_index); + let old_hash = dep_graph_data.prev_value_fingerprint_of(prev_index); if new_hash != old_hash { incremental_verify_ich_failed(tcx, prev_index, &|| format_value(result)); diff --git a/compiler/rustc_mir_dataflow/src/impls/borrowed_locals.rs b/compiler/rustc_mir_dataflow/src/impls/borrowed_locals.rs index 4b2c52ad7999d..d5548266aa017 100644 --- a/compiler/rustc_mir_dataflow/src/impls/borrowed_locals.rs +++ b/compiler/rustc_mir_dataflow/src/impls/borrowed_locals.rs @@ -86,7 +86,6 @@ where Rvalue::Cast(..) | Rvalue::Ref(_, BorrowKind::Fake(_), _) - | Rvalue::ShallowInitBox(..) | Rvalue::Use(..) | Rvalue::ThreadLocalRef(..) | Rvalue::Repeat(..) diff --git a/compiler/rustc_mir_dataflow/src/move_paths/builder.rs b/compiler/rustc_mir_dataflow/src/move_paths/builder.rs index ced9bd735ba2b..224abf6901b33 100644 --- a/compiler/rustc_mir_dataflow/src/move_paths/builder.rs +++ b/compiler/rustc_mir_dataflow/src/move_paths/builder.rs @@ -391,15 +391,7 @@ impl<'a, 'tcx, F: Fn(Ty<'tcx>) -> bool> MoveDataBuilder<'a, 'tcx, F> { } StatementKind::Assign(box (place, rval)) => { self.create_move_path(*place); - if let RvalueInitializationState::Shallow = rval.initialization_state() { - // Box starts out uninitialized - need to create a separate - // move-path for the interior so it will be separate from - // the exterior. - self.create_move_path(self.tcx.mk_place_deref(*place)); - self.gather_init(place.as_ref(), InitKind::Shallow); - } else { - self.gather_init(place.as_ref(), InitKind::Deep); - } + self.gather_init(place.as_ref(), InitKind::Deep); self.gather_rvalue(rval); } StatementKind::FakeRead(box (_, place)) => { @@ -435,7 +427,6 @@ impl<'a, 'tcx, F: Fn(Ty<'tcx>) -> bool> MoveDataBuilder<'a, 'tcx, F> { Rvalue::Use(ref operand) | Rvalue::Repeat(ref operand, _) | Rvalue::Cast(_, ref operand, _) - | Rvalue::ShallowInitBox(ref operand, _) | Rvalue::UnaryOp(_, ref operand) | Rvalue::WrapUnsafeBinder(ref operand, _) => self.gather_operand(operand), Rvalue::BinaryOp(ref _binop, box (ref lhs, ref rhs)) => { diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs index 604f1da1a3abb..93da4f3a0a818 100644 --- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs +++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs @@ -467,7 +467,6 @@ impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> { Rvalue::Discriminant(place) => state.get_discr(place.as_ref(), &self.map), Rvalue::Use(operand) => return self.handle_operand(operand, state), Rvalue::CopyForDeref(_) => bug!("`CopyForDeref` in runtime MIR"), - Rvalue::ShallowInitBox(..) => bug!("`ShallowInitBox` in runtime MIR"), Rvalue::Ref(..) | Rvalue::RawPtr(..) => { // We don't track such places. return ValueOrPlace::TOP; diff --git a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs index 808be19cbd817..68c47ec4c1922 100644 --- a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs +++ b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs @@ -1,12 +1,8 @@ //! This pass transforms derefs of Box into a deref of the pointer inside Box. //! //! Box is not actually a pointer so it is incorrect to dereference it directly. -//! -//! `ShallowInitBox` being a device for drop elaboration to understand deferred assignment to box -//! contents, we do not need this any more on runtime MIR. -use rustc_abi::{FieldIdx, VariantIdx}; -use rustc_index::{IndexVec, indexvec}; +use rustc_abi::FieldIdx; use rustc_middle::mir::visit::MutVisitor; use rustc_middle::mir::*; use rustc_middle::span_bug; @@ -89,68 +85,6 @@ impl<'a, 'tcx> MutVisitor<'tcx> for ElaborateBoxDerefVisitor<'a, 'tcx> { self.super_place(place, context, location); } - - fn visit_statement(&mut self, stmt: &mut Statement<'tcx>, location: Location) { - self.super_statement(stmt, location); - - let tcx = self.tcx; - let source_info = stmt.source_info; - - if let StatementKind::Assign(box (_, ref mut rvalue)) = stmt.kind - && let Rvalue::ShallowInitBox(ref mut mutptr_to_u8, pointee) = *rvalue - && let ty::Adt(box_adt, box_args) = Ty::new_box(tcx, pointee).kind() - { - let args = tcx.mk_args(&[pointee.into()]); - let (unique_ty, nonnull_ty, ptr_ty) = - build_ptr_tys(tcx, pointee, self.unique_def, self.nonnull_def); - let adt_kind = |def: ty::AdtDef<'tcx>, args| { - Box::new(AggregateKind::Adt(def.did(), VariantIdx::ZERO, args, None, None)) - }; - let zst = |ty| { - Operand::Constant(Box::new(ConstOperand { - span: source_info.span, - user_ty: None, - const_: Const::zero_sized(ty), - })) - }; - - let constptr = self.patch.new_temp(ptr_ty, source_info.span); - self.patch.add_assign( - location, - constptr.into(), - Rvalue::Cast(CastKind::Transmute, mutptr_to_u8.clone(), ptr_ty), - ); - - let nonnull = self.patch.new_temp(nonnull_ty, source_info.span); - self.patch.add_assign( - location, - nonnull.into(), - Rvalue::Aggregate( - adt_kind(self.nonnull_def, args), - indexvec![Operand::Move(constptr.into())], - ), - ); - - let unique = self.patch.new_temp(unique_ty, source_info.span); - let phantomdata_ty = - self.unique_def.non_enum_variant().fields[FieldIdx::ONE].ty(tcx, args); - self.patch.add_assign( - location, - unique.into(), - Rvalue::Aggregate( - adt_kind(self.unique_def, args), - indexvec![Operand::Move(nonnull.into()), zst(phantomdata_ty)], - ), - ); - - let global_alloc_ty = - box_adt.non_enum_variant().fields[FieldIdx::ONE].ty(tcx, box_args); - *rvalue = Rvalue::Aggregate( - adt_kind(*box_adt, box_args), - indexvec![Operand::Move(unique.into()), zst(global_alloc_ty)], - ); - } - } } pub(super) struct ElaborateBoxDerefs; diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index 6507a5194adda..4e38b9dd6534b 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -1069,7 +1069,7 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> { // Unsupported values. Rvalue::ThreadLocalRef(..) => return None, - Rvalue::CopyForDeref(_) | Rvalue::ShallowInitBox(..) => { + Rvalue::CopyForDeref(_) => { bug!("forbidden in runtime MIR: {rvalue:?}") } }; diff --git a/compiler/rustc_mir_transform/src/known_panics_lint.rs b/compiler/rustc_mir_transform/src/known_panics_lint.rs index caaf300a88d64..873f6a01ec360 100644 --- a/compiler/rustc_mir_transform/src/known_panics_lint.rs +++ b/compiler/rustc_mir_transform/src/known_panics_lint.rs @@ -443,7 +443,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { | Rvalue::CopyForDeref(..) | Rvalue::Repeat(..) | Rvalue::Cast(..) - | Rvalue::ShallowInitBox(..) | Rvalue::Discriminant(..) | Rvalue::WrapUnsafeBinder(..) => {} } @@ -605,8 +604,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { Ref(..) | RawPtr(..) => return None, - ShallowInitBox(..) => return None, - Cast(ref kind, ref value, to) => match kind { CastKind::IntToInt | CastKind::IntToFloat => { let value = self.eval_operand(value)?; diff --git a/compiler/rustc_mir_transform/src/lint.rs b/compiler/rustc_mir_transform/src/lint.rs index 88297a4efef7e..b8b1b930bc418 100644 --- a/compiler/rustc_mir_transform/src/lint.rs +++ b/compiler/rustc_mir_transform/src/lint.rs @@ -85,7 +85,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Lint<'a, 'tcx> { | Rvalue::Repeat(..) | Rvalue::Aggregate(..) | Rvalue::Cast(..) - | Rvalue::ShallowInitBox(..) | Rvalue::WrapUnsafeBinder(..) => true, Rvalue::ThreadLocalRef(..) | Rvalue::UnaryOp(..) diff --git a/compiler/rustc_mir_transform/src/pass_manager.rs b/compiler/rustc_mir_transform/src/pass_manager.rs index e225c31881f83..a081364165438 100644 --- a/compiler/rustc_mir_transform/src/pass_manager.rs +++ b/compiler/rustc_mir_transform/src/pass_manager.rs @@ -1,5 +1,6 @@ use std::cell::RefCell; use std::collections::hash_map::Entry; +use std::sync::atomic::Ordering; use rustc_data_structures::fx::{FxHashMap, FxIndexSet}; use rustc_middle::mir::{Body, MirDumper, MirPhase, RuntimePhase}; @@ -285,6 +286,19 @@ fn run_passes_inner<'tcx>( continue; }; + if is_optimization_stage(body, phase_change, optimizations) + && let Some(limit) = &tcx.sess.opts.unstable_opts.mir_opt_bisect_limit + { + if limited_by_opt_bisect( + tcx, + tcx.def_path_debug_str(body.source.def_id()), + *limit, + *pass, + ) { + continue; + } + } + let dumper = if pass.is_mir_dump_enabled() && let Some(dumper) = MirDumper::new(tcx, pass_name, body) { @@ -356,3 +370,46 @@ pub(super) fn dump_mir_for_phase_change<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tc dumper.set_show_pass_num().set_disambiguator(&"after").dump_mir(body) } } + +fn is_optimization_stage( + body: &Body<'_>, + phase_change: Option, + optimizations: Optimizations, +) -> bool { + optimizations == Optimizations::Allowed + && body.phase == MirPhase::Runtime(RuntimePhase::PostCleanup) + && phase_change == Some(MirPhase::Runtime(RuntimePhase::Optimized)) +} + +fn limited_by_opt_bisect<'tcx, P>( + tcx: TyCtxt<'tcx>, + def_path: String, + limit: usize, + pass: &P, +) -> bool +where + P: MirPass<'tcx> + ?Sized, +{ + let current_opt_bisect_count = + tcx.sess.mir_opt_bisect_eval_count.fetch_add(1, Ordering::Relaxed); + + let can_run = current_opt_bisect_count < limit; + + if can_run { + eprintln!( + "BISECT: running pass ({}) {} on {}", + current_opt_bisect_count + 1, + pass.name(), + def_path + ); + } else { + eprintln!( + "BISECT: NOT running pass ({}) {} on {}", + current_opt_bisect_count + 1, + pass.name(), + def_path + ); + } + + !can_run +} diff --git a/compiler/rustc_mir_transform/src/promote_consts.rs b/compiler/rustc_mir_transform/src/promote_consts.rs index 3d1537b95efa9..fb880caf876e2 100644 --- a/compiler/rustc_mir_transform/src/promote_consts.rs +++ b/compiler/rustc_mir_transform/src/promote_consts.rs @@ -449,8 +449,6 @@ impl<'tcx> Validator<'_, 'tcx> { self.validate_operand(operand)?; } - Rvalue::ShallowInitBox(_, _) => return Err(Unpromotable), - Rvalue::UnaryOp(op, operand) => { match op { // These operations can never fail. diff --git a/compiler/rustc_mir_transform/src/single_use_consts.rs b/compiler/rustc_mir_transform/src/single_use_consts.rs index 02caa92ad3fc8..6d33736d64ecb 100644 --- a/compiler/rustc_mir_transform/src/single_use_consts.rs +++ b/compiler/rustc_mir_transform/src/single_use_consts.rs @@ -85,7 +85,7 @@ impl<'tcx> crate::MirPass<'tcx> for SingleUseConsts { } fn is_required(&self) -> bool { - true + false } } diff --git a/compiler/rustc_mir_transform/src/validate.rs b/compiler/rustc_mir_transform/src/validate.rs index 1afdb4639a0ce..78c161ebd58c9 100644 --- a/compiler/rustc_mir_transform/src/validate.rs +++ b/compiler/rustc_mir_transform/src/validate.rs @@ -1259,14 +1259,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { } } } - Rvalue::ShallowInitBox(operand, _) => { - if self.body.phase >= MirPhase::Runtime(RuntimePhase::Initial) { - self.fail(location, format!("ShallowInitBox after ElaborateBoxDerefs")) - } - - let a = operand.ty(&self.body.local_decls, self.tcx); - check_kinds!(a, "Cannot shallow init type {:?}", ty::RawPtr(..)); - } Rvalue::Cast(kind, operand, target_type) => { let op_ty = operand.ty(self.body, self.tcx); match kind { diff --git a/compiler/rustc_public/src/mir/body.rs b/compiler/rustc_public/src/mir/body.rs index e81b32ec9acf5..51757c5827221 100644 --- a/compiler/rustc_public/src/mir/body.rs +++ b/compiler/rustc_public/src/mir/body.rs @@ -567,13 +567,6 @@ pub enum Rvalue { /// [#74836]: https://github.com/rust-lang/rust/issues/74836 Repeat(Operand, TyConst), - /// Transmutes a `*mut u8` into shallow-initialized `Box`. - /// - /// This is different from a normal transmute because dataflow analysis will treat the box as - /// initialized but its content as uninitialized. Like other pointer casts, this in general - /// affects alias analysis. - ShallowInitBox(Operand, Ty), - /// Creates a pointer/reference to the given thread local. /// /// The yielded type is a `*mut T` if the static is mutable, otherwise if the static is extern a @@ -651,7 +644,6 @@ impl Rvalue { } AggregateKind::RawPtr(ty, mutability) => Ok(Ty::new_ptr(ty, mutability)), }, - Rvalue::ShallowInitBox(_, ty) => Ok(Ty::new_box(*ty)), Rvalue::CopyForDeref(place) => place.ty(locals), } } diff --git a/compiler/rustc_public/src/mir/pretty.rs b/compiler/rustc_public/src/mir/pretty.rs index 5ba72965cb292..bf2655e9a789c 100644 --- a/compiler/rustc_public/src/mir/pretty.rs +++ b/compiler/rustc_public/src/mir/pretty.rs @@ -383,7 +383,6 @@ fn pretty_rvalue(writer: &mut W, rval: &Rvalue) -> io::Result<()> { Rvalue::Repeat(op, cnst) => { write!(writer, "[{}; {}]", pretty_operand(op), pretty_ty_const(cnst)) } - Rvalue::ShallowInitBox(_, _) => Ok(()), Rvalue::ThreadLocalRef(item) => { write!(writer, "thread_local_ref{item:?}") } diff --git a/compiler/rustc_public/src/mir/visit.rs b/compiler/rustc_public/src/mir/visit.rs index 678205171ecf2..e1d9cf31036e2 100644 --- a/compiler/rustc_public/src/mir/visit.rs +++ b/compiler/rustc_public/src/mir/visit.rs @@ -277,10 +277,6 @@ macro_rules! make_mir_visitor { self.visit_operand(op, location); self.visit_ty_const(constant, location); } - Rvalue::ShallowInitBox(op, ty) => { - self.visit_ty(ty, location); - self.visit_operand(op, location) - } Rvalue::ThreadLocalRef(_) => {} Rvalue::UnaryOp(_, op) | Rvalue::Use(op) => { self.visit_operand(op, location); diff --git a/compiler/rustc_public/src/unstable/convert/stable/mir.rs b/compiler/rustc_public/src/unstable/convert/stable/mir.rs index a77808cfb275d..d25751c81f3f5 100644 --- a/compiler/rustc_public/src/unstable/convert/stable/mir.rs +++ b/compiler/rustc_public/src/unstable/convert/stable/mir.rs @@ -240,9 +240,6 @@ impl<'tcx> Stable<'tcx> for mir::Rvalue<'tcx> { let operands = operands.iter().map(|op| op.stable(tables, cx)).collect(); crate::mir::Rvalue::Aggregate(agg_kind.stable(tables, cx), operands) } - ShallowInitBox(op, ty) => { - crate::mir::Rvalue::ShallowInitBox(op.stable(tables, cx), ty.stable(tables, cx)) - } CopyForDeref(place) => crate::mir::Rvalue::CopyForDeref(place.stable(tables, cx)), WrapUnsafeBinder(..) => todo!("FIXME(unsafe_binders):"), } diff --git a/compiler/rustc_query_impl/src/dep_kind_vtables.rs b/compiler/rustc_query_impl/src/dep_kind_vtables.rs index 60d9fdc47ed6f..39bd2569ef468 100644 --- a/compiler/rustc_query_impl/src/dep_kind_vtables.rs +++ b/compiler/rustc_query_impl/src/dep_kind_vtables.rs @@ -1,5 +1,5 @@ use rustc_middle::bug; -use rustc_middle::dep_graph::{DepKindVTable, DepNodeKey, FingerprintStyle}; +use rustc_middle::dep_graph::{DepKindVTable, DepNodeKey, KeyFingerprintStyle}; use rustc_middle::query::QueryCache; use crate::plumbing::{force_from_dep_node_inner, try_load_from_on_disk_cache_inner}; @@ -15,7 +15,7 @@ mod non_query { DepKindVTable { is_anon: false, is_eval_always: false, - fingerprint_style: FingerprintStyle::Unit, + key_fingerprint_style: KeyFingerprintStyle::Unit, force_from_dep_node: Some(|_, dep_node, _| { bug!("force_from_dep_node: encountered {dep_node:?}") }), @@ -29,7 +29,7 @@ mod non_query { DepKindVTable { is_anon: false, is_eval_always: false, - fingerprint_style: FingerprintStyle::Unit, + key_fingerprint_style: KeyFingerprintStyle::Unit, force_from_dep_node: Some(|_, dep_node, _| { bug!("force_from_dep_node: encountered {dep_node:?}") }), @@ -42,7 +42,7 @@ mod non_query { DepKindVTable { is_anon: false, is_eval_always: false, - fingerprint_style: FingerprintStyle::Unit, + key_fingerprint_style: KeyFingerprintStyle::Unit, force_from_dep_node: Some(|tcx, _, prev_index| { tcx.dep_graph.force_diagnostic_node(tcx, prev_index); true @@ -56,7 +56,7 @@ mod non_query { DepKindVTable { is_anon: true, is_eval_always: false, - fingerprint_style: FingerprintStyle::Opaque, + key_fingerprint_style: KeyFingerprintStyle::Opaque, force_from_dep_node: Some(|_, _, _| bug!("cannot force an anon node")), try_load_from_on_disk_cache: None, name: &"AnonZeroDeps", @@ -67,7 +67,7 @@ mod non_query { DepKindVTable { is_anon: true, is_eval_always: false, - fingerprint_style: FingerprintStyle::Unit, + key_fingerprint_style: KeyFingerprintStyle::Unit, force_from_dep_node: None, try_load_from_on_disk_cache: None, name: &"TraitSelect", @@ -78,7 +78,7 @@ mod non_query { DepKindVTable { is_anon: false, is_eval_always: false, - fingerprint_style: FingerprintStyle::Opaque, + key_fingerprint_style: KeyFingerprintStyle::Opaque, force_from_dep_node: None, try_load_from_on_disk_cache: None, name: &"CompileCodegenUnit", @@ -89,7 +89,7 @@ mod non_query { DepKindVTable { is_anon: false, is_eval_always: false, - fingerprint_style: FingerprintStyle::Opaque, + key_fingerprint_style: KeyFingerprintStyle::Opaque, force_from_dep_node: None, try_load_from_on_disk_cache: None, name: &"CompileMonoItem", @@ -100,7 +100,7 @@ mod non_query { DepKindVTable { is_anon: false, is_eval_always: false, - fingerprint_style: FingerprintStyle::Unit, + key_fingerprint_style: KeyFingerprintStyle::Unit, force_from_dep_node: None, try_load_from_on_disk_cache: None, name: &"Metadata", @@ -118,17 +118,17 @@ where Cache: QueryCache + 'tcx, { let is_anon = FLAGS.is_anon; - let fingerprint_style = if is_anon { - FingerprintStyle::Opaque + let key_fingerprint_style = if is_anon { + KeyFingerprintStyle::Opaque } else { - >::fingerprint_style() + >::key_fingerprint_style() }; - if is_anon || !fingerprint_style.reconstructible() { + if is_anon || !key_fingerprint_style.reconstructible() { return DepKindVTable { is_anon, is_eval_always, - fingerprint_style, + key_fingerprint_style, force_from_dep_node: None, try_load_from_on_disk_cache: None, name: Q::NAME, @@ -138,7 +138,7 @@ where DepKindVTable { is_anon, is_eval_always, - fingerprint_style, + key_fingerprint_style, force_from_dep_node: Some(|tcx, dep_node, _| { force_from_dep_node_inner(Q::query_dispatcher(tcx), tcx, dep_node) }), diff --git a/compiler/rustc_query_impl/src/execution.rs b/compiler/rustc_query_impl/src/execution.rs index 80bdc5626ec80..1f064599332c1 100644 --- a/compiler/rustc_query_impl/src/execution.rs +++ b/compiler/rustc_query_impl/src/execution.rs @@ -509,7 +509,7 @@ fn try_load_from_disk_and_cache_in_memory<'tcx, C: QueryCache, const FLAGS: Quer dep_graph_data.mark_debug_loaded_from_disk(*dep_node) } - let prev_fingerprint = dep_graph_data.prev_fingerprint_of(prev_dep_node_index); + let prev_fingerprint = dep_graph_data.prev_value_fingerprint_of(prev_dep_node_index); // If `-Zincremental-verify-ich` is specified, re-hash results from // the cache and make sure that they have the expected fingerprint. // @@ -538,7 +538,7 @@ fn try_load_from_disk_and_cache_in_memory<'tcx, C: QueryCache, const FLAGS: Quer // can be forced from `DepNode`. debug_assert!( !query.will_cache_on_disk_for_key(tcx, key) - || !tcx.fingerprint_style(dep_node.kind).reconstructible(), + || !tcx.key_fingerprint_style(dep_node.kind).reconstructible(), "missing on-disk cache entry for {dep_node:?}" ); diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index 00f6a7fcf9167..5981e7e0f5269 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -396,8 +396,11 @@ pub(crate) fn try_load_from_on_disk_cache_inner<'tcx, C: QueryCache, const FLAGS ) { debug_assert!(tcx.dep_graph.is_green(&dep_node)); - let key = C::Key::recover(tcx, &dep_node).unwrap_or_else(|| { - panic!("Failed to recover key for {:?} with hash {}", dep_node, dep_node.hash) + let key = C::Key::try_recover_key(tcx, &dep_node).unwrap_or_else(|| { + panic!( + "Failed to recover key for {dep_node:?} with key fingerprint {}", + dep_node.key_fingerprint + ) }); if query.will_cache_on_disk_for_key(tcx, &key) { // Call `tcx.$query(key)` for its side-effect of loading the disk-cached @@ -462,7 +465,7 @@ pub(crate) fn force_from_dep_node_inner<'tcx, C: QueryCache, const FLAGS: QueryF "calling force_from_dep_node() on dep_kinds::codegen_unit" ); - if let Some(key) = C::Key::recover(tcx, &dep_node) { + if let Some(key) = C::Key::try_recover_key(tcx, &dep_node) { force_query(query, tcx, key, dep_node); true } else { diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs index f0dffd8829da3..d050ec01e0425 100644 --- a/compiler/rustc_resolve/src/build_reduced_graph.rs +++ b/compiler/rustc_resolve/src/build_reduced_graph.rs @@ -469,9 +469,15 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> { PathResult::NonModule(partial_res) => { expected_found_error(partial_res.expect_full_res()) } - PathResult::Failed { span, label, suggestion, .. } => { - Err(VisResolutionError::FailedToResolve(span, label, suggestion)) - } + PathResult::Failed { + span, label, suggestion, message, segment_name, .. + } => Err(VisResolutionError::FailedToResolve( + span, + segment_name, + label, + suggestion, + message, + )), PathResult::Indeterminate => Err(VisResolutionError::Indeterminate(path.span)), } } diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index ac6188c2c1523..dabb019ffdb87 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -32,7 +32,7 @@ use rustc_span::edit_distance::find_best_match_for_name; use rustc_span::edition::Edition; use rustc_span::hygiene::MacroKind; use rustc_span::source_map::{SourceMap, Spanned}; -use rustc_span::{BytePos, Ident, Span, Symbol, SyntaxContext, kw, sym}; +use rustc_span::{BytePos, Ident, RemapPathScopeComponents, Span, Symbol, SyntaxContext, kw, sym}; use thin_vec::{ThinVec, thin_vec}; use tracing::{debug, instrument}; @@ -899,9 +899,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ResolutionError::SelfImportOnlyInImportListWithNonEmptyPrefix => { self.dcx().create_err(errs::SelfImportOnlyInImportListWithNonEmptyPrefix { span }) } - ResolutionError::FailedToResolve { segment, label, suggestion, module } => { - let mut err = - struct_span_code_err!(self.dcx(), span, E0433, "failed to resolve: {label}"); + ResolutionError::FailedToResolve { segment, label, suggestion, module, message } => { + let mut err = struct_span_code_err!(self.dcx(), span, E0433, "{message}"); err.span_label(span, label); if let Some((suggestions, msg, applicability)) = suggestion { @@ -909,16 +908,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { err.help(msg); return err; } - err.multipart_suggestion(msg, suggestions, applicability); + err.multipart_suggestion_verbose(msg, suggestions, applicability); } - if let Some(segment) = segment { - let module = match module { - Some(ModuleOrUniformRoot::Module(m)) if let Some(id) = m.opt_def_id() => id, - _ => CRATE_DEF_ID.to_def_id(), - }; - self.find_cfg_stripped(&mut err, &segment, module); - } + let module = match module { + Some(ModuleOrUniformRoot::Module(m)) if let Some(id) = m.opt_def_id() => id, + _ => CRATE_DEF_ID.to_def_id(), + }; + self.find_cfg_stripped(&mut err, &segment, module); err } @@ -1108,10 +1105,17 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { VisResolutionError::AncestorOnly(span) => { self.dcx().create_err(errs::AncestorOnly(span)) } - VisResolutionError::FailedToResolve(span, label, suggestion) => self.into_struct_error( - span, - ResolutionError::FailedToResolve { segment: None, label, suggestion, module: None }, - ), + VisResolutionError::FailedToResolve(span, segment, label, suggestion, message) => self + .into_struct_error( + span, + ResolutionError::FailedToResolve { + segment, + label, + suggestion, + module: None, + message, + }, + ), VisResolutionError::ExpectedFound(span, path_str, res) => { self.dcx().create_err(errs::ExpectedModuleFound { span, res, path_str }) } @@ -2438,13 +2442,25 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { failed_segment_idx: usize, ident: Ident, diag_metadata: Option<&DiagMetadata<'_>>, - ) -> (String, Option) { + ) -> (String, String, Option) { let is_last = failed_segment_idx == path.len() - 1; let ns = if is_last { opt_ns.unwrap_or(TypeNS) } else { TypeNS }; let module_res = match module { Some(ModuleOrUniformRoot::Module(module)) => module.res(), _ => None, }; + let scope = match &path[..failed_segment_idx] { + [.., prev] => { + if prev.ident.name == kw::PathRoot { + format!("the crate root") + } else { + format!("`{}`", prev.ident) + } + } + _ => format!("this scope"), + }; + let message = format!("cannot find `{ident}` in {scope}"); + if module_res == self.graph_root.res() { let is_mod = |res| matches!(res, Res::Def(DefKind::Mod, _)); let mut candidates = self.lookup_import_candidates(ident, TypeNS, parent_scope, is_mod); @@ -2462,6 +2478,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { Path { segments, span: Span::default(), tokens: None } }; ( + message, String::from("unresolved import"), Some(( vec![(ident.span, pprust::path_to_string(&path))], @@ -2471,6 +2488,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ) } else if ident.name == sym::core { ( + message, format!("you might be missing crate `{ident}`"), Some(( vec![(ident.span, "std".to_string())], @@ -2479,9 +2497,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { )), ) } else if ident.name == kw::Underscore { - (format!("`_` is not a valid crate or module name"), None) + ( + "invalid crate or module name `_`".to_string(), + "`_` is not a valid crate or module name".to_string(), + None, + ) } else if self.tcx.sess.is_rust_2015() { ( + format!("cannot find module or crate `{ident}` in {scope}"), format!("use of unresolved module or unlinked crate `{ident}`"), Some(( vec![( @@ -2490,8 +2513,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { )], if was_invoked_from_cargo() { format!( - "if you wanted to use a crate named `{ident}`, use `cargo add {ident}` \ - to add it to your `Cargo.toml` and import it in your code", + "if you wanted to use a crate named `{ident}`, use `cargo add \ + {ident}` to add it to your `Cargo.toml` and import it in your \ + code", ) } else { format!( @@ -2503,7 +2527,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { )), ) } else { - (format!("could not find `{ident}` in the crate root"), None) + (message, format!("could not find `{ident}` in the crate root"), None) } } else if failed_segment_idx > 0 { let parent = path[failed_segment_idx - 1].ident.name; @@ -2569,15 +2593,16 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ); }; } - (msg, None) + (message, msg, None) } else if ident.name == kw::SelfUpper { // As mentioned above, `opt_ns` being `None` indicates a module path in import. // We can use this to improve a confusing error for, e.g. `use Self::Variant` in an // impl if opt_ns.is_none() { - ("`Self` cannot be used in imports".to_string(), None) + (message, "`Self` cannot be used in imports".to_string(), None) } else { ( + message, "`Self` is only available in impls, traits, and type definitions".to_string(), None, ) @@ -2608,12 +2633,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // } // ``` Some(LateDecl::RibDef(Res::Local(id))) => { - Some(*self.pat_span_map.get(&id).unwrap()) + Some((*self.pat_span_map.get(&id).unwrap(), "a", "local binding")) } // Name matches item from a local name binding // created by `use` declaration. For example: // ``` - // pub Foo: &str = ""; + // pub const Foo: &str = ""; // // mod submod { // use super::Foo; @@ -2621,18 +2646,27 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // // binding `Foo`. // } // ``` - Some(LateDecl::Decl(name_binding)) => Some(name_binding.span), + Some(LateDecl::Decl(name_binding)) => Some(( + name_binding.span, + name_binding.res().article(), + name_binding.res().descr(), + )), _ => None, }; - let suggestion = match_span.map(|span| { - ( - vec![(span, String::from(""))], - format!("`{ident}` is defined here, but is not a type"), - Applicability::MaybeIncorrect, - ) - }); - (format!("use of undeclared type `{ident}`"), suggestion) + let message = format!("cannot find type `{ident}` in {scope}"); + let label = if let Some((span, article, descr)) = match_span { + format!( + "`{ident}` is declared as {article} {descr} at `{}`, not a type", + self.tcx + .sess + .source_map() + .span_to_short_string(span, RemapPathScopeComponents::DIAGNOSTICS) + ) + } else { + format!("use of undeclared type `{ident}`") + }; + (message, label, None) } else { let mut suggestion = None; if ident.name == sym::alloc { @@ -2663,7 +2697,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ignore_import, ) { let descr = binding.res().descr(); - (format!("{descr} `{ident}` is not a crate or module"), suggestion) + let message = format!("cannot find module or crate `{ident}` in {scope}"); + (message, format!("{descr} `{ident}` is not a crate or module"), suggestion) } else { let suggestion = if suggestion.is_some() { suggestion @@ -2685,7 +2720,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { Applicability::MaybeIncorrect, )) }; - (format!("use of unresolved module or unlinked crate `{ident}`"), suggestion) + let message = format!("cannot find module or crate `{ident}` in {scope}"); + ( + message, + format!("use of unresolved module or unlinked crate `{ident}`"), + suggestion, + ) } } } diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs index d4d373d820644..5d413bc6daab2 100644 --- a/compiler/rustc_resolve/src/ident.rs +++ b/compiler/rustc_resolve/src/ident.rs @@ -1775,7 +1775,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { finalize.is_some(), module_had_parse_errors, module, - || ("there are too many leading `super` keywords".to_string(), None), + || { + ( + "too many leading `super` keywords".to_string(), + "there are too many leading `super` keywords".to_string(), + None, + ) + }, ); } if segment_idx == 0 { @@ -1823,16 +1829,24 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { module, || { let name_str = if name == kw::PathRoot { - "crate root".to_string() + "the crate root".to_string() } else { format!("`{name}`") }; - let label = if segment_idx == 1 && path[0].ident.name == kw::PathRoot { - format!("global paths cannot start with {name_str}") + let (message, label) = if segment_idx == 1 + && path[0].ident.name == kw::PathRoot + { + ( + format!("global paths cannot start with {name_str}"), + "cannot start with this".to_string(), + ) } else { - format!("{name_str} in paths can only be used in start position") + ( + format!("{name_str} in paths can only be used in start position"), + "can only be used in path start position".to_string(), + ) }; - (label, None) + (message, label, None) }, ); } @@ -1948,7 +1962,20 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { res.article(), res.descr() ); - (label, None) + let scope = match &path[..segment_idx] { + [.., prev] => { + if prev.ident.name == kw::PathRoot { + format!("the crate root") + } else { + format!("`{}`", prev.ident) + } + } + _ => format!("this scope"), + }; + // FIXME: reword, as the reason we expected a module is because of + // the following path segment. + let message = format!("cannot find module `{ident}` in {scope}"); + (message, label, None) }, ); } diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 4e7622d08462e..d9f9d1ff5a479 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -371,6 +371,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // - A glob decl is overwritten by its clone after setting ambiguity in it. // FIXME: avoid this by removing `warn_ambiguity`, or by triggering glob re-fetch // with the same decl in some way. + // - A glob decl is overwritten by a glob decl with larger visibility. + // FIXME: avoid this by updating this visibility in place. // - A glob decl is overwritten by a glob decl re-fetching an // overwritten decl from other module (the recursive case). // Here we are detecting all such re-fetches and overwrite old decls @@ -384,7 +386,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // FIXME: reenable the asserts when `warn_ambiguity` is removed (#149195). // assert_ne!(old_deep_decl, deep_decl); // assert!(old_deep_decl.is_glob_import()); - assert!(!deep_decl.is_glob_import()); + // FIXME: reenable the assert when visibility is updated in place. + // assert!(!deep_decl.is_glob_import()); if old_glob_decl.ambiguity.get().is_some() && glob_decl.ambiguity.get().is_none() { // Do not lose glob ambiguities when re-fetching the glob. glob_decl.ambiguity.set_unchecked(old_glob_decl.ambiguity.get()); @@ -1042,16 +1045,18 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { suggestion, module, error_implied_by_parse_error: _, + message, } => { if no_ambiguity { assert!(import.imported_module.get().is_none()); self.report_error( span, ResolutionError::FailedToResolve { - segment: Some(segment_name), + segment: segment_name, label, suggestion, module, + message, }, ); } diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 0b92792611a11..13a4166e00c1b 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -4890,14 +4890,16 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { module, segment_name, error_implied_by_parse_error: _, + message, } => { return Err(respan( span, ResolutionError::FailedToResolve { - segment: Some(segment_name), + segment: segment_name, label, suggestion, module, + message, }, )); } diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 94f8444db142d..5a6982b8c29d5 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -4060,25 +4060,32 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { "instead, you are more likely to want" }; let mut owned_sugg = lt.kind == MissingLifetimeKind::Ampersand; + let mut sugg_is_str_to_string = false; let mut sugg = vec![(lt.span, String::new())]; if let Some((kind, _span)) = self.diag_metadata.current_function && let FnKind::Fn(_, _, ast::Fn { sig, .. }) = kind - && let ast::FnRetTy::Ty(ty) = &sig.decl.output { let mut lt_finder = LifetimeFinder { lifetime: lt.span, found: None, seen: vec![] }; - lt_finder.visit_ty(&ty); - - if let [Ty { span, kind: TyKind::Ref(_, mut_ty), .. }] = - <_finder.seen[..] - { - // We might have a situation like - // fn g(mut x: impl Iterator) -> Option<&'_ ()> - // but `lt.span` only points at `'_`, so to suggest `-> Option<()>` - // we need to find a more accurate span to end up with - // fn g<'a>(mut x: impl Iterator) -> Option<()> - sugg = vec![(span.with_hi(mut_ty.ty.span.lo()), String::new())]; - owned_sugg = true; + for param in &sig.decl.inputs { + lt_finder.visit_ty(¶m.ty); + } + if let ast::FnRetTy::Ty(ret_ty) = &sig.decl.output { + lt_finder.visit_ty(ret_ty); + let mut ret_lt_finder = + LifetimeFinder { lifetime: lt.span, found: None, seen: vec![] }; + ret_lt_finder.visit_ty(ret_ty); + if let [Ty { span, kind: TyKind::Ref(_, mut_ty), .. }] = + &ret_lt_finder.seen[..] + { + // We might have a situation like + // fn g(mut x: impl Iterator) -> Option<&'_ ()> + // but `lt.span` only points at `'_`, so to suggest `-> Option<()>` + // we need to find a more accurate span to end up with + // fn g<'a>(mut x: impl Iterator) -> Option<()> + sugg = vec![(span.with_hi(mut_ty.ty.span.lo()), String::new())]; + owned_sugg = true; + } } if let Some(ty) = lt_finder.found { if let TyKind::Path(None, path) = &ty.kind { @@ -4098,6 +4105,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { lt.span.with_hi(ty.span.hi()), "String".to_string(), )]; + sugg_is_str_to_string = true; } Some(Res::PrimTy(..)) => {} Some(Res::Def( @@ -4124,6 +4132,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { lt.span.with_hi(ty.span.hi()), "String".to_string(), )]; + sugg_is_str_to_string = true; } Res::PrimTy(..) => {} Res::Def( @@ -4158,6 +4167,12 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { } } if owned_sugg { + if let Some(span) = + self.find_ref_prefix_span_for_owned_suggestion(lt.span) + && !sugg_is_str_to_string + { + sugg = vec![(span, String::new())]; + } err.multipart_suggestion_verbose( format!("{pre} to return an owned value"), sugg, @@ -4184,6 +4199,23 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { } } } + + fn find_ref_prefix_span_for_owned_suggestion(&self, lifetime: Span) -> Option { + let mut finder = RefPrefixSpanFinder { lifetime, span: None }; + if let Some(item) = self.diag_metadata.current_item { + finder.visit_item(item); + } else if let Some((kind, _span)) = self.diag_metadata.current_function + && let FnKind::Fn(_, _, ast::Fn { sig, .. }) = kind + { + for param in &sig.decl.inputs { + finder.visit_ty(¶m.ty); + } + if let ast::FnRetTy::Ty(ret_ty) = &sig.decl.output { + finder.visit_ty(ret_ty); + } + } + finder.span + } } fn mk_where_bound_predicate( @@ -4285,6 +4317,26 @@ impl<'ast> Visitor<'ast> for LifetimeFinder<'ast> { } } +struct RefPrefixSpanFinder { + lifetime: Span, + span: Option, +} + +impl<'ast> Visitor<'ast> for RefPrefixSpanFinder { + fn visit_ty(&mut self, t: &'ast Ty) { + if self.span.is_some() { + return; + } + if let TyKind::Ref(_, mut_ty) | TyKind::PinnedRef(_, mut_ty) = &t.kind + && t.span.lo() == self.lifetime.lo() + { + self.span = Some(t.span.with_hi(mut_ty.ty.span.lo())); + return; + } + walk_ty(self, t); + } +} + /// Shadowing involving a label is only a warning for historical reasons. //FIXME: make this a proper lint. pub(super) fn signal_label_shadowing(sess: &Session, orig: Span, shadower: Ident) { diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index ff1c30458a987..b0271c2737c0f 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -280,10 +280,11 @@ enum ResolutionError<'ra> { SelfImportOnlyInImportListWithNonEmptyPrefix, /// Error E0433: failed to resolve. FailedToResolve { - segment: Option, + segment: Symbol, label: String, suggestion: Option, module: Option>, + message: String, }, /// Error E0434: can't capture dynamic environment in a fn item. CannotCaptureDynamicEnvironmentInFnItem, @@ -342,7 +343,7 @@ enum ResolutionError<'ra> { enum VisResolutionError<'a> { Relative2018(Span, &'a ast::Path), AncestorOnly(Span), - FailedToResolve(Span, String, Option), + FailedToResolve(Span, Symbol, String, Option, String), ExpectedFound(Span, String, Res), Indeterminate(Span), ModuleOnly(Span), @@ -486,6 +487,7 @@ enum PathResult<'ra> { /// The segment name of target segment_name: Symbol, error_implied_by_parse_error: bool, + message: String, }, } @@ -496,10 +498,14 @@ impl<'ra> PathResult<'ra> { finalize: bool, error_implied_by_parse_error: bool, module: Option>, - label_and_suggestion: impl FnOnce() -> (String, Option), + label_and_suggestion: impl FnOnce() -> (String, String, Option), ) -> PathResult<'ra> { - let (label, suggestion) = - if finalize { label_and_suggestion() } else { (String::new(), None) }; + let (message, label, suggestion) = if finalize { + label_and_suggestion() + } else { + // FIXME: this output isn't actually present in the test suite. + (format!("cannot find `{ident}` in this scope"), String::new(), None) + }; PathResult::Failed { span: ident.span, segment_name: ident.name, @@ -508,6 +514,7 @@ impl<'ra> PathResult<'ra> { is_error_from_last_segment, module, error_implied_by_parse_error, + message, } } } diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs index e0973271da52d..99cd485241546 100644 --- a/compiler/rustc_resolve/src/macros.rs +++ b/compiler/rustc_resolve/src/macros.rs @@ -908,10 +908,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ), path_res @ (PathResult::NonModule(..) | PathResult::Failed { .. }) => { let mut suggestion = None; - let (span, label, module, segment) = - if let PathResult::Failed { span, label, module, segment_name, .. } = - path_res - { + let (span, message, label, module, segment) = match path_res { + PathResult::Failed { + span, label, module, segment_name, message, .. + } => { // try to suggest if it's not a macro, maybe a function if let PathResult::NonModule(partial_res) = self .cm() @@ -930,26 +930,52 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { Applicability::MaybeIncorrect, )); } - (span, label, module, segment_name) - } else { + (span, message, label, module, segment_name) + } + PathResult::NonModule(partial_res) => { + let found_an = partial_res.base_res().article(); + let found_descr = partial_res.base_res().descr(); + let scope = match &path[..partial_res.unresolved_segments()] { + [.., prev] => { + format!("{found_descr} `{}`", prev.ident) + } + _ => found_descr.to_string(), + }; + let expected_an = kind.article(); + let expected_descr = kind.descr(); + let expected_name = path[partial_res.unresolved_segments()].ident; + ( path_span, format!( - "partially resolved path in {} {}", - kind.article(), - kind.descr() + "cannot find {expected_descr} `{expected_name}` in {scope}" ), + match partial_res.base_res() { + Res::Def( + DefKind::Mod | DefKind::Macro(..) | DefKind::ExternCrate, + _, + ) => format!( + "partially resolved path in {expected_an} {expected_descr}", + ), + _ => format!( + "{expected_an} {expected_descr} can't exist within \ + {found_an} {found_descr}" + ), + }, None, path.last().map(|segment| segment.ident.name).unwrap(), ) - }; + } + _ => unreachable!(), + }; self.report_error( span, ResolutionError::FailedToResolve { - segment: Some(segment), + segment, label, suggestion, module, + message, }, ); } diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 9219b5a7e8aca..69f9ad9aa3613 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -2481,6 +2481,9 @@ options! { mir_include_spans: MirIncludeSpans = (MirIncludeSpans::default(), parse_mir_include_spans, [UNTRACKED], "include extra comments in mir pretty printing, like line numbers and statement indices, \ details about types, etc. (boolean for all passes, 'nll' to enable in NLL MIR only, default: 'nll')"), + mir_opt_bisect_limit: Option = (None, parse_opt_number, [TRACKED], + "limit the number of MIR optimization pass executions (global across all bodies). \ + Pass executions after this limit are skipped and reported. (default: no limit)"), #[rustc_lint_opt_deny_field_access("use `Session::mir_opt_level` instead of this field")] mir_opt_level: Option = (None, parse_opt_number, [TRACKED], "MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)"), diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index bb22e4a8db047..427f3e7fa5089 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -2,7 +2,7 @@ use std::any::Any; use std::path::PathBuf; use std::str::FromStr; use std::sync::Arc; -use std::sync::atomic::AtomicBool; +use std::sync::atomic::{AtomicBool, AtomicUsize}; use std::{env, io}; use rand::{RngCore, rng}; @@ -161,6 +161,12 @@ pub struct Session { /// Does the codegen backend support ThinLTO? pub thin_lto_supported: bool, + + /// Global per-session counter for MIR optimization pass applications. + /// + /// Used by `-Zmir-opt-bisect-limit` to assign an index to each + /// optimization-pass execution candidate during this compilation. + pub mir_opt_bisect_eval_count: AtomicUsize, } #[derive(Clone, Copy)] @@ -1101,6 +1107,7 @@ pub fn build_session( invocation_temp, replaced_intrinsics: FxHashSet::default(), // filled by `run_compiler` thin_lto_supported: true, // filled by `run_compiler` + mir_opt_bisect_eval_count: AtomicUsize::new(0), }; validate_commandline_args_with_session_available(&sess); diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 5623b984b2420..1d38b41c25dfb 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -327,7 +327,6 @@ symbols! { Pointer, Poll, ProcMacro, - ProceduralMasqueradeDummyType, Range, RangeBounds, RangeCopy, diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs index 6003461f35e8b..fdb2e7d838d52 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs @@ -300,6 +300,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { let rebased_args = alias.args.rebase_onto(tcx, trait_def_id, impl_substs); let impl_item_def_id = leaf_def.item.def_id; + if !tcx.check_args_compatible(impl_item_def_id, rebased_args) { + return false; + } let impl_assoc_ty = tcx.type_of(impl_item_def_id).instantiate(tcx, rebased_args); self.infcx.can_eq(param_env, impl_assoc_ty, concrete) diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs index 5a8dd0364bee3..7e6f566e242a3 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs @@ -11,7 +11,7 @@ use rustc_middle::traits::ObligationCauseCode; use rustc_middle::ty::error::ExpectedFound; use rustc_middle::ty::print::RegionHighlightMode; use rustc_middle::ty::{self, TyCtxt, TypeVisitable}; -use rustc_span::Span; +use rustc_span::{Ident, Span}; use tracing::debug; use crate::error_reporting::infer::nice_region_error::NiceRegionError; @@ -99,7 +99,8 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { // Get the span of all the used type parameters in the method. let assoc_item = self.tcx().associated_item(trait_item_def_id); - let mut visitor = TypeParamSpanVisitor { tcx: self.tcx(), types: vec![] }; + let mut visitor = + TypeParamSpanVisitor { tcx: self.tcx(), types: vec![], elided_lifetime_paths: vec![] }; match assoc_item.kind { ty::AssocKind::Fn { .. } => { if let Some(hir_id) = @@ -122,13 +123,49 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { found, }; - self.tcx().dcx().emit_err(diag) + let mut diag = self.tcx().dcx().create_err(diag); + // A limit not to make diag verbose. + const ELIDED_LIFETIME_NOTE_LIMIT: usize = 5; + let elided_lifetime_paths = visitor.elided_lifetime_paths; + let total_elided_lifetime_paths = elided_lifetime_paths.len(); + let shown_elided_lifetime_paths = if tcx.sess.opts.verbose { + total_elided_lifetime_paths + } else { + ELIDED_LIFETIME_NOTE_LIMIT + }; + + for elided in elided_lifetime_paths.into_iter().take(shown_elided_lifetime_paths) { + diag.span_note( + elided.span, + format!("`{}` here is elided as `{}`", elided.ident, elided.shorthand), + ); + } + if total_elided_lifetime_paths > shown_elided_lifetime_paths { + diag.note(format!( + "and {} more elided lifetime{} in type paths", + total_elided_lifetime_paths - shown_elided_lifetime_paths, + if total_elided_lifetime_paths - shown_elided_lifetime_paths == 1 { + "" + } else { + "s" + }, + )); + } + diag.emit() } } +#[derive(Clone)] +struct ElidedLifetimeInPath { + span: Span, + ident: Ident, + shorthand: String, +} + struct TypeParamSpanVisitor<'tcx> { tcx: TyCtxt<'tcx>, types: Vec, + elided_lifetime_paths: Vec, } impl<'tcx> Visitor<'tcx> for TypeParamSpanVisitor<'tcx> { @@ -138,6 +175,83 @@ impl<'tcx> Visitor<'tcx> for TypeParamSpanVisitor<'tcx> { self.tcx } + fn visit_qpath(&mut self, qpath: &'tcx hir::QPath<'tcx>, id: hir::HirId, _span: Span) { + fn record_elided_lifetimes( + tcx: TyCtxt<'_>, + elided_lifetime_paths: &mut Vec, + segment: &hir::PathSegment<'_>, + ) { + let Some(args) = segment.args else { return }; + if args.parenthesized != hir::GenericArgsParentheses::No { + // Our diagnostic rendering below uses `<...>` syntax; skip cases like `Fn(..) -> ..`. + return; + } + let elided_count = args + .args + .iter() + .filter(|arg| { + let hir::GenericArg::Lifetime(l) = arg else { return false }; + l.syntax == hir::LifetimeSyntax::Implicit + && matches!(l.source, hir::LifetimeSource::Path { .. }) + }) + .count(); + if elided_count == 0 + || elided_lifetime_paths.iter().any(|p| p.span == segment.ident.span) + { + return; + } + + let sm = tcx.sess.source_map(); + let mut parts = args + .args + .iter() + .map(|arg| match arg { + hir::GenericArg::Lifetime(l) => { + if l.syntax == hir::LifetimeSyntax::Implicit + && matches!(l.source, hir::LifetimeSource::Path { .. }) + { + "'_".to_string() + } else { + sm.span_to_snippet(l.ident.span) + .unwrap_or_else(|_| format!("'{}", l.ident.name)) + } + } + hir::GenericArg::Type(ty) => { + sm.span_to_snippet(ty.span).unwrap_or_else(|_| "..".to_string()) + } + hir::GenericArg::Const(ct) => { + sm.span_to_snippet(ct.span).unwrap_or_else(|_| "..".to_string()) + } + hir::GenericArg::Infer(_) => "_".to_string(), + }) + .collect::>(); + parts.extend(args.constraints.iter().map(|constraint| { + sm.span_to_snippet(constraint.span) + .unwrap_or_else(|_| format!("{} = ..", constraint.ident)) + })); + let shorthand = format!("{}<{}>", segment.ident, parts.join(", ")); + + elided_lifetime_paths.push(ElidedLifetimeInPath { + span: segment.ident.span, + ident: segment.ident, + shorthand, + }); + } + + match qpath { + hir::QPath::Resolved(_, path) => { + for segment in path.segments { + record_elided_lifetimes(self.tcx, &mut self.elided_lifetime_paths, segment); + } + } + hir::QPath::TypeRelative(_, segment) => { + record_elided_lifetimes(self.tcx, &mut self.elided_lifetime_paths, segment); + } + } + + hir::intravisit::walk_qpath(self, qpath, id); + } + fn visit_ty(&mut self, arg: &'tcx hir::Ty<'tcx, AmbigArg>) { match arg.kind { hir::TyKind::Ref(_, ref mut_ty) => { diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 04ca6403fe833..73e93657b02f7 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -182,7 +182,6 @@ #![feature(negative_impls)] #![feature(never_type)] #![feature(optimize_attribute)] -#![feature(rustc_allow_const_fn_unstable)] #![feature(rustc_attrs)] #![feature(slice_internals)] #![feature(staged_api)] diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index d650239a44c60..7158fda49a8d2 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -159,7 +159,6 @@ #![feature(pattern_types)] #![feature(prelude_import)] #![feature(repr_simd)] -#![feature(rustc_allow_const_fn_unstable)] #![feature(rustc_attrs)] #![feature(rustdoc_internals)] #![feature(simd_ffi)] diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index b21865a9ae546..d1d5790c694de 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -2481,7 +2481,8 @@ macro_rules! int_impl { /// /// Returns a tuple of the addition along with a boolean indicating /// whether an arithmetic overflow would occur. If an overflow would have - /// occurred then the wrapped value is returned. + /// occurred then the wrapped value is returned (negative if overflowed + /// above [`MAX`](Self::MAX), non-negative if below [`MIN`](Self::MIN)). /// /// # Examples /// @@ -2516,6 +2517,9 @@ macro_rules! int_impl { /// The output boolean returned by this method is *not* a carry flag, /// and should *not* be added to a more significant word. /// + /// If overflow occurred, the wrapped value is returned (negative if overflowed + /// above [`MAX`](Self::MAX), non-negative if below [`MIN`](Self::MIN)). + /// /// If the input carry is false, this method is equivalent to /// [`overflowing_add`](Self::overflowing_add). /// @@ -2583,7 +2587,8 @@ macro_rules! int_impl { /// Calculates `self` - `rhs`. /// /// Returns a tuple of the subtraction along with a boolean indicating whether an arithmetic overflow - /// would occur. If an overflow would have occurred then the wrapped value is returned. + /// would occur. If an overflow would have occurred then the wrapped value is returned + /// (negative if overflowed above [`MAX`](Self::MAX), non-negative if below [`MIN`](Self::MIN)). /// /// # Examples /// @@ -2619,6 +2624,9 @@ macro_rules! int_impl { /// The output boolean returned by this method is *not* a borrow flag, /// and should *not* be subtracted from a more significant word. /// + /// If overflow occurred, the wrapped value is returned (negative if overflowed + /// above [`MAX`](Self::MAX), non-negative if below [`MIN`](Self::MIN)). + /// /// If the input borrow is false, this method is equivalent to /// [`overflowing_sub`](Self::overflowing_sub). /// diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index cf79635dcd877..94396752ac6da 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -487,8 +487,8 @@ macro_rules! uint_impl { /// Performs a carry-less multiplication, returning the lower bits. /// - /// This operation is similar to long multiplication, except that exclusive or is used - /// instead of addition. The implementation is equivalent to: + /// This operation is similar to long multiplication in base 2, except that exclusive or is + /// used instead of addition. The implementation is equivalent to: /// /// ```no_run #[doc = concat!("pub fn carryless_mul(lhs: ", stringify!($SelfT), ", rhs: ", stringify!($SelfT), ") -> ", stringify!($SelfT), "{")] diff --git a/library/std/src/sys/args/unix.rs b/library/std/src/sys/args/unix.rs index 0dfbd5f03eba9..7a592c2b079dd 100644 --- a/library/std/src/sys/args/unix.rs +++ b/library/std/src/sys/args/unix.rs @@ -164,7 +164,7 @@ mod imp { // of this used `[[NSProcessInfo processInfo] arguments]`. #[cfg(target_vendor = "apple")] mod imp { - use crate::ffi::{c_char, c_int}; + use crate::ffi::c_char; pub unsafe fn init(_argc: isize, _argv: *const *const u8) { // No need to initialize anything in here, `libdyld.dylib` has already @@ -172,12 +172,6 @@ mod imp { } pub fn argc_argv() -> (isize, *const *const c_char) { - unsafe extern "C" { - // These functions are in crt_externs.h. - fn _NSGetArgc() -> *mut c_int; - fn _NSGetArgv() -> *mut *mut *mut c_char; - } - // SAFETY: The returned pointer points to a static initialized early // in the program lifetime by `libdyld.dylib`, and as such is always // valid. @@ -187,9 +181,9 @@ mod imp { // doesn't exist a lock that we can take. Instead, it is generally // expected that it's only modified in `main` / before other code // runs, so reading this here should be fine. - let argc = unsafe { _NSGetArgc().read() }; + let argc = unsafe { libc::_NSGetArgc().read() }; // SAFETY: Same as above. - let argv = unsafe { _NSGetArgv().read() }; + let argv = unsafe { libc::_NSGetArgv().read() }; // Cast from `*mut *mut c_char` to `*const *const c_char` (argc as isize, argv.cast()) diff --git a/src/doc/rustc/src/lints/levels.md b/src/doc/rustc/src/lints/levels.md index 09b55da741d6c..5b23ac9e09c1b 100644 --- a/src/doc/rustc/src/lints/levels.md +++ b/src/doc/rustc/src/lints/levels.md @@ -393,7 +393,7 @@ Here’s how these different lint controls interact: warning: 1 warning emitted ``` -3. [CLI level flags](#via-compiler-flag) take precedence over attributes. +3. [CLI level flags](#via-compiler-flag) override the default level of a lint. They essentially behave like crate-level attributes. Attributes within the source code take precedence over CLI flags, except for `-F`/`--forbid`, which cannot be overridden. The order of the flags matter; flags on the right take precedence over earlier flags. diff --git a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs index 06220f91c7458..1484b8c8bcc45 100644 --- a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs +++ b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs @@ -194,7 +194,6 @@ fn check_rvalue<'tcx>( )) } }, - Rvalue::ShallowInitBox(_, _) => Ok(()), Rvalue::UnaryOp(_, operand) => { let ty = operand.ty(body, cx.tcx); if ty.is_integral() || ty.is_bool() { diff --git a/src/tools/clippy/tests/ui/crashes/unreachable-array-or-slice.rs b/src/tools/clippy/tests/ui/crashes/unreachable-array-or-slice.rs index bc2e9aa92ce1e..b4f5bdb315f25 100644 --- a/src/tools/clippy/tests/ui/crashes/unreachable-array-or-slice.rs +++ b/src/tools/clippy/tests/ui/crashes/unreachable-array-or-slice.rs @@ -2,7 +2,7 @@ struct Foo(isize, isize, isize, isize); pub fn main() { let Self::anything_here_kills_it(a, b, ..) = Foo(5, 5, 5, 5); - //~^ ERROR: failed to resolve + //~^ ERROR: cannot find `Self` in this scope match [5, 5, 5, 5] { [..] => {}, } diff --git a/src/tools/clippy/tests/ui/crashes/unreachable-array-or-slice.stderr b/src/tools/clippy/tests/ui/crashes/unreachable-array-or-slice.stderr index 9e0d3b934b80f..6d7926ec9ad1b 100644 --- a/src/tools/clippy/tests/ui/crashes/unreachable-array-or-slice.stderr +++ b/src/tools/clippy/tests/ui/crashes/unreachable-array-or-slice.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions +error[E0433]: cannot find `Self` in this scope --> tests/ui/crashes/unreachable-array-or-slice.rs:4:9 | LL | let Self::anything_here_kills_it(a, b, ..) = Foo(5, 5, 5, 5); diff --git a/src/tools/miri/src/concurrency/thread.rs b/src/tools/miri/src/concurrency/thread.rs index 1c404d419ef83..9d829bf69e5eb 100644 --- a/src/tools/miri/src/concurrency/thread.rs +++ b/src/tools/miri/src/concurrency/thread.rs @@ -343,8 +343,8 @@ impl VisitProvenance for Thread<'_> { impl VisitProvenance for Frame<'_, Provenance, FrameExtra<'_>> { fn visit_provenance(&self, visit: &mut VisitWith<'_>) { + let return_place = self.return_place(); let Frame { - return_place, locals, extra, // There are some private fields we cannot access; they contain no tags. diff --git a/src/tools/miri/src/diagnostics.rs b/src/tools/miri/src/diagnostics.rs index 64c7096fc5c2e..71ec9723de8e9 100644 --- a/src/tools/miri/src/diagnostics.rs +++ b/src/tools/miri/src/diagnostics.rs @@ -493,7 +493,7 @@ pub fn report_result<'tcx>( for (i, frame) in ecx.active_thread_stack().iter().enumerate() { trace!("-------------------"); trace!("Frame {}", i); - trace!(" return: {:?}", frame.return_place); + trace!(" return: {:?}", frame.return_place()); for (i, local) in frame.locals.iter().enumerate() { trace!(" local {}: {:?}", i, local); } diff --git a/src/tools/miri/src/machine.rs b/src/tools/miri/src/machine.rs index d50475c748747..7883673cdd6a2 100644 --- a/src/tools/miri/src/machine.rs +++ b/src/tools/miri/src/machine.rs @@ -1235,7 +1235,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> { // to run extra MIR), and Ok(Some(body)) if we found MIR to run for the // foreign function // Any needed call to `goto_block` will be performed by `emulate_foreign_item`. - let args = ecx.copy_fn_args(args); // FIXME: Should `InPlace` arguments be reset to uninit? + let args = MiriInterpCx::copy_fn_args(args); // FIXME: Should `InPlace` arguments be reset to uninit? let link_name = Symbol::intern(ecx.tcx.symbol_name(instance).name); return ecx.emulate_foreign_item(link_name, abi, &args, dest, ret, unwind); } @@ -1262,7 +1262,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> { ret: Option, unwind: mir::UnwindAction, ) -> InterpResult<'tcx> { - let args = ecx.copy_fn_args(args); // FIXME: Should `InPlace` arguments be reset to uninit? + let args = MiriInterpCx::copy_fn_args(args); // FIXME: Should `InPlace` arguments be reset to uninit? ecx.emulate_dyn_sym(fn_val, abi, &args, dest, ret, unwind) } diff --git a/src/tools/miri/tests/fail/rustc-error2.rs b/src/tools/miri/tests/fail/rustc-error2.rs index ec42fd17e8927..07ebe0adfe52d 100644 --- a/src/tools/miri/tests/fail/rustc-error2.rs +++ b/src/tools/miri/tests/fail/rustc-error2.rs @@ -4,7 +4,7 @@ struct Struct(T); impl std::ops::Deref for Struct { type Target = dyn Fn(T); fn deref(&self) -> &assert_mem_uninitialized_valid::Target { - //~^ERROR: use of unresolved module or unlinked crate + //~^ERROR: cannot find module or crate `assert_mem_uninitialized_valid` in this scope unimplemented!() } } diff --git a/src/tools/miri/tests/fail/rustc-error2.stderr b/src/tools/miri/tests/fail/rustc-error2.stderr index 62e3f392ea9df..4d1ad9d4e6ed1 100644 --- a/src/tools/miri/tests/fail/rustc-error2.stderr +++ b/src/tools/miri/tests/fail/rustc-error2.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `assert_mem_uninitialized_valid` +error[E0433]: cannot find module or crate `assert_mem_uninitialized_valid` in this scope --> tests/fail/rustc-error2.rs:LL:CC | LL | fn deref(&self) -> &assert_mem_uninitialized_valid::Target { diff --git a/src/tools/miri/tests/fail/tail_calls/dangling-local-var.stderr b/src/tools/miri/tests/fail/tail_calls/dangling-local-var.stderr index 1577cceae5944..7b0efec7be5a5 100644 --- a/src/tools/miri/tests/fail/tail_calls/dangling-local-var.stderr +++ b/src/tools/miri/tests/fail/tail_calls/dangling-local-var.stderr @@ -14,8 +14,8 @@ LL | let local = 0; help: ALLOC was deallocated here: --> tests/fail/tail_calls/dangling-local-var.rs:LL:CC | -LL | f(std::ptr::null()); - | ^^^^^^^^^^^^^^^^^^^ +LL | let _val = unsafe { *x }; + | ^^^^ = note: stack backtrace: 0: g at tests/fail/tail_calls/dangling-local-var.rs:LL:CC diff --git a/src/tools/miri/tests/fail/validity/recursive-validity-box-bool.rs b/src/tools/miri/tests/fail/validity/recursive-validity-box-bool.rs new file mode 100644 index 0000000000000..dee2c9aad2c7d --- /dev/null +++ b/src/tools/miri/tests/fail/validity/recursive-validity-box-bool.rs @@ -0,0 +1,8 @@ +//@compile-flags: -Zmiri-recursive-validation + +fn main() { + let x = 3u8; + let xref = &x; + let xref_wrong_type: Box = unsafe { std::mem::transmute(xref) }; //~ERROR: encountered 0x03, but expected a boolean + let _val = *xref_wrong_type; +} diff --git a/src/tools/miri/tests/fail/validity/recursive-validity-box-bool.stderr b/src/tools/miri/tests/fail/validity/recursive-validity-box-bool.stderr new file mode 100644 index 0000000000000..d658909efd937 --- /dev/null +++ b/src/tools/miri/tests/fail/validity/recursive-validity-box-bool.stderr @@ -0,0 +1,13 @@ +error: Undefined Behavior: constructing invalid value at .: encountered 0x03, but expected a boolean + --> tests/fail/validity/recursive-validity-box-bool.rs:LL:CC + | +LL | let xref_wrong_type: Box = unsafe { std::mem::transmute(xref) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here + | + = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior + = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information + +note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace + +error: aborting due to 1 previous error + diff --git a/src/tools/miri/tests/pass/tail_call.rs b/src/tools/miri/tests/pass/function_calls/tail_call.rs similarity index 84% rename from src/tools/miri/tests/pass/tail_call.rs rename to src/tools/miri/tests/pass/function_calls/tail_call.rs index f620070639801..f9cf86bb898f4 100644 --- a/src/tools/miri/tests/pass/tail_call.rs +++ b/src/tools/miri/tests/pass/function_calls/tail_call.rs @@ -4,6 +4,7 @@ fn main() { assert_eq!(factorial(10), 3_628_800); assert_eq!(mutually_recursive_identity(1000), 1000); + non_scalar(); } fn factorial(n: u32) -> u32 { @@ -37,3 +38,14 @@ fn mutually_recursive_identity(x: u32) -> u32 { switch(x, 0) } + +fn non_scalar() { + fn f(x: [usize; 2], i: u32) { + if i == 0 { + return; + } + become f(x, i - 1); + } + + f([5, 5], 2); +} diff --git a/tests/codegen-llvm/intrinsics/likely_assert.rs b/tests/codegen-llvm/intrinsics/likely_assert.rs index 59a40c750eab4..e7e2cfdff052d 100644 --- a/tests/codegen-llvm/intrinsics/likely_assert.rs +++ b/tests/codegen-llvm/intrinsics/likely_assert.rs @@ -1,5 +1,5 @@ //@ compile-flags: -Copt-level=3 -#![feature(panic_internals, const_eval_select, rustc_allow_const_fn_unstable, core_intrinsics)] +#![feature(panic_internals, const_eval_select, rustc_attrs, core_intrinsics)] #![crate_type = "lib"] // check that assert! and const_assert! emit branch weights diff --git a/tests/mir-opt/optimize_none.rs b/tests/mir-opt/optimize_none.rs index a5b541bd2b628..99efcc35e5955 100644 --- a/tests/mir-opt/optimize_none.rs +++ b/tests/mir-opt/optimize_none.rs @@ -15,13 +15,14 @@ pub fn add_noopt() -> i32 { #[optimize(none)] pub fn const_branch() -> i32 { // CHECK-LABEL: fn const_branch( - // CHECK: switchInt(const true) -> [0: [[FALSE:bb[0-9]+]], otherwise: [[TRUE:bb[0-9]+]]]; + // CHECK: [[BOOL:_[0-9]+]] = const true; + // CHECK: switchInt(move [[BOOL]]) -> [0: [[BB_FALSE:bb[0-9]+]], otherwise: [[BB_TRUE:bb[0-9]+]]]; // CHECK-NEXT: } - // CHECK: [[FALSE]]: { + // CHECK: [[BB_FALSE]]: { // CHECK-NEXT: _0 = const 0 // CHECK-NEXT: goto // CHECK-NEXT: } - // CHECK: [[TRUE]]: { + // CHECK: [[BB_TRUE]]: { // CHECK-NEXT: _0 = const 1 // CHECK-NEXT: goto // CHECK-NEXT: } diff --git a/tests/run-make/issue-149402-suggest-unresolve/nightly.err b/tests/run-make/issue-149402-suggest-unresolve/nightly.err index 8659f0170df3b..8e122e3da388b 100644 --- a/tests/run-make/issue-149402-suggest-unresolve/nightly.err +++ b/tests/run-make/issue-149402-suggest-unresolve/nightly.err @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of undeclared type `Complete` +error[E0433]: cannot find type `Complete` in this scope --> foo.rs:3:12 | 3 | x.push(Complete::Item { name: "hello" }); diff --git a/tests/run-make/issue-149402-suggest-unresolve/stable.err b/tests/run-make/issue-149402-suggest-unresolve/stable.err index 6e82fe1a67eaf..f980d4548f64c 100644 --- a/tests/run-make/issue-149402-suggest-unresolve/stable.err +++ b/tests/run-make/issue-149402-suggest-unresolve/stable.err @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of undeclared type `Complete` +error[E0433]: cannot find type `Complete` in this scope --> foo.rs:3:12 | 3 | x.push(Complete::Item { name: "hello" }); diff --git a/tests/run-make/mir-opt-bisect-limit/main.rs b/tests/run-make/mir-opt-bisect-limit/main.rs new file mode 100644 index 0000000000000..674275b10fcd5 --- /dev/null +++ b/tests/run-make/mir-opt-bisect-limit/main.rs @@ -0,0 +1,11 @@ +#![crate_type = "lib"] +#![no_std] + +#[inline(never)] +pub fn callee(x: u64) -> u64 { + x.wrapping_mul(3).wrapping_add(7) +} + +pub fn caller(a: u64, b: u64) -> u64 { + callee(a) + callee(b) +} diff --git a/tests/run-make/mir-opt-bisect-limit/rmake.rs b/tests/run-make/mir-opt-bisect-limit/rmake.rs new file mode 100644 index 0000000000000..fa77cb7d8c35c --- /dev/null +++ b/tests/run-make/mir-opt-bisect-limit/rmake.rs @@ -0,0 +1,119 @@ +use std::path::Path; + +use run_make_support::{CompletedProcess, rfs, rustc}; + +struct Case { + name: &'static str, + flags: &'static [&'static str], + expect_inline_dump: bool, + expect_running: ExpectedCount, + expect_not_running: ExpectedCount, +} + +enum ExpectedCount { + Exactly(usize), + AtLeastOne, + Zero, +} + +fn main() { + let cases = [ + Case { + name: "limit0", + flags: &["-Zmir-opt-bisect-limit=0"], + expect_inline_dump: false, + expect_running: ExpectedCount::Exactly(0), + expect_not_running: ExpectedCount::AtLeastOne, + }, + Case { + name: "limit1", + flags: &["-Zmir-opt-bisect-limit=1"], + expect_inline_dump: false, + expect_running: ExpectedCount::Exactly(1), + expect_not_running: ExpectedCount::AtLeastOne, + }, + Case { + name: "huge_limit", + flags: &["-Zmir-opt-bisect-limit=1000000000"], + expect_inline_dump: true, + expect_running: ExpectedCount::AtLeastOne, + expect_not_running: ExpectedCount::Zero, + }, + Case { + name: "limit0_with_force_enable_inline", + flags: &["-Zmir-opt-bisect-limit=0", "-Zmir-enable-passes=+Inline"], + expect_inline_dump: false, + expect_running: ExpectedCount::Exactly(0), + expect_not_running: ExpectedCount::AtLeastOne, + }, + ]; + + for case in cases { + let (inline_dumped, running_count, not_running_count, output) = + compile_case(case.name, case.flags); + + assert_eq!( + inline_dumped, case.expect_inline_dump, + "{}: unexpected Inline dump presence", + case.name + ); + + assert_expected_count( + running_count, + case.expect_running, + &format!("{}: running count", case.name), + ); + assert_expected_count( + not_running_count, + case.expect_not_running, + &format!("{}: NOT running count", case.name), + ); + } +} + +fn compile_case(dump_dir: &str, extra_flags: &[&str]) -> (bool, usize, usize, CompletedProcess) { + if Path::new(dump_dir).exists() { + rfs::remove_dir_all(dump_dir); + } + rfs::create_dir_all(dump_dir); + + let mut cmd = rustc(); + cmd.input("main.rs") + .arg("--emit=mir") + .arg("-Zmir-opt-level=2") + .arg("-Copt-level=2") + .arg("-Zthreads=1") + .arg("-Zdump-mir=Inline") + .arg(format!("-Zdump-mir-dir={dump_dir}")); + + for &flag in extra_flags { + cmd.arg(flag); + } + + let output = cmd.run(); + let (running_count, not_running_count) = bisect_line_counts(&output); + (has_inline_dump_file(dump_dir), running_count, not_running_count, output) +} + +fn assert_expected_count(actual: usize, expected: ExpectedCount, context: &str) { + match expected { + ExpectedCount::Exactly(n) => assert_eq!(actual, n, "{context}"), + ExpectedCount::AtLeastOne => assert!(actual > 0, "{context}"), + ExpectedCount::Zero => assert_eq!(actual, 0, "{context}"), + } +} + +fn has_inline_dump_file(dir: &str) -> bool { + rfs::read_dir(dir) + .flatten() + .any(|entry| entry.file_name().to_string_lossy().contains(".Inline.")) +} + +fn bisect_line_counts(output: &CompletedProcess) -> (usize, usize) { + let stderr = output.stderr_utf8(); + let running_count = + stderr.lines().filter(|line| line.starts_with("BISECT: running pass (")).count(); + let not_running_count = + stderr.lines().filter(|line| line.starts_with("BISECT: NOT running pass (")).count(); + (running_count, not_running_count) +} diff --git a/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.rs b/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.rs index c71e5bee12ead..290b087916c22 100644 --- a/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.rs +++ b/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.rs @@ -1,6 +1,6 @@ // Regression test for issue #95879. -use unresolved_crate::module::Name; //~ ERROR failed to resolve +use unresolved_crate::module::Name; //~ ERROR cannot find /// [Name] pub struct S; diff --git a/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr b/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr index dcdd230c25a1c..cbbf7a7f23e7d 100644 --- a/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr +++ b/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `unresolved_crate` +error[E0433]: cannot find module or crate `unresolved_crate` in the crate root --> $DIR/unresolved-import-recovery.rs:3:5 | LL | use unresolved_crate::module::Name; diff --git a/tests/rustdoc-ui/issues/issue-61732.rs b/tests/rustdoc-ui/issues/issue-61732.rs index d5d9ad5e4637d..b375298ea40e9 100644 --- a/tests/rustdoc-ui/issues/issue-61732.rs +++ b/tests/rustdoc-ui/issues/issue-61732.rs @@ -1,4 +1,4 @@ // This previously triggered an ICE. pub(in crate::r#mod) fn main() {} -//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `r#mod` +//~^ ERROR cannot find module or crate `r#mod` in `crate` diff --git a/tests/rustdoc-ui/issues/issue-61732.stderr b/tests/rustdoc-ui/issues/issue-61732.stderr index c4e6997ab74d4..49d5bfc9a2f05 100644 --- a/tests/rustdoc-ui/issues/issue-61732.stderr +++ b/tests/rustdoc-ui/issues/issue-61732.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `r#mod` +error[E0433]: cannot find module or crate `r#mod` in `crate` --> $DIR/issue-61732.rs:3:15 | LL | pub(in crate::r#mod) fn main() {} diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-inline.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-inline.rs index fa2b6e907a26f..759a9412f7690 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-inline.rs +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-inline.rs @@ -137,7 +137,7 @@ struct MessageWrongType { struct InvalidPathFieldAttr { #[nonsense] //~^ ERROR `#[nonsense]` is not a valid attribute - //~^^ ERROR cannot find attribute `nonsense` in this scope + //~| ERROR cannot find attribute `nonsense` in this scope foo: String, } diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-inline.rs b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-inline.rs index c7636bca80b5b..2aed4fa9465c4 100644 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-inline.rs +++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-inline.rs @@ -90,6 +90,14 @@ struct G { var: String, } +#[derive(Subdiagnostic)] +#[label("...")] +struct H { + #[primary_span] + span: Span, + var: String, +} + #[derive(Subdiagnostic)] #[label(slug = 4)] //~^ ERROR no nested attribute expected here diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-inline.stderr b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-inline.stderr index 90e0c285ee746..8e634bf78797f 100644 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-inline.stderr +++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-inline.stderr @@ -35,109 +35,109 @@ LL | #[label(bug = "...")] | ^ error: derive(Diagnostic): no nested attribute expected here - --> $DIR/subdiagnostic-derive-inline.rs:94:9 + --> $DIR/subdiagnostic-derive-inline.rs:102:9 | LL | #[label(slug = 4)] | ^^^^ error: derive(Diagnostic): diagnostic message must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive-inline.rs:94:1 + --> $DIR/subdiagnostic-derive-inline.rs:102:1 | LL | #[label(slug = 4)] | ^ error: derive(Diagnostic): no nested attribute expected here - --> $DIR/subdiagnostic-derive-inline.rs:104:9 + --> $DIR/subdiagnostic-derive-inline.rs:112:9 | LL | #[label(slug("..."))] | ^^^^ error: derive(Diagnostic): diagnostic message must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive-inline.rs:104:1 + --> $DIR/subdiagnostic-derive-inline.rs:112:1 | LL | #[label(slug("..."))] | ^ error: derive(Diagnostic): diagnostic message must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive-inline.rs:114:1 + --> $DIR/subdiagnostic-derive-inline.rs:122:1 | LL | #[label()] | ^ error: derive(Diagnostic): no nested attribute expected here - --> $DIR/subdiagnostic-derive-inline.rs:123:28 + --> $DIR/subdiagnostic-derive-inline.rs:131:28 | LL | #[label("example message", code = "...")] | ^^^^ error: derive(Diagnostic): no nested attribute expected here - --> $DIR/subdiagnostic-derive-inline.rs:132:28 + --> $DIR/subdiagnostic-derive-inline.rs:140:28 | LL | #[label("example message", applicability = "machine-applicable")] | ^^^^^^^^^^^^^ error: derive(Diagnostic): unsupported type attribute for subdiagnostic enum - --> $DIR/subdiagnostic-derive-inline.rs:141:1 + --> $DIR/subdiagnostic-derive-inline.rs:149:1 | LL | #[foo] | ^ error: derive(Diagnostic): `#[bar]` is not a valid attribute - --> $DIR/subdiagnostic-derive-inline.rs:155:5 + --> $DIR/subdiagnostic-derive-inline.rs:163:5 | LL | #[bar] | ^ error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive-inline.rs:167:5 + --> $DIR/subdiagnostic-derive-inline.rs:175:5 | LL | #[bar = "..."] | ^ error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive-inline.rs:179:5 + --> $DIR/subdiagnostic-derive-inline.rs:187:5 | LL | #[bar = 4] | ^ error: derive(Diagnostic): `#[bar(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive-inline.rs:191:5 + --> $DIR/subdiagnostic-derive-inline.rs:199:5 | LL | #[bar("...")] | ^ error: derive(Diagnostic): no nested attribute expected here - --> $DIR/subdiagnostic-derive-inline.rs:203:13 + --> $DIR/subdiagnostic-derive-inline.rs:211:13 | LL | #[label(code = "...")] | ^^^^ error: derive(Diagnostic): diagnostic message must be first argument of a `#[label(...)]` attribute - --> $DIR/subdiagnostic-derive-inline.rs:203:5 + --> $DIR/subdiagnostic-derive-inline.rs:211:5 | LL | #[label(code = "...")] | ^ error: derive(Diagnostic): the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/subdiagnostic-derive-inline.rs:232:5 + --> $DIR/subdiagnostic-derive-inline.rs:240:5 | LL | #[primary_span] | ^ error: derive(Diagnostic): label without `#[primary_span]` field - --> $DIR/subdiagnostic-derive-inline.rs:229:1 + --> $DIR/subdiagnostic-derive-inline.rs:237:1 | LL | #[label("example message")] | ^ error: derive(Diagnostic): `#[applicability]` is only valid on suggestions - --> $DIR/subdiagnostic-derive-inline.rs:242:5 + --> $DIR/subdiagnostic-derive-inline.rs:250:5 | LL | #[applicability] | ^ error: derive(Diagnostic): `#[bar]` is not a valid attribute - --> $DIR/subdiagnostic-derive-inline.rs:252:5 + --> $DIR/subdiagnostic-derive-inline.rs:260:5 | LL | #[bar] | ^ @@ -145,13 +145,13 @@ LL | #[bar] = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute - --> $DIR/subdiagnostic-derive-inline.rs:263:5 + --> $DIR/subdiagnostic-derive-inline.rs:271:5 | LL | #[bar = "..."] | ^ error: derive(Diagnostic): `#[bar(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive-inline.rs:274:5 + --> $DIR/subdiagnostic-derive-inline.rs:282:5 | LL | #[bar("...")] | ^ @@ -159,7 +159,7 @@ LL | #[bar("...")] = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes error: unexpected unsupported untagged union - --> $DIR/subdiagnostic-derive-inline.rs:290:1 + --> $DIR/subdiagnostic-derive-inline.rs:298:1 | LL | / union AC { LL | | @@ -169,97 +169,97 @@ LL | | } | |_^ error: expected this path to be an identifier - --> $DIR/subdiagnostic-derive-inline.rs:305:28 + --> $DIR/subdiagnostic-derive-inline.rs:313:28 | LL | #[label("example message", no_crate::example)] | ^^^^^^^^^^^^^^^^^ error: derive(Diagnostic): attribute specified multiple times - --> $DIR/subdiagnostic-derive-inline.rs:318:5 + --> $DIR/subdiagnostic-derive-inline.rs:326:5 | LL | #[primary_span] | ^ | note: previously specified here - --> $DIR/subdiagnostic-derive-inline.rs:315:5 + --> $DIR/subdiagnostic-derive-inline.rs:323:5 | LL | #[primary_span] | ^ error: derive(Diagnostic): subdiagnostic kind not specified - --> $DIR/subdiagnostic-derive-inline.rs:324:8 + --> $DIR/subdiagnostic-derive-inline.rs:332:8 | LL | struct AG { | ^^ error: derive(Diagnostic): attribute specified multiple times - --> $DIR/subdiagnostic-derive-inline.rs:361:47 + --> $DIR/subdiagnostic-derive-inline.rs:369:47 | LL | #[suggestion("example message", code = "...", code = "...")] | ^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive-inline.rs:361:33 + --> $DIR/subdiagnostic-derive-inline.rs:369:33 | LL | #[suggestion("example message", code = "...", code = "...")] | ^^^^ error: derive(Diagnostic): attribute specified multiple times - --> $DIR/subdiagnostic-derive-inline.rs:379:5 + --> $DIR/subdiagnostic-derive-inline.rs:387:5 | LL | #[applicability] | ^ | note: previously specified here - --> $DIR/subdiagnostic-derive-inline.rs:376:5 + --> $DIR/subdiagnostic-derive-inline.rs:384:5 | LL | #[applicability] | ^ error: derive(Diagnostic): the `#[applicability]` attribute can only be applied to fields of type `Applicability` - --> $DIR/subdiagnostic-derive-inline.rs:389:5 + --> $DIR/subdiagnostic-derive-inline.rs:397:5 | LL | #[applicability] | ^ error: derive(Diagnostic): suggestion without `code = "..."` - --> $DIR/subdiagnostic-derive-inline.rs:402:1 + --> $DIR/subdiagnostic-derive-inline.rs:410:1 | LL | #[suggestion("example message")] | ^ error: derive(Diagnostic): invalid applicability - --> $DIR/subdiagnostic-derive-inline.rs:412:63 + --> $DIR/subdiagnostic-derive-inline.rs:420:63 | LL | #[suggestion("example message", code = "...", applicability = "foo")] | ^^^^^ error: derive(Diagnostic): suggestion without `#[primary_span]` field - --> $DIR/subdiagnostic-derive-inline.rs:430:1 + --> $DIR/subdiagnostic-derive-inline.rs:438:1 | LL | #[suggestion("example message", code = "...")] | ^ error: derive(Diagnostic): unsupported type attribute for subdiagnostic enum - --> $DIR/subdiagnostic-derive-inline.rs:444:1 + --> $DIR/subdiagnostic-derive-inline.rs:452:1 | LL | #[label] | ^ error: derive(Diagnostic): `var` doesn't refer to a field on this type - --> $DIR/subdiagnostic-derive-inline.rs:464:40 + --> $DIR/subdiagnostic-derive-inline.rs:472:40 | LL | #[suggestion("example message", code = "{var}", applicability = "machine-applicable")] | ^^^^^^^ error: derive(Diagnostic): `var` doesn't refer to a field on this type - --> $DIR/subdiagnostic-derive-inline.rs:483:44 + --> $DIR/subdiagnostic-derive-inline.rs:491:44 | LL | #[suggestion("example message", code = "{var}", applicability = "machine-applicable")] | ^^^^^^^ error: derive(Diagnostic): `#[suggestion_part]` is not a valid attribute - --> $DIR/subdiagnostic-derive-inline.rs:506:5 + --> $DIR/subdiagnostic-derive-inline.rs:514:5 | LL | #[suggestion_part] | ^ @@ -267,7 +267,7 @@ LL | #[suggestion_part] = help: `#[suggestion_part(...)]` is only valid in multipart suggestions, use `#[primary_span]` instead error: derive(Diagnostic): `#[suggestion_part(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive-inline.rs:509:5 + --> $DIR/subdiagnostic-derive-inline.rs:517:5 | LL | #[suggestion_part(code = "...")] | ^ @@ -275,13 +275,13 @@ LL | #[suggestion_part(code = "...")] = help: `#[suggestion_part(...)]` is only valid in multipart suggestions error: derive(Diagnostic): suggestion without `#[primary_span]` field - --> $DIR/subdiagnostic-derive-inline.rs:503:1 + --> $DIR/subdiagnostic-derive-inline.rs:511:1 | LL | #[suggestion("example message", code = "...")] | ^ error: derive(Diagnostic): invalid nested attribute - --> $DIR/subdiagnostic-derive-inline.rs:518:43 + --> $DIR/subdiagnostic-derive-inline.rs:526:43 | LL | #[multipart_suggestion("example message", code = "...", applicability = "machine-applicable")] | ^^^^ @@ -289,25 +289,25 @@ LL | #[multipart_suggestion("example message", code = "...", applicability = "ma = help: only `style` and `applicability` are valid nested attributes error: derive(Diagnostic): multipart suggestion without any `#[suggestion_part(...)]` fields - --> $DIR/subdiagnostic-derive-inline.rs:518:1 + --> $DIR/subdiagnostic-derive-inline.rs:526:1 | LL | #[multipart_suggestion("example message", code = "...", applicability = "machine-applicable")] | ^ error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive-inline.rs:528:5 + --> $DIR/subdiagnostic-derive-inline.rs:536:5 | LL | #[suggestion_part] | ^ error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive-inline.rs:536:5 + --> $DIR/subdiagnostic-derive-inline.rs:544:5 | LL | #[suggestion_part()] | ^ error: derive(Diagnostic): `#[primary_span]` is not a valid attribute - --> $DIR/subdiagnostic-derive-inline.rs:545:5 + --> $DIR/subdiagnostic-derive-inline.rs:553:5 | LL | #[primary_span] | ^ @@ -315,127 +315,127 @@ LL | #[primary_span] = help: multipart suggestions use one or more `#[suggestion_part]`s rather than one `#[primary_span]` error: derive(Diagnostic): multipart suggestion without any `#[suggestion_part(...)]` fields - --> $DIR/subdiagnostic-derive-inline.rs:542:1 + --> $DIR/subdiagnostic-derive-inline.rs:550:1 | LL | #[multipart_suggestion("example message")] | ^ error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive-inline.rs:553:5 + --> $DIR/subdiagnostic-derive-inline.rs:561:5 | LL | #[suggestion_part] | ^ error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."` - --> $DIR/subdiagnostic-derive-inline.rs:556:5 + --> $DIR/subdiagnostic-derive-inline.rs:564:5 | LL | #[suggestion_part()] | ^ error: derive(Diagnostic): `code` is the only valid nested attribute - --> $DIR/subdiagnostic-derive-inline.rs:559:23 + --> $DIR/subdiagnostic-derive-inline.rs:567:23 | LL | #[suggestion_part(foo = "bar")] | ^^^ error: derive(Diagnostic): the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/subdiagnostic-derive-inline.rs:563:5 + --> $DIR/subdiagnostic-derive-inline.rs:571:5 | LL | #[suggestion_part(code = "...")] | ^ error: derive(Diagnostic): the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` - --> $DIR/subdiagnostic-derive-inline.rs:566:5 + --> $DIR/subdiagnostic-derive-inline.rs:574:5 | LL | #[suggestion_part()] | ^ error: expected `,` - --> $DIR/subdiagnostic-derive-inline.rs:559:27 + --> $DIR/subdiagnostic-derive-inline.rs:567:27 | LL | #[suggestion_part(foo = "bar")] | ^ error: derive(Diagnostic): attribute specified multiple times - --> $DIR/subdiagnostic-derive-inline.rs:574:37 + --> $DIR/subdiagnostic-derive-inline.rs:582:37 | LL | #[suggestion_part(code = "...", code = ",,,")] | ^^^^ | note: previously specified here - --> $DIR/subdiagnostic-derive-inline.rs:574:23 + --> $DIR/subdiagnostic-derive-inline.rs:582:23 | LL | #[suggestion_part(code = "...", code = ",,,")] | ^^^^ error: derive(Diagnostic): `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_suggestion]` attributes have a static `applicability = "..."` - --> $DIR/subdiagnostic-derive-inline.rs:603:5 + --> $DIR/subdiagnostic-derive-inline.rs:611:5 | LL | #[applicability] | ^ error: derive(Diagnostic): expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive-inline.rs:651:28 + --> $DIR/subdiagnostic-derive-inline.rs:659:28 | LL | #[suggestion_part(code("foo"))] | ^^^^^ error: unexpected token, expected `)` - --> $DIR/subdiagnostic-derive-inline.rs:651:28 + --> $DIR/subdiagnostic-derive-inline.rs:659:28 | LL | #[suggestion_part(code("foo"))] | ^^^^^ error: derive(Diagnostic): expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive-inline.rs:661:28 + --> $DIR/subdiagnostic-derive-inline.rs:669:28 | LL | #[suggestion_part(code("foo", "bar"))] | ^^^^^ error: unexpected token, expected `)` - --> $DIR/subdiagnostic-derive-inline.rs:661:28 + --> $DIR/subdiagnostic-derive-inline.rs:669:28 | LL | #[suggestion_part(code("foo", "bar"))] | ^^^^^ error: derive(Diagnostic): expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive-inline.rs:671:28 + --> $DIR/subdiagnostic-derive-inline.rs:679:28 | LL | #[suggestion_part(code(3))] | ^ error: unexpected token, expected `)` - --> $DIR/subdiagnostic-derive-inline.rs:671:28 + --> $DIR/subdiagnostic-derive-inline.rs:679:28 | LL | #[suggestion_part(code(3))] | ^ error: derive(Diagnostic): expected exactly one string literal for `code = ...` - --> $DIR/subdiagnostic-derive-inline.rs:681:28 + --> $DIR/subdiagnostic-derive-inline.rs:689:28 | LL | #[suggestion_part(code())] | ^ error: expected string literal - --> $DIR/subdiagnostic-derive-inline.rs:690:30 + --> $DIR/subdiagnostic-derive-inline.rs:698:30 | LL | #[suggestion_part(code = 3)] | ^ error: derive(Diagnostic): attribute specified multiple times - --> $DIR/subdiagnostic-derive-inline.rs:732:1 + --> $DIR/subdiagnostic-derive-inline.rs:740:1 | LL | #[suggestion("example message", code = "", style = "hidden", style = "normal")] | ^ | note: previously specified here - --> $DIR/subdiagnostic-derive-inline.rs:732:1 + --> $DIR/subdiagnostic-derive-inline.rs:740:1 | LL | #[suggestion("example message", code = "", style = "hidden", style = "normal")] | ^ error: derive(Diagnostic): `#[suggestion_hidden(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive-inline.rs:741:1 + --> $DIR/subdiagnostic-derive-inline.rs:749:1 | LL | #[suggestion_hidden("example message", code = "")] | ^ @@ -443,7 +443,7 @@ LL | #[suggestion_hidden("example message", code = "")] = help: Use `#[suggestion(..., style = "hidden")]` instead error: derive(Diagnostic): `#[suggestion_hidden(...)]` is not a valid attribute - --> $DIR/subdiagnostic-derive-inline.rs:749:1 + --> $DIR/subdiagnostic-derive-inline.rs:757:1 | LL | #[suggestion_hidden("example message", code = "", style = "normal")] | ^ @@ -451,7 +451,7 @@ LL | #[suggestion_hidden("example message", code = "", style = "normal")] = help: Use `#[suggestion(..., style = "hidden")]` instead error: derive(Diagnostic): invalid suggestion style - --> $DIR/subdiagnostic-derive-inline.rs:757:52 + --> $DIR/subdiagnostic-derive-inline.rs:765:52 | LL | #[suggestion("example message", code = "", style = "foo")] | ^^^^^ @@ -459,25 +459,25 @@ LL | #[suggestion("example message", code = "", style = "foo")] = help: valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only` error: expected string literal - --> $DIR/subdiagnostic-derive-inline.rs:765:52 + --> $DIR/subdiagnostic-derive-inline.rs:773:52 | LL | #[suggestion("example message", code = "", style = 42)] | ^^ error: expected `=` - --> $DIR/subdiagnostic-derive-inline.rs:773:49 + --> $DIR/subdiagnostic-derive-inline.rs:781:49 | LL | #[suggestion("example message", code = "", style)] | ^ error: expected `=` - --> $DIR/subdiagnostic-derive-inline.rs:781:49 + --> $DIR/subdiagnostic-derive-inline.rs:789:49 | LL | #[suggestion("example message", code = "", style("foo"))] | ^ error: derive(Diagnostic): `#[primary_span]` is not a valid attribute - --> $DIR/subdiagnostic-derive-inline.rs:792:5 + --> $DIR/subdiagnostic-derive-inline.rs:800:5 | LL | #[primary_span] | ^ @@ -486,7 +486,7 @@ LL | #[primary_span] = help: to create a suggestion with multiple spans, use `#[multipart_suggestion]` instead error: derive(Diagnostic): suggestion without `#[primary_span]` field - --> $DIR/subdiagnostic-derive-inline.rs:789:1 + --> $DIR/subdiagnostic-derive-inline.rs:797:1 | LL | #[suggestion("example message", code = "")] | ^ @@ -498,49 +498,49 @@ LL | #[foo] | ^^^ error: cannot find attribute `foo` in this scope - --> $DIR/subdiagnostic-derive-inline.rs:141:3 + --> $DIR/subdiagnostic-derive-inline.rs:149:3 | LL | #[foo] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive-inline.rs:155:7 + --> $DIR/subdiagnostic-derive-inline.rs:163:7 | LL | #[bar] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive-inline.rs:167:7 + --> $DIR/subdiagnostic-derive-inline.rs:175:7 | LL | #[bar = "..."] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive-inline.rs:179:7 + --> $DIR/subdiagnostic-derive-inline.rs:187:7 | LL | #[bar = 4] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive-inline.rs:191:7 + --> $DIR/subdiagnostic-derive-inline.rs:199:7 | LL | #[bar("...")] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive-inline.rs:252:7 + --> $DIR/subdiagnostic-derive-inline.rs:260:7 | LL | #[bar] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive-inline.rs:263:7 + --> $DIR/subdiagnostic-derive-inline.rs:271:7 | LL | #[bar = "..."] | ^^^ error: cannot find attribute `bar` in this scope - --> $DIR/subdiagnostic-derive-inline.rs:274:7 + --> $DIR/subdiagnostic-derive-inline.rs:282:7 | LL | #[bar("...")] | ^^^ diff --git a/tests/ui/asm/naked-invalid-attr.rs b/tests/ui/asm/naked-invalid-attr.rs index eba7cf01b7b29..d020fae41cf90 100644 --- a/tests/ui/asm/naked-invalid-attr.rs +++ b/tests/ui/asm/naked-invalid-attr.rs @@ -56,7 +56,7 @@ fn main() { // Check that the path of an attribute without a name is printed correctly (issue #140082) #[::a] //~^ ERROR attribute incompatible with `#[unsafe(naked)]` -//~| ERROR failed to resolve: use of unresolved module or unlinked crate `a` +//~| ERROR cannot find module or crate `a` in the crate root #[unsafe(naked)] extern "C" fn issue_140082() { naked_asm!("") diff --git a/tests/ui/asm/naked-invalid-attr.stderr b/tests/ui/asm/naked-invalid-attr.stderr index a6348923277dd..9962cbafc37f6 100644 --- a/tests/ui/asm/naked-invalid-attr.stderr +++ b/tests/ui/asm/naked-invalid-attr.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `a` +error[E0433]: cannot find module or crate `a` in the crate root --> $DIR/naked-invalid-attr.rs:57:5 | LL | #[::a] diff --git a/tests/ui/associated-types/suggest-param-env-shadowing-incompatible-args.rs b/tests/ui/associated-types/suggest-param-env-shadowing-incompatible-args.rs new file mode 100644 index 0000000000000..4a3ccc287f7f0 --- /dev/null +++ b/tests/ui/associated-types/suggest-param-env-shadowing-incompatible-args.rs @@ -0,0 +1,18 @@ +//@ compile-flags: -Znext-solver=globally + +// Regression test for https://github.com/rust-lang/rust/issues/152684. + +#![feature(associated_type_defaults)] + +trait Foo { + type Assoc = T; + //~^ ERROR defaults for generic parameters are not allowed here + fn foo() -> Self::Assoc; +} +impl Foo for () { + fn foo() -> Self::Assoc { + [] //~ ERROR mismatched types + } +} + +fn main() {} diff --git a/tests/ui/associated-types/suggest-param-env-shadowing-incompatible-args.stderr b/tests/ui/associated-types/suggest-param-env-shadowing-incompatible-args.stderr new file mode 100644 index 0000000000000..c401233242489 --- /dev/null +++ b/tests/ui/associated-types/suggest-param-env-shadowing-incompatible-args.stderr @@ -0,0 +1,20 @@ +error: defaults for generic parameters are not allowed here + --> $DIR/suggest-param-env-shadowing-incompatible-args.rs:8:16 + | +LL | type Assoc = T; + | ^^^^^^ + +error[E0308]: mismatched types + --> $DIR/suggest-param-env-shadowing-incompatible-args.rs:14:9 + | +LL | fn foo() -> Self::Assoc { + | ----------- expected `<() as Foo>::Assoc` because of return type +LL | [] + | ^^ expected `u8`, found `[_; 0]` + | + = note: expected type `u8` + found array `[_; 0]` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/attributes/builtin-attribute-prefix.rs b/tests/ui/attributes/builtin-attribute-prefix.rs index d184c6d008df6..02af7f536f86b 100644 --- a/tests/ui/attributes/builtin-attribute-prefix.rs +++ b/tests/ui/attributes/builtin-attribute-prefix.rs @@ -1,8 +1,8 @@ // Regression test for https://github.com/rust-lang/rust/issues/143789 #[must_use::skip] -//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `must_use` +//~^ ERROR: cannot find module or crate `must_use` fn main() { } // Regression test for https://github.com/rust-lang/rust/issues/137590 struct S(#[stable::skip] u8, u16, u32); -//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `stable` +//~^ ERROR: cannot find module or crate `stable` diff --git a/tests/ui/attributes/builtin-attribute-prefix.stderr b/tests/ui/attributes/builtin-attribute-prefix.stderr index a16080c003fb4..a3e6c2e0172b6 100644 --- a/tests/ui/attributes/builtin-attribute-prefix.stderr +++ b/tests/ui/attributes/builtin-attribute-prefix.stderr @@ -1,10 +1,10 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `stable` +error[E0433]: cannot find module or crate `stable` in this scope --> $DIR/builtin-attribute-prefix.rs:7:12 | LL | struct S(#[stable::skip] u8, u16, u32); | ^^^^^^ use of unresolved module or unlinked crate `stable` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `must_use` +error[E0433]: cannot find module or crate `must_use` in this scope --> $DIR/builtin-attribute-prefix.rs:2:3 | LL | #[must_use::skip] diff --git a/tests/ui/attributes/check-builtin-attr-ice.rs b/tests/ui/attributes/check-builtin-attr-ice.rs index 811210e2ccaf9..bf4e3492f7091 100644 --- a/tests/ui/attributes/check-builtin-attr-ice.rs +++ b/tests/ui/attributes/check-builtin-attr-ice.rs @@ -43,11 +43,11 @@ struct Foo { #[should_panic::skip] - //~^ ERROR failed to resolve + //~^ ERROR cannot find pub field: u8, #[should_panic::a::b::c] - //~^ ERROR failed to resolve + //~^ ERROR cannot find pub field2: u8, } @@ -55,6 +55,6 @@ fn foo() {} fn main() { #[deny::skip] - //~^ ERROR failed to resolve + //~^ ERROR cannot find foo(); } diff --git a/tests/ui/attributes/check-builtin-attr-ice.stderr b/tests/ui/attributes/check-builtin-attr-ice.stderr index 07bbe01898a7d..35c97a05918ee 100644 --- a/tests/ui/attributes/check-builtin-attr-ice.stderr +++ b/tests/ui/attributes/check-builtin-attr-ice.stderr @@ -1,16 +1,16 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `should_panic` +error[E0433]: cannot find module or crate `should_panic` in this scope --> $DIR/check-builtin-attr-ice.rs:45:7 | LL | #[should_panic::skip] | ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `should_panic` +error[E0433]: cannot find module or crate `should_panic` in this scope --> $DIR/check-builtin-attr-ice.rs:49:7 | LL | #[should_panic::a::b::c] | ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `deny` +error[E0433]: cannot find module or crate `deny` in this scope --> $DIR/check-builtin-attr-ice.rs:57:7 | LL | #[deny::skip] diff --git a/tests/ui/attributes/check-cfg_attr-ice.rs b/tests/ui/attributes/check-cfg_attr-ice.rs index 5bf8baab14140..5fb3f2798ba7a 100644 --- a/tests/ui/attributes/check-cfg_attr-ice.rs +++ b/tests/ui/attributes/check-cfg_attr-ice.rs @@ -10,27 +10,27 @@ #![crate_type = "lib"] #[cfg_attr::no_such_thing] -//~^ ERROR failed to resolve +//~^ ERROR cannot find mod we_are_no_strangers_to_love {} #[cfg_attr::no_such_thing] -//~^ ERROR failed to resolve +//~^ ERROR cannot find struct YouKnowTheRules { #[cfg_attr::no_such_thing] - //~^ ERROR failed to resolve + //~^ ERROR cannot find and_so_do_i: u8, } #[cfg_attr::no_such_thing] -//~^ ERROR failed to resolve +//~^ ERROR cannot find fn a_full_commitment() { #[cfg_attr::no_such_thing] - //~^ ERROR failed to resolve + //~^ ERROR cannot find let is_what_i_am_thinking_of = (); } #[cfg_attr::no_such_thing] -//~^ ERROR failed to resolve +//~^ ERROR cannot find union AnyOtherGuy { owo: () } @@ -39,30 +39,30 @@ struct This; #[cfg_attr(FALSE, doc = "you wouldn't get this")] impl From for This { #[cfg_attr::no_such_thing] - //~^ ERROR failed to resolve + //~^ ERROR cannot find fn from(#[cfg_attr::no_such_thing] any_other_guy: AnyOtherGuy) -> This { - //~^ ERROR failed to resolve + //~^ ERROR cannot find #[cfg_attr::no_such_thing] //~^ ERROR attributes on expressions are experimental - //~| ERROR failed to resolve + //~| ERROR cannot find unreachable!() } } #[cfg_attr::no_such_thing] -//~^ ERROR failed to resolve +//~^ ERROR cannot find enum NeverGonna { #[cfg_attr::no_such_thing] - //~^ ERROR failed to resolve + //~^ ERROR cannot find GiveYouUp(#[cfg_attr::no_such_thing] u8), - //~^ ERROR failed to resolve + //~^ ERROR cannot find LetYouDown { #![cfg_attr::no_such_thing] //~^ ERROR an inner attribute is not permitted in this context never_gonna: (), round_around: (), #[cfg_attr::no_such_thing] - //~^ ERROR failed to resolve + //~^ ERROR cannot find and_desert_you: (), }, } diff --git a/tests/ui/attributes/check-cfg_attr-ice.stderr b/tests/ui/attributes/check-cfg_attr-ice.stderr index bed3150bdc2f3..65476e2f76b6d 100644 --- a/tests/ui/attributes/check-cfg_attr-ice.stderr +++ b/tests/ui/attributes/check-cfg_attr-ice.stderr @@ -17,79 +17,79 @@ LL | #[cfg_attr::no_such_thing] = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr` +error[E0433]: cannot find module or crate `cfg_attr` in this scope --> $DIR/check-cfg_attr-ice.rs:52:3 | LL | #[cfg_attr::no_such_thing] | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr` +error[E0433]: cannot find module or crate `cfg_attr` in this scope --> $DIR/check-cfg_attr-ice.rs:55:7 | LL | #[cfg_attr::no_such_thing] | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr` +error[E0433]: cannot find module or crate `cfg_attr` in this scope --> $DIR/check-cfg_attr-ice.rs:57:17 | LL | GiveYouUp(#[cfg_attr::no_such_thing] u8), | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr` +error[E0433]: cannot find module or crate `cfg_attr` in this scope --> $DIR/check-cfg_attr-ice.rs:64:11 | LL | #[cfg_attr::no_such_thing] | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr` +error[E0433]: cannot find module or crate `cfg_attr` in this scope --> $DIR/check-cfg_attr-ice.rs:41:7 | LL | #[cfg_attr::no_such_thing] | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr` +error[E0433]: cannot find module or crate `cfg_attr` in this scope --> $DIR/check-cfg_attr-ice.rs:43:15 | LL | fn from(#[cfg_attr::no_such_thing] any_other_guy: AnyOtherGuy) -> This { | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr` +error[E0433]: cannot find module or crate `cfg_attr` in this scope --> $DIR/check-cfg_attr-ice.rs:45:11 | LL | #[cfg_attr::no_such_thing] | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr` +error[E0433]: cannot find module or crate `cfg_attr` in this scope --> $DIR/check-cfg_attr-ice.rs:32:3 | LL | #[cfg_attr::no_such_thing] | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr` +error[E0433]: cannot find module or crate `cfg_attr` in this scope --> $DIR/check-cfg_attr-ice.rs:24:3 | LL | #[cfg_attr::no_such_thing] | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr` +error[E0433]: cannot find module or crate `cfg_attr` in this scope --> $DIR/check-cfg_attr-ice.rs:27:7 | LL | #[cfg_attr::no_such_thing] | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr` +error[E0433]: cannot find module or crate `cfg_attr` in this scope --> $DIR/check-cfg_attr-ice.rs:16:3 | LL | #[cfg_attr::no_such_thing] | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr` +error[E0433]: cannot find module or crate `cfg_attr` in this scope --> $DIR/check-cfg_attr-ice.rs:19:7 | LL | #[cfg_attr::no_such_thing] | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr` +error[E0433]: cannot find module or crate `cfg_attr` in this scope --> $DIR/check-cfg_attr-ice.rs:12:3 | LL | #[cfg_attr::no_such_thing] diff --git a/tests/ui/attributes/custom_attr_multisegment_error.rs b/tests/ui/attributes/custom_attr_multisegment_error.rs index 1045282c3a330..f42c35ffea13c 100644 --- a/tests/ui/attributes/custom_attr_multisegment_error.rs +++ b/tests/ui/attributes/custom_attr_multisegment_error.rs @@ -2,5 +2,5 @@ mod existent {} -#[existent::nonexistent] //~ ERROR failed to resolve: could not find `nonexistent` in `existent` +#[existent::nonexistent] //~ ERROR cannot find `nonexistent` in `existent` fn main() {} diff --git a/tests/ui/attributes/custom_attr_multisegment_error.stderr b/tests/ui/attributes/custom_attr_multisegment_error.stderr index 02bed225d53ee..8066fc74de4b5 100644 --- a/tests/ui/attributes/custom_attr_multisegment_error.stderr +++ b/tests/ui/attributes/custom_attr_multisegment_error.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: could not find `nonexistent` in `existent` +error[E0433]: cannot find `nonexistent` in `existent` --> $DIR/custom_attr_multisegment_error.rs:5:13 | LL | #[existent::nonexistent] diff --git a/tests/ui/attributes/field-attributes-vis-unresolved.rs b/tests/ui/attributes/field-attributes-vis-unresolved.rs index be710a3cd744c..bcdabe42fcc2a 100644 --- a/tests/ui/attributes/field-attributes-vis-unresolved.rs +++ b/tests/ui/attributes/field-attributes-vis-unresolved.rs @@ -15,12 +15,12 @@ mod internal { struct S { #[rustfmt::skip] - pub(in nonexistent) field: u8 //~ ERROR failed to resolve + pub(in nonexistent) field: u8 //~ ERROR cannot find } struct Z( #[rustfmt::skip] - pub(in nonexistent) u8 //~ ERROR failed to resolve + pub(in nonexistent) u8 //~ ERROR cannot find ); fn main() {} diff --git a/tests/ui/attributes/field-attributes-vis-unresolved.stderr b/tests/ui/attributes/field-attributes-vis-unresolved.stderr index 1ebfde4cd67e3..f1148385d8a17 100644 --- a/tests/ui/attributes/field-attributes-vis-unresolved.stderr +++ b/tests/ui/attributes/field-attributes-vis-unresolved.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistent` +error[E0433]: cannot find module or crate `nonexistent` in the crate root --> $DIR/field-attributes-vis-unresolved.rs:18:12 | LL | pub(in nonexistent) field: u8 @@ -9,7 +9,7 @@ help: you might be missing a crate named `nonexistent`, add it to your project a LL + extern crate nonexistent; | -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistent` +error[E0433]: cannot find module or crate `nonexistent` in the crate root --> $DIR/field-attributes-vis-unresolved.rs:23:12 | LL | pub(in nonexistent) u8 diff --git a/tests/ui/attributes/illegal-macro-use.rs b/tests/ui/attributes/illegal-macro-use.rs index 5a567107a6e2e..e16a223c75ff0 100644 --- a/tests/ui/attributes/illegal-macro-use.rs +++ b/tests/ui/attributes/illegal-macro-use.rs @@ -1,15 +1,15 @@ // issue#140255 -#[macro_use::a] //~ ERROR failed to resolve: use of unresolved module or unlinked crate `macro_use` +#[macro_use::a] //~ ERROR cannot find fn f0() {} -#[macro_use::a::b] //~ ERROR failed to resolve: use of unresolved module or unlinked crate `macro_use` +#[macro_use::a::b] //~ ERROR cannot find fn f1() {} -#[macro_escape::a] //~ ERROR failed to resolve: use of unresolved module or unlinked crate `macro_escape` +#[macro_escape::a] //~ ERROR cannot find fn f2() {} -#[macro_escape::a::b] //~ ERROR failed to resolve: use of unresolved module or unlinked crate `macro_escape` +#[macro_escape::a::b] //~ ERROR cannot find fn f3() {} fn main() {} diff --git a/tests/ui/attributes/illegal-macro-use.stderr b/tests/ui/attributes/illegal-macro-use.stderr index fa6bb83d588ae..13c9f05ccd667 100644 --- a/tests/ui/attributes/illegal-macro-use.stderr +++ b/tests/ui/attributes/illegal-macro-use.stderr @@ -1,22 +1,22 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `macro_escape` +error[E0433]: cannot find module or crate `macro_escape` in this scope --> $DIR/illegal-macro-use.rs:12:3 | LL | #[macro_escape::a::b] | ^^^^^^^^^^^^ use of unresolved module or unlinked crate `macro_escape` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `macro_escape` +error[E0433]: cannot find module or crate `macro_escape` in this scope --> $DIR/illegal-macro-use.rs:9:3 | LL | #[macro_escape::a] | ^^^^^^^^^^^^ use of unresolved module or unlinked crate `macro_escape` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `macro_use` +error[E0433]: cannot find module or crate `macro_use` in this scope --> $DIR/illegal-macro-use.rs:6:3 | LL | #[macro_use::a::b] | ^^^^^^^^^ use of unresolved module or unlinked crate `macro_use` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `macro_use` +error[E0433]: cannot find module or crate `macro_use` in this scope --> $DIR/illegal-macro-use.rs:3:3 | LL | #[macro_use::a] diff --git a/tests/ui/attributes/malformed-attrs.rs b/tests/ui/attributes/malformed-attrs.rs index 489c8bf9f4954..6193a101918bd 100644 --- a/tests/ui/attributes/malformed-attrs.rs +++ b/tests/ui/attributes/malformed-attrs.rs @@ -2,7 +2,6 @@ // We enable a bunch of features to not get feature-gate errs in this test. #![deny(invalid_doc_attributes)] #![feature(rustc_attrs)] -#![feature(rustc_allow_const_fn_unstable)] #![feature(allow_internal_unstable)] // FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity #![feature(fn_align)] diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr index 009da1d12a16e..01e70adf4ee99 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -1,5 +1,5 @@ error[E0539]: malformed `cfg` attribute input - --> $DIR/malformed-attrs.rs:107:1 + --> $DIR/malformed-attrs.rs:106:1 | LL | #[cfg] | ^^^^^^ @@ -10,7 +10,7 @@ LL | #[cfg] = note: for more information, visit error[E0539]: malformed `cfg_attr` attribute input - --> $DIR/malformed-attrs.rs:109:1 + --> $DIR/malformed-attrs.rs:108:1 | LL | #[cfg_attr] | ^^^^^^^^^^^ @@ -21,13 +21,13 @@ LL | #[cfg_attr] = note: for more information, visit error[E0463]: can't find crate for `wloop` - --> $DIR/malformed-attrs.rs:215:1 + --> $DIR/malformed-attrs.rs:214:1 | LL | extern crate wloop; | ^^^^^^^^^^^^^^^^^^^ can't find crate error: malformed `allow` attribute input - --> $DIR/malformed-attrs.rs:181:1 + --> $DIR/malformed-attrs.rs:180:1 | LL | #[allow] | ^^^^^^^^ @@ -43,7 +43,7 @@ LL | #[allow(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `expect` attribute input - --> $DIR/malformed-attrs.rs:183:1 + --> $DIR/malformed-attrs.rs:182:1 | LL | #[expect] | ^^^^^^^^^ @@ -59,7 +59,7 @@ LL | #[expect(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `warn` attribute input - --> $DIR/malformed-attrs.rs:185:1 + --> $DIR/malformed-attrs.rs:184:1 | LL | #[warn] | ^^^^^^^ @@ -75,7 +75,7 @@ LL | #[warn(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `deny` attribute input - --> $DIR/malformed-attrs.rs:187:1 + --> $DIR/malformed-attrs.rs:186:1 | LL | #[deny] | ^^^^^^^ @@ -91,7 +91,7 @@ LL | #[deny(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `forbid` attribute input - --> $DIR/malformed-attrs.rs:189:1 + --> $DIR/malformed-attrs.rs:188:1 | LL | #[forbid] | ^^^^^^^^^ @@ -107,25 +107,25 @@ LL | #[forbid(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:104:1 + --> $DIR/malformed-attrs.rs:103:1 | LL | #[proc_macro = 18] | ^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:121:1 + --> $DIR/malformed-attrs.rs:120:1 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:128:1 + --> $DIR/malformed-attrs.rs:127:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint - --> $DIR/malformed-attrs.rs:220:1 + --> $DIR/malformed-attrs.rs:219:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -134,7 +134,7 @@ LL | #[allow_internal_unsafe = 1] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0539]: malformed `windows_subsystem` attribute input - --> $DIR/malformed-attrs.rs:27:1 + --> $DIR/malformed-attrs.rs:26:1 | LL | #![windows_subsystem] | ^^^-----------------^ @@ -150,25 +150,25 @@ LL | #![windows_subsystem = "windows"] | +++++++++++ error[E0539]: malformed `export_name` attribute input - --> $DIR/malformed-attrs.rs:30:1 + --> $DIR/malformed-attrs.rs:29:1 | LL | #[unsafe(export_name)] | ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]` error: `rustc_allow_const_fn_unstable` expects a list of feature names - --> $DIR/malformed-attrs.rs:32:1 + --> $DIR/malformed-attrs.rs:31:1 | LL | #[rustc_allow_const_fn_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `allow_internal_unstable` expects a list of feature names - --> $DIR/malformed-attrs.rs:35:1 + --> $DIR/malformed-attrs.rs:34:1 | LL | #[allow_internal_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0539]: malformed `rustc_confusables` attribute input - --> $DIR/malformed-attrs.rs:37:1 + --> $DIR/malformed-attrs.rs:36:1 | LL | #[rustc_confusables] | ^^^^^^^^^^^^^^^^^^^^ @@ -177,7 +177,7 @@ LL | #[rustc_confusables] | help: must be of the form: `#[rustc_confusables("name1", "name2", ...)]` error: `#[rustc_confusables]` attribute cannot be used on functions - --> $DIR/malformed-attrs.rs:37:1 + --> $DIR/malformed-attrs.rs:36:1 | LL | #[rustc_confusables] | ^^^^^^^^^^^^^^^^^^^^ @@ -185,7 +185,7 @@ LL | #[rustc_confusables] = help: `#[rustc_confusables]` can only be applied to inherent methods error[E0539]: malformed `deprecated` attribute input - --> $DIR/malformed-attrs.rs:40:1 + --> $DIR/malformed-attrs.rs:39:1 | LL | #[deprecated = 5] | ^^^^^^^^^^^^^^^-^ @@ -193,7 +193,7 @@ LL | #[deprecated = 5] | expected a string literal here error[E0539]: malformed `rustc_macro_transparency` attribute input - --> $DIR/malformed-attrs.rs:44:1 + --> $DIR/malformed-attrs.rs:43:1 | LL | #[rustc_macro_transparency] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -208,7 +208,7 @@ LL | #[rustc_macro_transparency = "transparent"] | +++++++++++++++ error: `#[rustc_macro_transparency]` attribute cannot be used on functions - --> $DIR/malformed-attrs.rs:44:1 + --> $DIR/malformed-attrs.rs:43:1 | LL | #[rustc_macro_transparency] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -216,7 +216,7 @@ LL | #[rustc_macro_transparency] = help: `#[rustc_macro_transparency]` can only be applied to macro defs error[E0539]: malformed `repr` attribute input - --> $DIR/malformed-attrs.rs:47:1 + --> $DIR/malformed-attrs.rs:46:1 | LL | #[repr] | ^^^^^^^ expected this to be a list @@ -224,7 +224,7 @@ LL | #[repr] = note: for more information, visit error[E0565]: malformed `rustc_as_ptr` attribute input - --> $DIR/malformed-attrs.rs:50:1 + --> $DIR/malformed-attrs.rs:49:1 | LL | #[rustc_as_ptr = 5] | ^^^^^^^^^^^^^^^---^ @@ -233,7 +233,7 @@ LL | #[rustc_as_ptr = 5] | help: must be of the form: `#[rustc_as_ptr]` error[E0539]: malformed `rustc_align` attribute input - --> $DIR/malformed-attrs.rs:55:1 + --> $DIR/malformed-attrs.rs:54:1 | LL | #[rustc_align] | ^^^^^^^^^^^^^^ @@ -242,7 +242,7 @@ LL | #[rustc_align] | help: must be of the form: `#[rustc_align()]` error[E0539]: malformed `optimize` attribute input - --> $DIR/malformed-attrs.rs:57:1 + --> $DIR/malformed-attrs.rs:56:1 | LL | #[optimize] | ^^^^^^^^^^^ expected this to be a list @@ -257,7 +257,7 @@ LL | #[optimize(speed)] | +++++++ error[E0565]: malformed `cold` attribute input - --> $DIR/malformed-attrs.rs:59:1 + --> $DIR/malformed-attrs.rs:58:1 | LL | #[cold = 1] | ^^^^^^^---^ @@ -266,7 +266,7 @@ LL | #[cold = 1] | help: must be of the form: `#[cold]` error[E0539]: malformed `must_use` attribute input - --> $DIR/malformed-attrs.rs:61:1 + --> $DIR/malformed-attrs.rs:60:1 | LL | #[must_use()] | ^^^^^^^^^^--^ @@ -284,7 +284,7 @@ LL + #[must_use] | error[E0565]: malformed `no_mangle` attribute input - --> $DIR/malformed-attrs.rs:63:1 + --> $DIR/malformed-attrs.rs:62:1 | LL | #[no_mangle = 1] | ^^^^^^^^^^^^---^ @@ -293,7 +293,7 @@ LL | #[no_mangle = 1] | help: must be of the form: `#[no_mangle]` error[E0565]: malformed `naked` attribute input - --> $DIR/malformed-attrs.rs:65:1 + --> $DIR/malformed-attrs.rs:64:1 | LL | #[unsafe(naked())] | ^^^^^^^^^^^^^^--^^ @@ -302,7 +302,7 @@ LL | #[unsafe(naked())] | help: must be of the form: `#[naked]` error[E0565]: malformed `track_caller` attribute input - --> $DIR/malformed-attrs.rs:67:1 + --> $DIR/malformed-attrs.rs:66:1 | LL | #[track_caller()] | ^^^^^^^^^^^^^^--^ @@ -311,13 +311,13 @@ LL | #[track_caller()] | help: must be of the form: `#[track_caller]` error[E0539]: malformed `export_name` attribute input - --> $DIR/malformed-attrs.rs:69:1 + --> $DIR/malformed-attrs.rs:68:1 | LL | #[export_name()] | ^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]` error[E0805]: malformed `used` attribute input - --> $DIR/malformed-attrs.rs:71:1 + --> $DIR/malformed-attrs.rs:70:1 | LL | #[used()] | ^^^^^^--^ @@ -335,7 +335,7 @@ LL + #[used] | error: `#[used]` attribute cannot be used on functions - --> $DIR/malformed-attrs.rs:71:1 + --> $DIR/malformed-attrs.rs:70:1 | LL | #[used()] | ^^^^^^^^^ @@ -343,13 +343,13 @@ LL | #[used()] = help: `#[used]` can only be applied to statics error[E0539]: malformed `crate_name` attribute input - --> $DIR/malformed-attrs.rs:74:1 + --> $DIR/malformed-attrs.rs:73:1 | LL | #[crate_name] | ^^^^^^^^^^^^^ help: must be of the form: `#[crate_name = "name"]` error[E0539]: malformed `target_feature` attribute input - --> $DIR/malformed-attrs.rs:79:1 + --> $DIR/malformed-attrs.rs:78:1 | LL | #[target_feature] | ^^^^^^^^^^^^^^^^^ @@ -358,7 +358,7 @@ LL | #[target_feature] | help: must be of the form: `#[target_feature(enable = "feat1, feat2")]` error[E0565]: malformed `export_stable` attribute input - --> $DIR/malformed-attrs.rs:81:1 + --> $DIR/malformed-attrs.rs:80:1 | LL | #[export_stable = 1] | ^^^^^^^^^^^^^^^^---^ @@ -367,7 +367,7 @@ LL | #[export_stable = 1] | help: must be of the form: `#[export_stable]` error[E0539]: malformed `link` attribute input - --> $DIR/malformed-attrs.rs:83:1 + --> $DIR/malformed-attrs.rs:82:1 | LL | #[link] | ^^^^^^^ expected this to be a list @@ -375,7 +375,7 @@ LL | #[link] = note: for more information, visit error[E0539]: malformed `link_name` attribute input - --> $DIR/malformed-attrs.rs:87:1 + --> $DIR/malformed-attrs.rs:86:1 | LL | #[link_name] | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]` @@ -383,7 +383,7 @@ LL | #[link_name] = note: for more information, visit error[E0539]: malformed `link_section` attribute input - --> $DIR/malformed-attrs.rs:91:1 + --> $DIR/malformed-attrs.rs:90:1 | LL | #[link_section] | ^^^^^^^^^^^^^^^ help: must be of the form: `#[link_section = "name"]` @@ -391,7 +391,7 @@ LL | #[link_section] = note: for more information, visit error[E0539]: malformed `coverage` attribute input - --> $DIR/malformed-attrs.rs:93:1 + --> $DIR/malformed-attrs.rs:92:1 | LL | #[coverage] | ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument @@ -404,13 +404,13 @@ LL | #[coverage(on)] | ++++ error[E0539]: malformed `sanitize` attribute input - --> $DIR/malformed-attrs.rs:95:1 + --> $DIR/malformed-attrs.rs:94:1 | LL | #[sanitize] | ^^^^^^^^^^^ expected this to be a list error[E0565]: malformed `no_implicit_prelude` attribute input - --> $DIR/malformed-attrs.rs:100:1 + --> $DIR/malformed-attrs.rs:99:1 | LL | #[no_implicit_prelude = 23] | ^^^^^^^^^^^^^^^^^^^^^^----^ @@ -419,7 +419,7 @@ LL | #[no_implicit_prelude = 23] | help: must be of the form: `#[no_implicit_prelude]` error[E0565]: malformed `proc_macro` attribute input - --> $DIR/malformed-attrs.rs:104:1 + --> $DIR/malformed-attrs.rs:103:1 | LL | #[proc_macro = 18] | ^^^^^^^^^^^^^----^ @@ -428,7 +428,7 @@ LL | #[proc_macro = 18] | help: must be of the form: `#[proc_macro]` error[E0539]: malformed `instruction_set` attribute input - --> $DIR/malformed-attrs.rs:111:1 + --> $DIR/malformed-attrs.rs:110:1 | LL | #[instruction_set] | ^^^^^^^^^^^^^^^^^^ @@ -439,7 +439,7 @@ LL | #[instruction_set] = note: for more information, visit error[E0539]: malformed `patchable_function_entry` attribute input - --> $DIR/malformed-attrs.rs:113:1 + --> $DIR/malformed-attrs.rs:112:1 | LL | #[patchable_function_entry] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -448,7 +448,7 @@ LL | #[patchable_function_entry] | help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]` error[E0565]: malformed `coroutine` attribute input - --> $DIR/malformed-attrs.rs:116:5 + --> $DIR/malformed-attrs.rs:115:5 | LL | #[coroutine = 63] || {} | ^^^^^^^^^^^^----^ @@ -457,7 +457,7 @@ LL | #[coroutine = 63] || {} | help: must be of the form: `#[coroutine]` error[E0565]: malformed `proc_macro_attribute` attribute input - --> $DIR/malformed-attrs.rs:121:1 + --> $DIR/malformed-attrs.rs:120:1 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^^^----^ @@ -466,7 +466,7 @@ LL | #[proc_macro_attribute = 19] | help: must be of the form: `#[proc_macro_attribute]` error[E0539]: malformed `must_use` attribute input - --> $DIR/malformed-attrs.rs:124:1 + --> $DIR/malformed-attrs.rs:123:1 | LL | #[must_use = 1] | ^^^^^^^^^^^^^-^ @@ -484,7 +484,7 @@ LL + #[must_use] | error[E0539]: malformed `proc_macro_derive` attribute input - --> $DIR/malformed-attrs.rs:128:1 + --> $DIR/malformed-attrs.rs:127:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ expected this to be a list @@ -498,7 +498,7 @@ LL | #[proc_macro_derive(TraitName, attributes(name1, name2, ...))] | ++++++++++++++++++++++++++++++++++++++++++ error[E0539]: malformed `rustc_layout_scalar_valid_range_start` attribute input - --> $DIR/malformed-attrs.rs:133:1 + --> $DIR/malformed-attrs.rs:132:1 | LL | #[rustc_layout_scalar_valid_range_start] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -507,7 +507,7 @@ LL | #[rustc_layout_scalar_valid_range_start] | help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]` error[E0539]: malformed `rustc_layout_scalar_valid_range_end` attribute input - --> $DIR/malformed-attrs.rs:135:1 + --> $DIR/malformed-attrs.rs:134:1 | LL | #[rustc_layout_scalar_valid_range_end] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -516,7 +516,7 @@ LL | #[rustc_layout_scalar_valid_range_end] | help: must be of the form: `#[rustc_layout_scalar_valid_range_end(end)]` error[E0539]: malformed `must_not_suspend` attribute input - --> $DIR/malformed-attrs.rs:137:1 + --> $DIR/malformed-attrs.rs:136:1 | LL | #[must_not_suspend()] | ^^^^^^^^^^^^^^^^^^--^ @@ -532,7 +532,7 @@ LL + #[must_not_suspend] | error[E0539]: malformed `cfi_encoding` attribute input - --> $DIR/malformed-attrs.rs:139:1 + --> $DIR/malformed-attrs.rs:138:1 | LL | #[cfi_encoding = ""] | ^^^^^^^^^^^^^^^^^--^ @@ -541,7 +541,7 @@ LL | #[cfi_encoding = ""] | help: must be of the form: `#[cfi_encoding = "encoding"]` error[E0565]: malformed `marker` attribute input - --> $DIR/malformed-attrs.rs:158:1 + --> $DIR/malformed-attrs.rs:157:1 | LL | #[marker = 3] | ^^^^^^^^^---^ @@ -550,7 +550,7 @@ LL | #[marker = 3] | help: must be of the form: `#[marker]` error[E0565]: malformed `fundamental` attribute input - --> $DIR/malformed-attrs.rs:160:1 + --> $DIR/malformed-attrs.rs:159:1 | LL | #[fundamental()] | ^^^^^^^^^^^^^--^ @@ -559,7 +559,7 @@ LL | #[fundamental()] | help: must be of the form: `#[fundamental]` error[E0565]: malformed `ffi_pure` attribute input - --> $DIR/malformed-attrs.rs:168:5 + --> $DIR/malformed-attrs.rs:167:5 | LL | #[unsafe(ffi_pure = 1)] | ^^^^^^^^^^^^^^^^^^---^^ @@ -568,7 +568,7 @@ LL | #[unsafe(ffi_pure = 1)] | help: must be of the form: `#[ffi_pure]` error[E0539]: malformed `link_ordinal` attribute input - --> $DIR/malformed-attrs.rs:170:5 + --> $DIR/malformed-attrs.rs:169:5 | LL | #[link_ordinal] | ^^^^^^^^^^^^^^^ @@ -579,7 +579,7 @@ LL | #[link_ordinal] = note: for more information, visit error[E0565]: malformed `ffi_const` attribute input - --> $DIR/malformed-attrs.rs:174:5 + --> $DIR/malformed-attrs.rs:173:5 | LL | #[unsafe(ffi_const = 1)] | ^^^^^^^^^^^^^^^^^^^---^^ @@ -588,13 +588,13 @@ LL | #[unsafe(ffi_const = 1)] | help: must be of the form: `#[ffi_const]` error[E0539]: malformed `linkage` attribute input - --> $DIR/malformed-attrs.rs:176:5 + --> $DIR/malformed-attrs.rs:175:5 | LL | #[linkage] | ^^^^^^^^^^ expected this to be of the form `linkage = "..."` error[E0539]: malformed `debugger_visualizer` attribute input - --> $DIR/malformed-attrs.rs:191:1 + --> $DIR/malformed-attrs.rs:190:1 | LL | #[debugger_visualizer] | ^^^^^^^^^^^^^^^^^^^^^^ @@ -605,7 +605,7 @@ LL | #[debugger_visualizer] = note: for more information, visit error[E0565]: malformed `automatically_derived` attribute input - --> $DIR/malformed-attrs.rs:193:1 + --> $DIR/malformed-attrs.rs:192:1 | LL | #[automatically_derived = 18] | ^^^^^^^^^^^^^^^^^^^^^^^^----^ @@ -614,7 +614,7 @@ LL | #[automatically_derived = 18] | help: must be of the form: `#[automatically_derived]` error[E0565]: malformed `non_exhaustive` attribute input - --> $DIR/malformed-attrs.rs:201:1 + --> $DIR/malformed-attrs.rs:200:1 | LL | #[non_exhaustive = 1] | ^^^^^^^^^^^^^^^^^---^ @@ -623,7 +623,7 @@ LL | #[non_exhaustive = 1] | help: must be of the form: `#[non_exhaustive]` error[E0565]: malformed `thread_local` attribute input - --> $DIR/malformed-attrs.rs:207:1 + --> $DIR/malformed-attrs.rs:206:1 | LL | #[thread_local()] | ^^^^^^^^^^^^^^--^ @@ -632,7 +632,7 @@ LL | #[thread_local()] | help: must be of the form: `#[thread_local]` error[E0565]: malformed `no_link` attribute input - --> $DIR/malformed-attrs.rs:211:1 + --> $DIR/malformed-attrs.rs:210:1 | LL | #[no_link()] | ^^^^^^^^^--^ @@ -641,7 +641,7 @@ LL | #[no_link()] | help: must be of the form: `#[no_link]` error[E0539]: malformed `macro_use` attribute input - --> $DIR/malformed-attrs.rs:213:1 + --> $DIR/malformed-attrs.rs:212:1 | LL | #[macro_use = 1] | ^^^^^^^^^^^^---^ @@ -659,7 +659,7 @@ LL + #[macro_use] | error[E0539]: malformed `macro_export` attribute input - --> $DIR/malformed-attrs.rs:218:1 + --> $DIR/malformed-attrs.rs:217:1 | LL | #[macro_export = 18] | ^^^^^^^^^^^^^^^----^ @@ -676,7 +676,7 @@ LL + #[macro_export] | error[E0565]: malformed `allow_internal_unsafe` attribute input - --> $DIR/malformed-attrs.rs:220:1 + --> $DIR/malformed-attrs.rs:219:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^---^ @@ -685,7 +685,7 @@ LL | #[allow_internal_unsafe = 1] | help: must be of the form: `#[allow_internal_unsafe]` error: attribute should be applied to `const fn` - --> $DIR/malformed-attrs.rs:32:1 + --> $DIR/malformed-attrs.rs:31:1 | LL | #[rustc_allow_const_fn_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -697,7 +697,7 @@ LL | | } | |_- not a `const fn` warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/malformed-attrs.rs:83:1 + --> $DIR/malformed-attrs.rs:82:1 | LL | #[link] | ^^^^^^^ @@ -712,19 +712,19 @@ LL | | } = note: requested on the command line with `-W unused-attributes` error: `#[repr(align(...))]` is not supported on functions - --> $DIR/malformed-attrs.rs:47:1 + --> $DIR/malformed-attrs.rs:46:1 | LL | #[repr] | ^^^^^^^ | help: use `#[rustc_align(...)]` instead - --> $DIR/malformed-attrs.rs:47:1 + --> $DIR/malformed-attrs.rs:46:1 | LL | #[repr] | ^^^^^^^ warning: missing options for `on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:143:1 + --> $DIR/malformed-attrs.rs:142:1 | LL | #[diagnostic::on_unimplemented] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -733,7 +733,7 @@ LL | #[diagnostic::on_unimplemented] = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: malformed `on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:145:1 + --> $DIR/malformed-attrs.rs:144:1 | LL | #[diagnostic::on_unimplemented = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here @@ -741,7 +741,7 @@ LL | #[diagnostic::on_unimplemented = 1] = help: only `message`, `note` and `label` are allowed as options error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]` - --> $DIR/malformed-attrs.rs:42:1 + --> $DIR/malformed-attrs.rs:41:1 | LL | #[doc] | ^^^^^^ @@ -753,7 +753,7 @@ LL | #![deny(invalid_doc_attributes)] | ^^^^^^^^^^^^^^^^^^^^^^ error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` - --> $DIR/malformed-attrs.rs:52:1 + --> $DIR/malformed-attrs.rs:51:1 | LL | #[inline = 5] | ^^^^^^^^^^^^^ @@ -763,13 +763,13 @@ LL | #[inline = 5] = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` - --> $DIR/malformed-attrs.rs:74:1 + --> $DIR/malformed-attrs.rs:73:1 | LL | #[crate_name] | ^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/malformed-attrs.rs:115:1 + --> $DIR/malformed-attrs.rs:114:1 | LL | / fn test() { LL | | #[coroutine = 63] || {} @@ -778,13 +778,13 @@ LL | | } | |_^ error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]` - --> $DIR/malformed-attrs.rs:77:1 + --> $DIR/malformed-attrs.rs:76:1 | LL | #[doc] | ^^^^^^ warning: `#[link_name]` attribute cannot be used on functions - --> $DIR/malformed-attrs.rs:87:1 + --> $DIR/malformed-attrs.rs:86:1 | LL | #[link_name] | ^^^^^^^^^^^^ @@ -793,7 +793,7 @@ LL | #[link_name] = help: `#[link_name]` can be applied to foreign functions and foreign statics error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:97:1 + --> $DIR/malformed-attrs.rs:96:1 | LL | #[ignore()] | ^^^^^^^^^^^ @@ -802,7 +802,7 @@ LL | #[ignore()] = note: for more information, see issue #57571 warning: `#[no_implicit_prelude]` attribute cannot be used on functions - --> $DIR/malformed-attrs.rs:100:1 + --> $DIR/malformed-attrs.rs:99:1 | LL | #[no_implicit_prelude = 23] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -811,13 +811,13 @@ LL | #[no_implicit_prelude = 23] = help: `#[no_implicit_prelude]` can be applied to crates and modules warning: `#[diagnostic::do_not_recommend]` does not expect any arguments - --> $DIR/malformed-attrs.rs:152:1 + --> $DIR/malformed-attrs.rs:151:1 | LL | #[diagnostic::do_not_recommend()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[automatically_derived]` attribute cannot be used on modules - --> $DIR/malformed-attrs.rs:193:1 + --> $DIR/malformed-attrs.rs:192:1 | LL | #[automatically_derived = 18] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -826,7 +826,7 @@ LL | #[automatically_derived = 18] = help: `#[automatically_derived]` can only be applied to trait impl blocks error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:227:1 + --> $DIR/malformed-attrs.rs:226:1 | LL | #[ignore = 1] | ^^^^^^^^^^^^^ @@ -835,7 +835,7 @@ LL | #[ignore = 1] = note: for more information, see issue #57571 error[E0308]: mismatched types - --> $DIR/malformed-attrs.rs:116:23 + --> $DIR/malformed-attrs.rs:115:23 | LL | fn test() { | - help: a return type might be missing here: `-> _` @@ -843,7 +843,7 @@ LL | #[coroutine = 63] || {} | ^^^^^ expected `()`, found coroutine | = note: expected unit type `()` - found coroutine `{coroutine@$DIR/malformed-attrs.rs:116:23: 116:25}` + found coroutine `{coroutine@$DIR/malformed-attrs.rs:115:23: 115:25}` error: aborting due to 75 previous errors; 8 warnings emitted @@ -851,7 +851,7 @@ Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805 For more information about an error, try `rustc --explain E0308`. Future incompatibility report: Future breakage diagnostic: error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` - --> $DIR/malformed-attrs.rs:52:1 + --> $DIR/malformed-attrs.rs:51:1 | LL | #[inline = 5] | ^^^^^^^^^^^^^ @@ -862,7 +862,7 @@ LL | #[inline = 5] Future breakage diagnostic: error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:97:1 + --> $DIR/malformed-attrs.rs:96:1 | LL | #[ignore()] | ^^^^^^^^^^^ @@ -873,7 +873,7 @@ LL | #[ignore()] Future breakage diagnostic: error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:227:1 + --> $DIR/malformed-attrs.rs:226:1 | LL | #[ignore = 1] | ^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/use-doc-alias-name.rs b/tests/ui/attributes/use-doc-alias-name.rs index 1fc9199b6e382..4d27249b89a73 100644 --- a/tests/ui/attributes/use-doc-alias-name.rs +++ b/tests/ui/attributes/use-doc-alias-name.rs @@ -42,7 +42,7 @@ fn main() { //~| HELP: `S5` has a name defined in the doc alias attribute as `DocAliasS5` not_exist_module::DocAliasS1; - //~^ ERROR: use of unresolved module or unlinked crate `not_exist_module` + //~^ ERROR: cannot find module or crate `not_exist_module` //~| HELP: you might be missing a crate named `not_exist_module` use_doc_alias_name_extern::DocAliasS1; @@ -50,7 +50,7 @@ fn main() { //~| HELP: `S1` has a name defined in the doc alias attribute as `DocAliasS1` m::n::DocAliasX::y::S6; - //~^ ERROR: could not find `DocAliasX` in `n` + //~^ ERROR: cannot find `DocAliasX` in `n` //~| HELP: `x` has a name defined in the doc alias attribute as `DocAliasX` m::n::x::y::DocAliasS6; diff --git a/tests/ui/attributes/use-doc-alias-name.stderr b/tests/ui/attributes/use-doc-alias-name.stderr index 07f4865e41520..3b4a0a919b178 100644 --- a/tests/ui/attributes/use-doc-alias-name.stderr +++ b/tests/ui/attributes/use-doc-alias-name.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: could not find `DocAliasX` in `n` +error[E0433]: cannot find `DocAliasX` in `n` --> $DIR/use-doc-alias-name.rs:52:11 | LL | m::n::DocAliasX::y::S6; @@ -136,7 +136,7 @@ LL - doc_alias_f2(); LL + f(); | -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `not_exist_module` +error[E0433]: cannot find module or crate `not_exist_module` in this scope --> $DIR/use-doc-alias-name.rs:44:5 | LL | not_exist_module::DocAliasS1; diff --git a/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.rs b/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.rs index cf927e34fb418..48466af504815 100644 --- a/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.rs +++ b/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.rs @@ -4,9 +4,9 @@ fn main() { let mut a = E::StructVar { boxed: Box::new(5_i32) }; - //~^ ERROR failed to resolve: use of undeclared type `E` + //~^ ERROR cannot find type `E` match a { E::StructVar { box boxed } => { } - //~^ ERROR failed to resolve: use of undeclared type `E` + //~^ ERROR cannot find type `E` } } diff --git a/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.stderr b/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.stderr index ae5c67eae9a6c..7be9ed27db0e3 100644 --- a/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.stderr +++ b/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of undeclared type `E` +error[E0433]: cannot find type `E` in this scope --> $DIR/non-ADT-struct-pattern-box-pattern-ice-121463.rs:6:17 | LL | let mut a = E::StructVar { boxed: Box::new(5_i32) }; @@ -9,7 +9,7 @@ help: a trait with a similar name exists LL | let mut a = Eq::StructVar { boxed: Box::new(5_i32) }; | + -error[E0433]: failed to resolve: use of undeclared type `E` +error[E0433]: cannot find type `E` in this scope --> $DIR/non-ADT-struct-pattern-box-pattern-ice-121463.rs:9:9 | LL | E::StructVar { box boxed } => { } diff --git a/tests/ui/cfg/diagnostics-cross-crate.rs b/tests/ui/cfg/diagnostics-cross-crate.rs index f959332c817f0..c5d8dcdc62f0a 100644 --- a/tests/ui/cfg/diagnostics-cross-crate.rs +++ b/tests/ui/cfg/diagnostics-cross-crate.rs @@ -14,7 +14,7 @@ fn main() { // The module isn't found - we would like to get a diagnostic, but currently don't due to // the awkward way the resolver diagnostics are currently implemented. - cfged_out::inner::doesnt_exist::hello(); //~ ERROR failed to resolve + cfged_out::inner::doesnt_exist::hello(); //~ ERROR cannot find //~^ NOTE could not find `doesnt_exist` in `inner` //~| NOTE found an item that was configured out diff --git a/tests/ui/cfg/diagnostics-cross-crate.stderr b/tests/ui/cfg/diagnostics-cross-crate.stderr index 658e5a442bda0..15e60cc43a3c9 100644 --- a/tests/ui/cfg/diagnostics-cross-crate.stderr +++ b/tests/ui/cfg/diagnostics-cross-crate.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: could not find `doesnt_exist` in `inner` +error[E0433]: cannot find `doesnt_exist` in `inner` --> $DIR/diagnostics-cross-crate.rs:17:23 | LL | cfged_out::inner::doesnt_exist::hello(); diff --git a/tests/ui/cfg/diagnostics-reexport-2.rs b/tests/ui/cfg/diagnostics-reexport-2.rs index f66b9ed99ee6e..bef8325170618 100644 --- a/tests/ui/cfg/diagnostics-reexport-2.rs +++ b/tests/ui/cfg/diagnostics-reexport-2.rs @@ -40,22 +40,22 @@ mod reexport32 { fn main() { reexport::gated::foo(); - //~^ ERROR failed to resolve: could not find `gated` in `reexport` + //~^ ERROR cannot find //~| NOTE could not find `gated` in `reexport` reexport2::gated::foo(); - //~^ ERROR failed to resolve: could not find `gated` in `reexport2` + //~^ ERROR cannot find //~| NOTE could not find `gated` in `reexport2` reexport30::gated::foo(); - //~^ ERROR failed to resolve: could not find `gated` in `reexport30` + //~^ ERROR cannot find //~| NOTE could not find `gated` in `reexport30` reexport31::gated::foo(); - //~^ ERROR failed to resolve: could not find `gated` in `reexport31` + //~^ ERROR cannot find //~| NOTE could not find `gated` in `reexport31` reexport32::gated::foo(); - //~^ ERROR failed to resolve: could not find `gated` in `reexport32` + //~^ ERROR cannot find //~| NOTE could not find `gated` in `reexport32` } diff --git a/tests/ui/cfg/diagnostics-reexport-2.stderr b/tests/ui/cfg/diagnostics-reexport-2.stderr index 713cffce65b6b..a79c623856ff3 100644 --- a/tests/ui/cfg/diagnostics-reexport-2.stderr +++ b/tests/ui/cfg/diagnostics-reexport-2.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: could not find `gated` in `reexport` +error[E0433]: cannot find `gated` in `reexport` --> $DIR/diagnostics-reexport-2.rs:42:15 | LL | reexport::gated::foo(); @@ -13,7 +13,7 @@ LL | #[cfg(false)] LL | pub mod gated { | ^^^^^ -error[E0433]: failed to resolve: could not find `gated` in `reexport2` +error[E0433]: cannot find `gated` in `reexport2` --> $DIR/diagnostics-reexport-2.rs:46:16 | LL | reexport2::gated::foo(); @@ -28,7 +28,7 @@ LL | #[cfg(false)] LL | pub mod gated { | ^^^^^ -error[E0433]: failed to resolve: could not find `gated` in `reexport30` +error[E0433]: cannot find `gated` in `reexport30` --> $DIR/diagnostics-reexport-2.rs:50:17 | LL | reexport30::gated::foo(); @@ -43,7 +43,7 @@ LL | #[cfg(false)] LL | pub mod gated { | ^^^^^ -error[E0433]: failed to resolve: could not find `gated` in `reexport31` +error[E0433]: cannot find `gated` in `reexport31` --> $DIR/diagnostics-reexport-2.rs:54:17 | LL | reexport31::gated::foo(); @@ -58,7 +58,7 @@ LL | #[cfg(false)] LL | pub mod gated { | ^^^^^ -error[E0433]: failed to resolve: could not find `gated` in `reexport32` +error[E0433]: cannot find `gated` in `reexport32` --> $DIR/diagnostics-reexport-2.rs:58:17 | LL | reexport32::gated::foo(); diff --git a/tests/ui/cfg/diagnostics-same-crate.rs b/tests/ui/cfg/diagnostics-same-crate.rs index 29209d5f3eaa7..40babaa3d4c9a 100644 --- a/tests/ui/cfg/diagnostics-same-crate.rs +++ b/tests/ui/cfg/diagnostics-same-crate.rs @@ -50,7 +50,7 @@ fn main() { //~| NOTE not found in `inner` // The module isn't found - we get a diagnostic. - inner::doesnt_exist::hello(); //~ ERROR failed to resolve + inner::doesnt_exist::hello(); //~ ERROR cannot find //~| NOTE could not find `doesnt_exist` in `inner` // It should find the one in the right module, not the wrong one. diff --git a/tests/ui/cfg/diagnostics-same-crate.stderr b/tests/ui/cfg/diagnostics-same-crate.stderr index a8d789e61d1a3..c20542e19eaf3 100644 --- a/tests/ui/cfg/diagnostics-same-crate.stderr +++ b/tests/ui/cfg/diagnostics-same-crate.stderr @@ -28,7 +28,7 @@ LL | #[cfg(false)] LL | pub mod doesnt_exist { | ^^^^^^^^^^^^ -error[E0433]: failed to resolve: could not find `doesnt_exist` in `inner` +error[E0433]: cannot find `doesnt_exist` in `inner` --> $DIR/diagnostics-same-crate.rs:53:12 | LL | inner::doesnt_exist::hello(); diff --git a/tests/ui/coherence/conflicting-impl-with-err.rs b/tests/ui/coherence/conflicting-impl-with-err.rs index 3e0234b874d7b..49219b4c4a353 100644 --- a/tests/ui/coherence/conflicting-impl-with-err.rs +++ b/tests/ui/coherence/conflicting-impl-with-err.rs @@ -1,8 +1,8 @@ struct ErrorKind; struct Error(ErrorKind); -impl From for Error { //~ ERROR failed to resolve - fn from(_: nope::Thing) -> Self { //~ ERROR failed to resolve +impl From for Error { //~ ERROR cannot find + fn from(_: nope::Thing) -> Self { //~ ERROR cannot find unimplemented!() } } diff --git a/tests/ui/coherence/conflicting-impl-with-err.stderr b/tests/ui/coherence/conflicting-impl-with-err.stderr index 75a201797b551..706798bb00003 100644 --- a/tests/ui/coherence/conflicting-impl-with-err.stderr +++ b/tests/ui/coherence/conflicting-impl-with-err.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nope` +error[E0433]: cannot find module or crate `nope` in this scope --> $DIR/conflicting-impl-with-err.rs:4:11 | LL | impl From for Error { @@ -6,7 +6,7 @@ LL | impl From for Error { | = help: you might be missing a crate named `nope` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nope` +error[E0433]: cannot find module or crate `nope` in this scope --> $DIR/conflicting-impl-with-err.rs:5:16 | LL | fn from(_: nope::Thing) -> Self { diff --git a/tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.rs b/tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.rs index 9f20cf0857947..c08d36f4d9ff1 100644 --- a/tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.rs +++ b/tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.rs @@ -11,7 +11,7 @@ where //~^ ERROR only lifetime parameters can be used in this context //~| ERROR defaults for generic parameters are not allowed in `for<...>` binders //~| ERROR defaults for generic parameters are not allowed in `for<...>` binders - //~| ERROR failed to resolve: use of undeclared type `COT` + //~| ERROR cannot find //~| ERROR the name `N` is already used for a generic parameter in this item's generic parameters { } diff --git a/tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.stderr b/tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.stderr index 8e9b5b03d14ee..de81c021b829c 100644 --- a/tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.stderr +++ b/tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.stderr @@ -43,7 +43,7 @@ error: defaults for generic parameters are not allowed in `for<...>` binders LL | for [(); COT::BYTES]:, | ^^^^^^^ -error[E0433]: failed to resolve: use of undeclared type `COT` +error[E0433]: cannot find type `COT` in this scope --> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:10:43 | LL | for [(); COT::BYTES]:, diff --git a/tests/ui/const-generics/issues/issue-82956.rs b/tests/ui/const-generics/issues/issue-82956.rs index 983717170c342..8586c39a717aa 100644 --- a/tests/ui/const-generics/issues/issue-82956.rs +++ b/tests/ui/const-generics/issues/issue-82956.rs @@ -24,7 +24,7 @@ where fn pop(self) -> (Self::Newlen, Self::Output) { let mut iter = IntoIter::new(self); - //~^ ERROR: failed to resolve: use of undeclared type `IntoIter` + //~^ ERROR: cannot find let end = iter.next_back().unwrap(); let new = [(); N - 1].map(move |()| iter.next().unwrap()); (new, end) diff --git a/tests/ui/const-generics/issues/issue-82956.stderr b/tests/ui/const-generics/issues/issue-82956.stderr index beb8014961153..a3d5572d5474d 100644 --- a/tests/ui/const-generics/issues/issue-82956.stderr +++ b/tests/ui/const-generics/issues/issue-82956.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of undeclared type `IntoIter` +error[E0433]: cannot find type `IntoIter` in this scope --> $DIR/issue-82956.rs:26:24 | LL | let mut iter = IntoIter::new(self); diff --git a/tests/ui/consts/const_refs_to_static-ice-121413.rs b/tests/ui/consts/const_refs_to_static-ice-121413.rs index cc368d971c055..27d5d8600b4b0 100644 --- a/tests/ui/consts/const_refs_to_static-ice-121413.rs +++ b/tests/ui/consts/const_refs_to_static-ice-121413.rs @@ -7,7 +7,7 @@ const REF_INTERIOR_MUT: &usize = { //~^ HELP consider importing this struct static FOO: Sync = AtomicUsize::new(0); - //~^ ERROR failed to resolve: use of undeclared type `AtomicUsize` + //~^ ERROR cannot find //~| WARN trait objects without an explicit `dyn` are deprecated //~| ERROR the size for values of type `(dyn Sync + 'static)` cannot be known at compilation time //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! diff --git a/tests/ui/consts/const_refs_to_static-ice-121413.stderr b/tests/ui/consts/const_refs_to_static-ice-121413.stderr index 89429d83b2052..150b8cb079e72 100644 --- a/tests/ui/consts/const_refs_to_static-ice-121413.stderr +++ b/tests/ui/consts/const_refs_to_static-ice-121413.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of undeclared type `AtomicUsize` +error[E0433]: cannot find type `AtomicUsize` in this scope --> $DIR/const_refs_to_static-ice-121413.rs:9:24 | LL | static FOO: Sync = AtomicUsize::new(0); diff --git a/tests/ui/consts/precise-drop-allow-const-fn-unstable.rs b/tests/ui/consts/precise-drop-allow-const-fn-unstable.rs index 56155e519dca4..4bd5f746f5021 100644 --- a/tests/ui/consts/precise-drop-allow-const-fn-unstable.rs +++ b/tests/ui/consts/precise-drop-allow-const-fn-unstable.rs @@ -2,7 +2,7 @@ //@ compile-flags: --crate-type=lib -Cinstrument-coverage -Zno-profiler-runtime //@[allow] check-pass -#![feature(staged_api, rustc_allow_const_fn_unstable)] +#![feature(staged_api, rustc_attrs)] #![stable(feature = "rust_test", since = "1.0.0")] #[stable(feature = "rust_test", since = "1.0.0")] diff --git a/tests/ui/delegation/bad-resolve.rs b/tests/ui/delegation/bad-resolve.rs index 861f2b15da205..79acaec021a66 100644 --- a/tests/ui/delegation/bad-resolve.rs +++ b/tests/ui/delegation/bad-resolve.rs @@ -40,7 +40,7 @@ impl Trait for S { } mod prefix {} -reuse unresolved_prefix::{a, b, c}; //~ ERROR use of unresolved module or unlinked crate +reuse unresolved_prefix::{a, b, c}; //~ ERROR cannot find module or crate `unresolved_prefix` reuse prefix::{self, super, crate}; //~ ERROR `crate` in paths can only be used in start position fn main() {} diff --git a/tests/ui/delegation/bad-resolve.stderr b/tests/ui/delegation/bad-resolve.stderr index 4c015c226b18f..6fde0bb13877a 100644 --- a/tests/ui/delegation/bad-resolve.stderr +++ b/tests/ui/delegation/bad-resolve.stderr @@ -91,7 +91,7 @@ LL | type Type; LL | impl Trait for S { | ^^^^^^^^^^^^^^^^ missing `Type` in implementation -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `unresolved_prefix` +error[E0433]: cannot find module or crate `unresolved_prefix` in this scope --> $DIR/bad-resolve.rs:43:7 | LL | reuse unresolved_prefix::{a, b, c}; @@ -99,11 +99,11 @@ LL | reuse unresolved_prefix::{a, b, c}; | = help: you might be missing a crate named `unresolved_prefix` -error[E0433]: failed to resolve: `crate` in paths can only be used in start position +error[E0433]: `crate` in paths can only be used in start position --> $DIR/bad-resolve.rs:44:29 | LL | reuse prefix::{self, super, crate}; - | ^^^^^ `crate` in paths can only be used in start position + | ^^^^^ can only be used in path start position error: aborting due to 12 previous errors diff --git a/tests/ui/delegation/glob-bad-path.rs b/tests/ui/delegation/glob-bad-path.rs index 4ac9d68e8dd1c..067cb651777e1 100644 --- a/tests/ui/delegation/glob-bad-path.rs +++ b/tests/ui/delegation/glob-bad-path.rs @@ -5,7 +5,7 @@ trait Trait {} struct S; impl Trait for u8 { - reuse unresolved::*; //~ ERROR failed to resolve: use of unresolved module or unlinked crate `unresolved` + reuse unresolved::*; //~ ERROR cannot find module or crate `unresolved` reuse S::*; //~ ERROR expected trait, found struct `S` } diff --git a/tests/ui/delegation/glob-bad-path.stderr b/tests/ui/delegation/glob-bad-path.stderr index 15d9ca4120332..7e92bc045bbd5 100644 --- a/tests/ui/delegation/glob-bad-path.stderr +++ b/tests/ui/delegation/glob-bad-path.stderr @@ -4,7 +4,7 @@ error: expected trait, found struct `S` LL | reuse S::*; | ^ not a trait -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `unresolved` +error[E0433]: cannot find module or crate `unresolved` in this scope --> $DIR/glob-bad-path.rs:8:11 | LL | reuse unresolved::*; diff --git a/tests/ui/delegation/impl-reuse-bad-path.rs b/tests/ui/delegation/impl-reuse-bad-path.rs index 19eb51153468d..656be5d79d9b1 100644 --- a/tests/ui/delegation/impl-reuse-bad-path.rs +++ b/tests/ui/delegation/impl-reuse-bad-path.rs @@ -4,7 +4,7 @@ mod unresolved { struct S; reuse impl unresolved for S { self.0 } - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `unresolved` + //~^ ERROR cannot find module or crate `unresolved` in this scope //~| ERROR cannot find trait `unresolved` in this scope trait T {} diff --git a/tests/ui/delegation/impl-reuse-bad-path.stderr b/tests/ui/delegation/impl-reuse-bad-path.stderr index 5fadd719ae4da..bf486260c6695 100644 --- a/tests/ui/delegation/impl-reuse-bad-path.stderr +++ b/tests/ui/delegation/impl-reuse-bad-path.stderr @@ -16,7 +16,7 @@ error: expected trait, found module `TraitModule` LL | reuse impl TraitModule for S { self.0 } | ^^^^^^^^^^^ not a trait -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `unresolved` +error[E0433]: cannot find module or crate `unresolved` in this scope --> $DIR/impl-reuse-bad-path.rs:6:16 | LL | reuse impl unresolved for S { self.0 } diff --git a/tests/ui/derived-errors/issue-31997-1.stderr b/tests/ui/derived-errors/issue-31997-1.stderr index 40485027a660c..2fb830ac41fc3 100644 --- a/tests/ui/derived-errors/issue-31997-1.stderr +++ b/tests/ui/derived-errors/issue-31997-1.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of undeclared type `HashMap` +error[E0433]: cannot find type `HashMap` in this scope --> $DIR/issue-31997-1.rs:20:19 | LL | let mut map = HashMap::new(); diff --git a/tests/ui/dollar-crate/dollar-crate-is-keyword-2.rs b/tests/ui/dollar-crate/dollar-crate-is-keyword-2.rs index bbab6f8774876..b007425bd3751 100644 --- a/tests/ui/dollar-crate/dollar-crate-is-keyword-2.rs +++ b/tests/ui/dollar-crate/dollar-crate-is-keyword-2.rs @@ -2,12 +2,18 @@ mod a {} macro_rules! m { () => { - use a::$crate; //~ ERROR unresolved import `a::$crate` - use a::$crate::b; //~ ERROR `$crate` in paths can only be used in start position - type A = a::$crate; //~ ERROR `$crate` in paths can only be used in start position + use a::$crate; //~ ERROR: unresolved import `a::$crate` + //~^ NOTE: no `$crate` in `a` + use a::$crate::b; //~ ERROR: `$crate` in paths can only be used in start position + //~^ NOTE: can only be used in path start position + type A = a::$crate; //~ ERROR: `$crate` in paths can only be used in start position + //~^ NOTE: can only be used in path start position } } m!(); +//~^ NOTE: in this expansion +//~| NOTE: in this expansion +//~| NOTE: in this expansion fn main() {} diff --git a/tests/ui/dollar-crate/dollar-crate-is-keyword-2.stderr b/tests/ui/dollar-crate/dollar-crate-is-keyword-2.stderr index d46029710d6f7..fc49e4c3dc3d9 100644 --- a/tests/ui/dollar-crate/dollar-crate-is-keyword-2.stderr +++ b/tests/ui/dollar-crate/dollar-crate-is-keyword-2.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: `$crate` in paths can only be used in start position - --> $DIR/dollar-crate-is-keyword-2.rs:6:16 +error[E0433]: `$crate` in paths can only be used in start position + --> $DIR/dollar-crate-is-keyword-2.rs:7:16 | LL | use a::$crate::b; - | ^^^^^^ `$crate` in paths can only be used in start position + | ^^^^^^ can only be used in path start position ... LL | m!(); | ---- in this macro invocation @@ -20,11 +20,11 @@ LL | m!(); | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0433]: failed to resolve: `$crate` in paths can only be used in start position - --> $DIR/dollar-crate-is-keyword-2.rs:7:21 +error[E0433]: `$crate` in paths can only be used in start position + --> $DIR/dollar-crate-is-keyword-2.rs:9:21 | LL | type A = a::$crate; - | ^^^^^^ `$crate` in paths can only be used in start position + | ^^^^^^ can only be used in path start position ... LL | m!(); | ---- in this macro invocation diff --git a/tests/ui/eii/privacy2.rs b/tests/ui/eii/privacy2.rs index e3f1f8c863da0..c11061f311eda 100644 --- a/tests/ui/eii/privacy2.rs +++ b/tests/ui/eii/privacy2.rs @@ -13,7 +13,7 @@ fn eii1_impl(x: u64) { println!("{x:?}") } -#[codegen::eii3] //~ ERROR failed to resolve: could not find `eii3` in `codegen` +#[codegen::eii3] //~ ERROR cannot find `eii3` in `codegen` fn eii3_impl(x: u64) { println!("{x:?}") } diff --git a/tests/ui/eii/privacy2.stderr b/tests/ui/eii/privacy2.stderr index 9f4fd6a071c9c..f0a04bf635617 100644 --- a/tests/ui/eii/privacy2.stderr +++ b/tests/ui/eii/privacy2.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: could not find `eii3` in `codegen` +error[E0433]: cannot find `eii3` in `codegen` --> $DIR/privacy2.rs:16:12 | LL | #[codegen::eii3] diff --git a/tests/ui/enum/assoc-fn-call-on-variant.rs b/tests/ui/enum/assoc-fn-call-on-variant.rs index 0886e7dcd8d82..c85d00eb0de8f 100644 --- a/tests/ui/enum/assoc-fn-call-on-variant.rs +++ b/tests/ui/enum/assoc-fn-call-on-variant.rs @@ -12,5 +12,6 @@ impl E { } fn main() { - E::A::f(); //~ ERROR failed to resolve: `A` is a variant, not a module + E::A::f(); //~ ERROR cannot find module `A` in `E` + //~^ NOTE: `A` is a variant, not a module } diff --git a/tests/ui/enum/assoc-fn-call-on-variant.stderr b/tests/ui/enum/assoc-fn-call-on-variant.stderr index ee75870ad394c..ab7049e22f4be 100644 --- a/tests/ui/enum/assoc-fn-call-on-variant.stderr +++ b/tests/ui/enum/assoc-fn-call-on-variant.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: `A` is a variant, not a module +error[E0433]: cannot find module `A` in `E` --> $DIR/assoc-fn-call-on-variant.rs:15:8 | LL | E::A::f(); diff --git a/tests/ui/error-codes/E0433.stderr b/tests/ui/error-codes/E0433.stderr index 1ac8c3ebc4d40..e1e09045e0dc0 100644 --- a/tests/ui/error-codes/E0433.stderr +++ b/tests/ui/error-codes/E0433.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of undeclared type `NonExistingMap` +error[E0433]: cannot find type `NonExistingMap` in this scope --> $DIR/E0433.rs:2:15 | LL | let map = NonExistingMap::new(); diff --git a/tests/ui/extern-flag/multiple-opts.rs b/tests/ui/extern-flag/multiple-opts.rs index 091064a070c37..5ba9ff96ac356 100644 --- a/tests/ui/extern-flag/multiple-opts.rs +++ b/tests/ui/extern-flag/multiple-opts.rs @@ -16,5 +16,5 @@ pub mod m { } fn main() { - somedep::somefun(); //~ ERROR failed to resolve + somedep::somefun(); //~ ERROR cannot find } diff --git a/tests/ui/extern-flag/multiple-opts.stderr b/tests/ui/extern-flag/multiple-opts.stderr index d0f38bad94c6e..698565626e3ae 100644 --- a/tests/ui/extern-flag/multiple-opts.stderr +++ b/tests/ui/extern-flag/multiple-opts.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `somedep` +error[E0433]: cannot find module or crate `somedep` in this scope --> $DIR/multiple-opts.rs:19:5 | LL | somedep::somefun(); diff --git a/tests/ui/extern-flag/noprelude.rs b/tests/ui/extern-flag/noprelude.rs index 4af617a1d628b..12425f3fb8d9b 100644 --- a/tests/ui/extern-flag/noprelude.rs +++ b/tests/ui/extern-flag/noprelude.rs @@ -3,5 +3,5 @@ //@ edition:2018 fn main() { - somedep::somefun(); //~ ERROR failed to resolve + somedep::somefun(); //~ ERROR cannot find } diff --git a/tests/ui/extern-flag/noprelude.stderr b/tests/ui/extern-flag/noprelude.stderr index fbd84956f66dc..4d8553085ae84 100644 --- a/tests/ui/extern-flag/noprelude.stderr +++ b/tests/ui/extern-flag/noprelude.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `somedep` +error[E0433]: cannot find module or crate `somedep` in this scope --> $DIR/noprelude.rs:6:5 | LL | somedep::somefun(); diff --git a/tests/ui/extern/extern-macro.rs b/tests/ui/extern/extern-macro.rs index ab974e628ff19..cfb4f76f59c7c 100644 --- a/tests/ui/extern/extern-macro.rs +++ b/tests/ui/extern/extern-macro.rs @@ -2,5 +2,5 @@ fn main() { enum Foo {} - let _ = Foo::bar!(); //~ ERROR failed to resolve: partially resolved path in a macro + let _ = Foo::bar!(); //~ ERROR cannot find macro `bar` in enum `Foo` } diff --git a/tests/ui/extern/extern-macro.stderr b/tests/ui/extern/extern-macro.stderr index e4d767f0e8644..83628846de776 100644 --- a/tests/ui/extern/extern-macro.stderr +++ b/tests/ui/extern/extern-macro.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: partially resolved path in a macro +error[E0433]: cannot find macro `bar` in enum `Foo` --> $DIR/extern-macro.rs:5:13 | LL | let _ = Foo::bar!(); - | ^^^^^^^^ partially resolved path in a macro + | ^^^^^^^^ a macro can't exist within an enum error: aborting due to 1 previous error diff --git a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.rs b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.rs index e52a2140e86d0..ea51ae0edca5f 100644 --- a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.rs +++ b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.rs @@ -2,5 +2,5 @@ use core::default; //~ ERROR unresolved import `core` fn main() { - let _: u8 = ::core::default::Default(); //~ ERROR failed to resolve + let _: u8 = ::core::default::Default(); //~ ERROR cannot find } diff --git a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr index dd78501de7185..4f073e4fe228a 100644 --- a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr +++ b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr @@ -7,7 +7,7 @@ LL | use core::default; | you might be missing crate `core` | help: try using `std` instead of `core`: `std` -error[E0433]: failed to resolve: you might be missing crate `core` +error[E0433]: cannot find `core` in the crate root --> $DIR/feature-gate-extern_absolute_paths.rs:5:19 | LL | let _: u8 = ::core::default::Default(); diff --git a/tests/ui/feature-gates/feature-gate-final-associated-functions.stderr b/tests/ui/feature-gates/feature-gate-final-associated-functions.stderr index b3731acd1d905..cd21aa1c0bf36 100644 --- a/tests/ui/feature-gates/feature-gate-final-associated-functions.stderr +++ b/tests/ui/feature-gates/feature-gate-final-associated-functions.stderr @@ -4,7 +4,7 @@ error[E0658]: `final` on trait functions is experimental LL | final fn bar() {} | ^^^^^ | - = note: see issue #1 for more information + = note: see issue #131179 for more information = help: add `#![feature(final_associated_functions)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date diff --git a/tests/ui/feature-gates/feature-gate-rustc-allow-const-fn-unstable.rs b/tests/ui/feature-gates/feature-gate-rustc-allow-const-fn-unstable.rs index 19d8fa87f5536..0c0e0c3629361 100644 --- a/tests/ui/feature-gates/feature-gate-rustc-allow-const-fn-unstable.rs +++ b/tests/ui/feature-gates/feature-gate-rustc-allow-const-fn-unstable.rs @@ -1,6 +1,6 @@ #![allow(unused_macros)] -#[rustc_allow_const_fn_unstable()] //~ ERROR rustc_allow_const_fn_unstable side-steps +#[rustc_allow_const_fn_unstable()] //~ ERROR use of an internal attribute const fn foo() { } fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-rustc-allow-const-fn-unstable.stderr b/tests/ui/feature-gates/feature-gate-rustc-allow-const-fn-unstable.stderr index 44f7a4bb0e688..42424abcc3cb6 100644 --- a/tests/ui/feature-gates/feature-gate-rustc-allow-const-fn-unstable.stderr +++ b/tests/ui/feature-gates/feature-gate-rustc-allow-const-fn-unstable.stderr @@ -1,12 +1,12 @@ -error[E0658]: rustc_allow_const_fn_unstable side-steps feature gating and stability checks +error[E0658]: use of an internal attribute --> $DIR/feature-gate-rustc-allow-const-fn-unstable.rs:3:1 | LL | #[rustc_allow_const_fn_unstable()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: see issue #69399 for more information - = help: add `#![feature(rustc_allow_const_fn_unstable)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable + = note: the `#[rustc_allow_const_fn_unstable]` attribute is an internal implementation detail that will never be stable + = note: rustc_allow_const_fn_unstable side-steps feature gating and stability checks error: aborting due to 1 previous error diff --git a/tests/ui/foreign/stashed-issue-121451.rs b/tests/ui/foreign/stashed-issue-121451.rs index 77a736739bfa0..f71e9dd8cc4e0 100644 --- a/tests/ui/foreign/stashed-issue-121451.rs +++ b/tests/ui/foreign/stashed-issue-121451.rs @@ -1,4 +1,4 @@ extern "C" fn _f() -> libc::uintptr_t {} -//~^ ERROR failed to resolve +//~^ ERROR cannot find fn main() {} diff --git a/tests/ui/foreign/stashed-issue-121451.stderr b/tests/ui/foreign/stashed-issue-121451.stderr index 31dd3b4fb5e8d..8a84d5e918ee1 100644 --- a/tests/ui/foreign/stashed-issue-121451.stderr +++ b/tests/ui/foreign/stashed-issue-121451.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `libc` +error[E0433]: cannot find module or crate `libc` in this scope --> $DIR/stashed-issue-121451.rs:1:23 | LL | extern "C" fn _f() -> libc::uintptr_t {} diff --git a/tests/ui/generic-associated-types/equality-bound.rs b/tests/ui/generic-associated-types/equality-bound.rs index be05181f5d09e..c136a6d4bdf2e 100644 --- a/tests/ui/generic-associated-types/equality-bound.rs +++ b/tests/ui/generic-associated-types/equality-bound.rs @@ -8,7 +8,7 @@ fn sum2(i: I) -> i32 where I::Item = i32 { } fn sum3(i: J) -> i32 where I::Item = i32 { //~^ ERROR equality constraints are not yet supported in `where` clauses -//~| ERROR failed to resolve: use of undeclared type `I` +//~| ERROR cannot find type `I` panic!() } diff --git a/tests/ui/generic-associated-types/equality-bound.stderr b/tests/ui/generic-associated-types/equality-bound.stderr index 265c86ac5bb61..0ceb5e329ab3a 100644 --- a/tests/ui/generic-associated-types/equality-bound.stderr +++ b/tests/ui/generic-associated-types/equality-bound.stderr @@ -200,7 +200,7 @@ LL - fn from_iter(_: T) -> Self where T::Item = A, T: IntoIterator, LL + fn from_iter(_: T) -> Self where T::Item = K, T: IntoIterator, | -error[E0433]: failed to resolve: use of undeclared type `I` +error[E0433]: cannot find type `I` in this scope --> $DIR/equality-bound.rs:9:41 | LL | fn sum3(i: J) -> i32 where I::Item = i32 { diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs index 71c33674b37fc..60355c22bb301 100644 --- a/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs +++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs @@ -10,7 +10,7 @@ macro a() { mod u { // Late resolution. fn f() { my_core::mem::drop(0); } - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `my_core` + //~^ ERROR cannot find } } @@ -23,7 +23,7 @@ mod v { mod u { // Late resolution. fn f() { my_core::mem::drop(0); } - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `my_core` + //~^ ERROR cannot find } fn main() {} diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr index 87ef07c27f5bd..db1a56d7d8169 100644 --- a/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr +++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr @@ -15,7 +15,7 @@ LL | a!(); | = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `my_core` +error[E0433]: cannot find module or crate `my_core` in this scope --> $DIR/extern-prelude-from-opaque-fail-2018.rs:12:18 | LL | fn f() { my_core::mem::drop(0); } @@ -29,7 +29,7 @@ LL | a!(); std::mem = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `my_core` +error[E0433]: cannot find module or crate `my_core` in this scope --> $DIR/extern-prelude-from-opaque-fail-2018.rs:25:14 | LL | fn f() { my_core::mem::drop(0); } diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs b/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs index 8265b73cc565b..8f75ba1434a14 100644 --- a/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs +++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs @@ -10,7 +10,7 @@ macro a() { mod u { // Late resolution. fn f() { my_core::mem::drop(0); } - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `my_core` + //~^ ERROR cannot find } } @@ -23,7 +23,7 @@ mod v { mod u { // Late resolution. fn f() { my_core::mem::drop(0); } - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `my_core` + //~^ ERROR cannot find } fn main() {} diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr b/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr index d36bc9130953e..f3a43fa0127c8 100644 --- a/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr +++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr @@ -15,7 +15,7 @@ LL | a!(); | = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `my_core` +error[E0433]: cannot find module or crate `my_core` in this scope --> $DIR/extern-prelude-from-opaque-fail.rs:12:18 | LL | fn f() { my_core::mem::drop(0); } @@ -29,7 +29,7 @@ LL | a!(); my_core::mem = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `my_core` +error[E0433]: cannot find module or crate `my_core` in this scope --> $DIR/extern-prelude-from-opaque-fail.rs:25:14 | LL | fn f() { my_core::mem::drop(0); } diff --git a/tests/ui/hygiene/no_implicit_prelude.rs b/tests/ui/hygiene/no_implicit_prelude.rs index 8145212fe309d..bfe7a6a446143 100644 --- a/tests/ui/hygiene/no_implicit_prelude.rs +++ b/tests/ui/hygiene/no_implicit_prelude.rs @@ -9,7 +9,7 @@ mod foo { #[no_implicit_prelude] mod bar { pub macro m() { - Vec::new(); //~ ERROR failed to resolve + Vec::new(); //~ ERROR cannot find ().clone() //~ ERROR no method named `clone` found } fn f() { diff --git a/tests/ui/hygiene/no_implicit_prelude.stderr b/tests/ui/hygiene/no_implicit_prelude.stderr index 0606fe5013862..5461ee527b880 100644 --- a/tests/ui/hygiene/no_implicit_prelude.stderr +++ b/tests/ui/hygiene/no_implicit_prelude.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of undeclared type `Vec` +error[E0433]: cannot find type `Vec` in this scope --> $DIR/no_implicit_prelude.rs:12:9 | LL | fn f() { ::bar::m!(); } diff --git a/tests/ui/impl-trait/issues/issue-72911.rs b/tests/ui/impl-trait/issues/issue-72911.rs index 63f4898f4306b..b105860ba6517 100644 --- a/tests/ui/impl-trait/issues/issue-72911.rs +++ b/tests/ui/impl-trait/issues/issue-72911.rs @@ -9,12 +9,12 @@ pub fn gather_all() -> impl Iterator { } fn gather_from_file(dir_entry: &foo::MissingItem) -> impl Iterator { - //~^ ERROR: failed to resolve + //~^ ERROR: cannot find unimplemented!() } fn lint_files() -> impl Iterator { - //~^ ERROR: failed to resolve + //~^ ERROR: cannot find unimplemented!() } diff --git a/tests/ui/impl-trait/issues/issue-72911.stderr b/tests/ui/impl-trait/issues/issue-72911.stderr index 063b7f68dc02a..1333f608ead17 100644 --- a/tests/ui/impl-trait/issues/issue-72911.stderr +++ b/tests/ui/impl-trait/issues/issue-72911.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `foo` +error[E0433]: cannot find module or crate `foo` in this scope --> $DIR/issue-72911.rs:11:33 | LL | fn gather_from_file(dir_entry: &foo::MissingItem) -> impl Iterator { @@ -6,7 +6,7 @@ LL | fn gather_from_file(dir_entry: &foo::MissingItem) -> impl Iterator $DIR/issue-72911.rs:16:41 | LL | fn lint_files() -> impl Iterator { diff --git a/tests/ui/impl-trait/stashed-diag-issue-121504.rs b/tests/ui/impl-trait/stashed-diag-issue-121504.rs index 84686ba4f7d3d..ee2cd1ee816fa 100644 --- a/tests/ui/impl-trait/stashed-diag-issue-121504.rs +++ b/tests/ui/impl-trait/stashed-diag-issue-121504.rs @@ -4,7 +4,7 @@ trait MyTrait { async fn foo(self) -> (Self, i32); } -impl MyTrait for xyz::T { //~ ERROR failed to resolve: use of unresolved module or unlinked crate `xyz` +impl MyTrait for xyz::T { //~ ERROR cannot find module or crate `xyz` async fn foo(self, key: i32) -> (u32, i32) { (self, key) } diff --git a/tests/ui/impl-trait/stashed-diag-issue-121504.stderr b/tests/ui/impl-trait/stashed-diag-issue-121504.stderr index 41c6cc425558d..f973e6c9dc423 100644 --- a/tests/ui/impl-trait/stashed-diag-issue-121504.stderr +++ b/tests/ui/impl-trait/stashed-diag-issue-121504.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `xyz` +error[E0433]: cannot find module or crate `xyz` in this scope --> $DIR/stashed-diag-issue-121504.rs:7:18 | LL | impl MyTrait for xyz::T { diff --git a/tests/ui/imports/absolute-paths-in-nested-use-groups.rs b/tests/ui/imports/absolute-paths-in-nested-use-groups.rs index 96b5131674c75..9a8c9aab72828 100644 --- a/tests/ui/imports/absolute-paths-in-nested-use-groups.rs +++ b/tests/ui/imports/absolute-paths-in-nested-use-groups.rs @@ -3,9 +3,12 @@ mod foo {} use foo::{ - ::bar, //~ ERROR crate root in paths can only be used in start position - super::bar, //~ ERROR `super` in paths can only be used in start position - self::bar, //~ ERROR `self` in paths can only be used in start position + ::bar, + //~^ ERROR: crate root in paths can only be used in start position + super::bar, + //~^ ERROR: `super` in paths can only be used in start position + self::bar, + //~^ ERROR: `self` in paths can only be used in start position }; fn main() {} diff --git a/tests/ui/imports/absolute-paths-in-nested-use-groups.stderr b/tests/ui/imports/absolute-paths-in-nested-use-groups.stderr index e41590ac45eed..ff951ad7489c7 100644 --- a/tests/ui/imports/absolute-paths-in-nested-use-groups.stderr +++ b/tests/ui/imports/absolute-paths-in-nested-use-groups.stderr @@ -1,20 +1,20 @@ -error[E0433]: failed to resolve: crate root in paths can only be used in start position +error[E0433]: the crate root in paths can only be used in start position --> $DIR/absolute-paths-in-nested-use-groups.rs:6:5 | LL | ::bar, - | ^ crate root in paths can only be used in start position + | ^ can only be used in path start position -error[E0433]: failed to resolve: `super` in paths can only be used in start position - --> $DIR/absolute-paths-in-nested-use-groups.rs:7:5 +error[E0433]: `super` in paths can only be used in start position + --> $DIR/absolute-paths-in-nested-use-groups.rs:8:5 | LL | super::bar, - | ^^^^^ `super` in paths can only be used in start position + | ^^^^^ can only be used in path start position -error[E0433]: failed to resolve: `self` in paths can only be used in start position - --> $DIR/absolute-paths-in-nested-use-groups.rs:8:5 +error[E0433]: `self` in paths can only be used in start position + --> $DIR/absolute-paths-in-nested-use-groups.rs:10:5 | LL | self::bar, - | ^^^^ `self` in paths can only be used in start position + | ^^^^ can only be used in path start position error: aborting due to 3 previous errors diff --git a/tests/ui/imports/extern-prelude-extern-crate-fail.rs b/tests/ui/imports/extern-prelude-extern-crate-fail.rs index 84751ecc02b63..7412706dcf39c 100644 --- a/tests/ui/imports/extern-prelude-extern-crate-fail.rs +++ b/tests/ui/imports/extern-prelude-extern-crate-fail.rs @@ -7,7 +7,7 @@ mod n { mod m { fn check() { - two_macros::m!(); //~ ERROR failed to resolve: use of unresolved module or unlinked crate `two_macros` + two_macros::m!(); //~ ERROR cannot find } } diff --git a/tests/ui/imports/extern-prelude-extern-crate-fail.stderr b/tests/ui/imports/extern-prelude-extern-crate-fail.stderr index ec53730afa024..42735ff90c90b 100644 --- a/tests/ui/imports/extern-prelude-extern-crate-fail.stderr +++ b/tests/ui/imports/extern-prelude-extern-crate-fail.stderr @@ -9,7 +9,7 @@ LL | define_std_as_non_existent!(); | = note: this error originates in the macro `define_std_as_non_existent` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `two_macros` +error[E0433]: cannot find module or crate `two_macros` in this scope --> $DIR/extern-prelude-extern-crate-fail.rs:10:9 | LL | two_macros::m!(); diff --git a/tests/ui/imports/nested-import-root-symbol-150103.rs b/tests/ui/imports/nested-import-root-symbol-150103.rs index 066ed37d8bbbd..7e126d8188c76 100644 --- a/tests/ui/imports/nested-import-root-symbol-150103.rs +++ b/tests/ui/imports/nested-import-root-symbol-150103.rs @@ -3,11 +3,11 @@ // caused by `{{root}}` appearing in diagnostic suggestions mod A { - use Iuse::{ ::Fish }; //~ ERROR failed to resolve: use of unresolved module or unlinked crate + use Iuse::{ ::Fish }; //~ ERROR cannot find module or crate `Iuse` in the crate root } mod B { - use A::{::Fish}; //~ ERROR failed to resolve: crate root in paths can only be used in start position + use A::{::Fish}; //~ ERROR the crate root in paths can only be used in start position } fn main() {} diff --git a/tests/ui/imports/nested-import-root-symbol-150103.stderr b/tests/ui/imports/nested-import-root-symbol-150103.stderr index be8b8c12d2187..e5240ceef2683 100644 --- a/tests/ui/imports/nested-import-root-symbol-150103.stderr +++ b/tests/ui/imports/nested-import-root-symbol-150103.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `Iuse` +error[E0433]: cannot find module or crate `Iuse` in the crate root --> $DIR/nested-import-root-symbol-150103.rs:6:9 | LL | use Iuse::{ ::Fish }; @@ -9,11 +9,11 @@ help: you might be missing a crate named `Iuse`, add it to your project and impo LL + extern crate Iuse; | -error[E0433]: failed to resolve: crate root in paths can only be used in start position +error[E0433]: the crate root in paths can only be used in start position --> $DIR/nested-import-root-symbol-150103.rs:10:13 | LL | use A::{::Fish}; - | ^ crate root in paths can only be used in start position + | ^ can only be used in path start position error: aborting due to 2 previous errors diff --git a/tests/ui/imports/overwrite-different-vis-3.rs b/tests/ui/imports/overwrite-different-vis-3.rs new file mode 100644 index 0000000000000..f45c5cdfb3abf --- /dev/null +++ b/tests/ui/imports/overwrite-different-vis-3.rs @@ -0,0 +1,14 @@ +// Regression test for issue #152606. + +//@ check-pass + +mod outer { + mod inner { + use super::*; // should go before the ambiguous glob imports + } + + use crate::*; + pub use crate::*; +} + +fn main() {} diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr index 91fad1fb3099c..b079471e809c9 100644 --- a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: unresolved import +error[E0433]: cannot find `bar` in `crate` --> $DIR/suggest-import-issue-120074.rs:14:35 | LL | println!("Hello, {}!", crate::bar::do_the_thing); diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr deleted file mode 100644 index 91fad1fb3099c..0000000000000 --- a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0433]: failed to resolve: unresolved import - --> $DIR/suggest-import-issue-120074.rs:14:35 - | -LL | println!("Hello, {}!", crate::bar::do_the_thing); - | ^^^ unresolved import - | -help: a similar path exists - | -LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); - | +++++ -help: consider importing this module - | -LL + use foo::bar; - | -help: if you import `bar`, refer to it directly - | -LL - println!("Hello, {}!", crate::bar::do_the_thing); -LL + println!("Hello, {}!", bar::do_the_thing); - | - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/imports/suggest-import-issue-120074.post2015.stderr b/tests/ui/imports/suggest-import-issue-120074.post2015.stderr index f334fb31a3dc1..045a7df3feeaf 100644 --- a/tests/ui/imports/suggest-import-issue-120074.post2015.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.post2015.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: unresolved import +error[E0433]: cannot find `bar` in `crate` --> $DIR/suggest-import-issue-120074.rs:14:35 | LL | println!("Hello, {}!", crate::bar::do_the_thing); diff --git a/tests/ui/imports/suggest-import-issue-120074.rs b/tests/ui/imports/suggest-import-issue-120074.rs index 4ca0d52b1f3ee..27027405f4dee 100644 --- a/tests/ui/imports/suggest-import-issue-120074.rs +++ b/tests/ui/imports/suggest-import-issue-120074.rs @@ -11,5 +11,5 @@ pub mod foo { } fn main() { - println!("Hello, {}!", crate::bar::do_the_thing); //~ ERROR failed to resolve: unresolved import + println!("Hello, {}!", crate::bar::do_the_thing); //~ ERROR cannot find `bar` in `crate` } diff --git a/tests/ui/imports/tool-mod-child.rs b/tests/ui/imports/tool-mod-child.rs index c0978046719af..6f67d200c2d76 100644 --- a/tests/ui/imports/tool-mod-child.rs +++ b/tests/ui/imports/tool-mod-child.rs @@ -1,8 +1,8 @@ //@ edition:2015 use clippy::a; //~ ERROR unresolved import `clippy` -use clippy::a::b; //~ ERROR failed to resolve: use of unresolved module or unlinked crate `clippy` +use clippy::a::b; //~ ERROR cannot find use rustdoc::a; //~ ERROR unresolved import `rustdoc` -use rustdoc::a::b; //~ ERROR failed to resolve: use of unresolved module or unlinked crate `rustdoc` +use rustdoc::a::b; //~ ERROR cannot find fn main() {} diff --git a/tests/ui/imports/tool-mod-child.stderr b/tests/ui/imports/tool-mod-child.stderr index 3e216c492d34a..babb5e21cbf7f 100644 --- a/tests/ui/imports/tool-mod-child.stderr +++ b/tests/ui/imports/tool-mod-child.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `clippy` +error[E0433]: cannot find module or crate `clippy` in the crate root --> $DIR/tool-mod-child.rs:3:5 | LL | use clippy::a::b; @@ -20,7 +20,7 @@ help: you might be missing a crate named `clippy`, add it to your project and im LL + extern crate clippy; | -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `rustdoc` +error[E0433]: cannot find module or crate `rustdoc` in the crate root --> $DIR/tool-mod-child.rs:6:5 | LL | use rustdoc::a::b; diff --git a/tests/ui/issues/issue-38857.rs b/tests/ui/issues/issue-38857.rs index 81d881c100bb6..63a0af759a3de 100644 --- a/tests/ui/issues/issue-38857.rs +++ b/tests/ui/issues/issue-38857.rs @@ -1,5 +1,5 @@ fn main() { let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() }; - //~^ ERROR failed to resolve: could not find `imp` in `sys` [E0433] - //~^^ ERROR module `sys` is private [E0603] + //~^ ERROR: cannot find `imp` in `sys` [E0433] + //~| ERROR: module `sys` is private [E0603] } diff --git a/tests/ui/issues/issue-38857.stderr b/tests/ui/issues/issue-38857.stderr index 4d505784b8654..85a0c266ac657 100644 --- a/tests/ui/issues/issue-38857.stderr +++ b/tests/ui/issues/issue-38857.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: could not find `imp` in `sys` +error[E0433]: cannot find `imp` in `sys` --> $DIR/issue-38857.rs:2:23 | LL | let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() }; diff --git a/tests/ui/issues/issue-46101.rs b/tests/ui/issues/issue-46101.rs index ab3d30d401f06..86b06f7c61d0a 100644 --- a/tests/ui/issues/issue-46101.rs +++ b/tests/ui/issues/issue-46101.rs @@ -1,6 +1,6 @@ trait Foo {} -#[derive(Foo::Anything)] //~ ERROR failed to resolve: partially resolved path in a derive macro - //~| ERROR failed to resolve: partially resolved path in a derive macro +#[derive(Foo::Anything)] //~ ERROR cannot find + //~| ERROR cannot find struct S; fn main() {} diff --git a/tests/ui/issues/issue-46101.stderr b/tests/ui/issues/issue-46101.stderr index a0cdd5d5f0532..1dada87d72d64 100644 --- a/tests/ui/issues/issue-46101.stderr +++ b/tests/ui/issues/issue-46101.stderr @@ -1,14 +1,14 @@ -error[E0433]: failed to resolve: partially resolved path in a derive macro +error[E0433]: cannot find derive macro `Anything` in trait `Foo` --> $DIR/issue-46101.rs:2:10 | LL | #[derive(Foo::Anything)] - | ^^^^^^^^^^^^^ partially resolved path in a derive macro + | ^^^^^^^^^^^^^ a derive macro can't exist within a trait -error[E0433]: failed to resolve: partially resolved path in a derive macro +error[E0433]: cannot find derive macro `Anything` in trait `Foo` --> $DIR/issue-46101.rs:2:10 | LL | #[derive(Foo::Anything)] - | ^^^^^^^^^^^^^ partially resolved path in a derive macro + | ^^^^^^^^^^^^^ a derive macro can't exist within a trait | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/keyword/keyword-super-as-identifier.rs b/tests/ui/keyword/keyword-super-as-identifier.rs index 02c1b27b08a96..0aeb224e183be 100644 --- a/tests/ui/keyword/keyword-super-as-identifier.rs +++ b/tests/ui/keyword/keyword-super-as-identifier.rs @@ -1,3 +1,3 @@ fn main() { - let super = 22; //~ ERROR failed to resolve: there are too many leading `super` keywords + let super = 22; //~ ERROR too many leading `super` keywords } diff --git a/tests/ui/keyword/keyword-super-as-identifier.stderr b/tests/ui/keyword/keyword-super-as-identifier.stderr index bfb27c143ff79..d8609c6bcbe8c 100644 --- a/tests/ui/keyword/keyword-super-as-identifier.stderr +++ b/tests/ui/keyword/keyword-super-as-identifier.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: there are too many leading `super` keywords +error[E0433]: too many leading `super` keywords --> $DIR/keyword-super-as-identifier.rs:2:9 | LL | let super = 22; diff --git a/tests/ui/keyword/keyword-super.rs b/tests/ui/keyword/keyword-super.rs index c121a6c1050ea..c21149a846fe0 100644 --- a/tests/ui/keyword/keyword-super.rs +++ b/tests/ui/keyword/keyword-super.rs @@ -1,3 +1,3 @@ fn main() { - let super: isize; //~ ERROR failed to resolve: there are too many leading `super` keywords + let super: isize; //~ ERROR: too many leading `super` keywords } diff --git a/tests/ui/keyword/keyword-super.stderr b/tests/ui/keyword/keyword-super.stderr index bf595442c3b8b..69af7da09376a 100644 --- a/tests/ui/keyword/keyword-super.stderr +++ b/tests/ui/keyword/keyword-super.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: there are too many leading `super` keywords +error[E0433]: too many leading `super` keywords --> $DIR/keyword-super.rs:2:9 | LL | let super: isize; diff --git a/tests/ui/lifetimes/issue-97194.rs b/tests/ui/lifetimes/issue-97194.rs index 5f3560dbe946e..5e7c3683d209b 100644 --- a/tests/ui/lifetimes/issue-97194.rs +++ b/tests/ui/lifetimes/issue-97194.rs @@ -1,8 +1,8 @@ extern "C" { fn bget(&self, index: [usize; Self::DIM]) -> bool { - //~^ ERROR incorrect function inside `extern` block - //~| ERROR `self` parameter is only allowed in associated functions - //~| ERROR failed to resolve: `Self` + //~^ ERROR: incorrect function inside `extern` block + //~| ERROR: `self` parameter is only allowed in associated functions + //~| ERROR: cannot find `Self` type T<'a> = &'a str; } } diff --git a/tests/ui/lifetimes/issue-97194.stderr b/tests/ui/lifetimes/issue-97194.stderr index 345e21cb2507e..c7e318f7390a7 100644 --- a/tests/ui/lifetimes/issue-97194.stderr +++ b/tests/ui/lifetimes/issue-97194.stderr @@ -22,7 +22,7 @@ LL | fn bget(&self, index: [usize; Self::DIM]) -> bool { | = note: associated functions are those in `impl` or `trait` definitions -error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions +error[E0433]: cannot find `Self` in this scope --> $DIR/issue-97194.rs:2:35 | LL | fn bget(&self, index: [usize; Self::DIM]) -> bool { diff --git a/tests/ui/lifetimes/mut-ref-owned-suggestion.rs b/tests/ui/lifetimes/mut-ref-owned-suggestion.rs new file mode 100644 index 0000000000000..ae5e8f6658b63 --- /dev/null +++ b/tests/ui/lifetimes/mut-ref-owned-suggestion.rs @@ -0,0 +1,29 @@ +//! Regression test for +//! Tests that `&mut T` suggests `T`, not `mut T`, `&mut str` suggests `String`, not `str`, +//! when recommending an owned value. +fn with_fn(_f: impl Fn() -> &mut ()) {} +//~^ ERROR: missing lifetime specifier + +fn with_ref_mut_str(_f: impl Fn() -> &mut str) {} +//~^ ERROR: missing lifetime specifier + +fn with_fn_has_return(_f: impl Fn() -> &mut ()) -> i32 { + //~^ ERROR: missing lifetime specifier + 2 +} + +fn with_dyn(_f: Box &mut i32>) {} +//~^ ERROR: missing lifetime specifier + +fn trait_bound &mut i32>(_f: F) {} +//~^ ERROR: missing lifetime specifier + +fn nested_result(_f: impl Fn() -> Result<&mut i32, ()>) {} +//~^ ERROR: missing lifetime specifier + +struct Holder &mut i32> { + //~^ ERROR: missing lifetime specifier + f: F, +} + +fn main() {} diff --git a/tests/ui/lifetimes/mut-ref-owned-suggestion.stderr b/tests/ui/lifetimes/mut-ref-owned-suggestion.stderr new file mode 100644 index 0000000000000..a3e58331342a9 --- /dev/null +++ b/tests/ui/lifetimes/mut-ref-owned-suggestion.stderr @@ -0,0 +1,137 @@ +error[E0106]: missing lifetime specifier + --> $DIR/mut-ref-owned-suggestion.rs:4:29 + | +LL | fn with_fn(_f: impl Fn() -> &mut ()) {} + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from +help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static` + | +LL | fn with_fn(_f: impl Fn() -> &'static mut ()) {} + | +++++++ +help: instead, you are more likely to want to return an owned value + | +LL - fn with_fn(_f: impl Fn() -> &mut ()) {} +LL + fn with_fn(_f: impl Fn() -> ()) {} + | + +error[E0106]: missing lifetime specifier + --> $DIR/mut-ref-owned-suggestion.rs:7:38 + | +LL | fn with_ref_mut_str(_f: impl Fn() -> &mut str) {} + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from +help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static` + | +LL | fn with_ref_mut_str(_f: impl Fn() -> &'static mut str) {} + | +++++++ +help: instead, you are more likely to want to return an owned value + | +LL - fn with_ref_mut_str(_f: impl Fn() -> &mut str) {} +LL + fn with_ref_mut_str(_f: impl Fn() -> String) {} + | + +error[E0106]: missing lifetime specifier + --> $DIR/mut-ref-owned-suggestion.rs:10:40 + | +LL | fn with_fn_has_return(_f: impl Fn() -> &mut ()) -> i32 { + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static` + | +LL | fn with_fn_has_return(_f: impl Fn() -> &'static mut ()) -> i32 { + | +++++++ +help: consider making the bound lifetime-generic with a new `'a` lifetime + | +LL - fn with_fn_has_return(_f: impl Fn() -> &mut ()) -> i32 { +LL + fn with_fn_has_return(_f: impl for<'a> Fn() -> &'a ()) -> i32 { + | +help: consider introducing a named lifetime parameter + | +LL - fn with_fn_has_return(_f: impl Fn() -> &mut ()) -> i32 { +LL + fn with_fn_has_return<'a>(_f: impl Fn() -> &'a ()) -> i32 { + | +help: alternatively, you might want to return an owned value + | +LL - fn with_fn_has_return(_f: impl Fn() -> &mut ()) -> i32 { +LL + fn with_fn_has_return(_f: impl Fn() -> ()) -> i32 { + | + +error[E0106]: missing lifetime specifier + --> $DIR/mut-ref-owned-suggestion.rs:15:33 + | +LL | fn with_dyn(_f: Box &mut i32>) {} + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from +help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static` + | +LL | fn with_dyn(_f: Box &'static mut i32>) {} + | +++++++ +help: instead, you are more likely to want to return an owned value + | +LL - fn with_dyn(_f: Box &mut i32>) {} +LL + fn with_dyn(_f: Box i32>) {} + | + +error[E0106]: missing lifetime specifier + --> $DIR/mut-ref-owned-suggestion.rs:18:27 + | +LL | fn trait_bound &mut i32>(_f: F) {} + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from +help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static` + | +LL | fn trait_bound &'static mut i32>(_f: F) {} + | +++++++ +help: instead, you are more likely to want to change the argument to be borrowed... + | +LL | fn trait_bound &mut i32>(_f: &F) {} + | + +help: ...or alternatively, you might want to return an owned value + | +LL - fn trait_bound &mut i32>(_f: F) {} +LL + fn trait_bound i32>(_f: F) {} + | + +error[E0106]: missing lifetime specifier + --> $DIR/mut-ref-owned-suggestion.rs:21:42 + | +LL | fn nested_result(_f: impl Fn() -> Result<&mut i32, ()>) {} + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from +help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static` + | +LL | fn nested_result(_f: impl Fn() -> Result<&'static mut i32, ()>) {} + | +++++++ +help: instead, you are more likely to want to return an owned value + | +LL - fn nested_result(_f: impl Fn() -> Result<&mut i32, ()>) {} +LL + fn nested_result(_f: impl Fn() -> Result) {} + | + +error[E0106]: missing lifetime specifier + --> $DIR/mut-ref-owned-suggestion.rs:24:26 + | +LL | struct Holder &mut i32> { + | ^ expected named lifetime parameter + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from +help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static` + | +LL | struct Holder &'static mut i32> { + | +++++++ +help: instead, you are more likely to want to return an owned value + | +LL - struct Holder &mut i32> { +LL + struct Holder i32> { + | + +error: aborting due to 7 previous errors + +For more information about this error, try `rustc --explain E0106`. diff --git a/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.rs b/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.rs new file mode 100644 index 0000000000000..4bf92a2c1c18e --- /dev/null +++ b/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.rs @@ -0,0 +1,49 @@ +// Regression test for https://github.com/rust-lang/rust/issues/65866. + +mod plain { + struct Foo; + + struct Re<'a> { + _data: &'a u16, + } + + trait Bar { + fn bar(&self, r: &mut Re); + //~^ NOTE expected + //~| NOTE `Re` here is elided as `Re<'_>` + } + + impl Bar for Foo { + fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a>) {} + //~^ ERROR `impl` item signature doesn't match `trait` item signature + //~| NOTE expected signature + //~| NOTE found + //~| HELP the lifetime requirements + //~| HELP verify the lifetime relationships + } +} + +mod with_type_args { + struct Foo; + + struct Re<'a, T> { + _data: (&'a u16, T), + } + + trait Bar { + fn bar(&self, r: &mut Re); + //~^ NOTE expected + //~| NOTE `Re` here is elided as `Re<'_, u8>` + } + + impl Bar for Foo { + fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a, u8>) {} + //~^ ERROR `impl` item signature doesn't match `trait` item signature + //~| NOTE expected signature + //~| NOTE found + //~| HELP the lifetime requirements + //~| HELP verify the lifetime relationships + } +} + +fn main() {} diff --git a/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr b/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr new file mode 100644 index 0000000000000..db69b4f3656e6 --- /dev/null +++ b/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr @@ -0,0 +1,40 @@ +error: `impl` item signature doesn't match `trait` item signature + --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:17:9 + | +LL | fn bar(&self, r: &mut Re); + | -------------------------- expected `fn(&'1 plain::Foo, &'2 mut plain::Re<'3>)` +... +LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 plain::Foo, &'2 mut plain::Re<'1>)` + | + = note: expected signature `fn(&'1 plain::Foo, &'2 mut plain::Re<'3>)` + found signature `fn(&'1 plain::Foo, &'2 mut plain::Re<'1>)` + = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` + = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output +note: `Re` here is elided as `Re<'_>` + --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:11:31 + | +LL | fn bar(&self, r: &mut Re); + | ^^ + +error: `impl` item signature doesn't match `trait` item signature + --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:40:9 + | +LL | fn bar(&self, r: &mut Re); + | ------------------------------ expected `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'3, u8>)` +... +LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a, u8>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'1, u8>)` + | + = note: expected signature `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'3, u8>)` + found signature `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'1, u8>)` + = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` + = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output +note: `Re` here is elided as `Re<'_, u8>` + --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:34:31 + | +LL | fn bar(&self, r: &mut Re); + | ^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/ice-array-into-iter-lint-issue-121532.rs b/tests/ui/lint/ice-array-into-iter-lint-issue-121532.rs index 92cab01fe48c8..d095903ec03ae 100644 --- a/tests/ui/lint/ice-array-into-iter-lint-issue-121532.rs +++ b/tests/ui/lint/ice-array-into-iter-lint-issue-121532.rs @@ -4,7 +4,7 @@ // Typeck fails for the arg type as // `Self` makes no sense here -fn func(a: Self::ItemsIterator) { //~ ERROR failed to resolve: `Self` is only available in impls, traits, and type definitions +fn func(a: Self::ItemsIterator) { //~ ERROR cannot find `Self` a.into_iter(); } diff --git a/tests/ui/lint/ice-array-into-iter-lint-issue-121532.stderr b/tests/ui/lint/ice-array-into-iter-lint-issue-121532.stderr index 73ceddae940b2..1a0eaba92375c 100644 --- a/tests/ui/lint/ice-array-into-iter-lint-issue-121532.stderr +++ b/tests/ui/lint/ice-array-into-iter-lint-issue-121532.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions +error[E0433]: cannot find `Self` in this scope --> $DIR/ice-array-into-iter-lint-issue-121532.rs:7:12 | LL | fn func(a: Self::ItemsIterator) { diff --git a/tests/ui/macros/builtin-prelude-no-accidents.rs b/tests/ui/macros/builtin-prelude-no-accidents.rs index 9bebcb75526fb..bffe3776b7b47 100644 --- a/tests/ui/macros/builtin-prelude-no-accidents.rs +++ b/tests/ui/macros/builtin-prelude-no-accidents.rs @@ -2,7 +2,7 @@ // because macros with the same names are in prelude. fn main() { - env::current_dir; //~ ERROR use of unresolved module or unlinked crate `env` - type A = panic::PanicInfo; //~ ERROR use of unresolved module or unlinked crate `panic` - type B = vec::Vec; //~ ERROR use of unresolved module or unlinked crate `vec` + env::current_dir; //~ ERROR cannot find module or crate `env` + type A = panic::PanicInfo; //~ ERROR cannot find module or crate `panic` + type B = vec::Vec; //~ ERROR cannot find module or crate `vec` } diff --git a/tests/ui/macros/builtin-prelude-no-accidents.stderr b/tests/ui/macros/builtin-prelude-no-accidents.stderr index 8c7095a6aedf3..3cc322373afb4 100644 --- a/tests/ui/macros/builtin-prelude-no-accidents.stderr +++ b/tests/ui/macros/builtin-prelude-no-accidents.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `env` +error[E0433]: cannot find module or crate `env` in this scope --> $DIR/builtin-prelude-no-accidents.rs:5:5 | LL | env::current_dir; @@ -10,7 +10,7 @@ help: consider importing this module LL + use std::env; | -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `panic` +error[E0433]: cannot find module or crate `panic` in this scope --> $DIR/builtin-prelude-no-accidents.rs:6:14 | LL | type A = panic::PanicInfo; @@ -22,7 +22,7 @@ help: consider importing this module LL + use std::panic; | -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `vec` +error[E0433]: cannot find module or crate `vec` in this scope --> $DIR/builtin-prelude-no-accidents.rs:7:14 | LL | type B = vec::Vec; diff --git a/tests/ui/macros/builtin-std-paths-fail.rs b/tests/ui/macros/builtin-std-paths-fail.rs index c1a4e32a6dcbc..fd51c42ff37fa 100644 --- a/tests/ui/macros/builtin-std-paths-fail.rs +++ b/tests/ui/macros/builtin-std-paths-fail.rs @@ -1,25 +1,25 @@ #[derive( - core::RustcDecodable, //~ ERROR could not find `RustcDecodable` in `core` - //~| ERROR could not find `RustcDecodable` in `core` - core::RustcDecodable, //~ ERROR could not find `RustcDecodable` in `core` - //~| ERROR could not find `RustcDecodable` in `core` + core::RustcDecodable, //~ ERROR cannot find `RustcDecodable` in `core` + //~| ERROR cannot find `RustcDecodable` in `core` + core::RustcDecodable, //~ ERROR cannot find `RustcDecodable` in `core` + //~| ERROR cannot find `RustcDecodable` in `core` )] -#[core::bench] //~ ERROR could not find `bench` in `core` -#[core::global_allocator] //~ ERROR could not find `global_allocator` in `core` -#[core::test_case] //~ ERROR could not find `test_case` in `core` -#[core::test] //~ ERROR could not find `test` in `core` +#[core::bench] //~ ERROR cannot find `bench` in `core` +#[core::global_allocator] //~ ERROR cannot find `global_allocator` in `core` +#[core::test_case] //~ ERROR cannot find `test_case` in `core` +#[core::test] //~ ERROR cannot find `test` in `core` struct Core; #[derive( - std::RustcDecodable, //~ ERROR could not find `RustcDecodable` in `std` - //~| ERROR could not find `RustcDecodable` in `std` - std::RustcDecodable, //~ ERROR could not find `RustcDecodable` in `std` - //~| ERROR could not find `RustcDecodable` in `std` + std::RustcDecodable, //~ ERROR cannot find `RustcDecodable` in `std` + //~| ERROR cannot find `RustcDecodable` in `std` + std::RustcDecodable, //~ ERROR cannot find `RustcDecodable` in `std` + //~| ERROR cannot find `RustcDecodable` in `std` )] -#[std::bench] //~ ERROR could not find `bench` in `std` -#[std::global_allocator] //~ ERROR could not find `global_allocator` in `std` -#[std::test_case] //~ ERROR could not find `test_case` in `std` -#[std::test] //~ ERROR could not find `test` in `std` +#[std::bench] //~ ERROR cannot find `bench` in `std` +#[std::global_allocator] //~ ERROR cannot find `global_allocator` in `std` +#[std::test_case] //~ ERROR cannot find `test_case` in `std` +#[std::test] //~ ERROR cannot find `test` in `std` struct Std; fn main() {} diff --git a/tests/ui/macros/builtin-std-paths-fail.stderr b/tests/ui/macros/builtin-std-paths-fail.stderr index 85d2bd2132f25..247e3f172a3c7 100644 --- a/tests/ui/macros/builtin-std-paths-fail.stderr +++ b/tests/ui/macros/builtin-std-paths-fail.stderr @@ -1,16 +1,16 @@ -error[E0433]: failed to resolve: could not find `RustcDecodable` in `core` +error[E0433]: cannot find `RustcDecodable` in `core` --> $DIR/builtin-std-paths-fail.rs:2:11 | LL | core::RustcDecodable, | ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `core` -error[E0433]: failed to resolve: could not find `RustcDecodable` in `core` +error[E0433]: cannot find `RustcDecodable` in `core` --> $DIR/builtin-std-paths-fail.rs:4:11 | LL | core::RustcDecodable, | ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `core` -error[E0433]: failed to resolve: could not find `RustcDecodable` in `core` +error[E0433]: cannot find `RustcDecodable` in `core` --> $DIR/builtin-std-paths-fail.rs:2:11 | LL | core::RustcDecodable, @@ -18,7 +18,7 @@ LL | core::RustcDecodable, | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0433]: failed to resolve: could not find `RustcDecodable` in `core` +error[E0433]: cannot find `RustcDecodable` in `core` --> $DIR/builtin-std-paths-fail.rs:4:11 | LL | core::RustcDecodable, @@ -26,43 +26,43 @@ LL | core::RustcDecodable, | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0433]: failed to resolve: could not find `bench` in `core` +error[E0433]: cannot find `bench` in `core` --> $DIR/builtin-std-paths-fail.rs:7:9 | LL | #[core::bench] | ^^^^^ could not find `bench` in `core` -error[E0433]: failed to resolve: could not find `global_allocator` in `core` +error[E0433]: cannot find `global_allocator` in `core` --> $DIR/builtin-std-paths-fail.rs:8:9 | LL | #[core::global_allocator] | ^^^^^^^^^^^^^^^^ could not find `global_allocator` in `core` -error[E0433]: failed to resolve: could not find `test_case` in `core` +error[E0433]: cannot find `test_case` in `core` --> $DIR/builtin-std-paths-fail.rs:9:9 | LL | #[core::test_case] | ^^^^^^^^^ could not find `test_case` in `core` -error[E0433]: failed to resolve: could not find `test` in `core` +error[E0433]: cannot find `test` in `core` --> $DIR/builtin-std-paths-fail.rs:10:9 | LL | #[core::test] | ^^^^ could not find `test` in `core` -error[E0433]: failed to resolve: could not find `RustcDecodable` in `std` +error[E0433]: cannot find `RustcDecodable` in `std` --> $DIR/builtin-std-paths-fail.rs:14:10 | LL | std::RustcDecodable, | ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `std` -error[E0433]: failed to resolve: could not find `RustcDecodable` in `std` +error[E0433]: cannot find `RustcDecodable` in `std` --> $DIR/builtin-std-paths-fail.rs:16:10 | LL | std::RustcDecodable, | ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `std` -error[E0433]: failed to resolve: could not find `RustcDecodable` in `std` +error[E0433]: cannot find `RustcDecodable` in `std` --> $DIR/builtin-std-paths-fail.rs:14:10 | LL | std::RustcDecodable, @@ -70,7 +70,7 @@ LL | std::RustcDecodable, | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0433]: failed to resolve: could not find `RustcDecodable` in `std` +error[E0433]: cannot find `RustcDecodable` in `std` --> $DIR/builtin-std-paths-fail.rs:16:10 | LL | std::RustcDecodable, @@ -78,25 +78,25 @@ LL | std::RustcDecodable, | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0433]: failed to resolve: could not find `bench` in `std` +error[E0433]: cannot find `bench` in `std` --> $DIR/builtin-std-paths-fail.rs:19:8 | LL | #[std::bench] | ^^^^^ could not find `bench` in `std` -error[E0433]: failed to resolve: could not find `global_allocator` in `std` +error[E0433]: cannot find `global_allocator` in `std` --> $DIR/builtin-std-paths-fail.rs:20:8 | LL | #[std::global_allocator] | ^^^^^^^^^^^^^^^^ could not find `global_allocator` in `std` -error[E0433]: failed to resolve: could not find `test_case` in `std` +error[E0433]: cannot find `test_case` in `std` --> $DIR/builtin-std-paths-fail.rs:21:8 | LL | #[std::test_case] | ^^^^^^^^^ could not find `test_case` in `std` -error[E0433]: failed to resolve: could not find `test` in `std` +error[E0433]: cannot find `test` in `std` --> $DIR/builtin-std-paths-fail.rs:22:8 | LL | #[std::test] diff --git a/tests/ui/macros/compile_error_macro-suppress-errors.rs b/tests/ui/macros/compile_error_macro-suppress-errors.rs index b2b6a8ae00882..e1c2248035e94 100644 --- a/tests/ui/macros/compile_error_macro-suppress-errors.rs +++ b/tests/ui/macros/compile_error_macro-suppress-errors.rs @@ -36,5 +36,5 @@ fn main() { //~^ ERROR: cannot find function `some_function` in module `another_module` let _: another_module::SomeType = another_module::Hello::new(); //~^ ERROR: cannot find type `SomeType` in module `another_module` - //~^^ ERROR: failed to resolve: could not find `Hello` in `another_module` + //~| ERROR: cannot find `Hello` in `another_module` } diff --git a/tests/ui/macros/compile_error_macro-suppress-errors.stderr b/tests/ui/macros/compile_error_macro-suppress-errors.stderr index 73b1563596247..bda1deb9c4134 100644 --- a/tests/ui/macros/compile_error_macro-suppress-errors.stderr +++ b/tests/ui/macros/compile_error_macro-suppress-errors.stderr @@ -16,7 +16,7 @@ error[E0432]: unresolved import `crate::another_module::NotExist` LL | use crate::another_module::NotExist; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `NotExist` in `another_module` -error[E0433]: failed to resolve: could not find `Hello` in `another_module` +error[E0433]: cannot find `Hello` in `another_module` --> $DIR/compile_error_macro-suppress-errors.rs:37:55 | LL | let _: another_module::SomeType = another_module::Hello::new(); diff --git a/tests/ui/macros/macro-inner-attributes.rs b/tests/ui/macros/macro-inner-attributes.rs index 1a832ca9b0c4b..fc69f2e4cebe7 100644 --- a/tests/ui/macros/macro-inner-attributes.rs +++ b/tests/ui/macros/macro-inner-attributes.rs @@ -4,8 +4,8 @@ macro_rules! test { ($nm:ident, #[$a:meta], $i:item) => (mod $nm { #![$a] $i }); } -test!(a, - #[cfg(false)], +test!(a, //~ NOTE: found an item that was configured out + #[cfg(false)], //~ NOTE: the item is gated here pub fn bar() { }); test!(b, @@ -14,7 +14,7 @@ test!(b, #[rustc_dummy] fn main() { - a::bar(); - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `a` + a::bar(); //~ ERROR: cannot find module or crate `a` + //~^ NOTE: use of unresolved module or unlinked crate `a` b::bar(); } diff --git a/tests/ui/macros/macro-inner-attributes.stderr b/tests/ui/macros/macro-inner-attributes.stderr index 3c043c38abb55..5523dda33c323 100644 --- a/tests/ui/macros/macro-inner-attributes.stderr +++ b/tests/ui/macros/macro-inner-attributes.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `a` +error[E0433]: cannot find module or crate `a` in this scope --> $DIR/macro-inner-attributes.rs:17:5 | LL | a::bar(); diff --git a/tests/ui/macros/macro-path-prelude-fail-1.rs b/tests/ui/macros/macro-path-prelude-fail-1.rs index d93792bdfe38d..a077ef0c66328 100644 --- a/tests/ui/macros/macro-path-prelude-fail-1.rs +++ b/tests/ui/macros/macro-path-prelude-fail-1.rs @@ -1,7 +1,9 @@ mod m { fn check() { - Vec::clone!(); //~ ERROR failed to resolve: `Vec` is a struct, not a module - u8::clone!(); //~ ERROR failed to resolve: `u8` is a builtin type, not a module + Vec::clone!(); //~ ERROR cannot find + //~^ NOTE `Vec` is a struct, not a module + u8::clone!(); //~ ERROR cannot find + //~^ NOTE `u8` is a builtin type, not a module } } diff --git a/tests/ui/macros/macro-path-prelude-fail-1.stderr b/tests/ui/macros/macro-path-prelude-fail-1.stderr index f8377ffb35556..0332b18992eb5 100644 --- a/tests/ui/macros/macro-path-prelude-fail-1.stderr +++ b/tests/ui/macros/macro-path-prelude-fail-1.stderr @@ -1,11 +1,11 @@ -error[E0433]: failed to resolve: `Vec` is a struct, not a module +error[E0433]: cannot find module `Vec` in this scope --> $DIR/macro-path-prelude-fail-1.rs:3:9 | LL | Vec::clone!(); | ^^^ `Vec` is a struct, not a module -error[E0433]: failed to resolve: `u8` is a builtin type, not a module - --> $DIR/macro-path-prelude-fail-1.rs:4:9 +error[E0433]: cannot find module `u8` in this scope + --> $DIR/macro-path-prelude-fail-1.rs:5:9 | LL | u8::clone!(); | ^^ `u8` is a builtin type, not a module diff --git a/tests/ui/macros/macro-path-prelude-fail-2.rs b/tests/ui/macros/macro-path-prelude-fail-2.rs index 816a3c4ccc004..f359f34e4fd17 100644 --- a/tests/ui/macros/macro-path-prelude-fail-2.rs +++ b/tests/ui/macros/macro-path-prelude-fail-2.rs @@ -1,6 +1,6 @@ mod m { fn check() { - Result::Ok!(); //~ ERROR failed to resolve: partially resolved path in a macro + Result::Ok!(); //~ ERROR cannot find } } diff --git a/tests/ui/macros/macro-path-prelude-fail-2.stderr b/tests/ui/macros/macro-path-prelude-fail-2.stderr index 87646031cdb82..e1ea8cbc60ecd 100644 --- a/tests/ui/macros/macro-path-prelude-fail-2.stderr +++ b/tests/ui/macros/macro-path-prelude-fail-2.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: partially resolved path in a macro +error[E0433]: cannot find macro `Ok` in enum `Result` --> $DIR/macro-path-prelude-fail-2.rs:3:9 | LL | Result::Ok!(); - | ^^^^^^^^^^ partially resolved path in a macro + | ^^^^^^^^^^ a macro can't exist within an enum error: aborting due to 1 previous error diff --git a/tests/ui/macros/macro_path_as_generic_bound.rs b/tests/ui/macros/macro_path_as_generic_bound.rs index 663f85688ec9a..d720752f4ca57 100644 --- a/tests/ui/macros/macro_path_as_generic_bound.rs +++ b/tests/ui/macros/macro_path_as_generic_bound.rs @@ -4,6 +4,6 @@ macro_rules! foo(($t:path) => { impl Foo for T {} }); -foo!(m::m2::A); //~ ERROR failed to resolve +foo!(m::m2::A); //~ ERROR cannot find fn main() {} diff --git a/tests/ui/macros/macro_path_as_generic_bound.stderr b/tests/ui/macros/macro_path_as_generic_bound.stderr index 9fe4ad27aa059..c4454ff23e6a4 100644 --- a/tests/ui/macros/macro_path_as_generic_bound.stderr +++ b/tests/ui/macros/macro_path_as_generic_bound.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `m` +error[E0433]: cannot find module or crate `m` in this scope --> $DIR/macro_path_as_generic_bound.rs:7:6 | LL | foo!(m::m2::A); diff --git a/tests/ui/macros/meta-item-absolute-path.rs b/tests/ui/macros/meta-item-absolute-path.rs index e677016cff82e..429d259ae2c4d 100644 --- a/tests/ui/macros/meta-item-absolute-path.rs +++ b/tests/ui/macros/meta-item-absolute-path.rs @@ -1,6 +1,6 @@ //@ edition:2015 -#[derive(::Absolute)] //~ ERROR failed to resolve - //~| ERROR failed to resolve +#[derive(::Absolute)] //~ ERROR cannot find + //~| ERROR cannot find struct S; fn main() {} diff --git a/tests/ui/macros/meta-item-absolute-path.stderr b/tests/ui/macros/meta-item-absolute-path.stderr index 93c442036ce26..9a9d90ca3f448 100644 --- a/tests/ui/macros/meta-item-absolute-path.stderr +++ b/tests/ui/macros/meta-item-absolute-path.stderr @@ -1,10 +1,10 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `Absolute` +error[E0433]: cannot find module or crate `Absolute` in the crate root --> $DIR/meta-item-absolute-path.rs:2:12 | LL | #[derive(::Absolute)] | ^^^^^^^^ use of unresolved module or unlinked crate `Absolute` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `Absolute` +error[E0433]: cannot find module or crate `Absolute` in the crate root --> $DIR/meta-item-absolute-path.rs:2:12 | LL | #[derive(::Absolute)] diff --git a/tests/ui/mir/issue-121103.rs b/tests/ui/mir/issue-121103.rs index 247c644c5bb19..4a3d3f5590f31 100644 --- a/tests/ui/mir/issue-121103.rs +++ b/tests/ui/mir/issue-121103.rs @@ -1,3 +1,5 @@ fn main(_: as lib2::TypeFn>::Output) {} -//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `lib2` -//~| ERROR failed to resolve: use of unresolved module or unlinked crate `lib2` +//~^ ERROR: cannot find +//~| ERROR: cannot find +//~| NOTE: use of unresolved module or unlinked crate `lib2` +//~| NOTE: use of unresolved module or unlinked crate `lib2` diff --git a/tests/ui/mir/issue-121103.stderr b/tests/ui/mir/issue-121103.stderr index 3565f6f0cdeff..236a3cbc5806f 100644 --- a/tests/ui/mir/issue-121103.stderr +++ b/tests/ui/mir/issue-121103.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `lib2` +error[E0433]: cannot find module or crate `lib2` in this scope --> $DIR/issue-121103.rs:1:38 | LL | fn main(_: as lib2::TypeFn>::Output) {} @@ -6,7 +6,7 @@ LL | fn main(_: as lib2::TypeFn>::Output) {} | = help: you might be missing a crate named `lib2` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `lib2` +error[E0433]: cannot find module or crate `lib2` in this scope --> $DIR/issue-121103.rs:1:13 | LL | fn main(_: as lib2::TypeFn>::Output) {} diff --git a/tests/ui/modules/super-at-crate-root.rs b/tests/ui/modules/super-at-crate-root.rs index d605dc0cccb33..0aac3a0875709 100644 --- a/tests/ui/modules/super-at-crate-root.rs +++ b/tests/ui/modules/super-at-crate-root.rs @@ -1,6 +1,6 @@ //! Check that `super` keyword used at the crate root (top-level) results in a compilation error //! as there is no parent module to resolve. -use super::f; //~ ERROR there are too many leading `super` keywords +use super::f; //~ ERROR too many leading `super` keywords fn main() {} diff --git a/tests/ui/modules/super-at-crate-root.stderr b/tests/ui/modules/super-at-crate-root.stderr index 0279870886467..cb3855cc033d8 100644 --- a/tests/ui/modules/super-at-crate-root.stderr +++ b/tests/ui/modules/super-at-crate-root.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: there are too many leading `super` keywords +error[E0433]: too many leading `super` keywords --> $DIR/super-at-crate-root.rs:4:5 | LL | use super::f; diff --git a/tests/ui/parser/const-param-decl-on-type-instead-of-impl.rs b/tests/ui/parser/const-param-decl-on-type-instead-of-impl.rs index 3876fb41d23f1..764c1c2a3210c 100644 --- a/tests/ui/parser/const-param-decl-on-type-instead-of-impl.rs +++ b/tests/ui/parser/const-param-decl-on-type-instead-of-impl.rs @@ -11,5 +11,5 @@ fn banana(a: >::BAR) {} fn chaenomeles() { path::path::Struct::() //~^ ERROR unexpected `const` parameter declaration - //~| ERROR failed to resolve: use of unresolved module or unlinked crate `path` + //~| ERROR cannot find module or crate `path` } diff --git a/tests/ui/parser/const-param-decl-on-type-instead-of-impl.stderr b/tests/ui/parser/const-param-decl-on-type-instead-of-impl.stderr index db7c76dc1aa95..7aba69a0cf5a0 100644 --- a/tests/ui/parser/const-param-decl-on-type-instead-of-impl.stderr +++ b/tests/ui/parser/const-param-decl-on-type-instead-of-impl.stderr @@ -22,7 +22,7 @@ error: unexpected `const` parameter declaration LL | path::path::Struct::() | ^^^^^^^^^^^^^^ expected a `const` expression, not a parameter declaration -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `path` +error[E0433]: cannot find module or crate `path` in this scope --> $DIR/const-param-decl-on-type-instead-of-impl.rs:12:5 | LL | path::path::Struct::() diff --git a/tests/ui/parser/dyn-trait-compatibility.rs b/tests/ui/parser/dyn-trait-compatibility.rs index c6e84284fbec1..dd01b6e19d05a 100644 --- a/tests/ui/parser/dyn-trait-compatibility.rs +++ b/tests/ui/parser/dyn-trait-compatibility.rs @@ -3,7 +3,7 @@ type A0 = dyn; //~^ ERROR cannot find type `dyn` in this scope type A1 = dyn::dyn; -//~^ ERROR use of unresolved module or unlinked crate `dyn` +//~^ ERROR cannot find module or crate `dyn` in this scope type A2 = dyn; //~^ ERROR cannot find type `dyn` in this scope //~| ERROR cannot find type `dyn` in this scope diff --git a/tests/ui/parser/dyn-trait-compatibility.stderr b/tests/ui/parser/dyn-trait-compatibility.stderr index d15bf3c97f659..233b22123d31c 100644 --- a/tests/ui/parser/dyn-trait-compatibility.stderr +++ b/tests/ui/parser/dyn-trait-compatibility.stderr @@ -40,7 +40,7 @@ error[E0425]: cannot find type `dyn` in this scope LL | type A3 = dyn<::dyn>; | ^^^ not found in this scope -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `dyn` +error[E0433]: cannot find module or crate `dyn` in this scope --> $DIR/dyn-trait-compatibility.rs:5:11 | LL | type A1 = dyn::dyn; diff --git a/tests/ui/parser/mod_file_not_exist.rs b/tests/ui/parser/mod_file_not_exist.rs index 49ce44982ab98..ba89a8c2c1fbe 100644 --- a/tests/ui/parser/mod_file_not_exist.rs +++ b/tests/ui/parser/mod_file_not_exist.rs @@ -1,8 +1,9 @@ -mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file` -//~^ HELP to create the module `not_a_real_file`, create file +mod not_a_real_file; +//~^ ERROR: file not found for module `not_a_real_file` +//~| HELP: to create the module `not_a_real_file`, create file fn main() { assert_eq!(mod_file_aux::bar(), 10); - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `mod_file_aux` - //~| HELP you might be missing a crate named `mod_file_aux` + //~^ ERROR: cannot find module or crate `mod_file_aux` + //~| HELP: you might be missing a crate named `mod_file_aux` } diff --git a/tests/ui/parser/mod_file_not_exist.stderr b/tests/ui/parser/mod_file_not_exist.stderr index d9e4e8f31f5fe..83fff7161cae6 100644 --- a/tests/ui/parser/mod_file_not_exist.stderr +++ b/tests/ui/parser/mod_file_not_exist.stderr @@ -7,8 +7,8 @@ LL | mod not_a_real_file; = help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs" or "$DIR/not_a_real_file/mod.rs" = note: if there is a `mod not_a_real_file` elsewhere in the crate already, import it with `use crate::...` instead -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `mod_file_aux` - --> $DIR/mod_file_not_exist.rs:5:16 +error[E0433]: cannot find module or crate `mod_file_aux` in this scope + --> $DIR/mod_file_not_exist.rs:6:16 | LL | assert_eq!(mod_file_aux::bar(), 10); | ^^^^^^^^^^^^ use of unresolved module or unlinked crate `mod_file_aux` diff --git a/tests/ui/parser/mod_file_not_exist_windows.rs b/tests/ui/parser/mod_file_not_exist_windows.rs index bb74684d99447..b0b65ae8c7599 100644 --- a/tests/ui/parser/mod_file_not_exist_windows.rs +++ b/tests/ui/parser/mod_file_not_exist_windows.rs @@ -5,6 +5,6 @@ mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file` fn main() { assert_eq!(mod_file_aux::bar(), 10); - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `mod_file_aux` + //~^ ERROR cannot find module or crate `mod_file_aux` in this scope //~| HELP you might be missing a crate named `mod_file_aux` } diff --git a/tests/ui/parser/mod_file_not_exist_windows.stderr b/tests/ui/parser/mod_file_not_exist_windows.stderr index 03c762d0ef2dd..95c6c1c92e64a 100644 --- a/tests/ui/parser/mod_file_not_exist_windows.stderr +++ b/tests/ui/parser/mod_file_not_exist_windows.stderr @@ -7,7 +7,7 @@ LL | mod not_a_real_file; = help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs" or "$DIR/not_a_real_file/mod.rs" = note: if there is a `mod not_a_real_file` elsewhere in the crate already, import it with `use crate::...` instead -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `mod_file_aux` +error[E0433]: cannot find module or crate `mod_file_aux` in this scope --> $DIR/mod_file_not_exist_windows.rs:7:16 | LL | assert_eq!(mod_file_aux::bar(), 10); diff --git a/tests/ui/pattern/pattern-error-continue.rs b/tests/ui/pattern/pattern-error-continue.rs index 664d4e80ef561..56c3fa1dda7d9 100644 --- a/tests/ui/pattern/pattern-error-continue.rs +++ b/tests/ui/pattern/pattern-error-continue.rs @@ -32,6 +32,6 @@ fn main() { //~| NOTE expected `char`, found `bool` match () { - E::V => {} //~ ERROR failed to resolve: use of undeclared type `E` + E::V => {} //~ ERROR cannot find type `E` } } diff --git a/tests/ui/pattern/pattern-error-continue.stderr b/tests/ui/pattern/pattern-error-continue.stderr index de90d99a0ff1c..5068f2800617f 100644 --- a/tests/ui/pattern/pattern-error-continue.stderr +++ b/tests/ui/pattern/pattern-error-continue.stderr @@ -52,7 +52,7 @@ note: function defined here LL | fn f(_c: char) {} | ^ -------- -error[E0433]: failed to resolve: use of undeclared type `E` +error[E0433]: cannot find type `E` in this scope --> $DIR/pattern-error-continue.rs:35:9 | LL | E::V => {} diff --git a/tests/ui/privacy/restricted/test.rs b/tests/ui/privacy/restricted/test.rs index 82432b4db5095..26018fbb01a6c 100644 --- a/tests/ui/privacy/restricted/test.rs +++ b/tests/ui/privacy/restricted/test.rs @@ -48,6 +48,6 @@ fn main() { } mod pathological { - pub(in bad::path) mod m1 {} //~ ERROR failed to resolve: use of unresolved module or unlinked crate `bad` + pub(in bad::path) mod m1 {} //~ ERROR: cannot find module or crate `bad` pub(in foo) mod m2 {} //~ ERROR visibilities can only be restricted to ancestor modules } diff --git a/tests/ui/privacy/restricted/test.stderr b/tests/ui/privacy/restricted/test.stderr index 8d7925cf99fc6..ae56e0bf78443 100644 --- a/tests/ui/privacy/restricted/test.stderr +++ b/tests/ui/privacy/restricted/test.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `bad` +error[E0433]: cannot find module or crate `bad` in the crate root --> $DIR/test.rs:51:12 | LL | pub(in bad::path) mod m1 {} diff --git a/tests/ui/privacy/unreachable-issue-121455.rs b/tests/ui/privacy/unreachable-issue-121455.rs index 5da30d6ed6397..c1822034eb19d 100644 --- a/tests/ui/privacy/unreachable-issue-121455.rs +++ b/tests/ui/privacy/unreachable-issue-121455.rs @@ -1,5 +1,6 @@ fn test(s: &Self::Id) { -//~^ ERROR failed to resolve: `Self` is only available in impls, traits, and type definitions +//~^ ERROR: cannot find `Self` +//~| NOTE: `Self` is only available in impls, traits, and type definitions match &s[0..3] {} } diff --git a/tests/ui/privacy/unreachable-issue-121455.stderr b/tests/ui/privacy/unreachable-issue-121455.stderr index 864e950a98eb2..fe4c38081b74f 100644 --- a/tests/ui/privacy/unreachable-issue-121455.stderr +++ b/tests/ui/privacy/unreachable-issue-121455.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions +error[E0433]: cannot find `Self` in this scope --> $DIR/unreachable-issue-121455.rs:1:13 | LL | fn test(s: &Self::Id) { diff --git a/tests/ui/proc-macro/amputate-span.stderr b/tests/ui/proc-macro/amputate-span.stderr index aa797339be467..bd2f39edec4f1 100644 --- a/tests/ui/proc-macro/amputate-span.stderr +++ b/tests/ui/proc-macro/amputate-span.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of undeclared type `Command` +error[E0433]: cannot find type `Command` in this scope --> $DIR/amputate-span.rs:49:5 | LL | Command::new("git"); @@ -9,7 +9,7 @@ help: consider importing this struct LL + use std::process::Command; | -error[E0433]: failed to resolve: use of undeclared type `Command` +error[E0433]: cannot find type `Command` in this scope --> $DIR/amputate-span.rs:63:9 | LL | Command::new("git"); diff --git a/tests/ui/proc-macro/pretty-print-hack-hide.rs b/tests/ui/proc-macro/pretty-print-hack-hide.rs deleted file mode 100644 index fd98f16a780ea..0000000000000 --- a/tests/ui/proc-macro/pretty-print-hack-hide.rs +++ /dev/null @@ -1,12 +0,0 @@ -//@ proc-macro: test-macros.rs -//@ compile-flags: -Z span-debug -//@ check-pass - -#![no_std] // Don't load unnecessary hygiene information from std -extern crate std; - -#[macro_use] extern crate test_macros; - -include!("pretty-print-hack/rental-0.5.6/src/lib.rs"); - -fn main() {} diff --git a/tests/ui/proc-macro/pretty-print-hack-hide.stdout b/tests/ui/proc-macro/pretty-print-hack-hide.stdout deleted file mode 100644 index ea796bb269768..0000000000000 --- a/tests/ui/proc-macro/pretty-print-hack-hide.stdout +++ /dev/null @@ -1,21 +0,0 @@ -PRINT-DERIVE INPUT (DISPLAY): enum ProceduralMasqueradeDummyType { Input } -PRINT-DERIVE INPUT (DEBUG): TokenStream [ - Ident { - ident: "enum", - span: $DIR/pretty-print-hack/rental-0.5.6/src/lib.rs:4:1: 4:5 (#0), - }, - Ident { - ident: "ProceduralMasqueradeDummyType", - span: $DIR/pretty-print-hack/rental-0.5.6/src/lib.rs:4:6: 4:35 (#0), - }, - Group { - delimiter: Brace, - stream: TokenStream [ - Ident { - ident: "Input", - span: $DIR/pretty-print-hack/rental-0.5.6/src/lib.rs:13:5: 13:10 (#0), - }, - ], - span: $DIR/pretty-print-hack/rental-0.5.6/src/lib.rs:4:36: 14:2 (#0), - }, -] diff --git a/tests/ui/proc-macro/pretty-print-hack-show.local.stderr b/tests/ui/proc-macro/pretty-print-hack-show.local.stderr deleted file mode 100644 index 889cd0c90ebb2..0000000000000 --- a/tests/ui/proc-macro/pretty-print-hack-show.local.stderr +++ /dev/null @@ -1,6 +0,0 @@ -error: using an old version of `rental` - | - = note: older versions of the `rental` crate no longer compile; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives - -error: aborting due to 1 previous error - diff --git a/tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr b/tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr deleted file mode 100644 index 889cd0c90ebb2..0000000000000 --- a/tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr +++ /dev/null @@ -1,6 +0,0 @@ -error: using an old version of `rental` - | - = note: older versions of the `rental` crate no longer compile; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives - -error: aborting due to 1 previous error - diff --git a/tests/ui/proc-macro/pretty-print-hack-show.rs b/tests/ui/proc-macro/pretty-print-hack-show.rs deleted file mode 100644 index 08e26c8114276..0000000000000 --- a/tests/ui/proc-macro/pretty-print-hack-show.rs +++ /dev/null @@ -1,21 +0,0 @@ -//@ proc-macro: test-macros.rs -//@ compile-flags: -Z span-debug -//@ revisions: local remapped -//@ [remapped] remap-src-base - -#![no_std] // Don't load unnecessary hygiene information from std -extern crate std; - -#[macro_use] extern crate test_macros; - -mod first { - include!("pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs"); -} - -mod second { - include!("pretty-print-hack/rental-0.5.5/src/lib.rs"); -} - -fn main() {} - -//~? ERROR using an old version of `rental` diff --git a/tests/ui/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs b/tests/ui/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs deleted file mode 100644 index a27176a38e224..0000000000000 --- a/tests/ui/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -//@ ignore-auxiliary (used by `../../../pretty-print-hack-show.rs`) - -#[derive(Print)] -enum ProceduralMasqueradeDummyType { -//~^ ERROR using -//~| WARN this was previously -//~| ERROR using -//~| WARN this was previously -//~| ERROR using -//~| WARN this was previously -//~| ERROR using -//~| WARN this was previously - Input -} diff --git a/tests/ui/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs b/tests/ui/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs deleted file mode 100644 index a27176a38e224..0000000000000 --- a/tests/ui/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -//@ ignore-auxiliary (used by `../../../pretty-print-hack-show.rs`) - -#[derive(Print)] -enum ProceduralMasqueradeDummyType { -//~^ ERROR using -//~| WARN this was previously -//~| ERROR using -//~| WARN this was previously -//~| ERROR using -//~| WARN this was previously -//~| ERROR using -//~| WARN this was previously - Input -} diff --git a/tests/ui/proc-macro/pretty-print-hack/rental-0.5.6/src/lib.rs b/tests/ui/proc-macro/pretty-print-hack/rental-0.5.6/src/lib.rs deleted file mode 100644 index 765ee4be656e3..0000000000000 --- a/tests/ui/proc-macro/pretty-print-hack/rental-0.5.6/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -//@ ignore-auxiliary (used by `../../../pretty-print-hack/hide.rs`) - -#[derive(Print)] -enum ProceduralMasqueradeDummyType { -//~^ ERROR using -//~| WARN this was previously -//~| ERROR using -//~| WARN this was previously -//~| ERROR using -//~| WARN this was previously -//~| ERROR using -//~| WARN this was previously - Input -} diff --git a/tests/ui/resolve/112590-2.fixed b/tests/ui/resolve/112590-2.fixed index bbc8d4b2954a1..2bda2197d6d47 100644 --- a/tests/ui/resolve/112590-2.fixed +++ b/tests/ui/resolve/112590-2.fixed @@ -16,7 +16,7 @@ mod u { use foo::bar::baz::MyVec; fn _a() { - let _: Vec = MyVec::new(); //~ ERROR failed to resolve + let _: Vec = MyVec::new(); //~ ERROR cannot find } } @@ -24,12 +24,12 @@ mod v { use foo::bar::baz::MyVec; fn _b() { - let _: Vec = MyVec::new(); //~ ERROR failed to resolve + let _: Vec = MyVec::new(); //~ ERROR cannot find } } fn main() { - let _t: Vec = Vec::new(); //~ ERROR failed to resolve - type _B = vec::Vec::; //~ ERROR failed to resolve - let _t = AtomicBool::new(true); //~ ERROR failed to resolve + let _t: Vec = Vec::new(); //~ ERROR cannot find + type _B = vec::Vec::; //~ ERROR cannot find + let _t = AtomicBool::new(true); //~ ERROR cannot find } diff --git a/tests/ui/resolve/112590-2.rs b/tests/ui/resolve/112590-2.rs index 97d0b0bf2a947..a458ff501f979 100644 --- a/tests/ui/resolve/112590-2.rs +++ b/tests/ui/resolve/112590-2.rs @@ -10,18 +10,18 @@ mod foo { mod u { fn _a() { - let _: Vec = super::foo::baf::baz::MyVec::new(); //~ ERROR failed to resolve + let _: Vec = super::foo::baf::baz::MyVec::new(); //~ ERROR cannot find } } mod v { fn _b() { - let _: Vec = fox::bar::baz::MyVec::new(); //~ ERROR failed to resolve + let _: Vec = fox::bar::baz::MyVec::new(); //~ ERROR cannot find } } fn main() { - let _t: Vec = vec::new(); //~ ERROR failed to resolve - type _B = vec::Vec::; //~ ERROR failed to resolve - let _t = std::sync_error::atomic::AtomicBool::new(true); //~ ERROR failed to resolve + let _t: Vec = vec::new(); //~ ERROR cannot find + type _B = vec::Vec::; //~ ERROR cannot find + let _t = std::sync_error::atomic::AtomicBool::new(true); //~ ERROR cannot find } diff --git a/tests/ui/resolve/112590-2.stderr b/tests/ui/resolve/112590-2.stderr index d6f4a8f22a456..8569dd0c3fa08 100644 --- a/tests/ui/resolve/112590-2.stderr +++ b/tests/ui/resolve/112590-2.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: could not find `baf` in `foo` +error[E0433]: cannot find `baf` in `foo` --> $DIR/112590-2.rs:13:39 | LL | let _: Vec = super::foo::baf::baz::MyVec::new(); @@ -14,7 +14,7 @@ LL - let _: Vec = super::foo::baf::baz::MyVec::new(); LL + let _: Vec = MyVec::new(); | -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `fox` +error[E0433]: cannot find module or crate `fox` in this scope --> $DIR/112590-2.rs:19:27 | LL | let _: Vec = fox::bar::baz::MyVec::new(); @@ -31,7 +31,7 @@ LL - let _: Vec = fox::bar::baz::MyVec::new(); LL + let _: Vec = MyVec::new(); | -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `vec` +error[E0433]: cannot find module or crate `vec` in this scope --> $DIR/112590-2.rs:25:15 | LL | type _B = vec::Vec::; @@ -43,7 +43,7 @@ help: consider importing this module LL + use std::vec; | -error[E0433]: failed to resolve: could not find `sync_error` in `std` +error[E0433]: cannot find `sync_error` in `std` --> $DIR/112590-2.rs:26:19 | LL | let _t = std::sync_error::atomic::AtomicBool::new(true); @@ -59,7 +59,7 @@ LL - let _t = std::sync_error::atomic::AtomicBool::new(true); LL + let _t = AtomicBool::new(true); | -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `vec` +error[E0433]: cannot find module or crate `vec` in this scope --> $DIR/112590-2.rs:24:24 | LL | let _t: Vec = vec::new(); diff --git a/tests/ui/resolve/bad-module.rs b/tests/ui/resolve/bad-module.rs index 9fe06ab0f52ed..0d59222e746f4 100644 --- a/tests/ui/resolve/bad-module.rs +++ b/tests/ui/resolve/bad-module.rs @@ -1,7 +1,7 @@ fn main() { let foo = thing::len(Vec::new()); - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `thing` + //~^ ERROR cannot find module or crate `thing` let foo = foo::bar::baz(); - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `foo` + //~^ ERROR cannot find module or crate `foo` } diff --git a/tests/ui/resolve/bad-module.stderr b/tests/ui/resolve/bad-module.stderr index 0f597e126fdc5..82c93ca973d16 100644 --- a/tests/ui/resolve/bad-module.stderr +++ b/tests/ui/resolve/bad-module.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `foo` +error[E0433]: cannot find module or crate `foo` in this scope --> $DIR/bad-module.rs:5:15 | LL | let foo = foo::bar::baz(); @@ -6,7 +6,7 @@ LL | let foo = foo::bar::baz(); | = help: you might be missing a crate named `foo` -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `thing` +error[E0433]: cannot find module or crate `thing` in this scope --> $DIR/bad-module.rs:2:15 | LL | let foo = thing::len(Vec::new()); diff --git a/tests/ui/resolve/editions-crate-root-2015.rs b/tests/ui/resolve/editions-crate-root-2015.rs index a2e19bfdf1c57..163984b4e8f78 100644 --- a/tests/ui/resolve/editions-crate-root-2015.rs +++ b/tests/ui/resolve/editions-crate-root-2015.rs @@ -2,17 +2,17 @@ mod inner { fn global_inner(_: ::nonexistant::Foo) { - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `nonexistant` + //~^ ERROR: cannot find module or crate `nonexistant` } fn crate_inner(_: crate::nonexistant::Foo) { - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `nonexistant` + //~^ ERROR: cannot find module or crate `nonexistant` } fn bare_global(_: ::nonexistant) { - //~^ ERROR cannot find type `nonexistant` in the crate root + //~^ ERROR: cannot find type `nonexistant` in the crate root } fn bare_crate(_: crate::nonexistant) { - //~^ ERROR cannot find type `nonexistant` in the crate root + //~^ ERROR: cannot find type `nonexistant` in the crate root } } diff --git a/tests/ui/resolve/editions-crate-root-2015.stderr b/tests/ui/resolve/editions-crate-root-2015.stderr index 989ee547a7c6c..a4002349387a9 100644 --- a/tests/ui/resolve/editions-crate-root-2015.stderr +++ b/tests/ui/resolve/editions-crate-root-2015.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistant` +error[E0433]: cannot find module or crate `nonexistant` in the crate root --> $DIR/editions-crate-root-2015.rs:4:26 | LL | fn global_inner(_: ::nonexistant::Foo) { @@ -9,7 +9,7 @@ help: you might be missing a crate named `nonexistant`, add it to your project a LL + extern crate nonexistant; | -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistant` +error[E0433]: cannot find module or crate `nonexistant` in `crate` --> $DIR/editions-crate-root-2015.rs:7:30 | LL | fn crate_inner(_: crate::nonexistant::Foo) { diff --git a/tests/ui/resolve/editions-crate-root-2018.rs b/tests/ui/resolve/editions-crate-root-2018.rs index 0e964d20f9c0e..c07f617455efb 100644 --- a/tests/ui/resolve/editions-crate-root-2018.rs +++ b/tests/ui/resolve/editions-crate-root-2018.rs @@ -2,17 +2,17 @@ mod inner { fn global_inner(_: ::nonexistant::Foo) { - //~^ ERROR failed to resolve: could not find `nonexistant` in the list of imported crates + //~^ ERROR: cannot find `nonexistant` } fn crate_inner(_: crate::nonexistant::Foo) { - //~^ ERROR failed to resolve: could not find `nonexistant` in the crate root + //~^ ERROR: cannot find `nonexistant` } fn bare_global(_: ::nonexistant) { - //~^ ERROR cannot find crate `nonexistant` in the list of imported crates + //~^ ERROR: cannot find crate `nonexistant` } fn bare_crate(_: crate::nonexistant) { - //~^ ERROR cannot find type `nonexistant` in the crate root + //~^ ERROR: cannot find type `nonexistant` in the crate root } } diff --git a/tests/ui/resolve/editions-crate-root-2018.stderr b/tests/ui/resolve/editions-crate-root-2018.stderr index 1bcef33961994..c7ce936700511 100644 --- a/tests/ui/resolve/editions-crate-root-2018.stderr +++ b/tests/ui/resolve/editions-crate-root-2018.stderr @@ -1,10 +1,10 @@ -error[E0433]: failed to resolve: could not find `nonexistant` in the list of imported crates +error[E0433]: cannot find `nonexistant` in the crate root --> $DIR/editions-crate-root-2018.rs:4:26 | LL | fn global_inner(_: ::nonexistant::Foo) { | ^^^^^^^^^^^ could not find `nonexistant` in the list of imported crates -error[E0433]: failed to resolve: could not find `nonexistant` in the crate root +error[E0433]: cannot find `nonexistant` in `crate` --> $DIR/editions-crate-root-2018.rs:7:30 | LL | fn crate_inner(_: crate::nonexistant::Foo) { diff --git a/tests/ui/resolve/export-fully-qualified-2018.rs b/tests/ui/resolve/export-fully-qualified-2018.rs index ce78b64bf256d..a6121c2e800cd 100644 --- a/tests/ui/resolve/export-fully-qualified-2018.rs +++ b/tests/ui/resolve/export-fully-qualified-2018.rs @@ -5,7 +5,8 @@ // want to change eventually. mod foo { - pub fn bar() { foo::baz(); } //~ ERROR failed to resolve: use of unresolved module or unlinked crate `foo` + pub fn bar() { foo::baz(); } //~ ERROR: cannot find + //~^ NOTE: use of unresolved module or unlinked crate `foo` fn baz() { } } diff --git a/tests/ui/resolve/export-fully-qualified-2018.stderr b/tests/ui/resolve/export-fully-qualified-2018.stderr index a985669b8b415..25c9e6fbdab96 100644 --- a/tests/ui/resolve/export-fully-qualified-2018.stderr +++ b/tests/ui/resolve/export-fully-qualified-2018.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `foo` +error[E0433]: cannot find module or crate `foo` in this scope --> $DIR/export-fully-qualified-2018.rs:8:20 | LL | pub fn bar() { foo::baz(); } diff --git a/tests/ui/resolve/export-fully-qualified.rs b/tests/ui/resolve/export-fully-qualified.rs index 0be3b81ebb8ff..db0570d64f26a 100644 --- a/tests/ui/resolve/export-fully-qualified.rs +++ b/tests/ui/resolve/export-fully-qualified.rs @@ -5,7 +5,7 @@ // want to change eventually. mod foo { - pub fn bar() { foo::baz(); } //~ ERROR failed to resolve: use of unresolved module or unlinked crate `foo` + pub fn bar() { foo::baz(); } //~ ERROR cannot find module or crate `foo` fn baz() { } } diff --git a/tests/ui/resolve/export-fully-qualified.stderr b/tests/ui/resolve/export-fully-qualified.stderr index e65483e57eb57..f8433dcfb8924 100644 --- a/tests/ui/resolve/export-fully-qualified.stderr +++ b/tests/ui/resolve/export-fully-qualified.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `foo` +error[E0433]: cannot find module or crate `foo` in this scope --> $DIR/export-fully-qualified.rs:8:20 | LL | pub fn bar() { foo::baz(); } diff --git a/tests/ui/resolve/exported-macro-in-mod-147958.rs b/tests/ui/resolve/exported-macro-in-mod-147958.rs new file mode 100644 index 0000000000000..5003c410b692d --- /dev/null +++ b/tests/ui/resolve/exported-macro-in-mod-147958.rs @@ -0,0 +1,21 @@ +//! Regression test for + +//@ check-pass + +#![feature(decl_macro)] + +macro_rules! exported { + () => { + #[macro_export] + macro_rules! exported { + () => {}; + } + }; +} +use inner1::*; +exported!(); +mod inner1 { + pub macro exported() {} +} + +fn main() {} diff --git a/tests/ui/resolve/extern-prelude-fail.rs b/tests/ui/resolve/extern-prelude-fail.rs index 7d0df03e57bbd..d86ee9550b332 100644 --- a/tests/ui/resolve/extern-prelude-fail.rs +++ b/tests/ui/resolve/extern-prelude-fail.rs @@ -6,5 +6,5 @@ fn main() { use extern_prelude::S; //~ ERROR unresolved import `extern_prelude` - let s = ::extern_prelude::S; //~ ERROR failed to resolve + let s = ::extern_prelude::S; //~ ERROR cannot find module or crate `extern_prelude` } diff --git a/tests/ui/resolve/extern-prelude-fail.stderr b/tests/ui/resolve/extern-prelude-fail.stderr index b9668154f4469..a6192051e95a6 100644 --- a/tests/ui/resolve/extern-prelude-fail.stderr +++ b/tests/ui/resolve/extern-prelude-fail.stderr @@ -9,7 +9,7 @@ help: you might be missing a crate named `extern_prelude`, add it to your projec LL + extern crate extern_prelude; | -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `extern_prelude` +error[E0433]: cannot find module or crate `extern_prelude` in the crate root --> $DIR/extern-prelude-fail.rs:9:15 | LL | let s = ::extern_prelude::S; diff --git a/tests/ui/resolve/function-module-ambiguity-error-71406.rs b/tests/ui/resolve/function-module-ambiguity-error-71406.rs index a7964de9ba5e2..21163e3486b4c 100644 --- a/tests/ui/resolve/function-module-ambiguity-error-71406.rs +++ b/tests/ui/resolve/function-module-ambiguity-error-71406.rs @@ -3,5 +3,6 @@ use std::sync::mpsc; fn main() { let (tx, rx) = mpsc::channel::new(1); - //~^ ERROR expected type, found function `channel` in `mpsc` + //~^ ERROR: cannot find `channel` + //~| NOTE: expected type, found function `channel` in `mpsc` } diff --git a/tests/ui/resolve/function-module-ambiguity-error-71406.stderr b/tests/ui/resolve/function-module-ambiguity-error-71406.stderr index c25bafa0a5ddb..e5b00f294f3ca 100644 --- a/tests/ui/resolve/function-module-ambiguity-error-71406.stderr +++ b/tests/ui/resolve/function-module-ambiguity-error-71406.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: expected type, found function `channel` in `mpsc` +error[E0433]: cannot find `channel` in `mpsc` --> $DIR/function-module-ambiguity-error-71406.rs:5:26 | LL | let (tx, rx) = mpsc::channel::new(1); diff --git a/tests/ui/resolve/impl-items-vis-unresolved.rs b/tests/ui/resolve/impl-items-vis-unresolved.rs index 1494c1cf96800..bbdc8170d4f6b 100644 --- a/tests/ui/resolve/impl-items-vis-unresolved.rs +++ b/tests/ui/resolve/impl-items-vis-unresolved.rs @@ -19,7 +19,7 @@ pub struct RawFloatState; impl RawFloatState { perftools_inline! { pub(super) fn new() {} - //~^ ERROR failed to resolve: there are too many leading `super` keywords + //~^ ERROR: too many leading `super` keywords } } diff --git a/tests/ui/resolve/impl-items-vis-unresolved.stderr b/tests/ui/resolve/impl-items-vis-unresolved.stderr index cccffdcbf541b..e433cb607cdac 100644 --- a/tests/ui/resolve/impl-items-vis-unresolved.stderr +++ b/tests/ui/resolve/impl-items-vis-unresolved.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: there are too many leading `super` keywords +error[E0433]: too many leading `super` keywords --> $DIR/impl-items-vis-unresolved.rs:21:13 | LL | pub(super) fn new() {} diff --git a/tests/ui/resolve/issue-101749-2.rs b/tests/ui/resolve/issue-101749-2.rs index 636ff07c71ceb..60846713f63fc 100644 --- a/tests/ui/resolve/issue-101749-2.rs +++ b/tests/ui/resolve/issue-101749-2.rs @@ -12,5 +12,5 @@ fn main() { let rect = Rectangle::new(3, 4); // `area` is not implemented for `Rectangle`, so this should not suggest let _ = rect::area(); - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `rect` + //~^ ERROR: cannot find module or crate `rect` } diff --git a/tests/ui/resolve/issue-101749-2.stderr b/tests/ui/resolve/issue-101749-2.stderr index 96a20b4bf5a05..f8ed9ceb830db 100644 --- a/tests/ui/resolve/issue-101749-2.stderr +++ b/tests/ui/resolve/issue-101749-2.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `rect` +error[E0433]: cannot find module or crate `rect` in this scope --> $DIR/issue-101749-2.rs:14:13 | LL | let _ = rect::area(); diff --git a/tests/ui/resolve/issue-101749.fixed b/tests/ui/resolve/issue-101749.fixed index 3244ad7a03139..ebd6533fe0e0f 100644 --- a/tests/ui/resolve/issue-101749.fixed +++ b/tests/ui/resolve/issue-101749.fixed @@ -15,5 +15,5 @@ impl Rectangle { fn main() { let rect = Rectangle::new(3, 4); let _ = rect.area(); - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `rect` + //~^ ERROR: cannot find module or crate `rect` } diff --git a/tests/ui/resolve/issue-101749.rs b/tests/ui/resolve/issue-101749.rs index c977df41d2f56..4c1a2e0f44033 100644 --- a/tests/ui/resolve/issue-101749.rs +++ b/tests/ui/resolve/issue-101749.rs @@ -15,5 +15,5 @@ impl Rectangle { fn main() { let rect = Rectangle::new(3, 4); let _ = rect::area(); - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `rect` + //~^ ERROR: cannot find module or crate `rect` } diff --git a/tests/ui/resolve/issue-101749.stderr b/tests/ui/resolve/issue-101749.stderr index 09e800ec7c310..8a508f5901612 100644 --- a/tests/ui/resolve/issue-101749.stderr +++ b/tests/ui/resolve/issue-101749.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `rect` +error[E0433]: cannot find module or crate `rect` in this scope --> $DIR/issue-101749.rs:17:13 | LL | let _ = rect::area(); diff --git a/tests/ui/resolve/issue-109250.rs b/tests/ui/resolve/issue-109250.rs index 68e33f693cef1..99fcae9647bff 100644 --- a/tests/ui/resolve/issue-109250.rs +++ b/tests/ui/resolve/issue-109250.rs @@ -1,3 +1,3 @@ fn main() { //~ HELP consider importing - HashMap::new; //~ ERROR failed to resolve: use of undeclared type `HashMap` + HashMap::new; //~ ERROR cannot find type `HashMap` } diff --git a/tests/ui/resolve/issue-109250.stderr b/tests/ui/resolve/issue-109250.stderr index ad6cc6986229a..d631232f73bf8 100644 --- a/tests/ui/resolve/issue-109250.stderr +++ b/tests/ui/resolve/issue-109250.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of undeclared type `HashMap` +error[E0433]: cannot find type `HashMap` in this scope --> $DIR/issue-109250.rs:2:5 | LL | HashMap::new; diff --git a/tests/ui/resolve/issue-117920.rs b/tests/ui/resolve/issue-117920.rs index 928f194c59c3f..6fbc412001f5b 100644 --- a/tests/ui/resolve/issue-117920.rs +++ b/tests/ui/resolve/issue-117920.rs @@ -1,6 +1,6 @@ #![crate_type = "lib"] -use super::A; //~ ERROR failed to resolve +use super::A; //~ ERROR too many leading `super` keywords mod b { pub trait A {} diff --git a/tests/ui/resolve/issue-117920.stderr b/tests/ui/resolve/issue-117920.stderr index c4528d467e9f5..810c2c06efe7f 100644 --- a/tests/ui/resolve/issue-117920.stderr +++ b/tests/ui/resolve/issue-117920.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: there are too many leading `super` keywords +error[E0433]: too many leading `super` keywords --> $DIR/issue-117920.rs:3:5 | LL | use super::A; diff --git a/tests/ui/resolve/issue-24968.rs b/tests/ui/resolve/issue-24968.rs index 19e16abcee3cb..22f5ea5204678 100644 --- a/tests/ui/resolve/issue-24968.rs +++ b/tests/ui/resolve/issue-24968.rs @@ -19,12 +19,12 @@ const FOO: Self = 0; //~^ ERROR cannot find type `Self` const FOO2: u32 = Self::bar(); -//~^ ERROR failed to resolve: `Self` +//~^ ERROR cannot find `Self` static FOO_S: Self = 0; //~^ ERROR cannot find type `Self` static FOO_S2: u32 = Self::bar(); -//~^ ERROR failed to resolve: `Self` +//~^ ERROR cannot find `Self` fn main() {} diff --git a/tests/ui/resolve/issue-24968.stderr b/tests/ui/resolve/issue-24968.stderr index 82f5a1d5b57b3..ce8ded2714f43 100644 --- a/tests/ui/resolve/issue-24968.stderr +++ b/tests/ui/resolve/issue-24968.stderr @@ -39,13 +39,13 @@ LL | static FOO_S: Self = 0; | | | `Self` not allowed in a static item -error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions +error[E0433]: cannot find `Self` in this scope --> $DIR/issue-24968.rs:21:19 | LL | const FOO2: u32 = Self::bar(); | ^^^^ `Self` is only available in impls, traits, and type definitions -error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions +error[E0433]: cannot find `Self` in this scope --> $DIR/issue-24968.rs:27:22 | LL | static FOO_S2: u32 = Self::bar(); diff --git a/tests/ui/resolve/issue-81508.rs b/tests/ui/resolve/issue-81508.rs index 23605cd2fd91d..96d5f52feba04 100644 --- a/tests/ui/resolve/issue-81508.rs +++ b/tests/ui/resolve/issue-81508.rs @@ -8,7 +8,7 @@ fn main() { let Baz: &str = ""; - println!("{}", Baz::Bar); //~ ERROR: failed to resolve: use of undeclared type `Baz` + println!("{}", Baz::Bar); //~ ERROR: cannot find type `Baz` } #[allow(non_upper_case_globals)] @@ -17,6 +17,6 @@ pub const Foo: &str = ""; mod submod { use super::Foo; fn function() { - println!("{}", Foo::Bar); //~ ERROR: failed to resolve: use of undeclared type `Foo` + println!("{}", Foo::Bar); //~ ERROR: cannot find type `Foo` } } diff --git a/tests/ui/resolve/issue-81508.stderr b/tests/ui/resolve/issue-81508.stderr index 7258174ba89b3..49fe9fbf62117 100644 --- a/tests/ui/resolve/issue-81508.stderr +++ b/tests/ui/resolve/issue-81508.stderr @@ -1,20 +1,14 @@ -error[E0433]: failed to resolve: use of undeclared type `Baz` +error[E0433]: cannot find type `Baz` in this scope --> $DIR/issue-81508.rs:11:20 | -LL | let Baz: &str = ""; - | --- help: `Baz` is defined here, but is not a type -LL | LL | println!("{}", Baz::Bar); - | ^^^ use of undeclared type `Baz` + | ^^^ `Baz` is declared as a local binding at `issue-81508.rs:9:9`, not a type -error[E0433]: failed to resolve: use of undeclared type `Foo` +error[E0433]: cannot find type `Foo` in this scope --> $DIR/issue-81508.rs:20:24 | -LL | use super::Foo; - | ---------- help: `Foo` is defined here, but is not a type -LL | fn function() { LL | println!("{}", Foo::Bar); - | ^^^ use of undeclared type `Foo` + | ^^^ `Foo` is declared as a constant at `issue-81508.rs:18:9`, not a type error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/issue-82156.rs b/tests/ui/resolve/issue-82156.rs index 6215259e48657..fc6840faf636b 100644 --- a/tests/ui/resolve/issue-82156.rs +++ b/tests/ui/resolve/issue-82156.rs @@ -1,3 +1,3 @@ fn main() { - super(); //~ ERROR failed to resolve: there are too many leading `super` keywords + super(); //~ ERROR: too many leading `super` keywords } diff --git a/tests/ui/resolve/issue-82156.stderr b/tests/ui/resolve/issue-82156.stderr index 3894b9573a45c..6fe0d4c4ea157 100644 --- a/tests/ui/resolve/issue-82156.stderr +++ b/tests/ui/resolve/issue-82156.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: there are too many leading `super` keywords +error[E0433]: too many leading `super` keywords --> $DIR/issue-82156.rs:2:5 | LL | super(); diff --git a/tests/ui/resolve/issue-82865.rs b/tests/ui/resolve/issue-82865.rs index 30084b133e0f6..545ca63e0b82b 100644 --- a/tests/ui/resolve/issue-82865.rs +++ b/tests/ui/resolve/issue-82865.rs @@ -3,7 +3,7 @@ #![feature(decl_macro)] -use x::y::z; //~ ERROR: failed to resolve: use of unresolved module or unlinked crate `x` +use x::y::z; //~ ERROR: cannot find module or crate `x` macro mac () { Box::z //~ ERROR: no function or associated item diff --git a/tests/ui/resolve/issue-82865.stderr b/tests/ui/resolve/issue-82865.stderr index c9184bafd4c9e..90059ad5a9659 100644 --- a/tests/ui/resolve/issue-82865.stderr +++ b/tests/ui/resolve/issue-82865.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `x` +error[E0433]: cannot find module or crate `x` in the crate root --> $DIR/issue-82865.rs:6:5 | LL | use x::y::z; diff --git a/tests/ui/resolve/missing-in-namespace.rs b/tests/ui/resolve/missing-in-namespace.rs index e1dedb072b77b..f54d478eb03a9 100644 --- a/tests/ui/resolve/missing-in-namespace.rs +++ b/tests/ui/resolve/missing-in-namespace.rs @@ -1,4 +1,4 @@ fn main() { let _map = std::hahmap::HashMap::new(); - //~^ ERROR failed to resolve: could not find `hahmap` in `std + //~^ ERROR: cannot find `hahmap` in `std } diff --git a/tests/ui/resolve/missing-in-namespace.stderr b/tests/ui/resolve/missing-in-namespace.stderr index 35585e4240a2b..cefcc097b1db6 100644 --- a/tests/ui/resolve/missing-in-namespace.stderr +++ b/tests/ui/resolve/missing-in-namespace.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: could not find `hahmap` in `std` +error[E0433]: cannot find `hahmap` in `std` --> $DIR/missing-in-namespace.rs:2:21 | LL | let _map = std::hahmap::HashMap::new(); diff --git a/tests/ui/resolve/prelude-order.rs b/tests/ui/resolve/prelude-order.rs index c6683bdff22a6..9bc3793dbf20c 100644 --- a/tests/ui/resolve/prelude-order.rs +++ b/tests/ui/resolve/prelude-order.rs @@ -59,7 +59,7 @@ extern crate macro_helpers as _; /* lang and libs implicitly in scope */ // tool/extern -> extern -#[type_ns::inner] //~ ERROR could not find `inner` in `type_ns` +#[type_ns::inner] //~ ERROR cannot find `inner` in `type_ns` fn t1() {} // tool/lang -> tool @@ -71,7 +71,7 @@ fn t2() {} fn t3() {} // extern/lang -> extern -#[usize::inner] //~ ERROR could not find `inner` in `usize` +#[usize::inner] //~ ERROR cannot find `inner` in `usize` fn e1() {} // NOTE: testing with `-> usize` isn't valid, crates aren't considered in that scope // (unless they have generic arguments, for some reason.) diff --git a/tests/ui/resolve/prelude-order.stderr b/tests/ui/resolve/prelude-order.stderr index 4dad39fb6d240..c7929bf74d51e 100644 --- a/tests/ui/resolve/prelude-order.stderr +++ b/tests/ui/resolve/prelude-order.stderr @@ -1,10 +1,10 @@ -error[E0433]: failed to resolve: could not find `inner` in `type_ns` +error[E0433]: cannot find `inner` in `type_ns` --> $DIR/prelude-order.rs:62:12 | LL | #[type_ns::inner] | ^^^^^ could not find `inner` in `type_ns` -error[E0433]: failed to resolve: could not find `inner` in `usize` +error[E0433]: cannot find `inner` in `usize` --> $DIR/prelude-order.rs:74:10 | LL | #[usize::inner] diff --git a/tests/ui/resolve/resolve-bad-visibility.rs b/tests/ui/resolve/resolve-bad-visibility.rs index 81635611fca93..55e381e8be1a1 100644 --- a/tests/ui/resolve/resolve-bad-visibility.rs +++ b/tests/ui/resolve/resolve-bad-visibility.rs @@ -5,8 +5,8 @@ trait Tr {} pub(in E) struct S; //~ ERROR expected module, found enum `E` pub(in Tr) struct Z; //~ ERROR expected module, found trait `Tr` pub(in std::vec) struct F; //~ ERROR visibilities can only be restricted to ancestor modules -pub(in nonexistent) struct G; //~ ERROR failed to resolve -pub(in too_soon) struct H; //~ ERROR failed to resolve +pub(in nonexistent) struct G; //~ ERROR cannot find +pub(in too_soon) struct H; //~ ERROR cannot find // Visibilities are resolved eagerly without waiting for modules becoming fully populated. // Visibilities can only use ancestor modules legally which are always available in time, diff --git a/tests/ui/resolve/resolve-bad-visibility.stderr b/tests/ui/resolve/resolve-bad-visibility.stderr index c7bbdfbd24952..4530757c3de55 100644 --- a/tests/ui/resolve/resolve-bad-visibility.stderr +++ b/tests/ui/resolve/resolve-bad-visibility.stderr @@ -16,7 +16,7 @@ error[E0742]: visibilities can only be restricted to ancestor modules LL | pub(in std::vec) struct F; | ^^^^^^^^ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistent` +error[E0433]: cannot find module or crate `nonexistent` in the crate root --> $DIR/resolve-bad-visibility.rs:8:8 | LL | pub(in nonexistent) struct G; @@ -27,7 +27,7 @@ help: you might be missing a crate named `nonexistent`, add it to your project a LL + extern crate nonexistent; | -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `too_soon` +error[E0433]: cannot find module or crate `too_soon` in the crate root --> $DIR/resolve-bad-visibility.rs:9:8 | LL | pub(in too_soon) struct H; diff --git a/tests/ui/resolve/resolve-variant-assoc-item.rs b/tests/ui/resolve/resolve-variant-assoc-item.rs index 7671dddc819bc..edf97daa172a4 100644 --- a/tests/ui/resolve/resolve-variant-assoc-item.rs +++ b/tests/ui/resolve/resolve-variant-assoc-item.rs @@ -3,6 +3,6 @@ enum E { V } use E::V; fn main() { - E::V::associated_item; //~ ERROR failed to resolve: `V` is a variant, not a module - V::associated_item; //~ ERROR failed to resolve: `V` is a variant, not a module + E::V::associated_item; //~ ERROR: cannot find + V::associated_item; //~ ERROR: cannot find } diff --git a/tests/ui/resolve/resolve-variant-assoc-item.stderr b/tests/ui/resolve/resolve-variant-assoc-item.stderr index 5528bb2495b52..460cea2dfb91c 100644 --- a/tests/ui/resolve/resolve-variant-assoc-item.stderr +++ b/tests/ui/resolve/resolve-variant-assoc-item.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: `V` is a variant, not a module +error[E0433]: cannot find module `V` in `E` --> $DIR/resolve-variant-assoc-item.rs:6:8 | LL | E::V::associated_item; @@ -10,7 +10,7 @@ LL - E::V::associated_item; LL + E::associated_item; | -error[E0433]: failed to resolve: `V` is a variant, not a module +error[E0433]: cannot find module `V` in this scope --> $DIR/resolve-variant-assoc-item.rs:7:5 | LL | V::associated_item; diff --git a/tests/ui/resolve/tool-import.rs b/tests/ui/resolve/tool-import.rs index 951505b92a0bf..bc34a64e7f933 100644 --- a/tests/ui/resolve/tool-import.rs +++ b/tests/ui/resolve/tool-import.rs @@ -1,7 +1,8 @@ //@ edition: 2018 use clippy::time::Instant; -//~^ ERROR `clippy` is a tool module +//~^ ERROR: cannot find module `clippy` +//~| NOTE: `clippy` is a tool module fn main() { Instant::now(); diff --git a/tests/ui/resolve/tool-import.stderr b/tests/ui/resolve/tool-import.stderr index b070439d72b77..02e4432fd9e56 100644 --- a/tests/ui/resolve/tool-import.stderr +++ b/tests/ui/resolve/tool-import.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: `clippy` is a tool module, not a module +error[E0433]: cannot find module `clippy` in this scope --> $DIR/tool-import.rs:3:5 | LL | use clippy::time::Instant; diff --git a/tests/ui/resolve/typo-suggestion-mistyped-in-path.rs b/tests/ui/resolve/typo-suggestion-mistyped-in-path.rs index 188e2ca7f1133..706564dc9b212 100644 --- a/tests/ui/resolve/typo-suggestion-mistyped-in-path.rs +++ b/tests/ui/resolve/typo-suggestion-mistyped-in-path.rs @@ -25,18 +25,18 @@ fn main() { //~| NOTE function or associated item not found in `Struct` Struc::foo(); - //~^ ERROR failed to resolve: use of undeclared type `Struc` + //~^ ERROR cannot find type `Struc` //~| NOTE use of undeclared type `Struc` modul::foo(); - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `modul` + //~^ ERROR cannot find module or crate `modul` //~| NOTE use of unresolved module or unlinked crate `modul` module::Struc::foo(); - //~^ ERROR failed to resolve: could not find `Struc` in `module` + //~^ ERROR cannot find `Struc` in `module` //~| NOTE could not find `Struc` in `module` Trai::foo(); - //~^ ERROR failed to resolve: use of undeclared type `Trai` + //~^ ERROR cannot find type `Trai` //~| NOTE use of undeclared type `Trai` } diff --git a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr index fef1f52b86b7e..b1afa703eb039 100644 --- a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr +++ b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: could not find `Struc` in `module` +error[E0433]: cannot find `Struc` in `module` --> $DIR/typo-suggestion-mistyped-in-path.rs:35:13 | LL | module::Struc::foo(); @@ -24,7 +24,7 @@ LL - Struct::fob(); LL + Struct::foo(); | -error[E0433]: failed to resolve: use of undeclared type `Struc` +error[E0433]: cannot find type `Struc` in this scope --> $DIR/typo-suggestion-mistyped-in-path.rs:27:5 | LL | Struc::foo(); @@ -35,7 +35,7 @@ help: a struct with a similar name exists LL | Struct::foo(); | + -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `modul` +error[E0433]: cannot find module or crate `modul` in this scope --> $DIR/typo-suggestion-mistyped-in-path.rs:31:5 | LL | modul::foo(); @@ -46,7 +46,7 @@ help: there is a crate or module with a similar name LL | module::foo(); | + -error[E0433]: failed to resolve: use of undeclared type `Trai` +error[E0433]: cannot find type `Trai` in this scope --> $DIR/typo-suggestion-mistyped-in-path.rs:39:5 | LL | Trai::foo(); diff --git a/tests/ui/resolve/unresolved-module-error-33293.rs b/tests/ui/resolve/unresolved-module-error-33293.rs index 354f9914d4431..18906e610dca5 100644 --- a/tests/ui/resolve/unresolved-module-error-33293.rs +++ b/tests/ui/resolve/unresolved-module-error-33293.rs @@ -2,6 +2,6 @@ fn main() { match 0 { aaa::bbb(_) => () - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `aaa` + //~^ ERROR: cannot find module or crate `aaa` }; } diff --git a/tests/ui/resolve/unresolved-module-error-33293.stderr b/tests/ui/resolve/unresolved-module-error-33293.stderr index 28528148387fb..e119a69d2cc25 100644 --- a/tests/ui/resolve/unresolved-module-error-33293.stderr +++ b/tests/ui/resolve/unresolved-module-error-33293.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `aaa` +error[E0433]: cannot find module or crate `aaa` in this scope --> $DIR/unresolved-module-error-33293.rs:4:9 | LL | aaa::bbb(_) => () diff --git a/tests/ui/resolve/unresolved-segments-visibility.rs b/tests/ui/resolve/unresolved-segments-visibility.rs index fc86b31adfc25..b9695de1e999b 100644 --- a/tests/ui/resolve/unresolved-segments-visibility.rs +++ b/tests/ui/resolve/unresolved-segments-visibility.rs @@ -6,6 +6,7 @@ extern crate alloc as b; mod foo { mod bar { pub(in crate::b::string::String::newy) extern crate alloc as e; - //~^ ERROR failed to resolve: `String` is a struct, not a module [E0433] + //~^ ERROR: cannot find module `String` in `string` [E0433] + //~| NOTE: `String` is a struct, not a module } } diff --git a/tests/ui/resolve/unresolved-segments-visibility.stderr b/tests/ui/resolve/unresolved-segments-visibility.stderr index 082579c9fa113..bfefdd6449d43 100644 --- a/tests/ui/resolve/unresolved-segments-visibility.stderr +++ b/tests/ui/resolve/unresolved-segments-visibility.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: `String` is a struct, not a module +error[E0433]: cannot find module `String` in `string` --> $DIR/unresolved-segments-visibility.rs:8:34 | LL | pub(in crate::b::string::String::newy) extern crate alloc as e; diff --git a/tests/ui/resolve/use_suggestion.rs b/tests/ui/resolve/use_suggestion.rs index 8c9bc6d76b8b2..a23a61a39b848 100644 --- a/tests/ui/resolve/use_suggestion.rs +++ b/tests/ui/resolve/use_suggestion.rs @@ -1,6 +1,6 @@ fn main() { - let x1 = HashMap::new(); //~ ERROR failed to resolve - let x2 = GooMap::new(); //~ ERROR failed to resolve + let x1 = HashMap::new(); //~ ERROR cannot find + let x2 = GooMap::new(); //~ ERROR cannot find let y1: HashMap; //~ ERROR cannot find type let y2: GooMap; //~ ERROR cannot find type diff --git a/tests/ui/resolve/use_suggestion.stderr b/tests/ui/resolve/use_suggestion.stderr index 9981c97b2c17e..98ef142e6b9cb 100644 --- a/tests/ui/resolve/use_suggestion.stderr +++ b/tests/ui/resolve/use_suggestion.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of undeclared type `HashMap` +error[E0433]: cannot find type `HashMap` in this scope --> $DIR/use_suggestion.rs:2:14 | LL | let x1 = HashMap::new(); @@ -26,7 +26,7 @@ error[E0425]: cannot find type `GooMap` in this scope LL | let y2: GooMap; | ^^^^^^ not found in this scope -error[E0433]: failed to resolve: use of undeclared type `GooMap` +error[E0433]: cannot find type `GooMap` in this scope --> $DIR/use_suggestion.rs:3:14 | LL | let x2 = GooMap::new(); diff --git a/tests/ui/resolve/visibility-indeterminate.rs b/tests/ui/resolve/visibility-indeterminate.rs index 181bb29077430..8033a30b233ce 100644 --- a/tests/ui/resolve/visibility-indeterminate.rs +++ b/tests/ui/resolve/visibility-indeterminate.rs @@ -2,6 +2,6 @@ foo!(); //~ ERROR cannot find macro `foo` in this scope -pub(in ::bar) struct Baz {} //~ ERROR failed to resolve: could not find `bar` in the list of imported crates +pub(in ::bar) struct Baz {} //~ ERROR cannot find `bar` fn main() {} diff --git a/tests/ui/resolve/visibility-indeterminate.stderr b/tests/ui/resolve/visibility-indeterminate.stderr index bbe28747f7c06..bd6fc11b67313 100644 --- a/tests/ui/resolve/visibility-indeterminate.stderr +++ b/tests/ui/resolve/visibility-indeterminate.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: could not find `bar` in the list of imported crates +error[E0433]: cannot find `bar` in the crate root --> $DIR/visibility-indeterminate.rs:5:10 | LL | pub(in ::bar) struct Baz {} diff --git a/tests/ui/rfcs/rfc-2126-crate-paths/crate-path-non-absolute.rs b/tests/ui/rfcs/rfc-2126-crate-paths/crate-path-non-absolute.rs index efadddf3ef1dc..95486e37b6914 100644 --- a/tests/ui/rfcs/rfc-2126-crate-paths/crate-path-non-absolute.rs +++ b/tests/ui/rfcs/rfc-2126-crate-paths/crate-path-non-absolute.rs @@ -3,8 +3,8 @@ struct S; pub mod m { fn f() { - let s = ::m::crate::S; //~ ERROR failed to resolve - let s1 = ::crate::S; //~ ERROR failed to resolve + let s = ::m::crate::S; //~ ERROR: `crate` in paths can only be used in start position + let s1 = ::crate::S; //~ ERROR: global paths cannot start with `crate` let s2 = crate::S; // no error } } diff --git a/tests/ui/rfcs/rfc-2126-crate-paths/crate-path-non-absolute.stderr b/tests/ui/rfcs/rfc-2126-crate-paths/crate-path-non-absolute.stderr index 6cb96e5762ad4..a267c037d1ff5 100644 --- a/tests/ui/rfcs/rfc-2126-crate-paths/crate-path-non-absolute.stderr +++ b/tests/ui/rfcs/rfc-2126-crate-paths/crate-path-non-absolute.stderr @@ -1,14 +1,14 @@ -error[E0433]: failed to resolve: `crate` in paths can only be used in start position +error[E0433]: `crate` in paths can only be used in start position --> $DIR/crate-path-non-absolute.rs:6:22 | LL | let s = ::m::crate::S; - | ^^^^^ `crate` in paths can only be used in start position + | ^^^^^ can only be used in path start position -error[E0433]: failed to resolve: global paths cannot start with `crate` +error[E0433]: global paths cannot start with `crate` --> $DIR/crate-path-non-absolute.rs:7:20 | LL | let s1 = ::crate::S; - | ^^^^^ global paths cannot start with `crate` + | ^^^^^ cannot start with this error: aborting due to 2 previous errors diff --git a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/non-existent-2.rs b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/non-existent-2.rs index 6bbfb69800e11..f8450d2ba0093 100644 --- a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/non-existent-2.rs +++ b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/non-existent-2.rs @@ -2,5 +2,5 @@ fn main() { let s = ::xcrate::S; - //~^ ERROR failed to resolve: could not find `xcrate` in the list of imported crates + //~^ ERROR cannot find `xcrate` } diff --git a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/non-existent-2.stderr b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/non-existent-2.stderr index e3875fd843b62..553365c932239 100644 --- a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/non-existent-2.stderr +++ b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/non-existent-2.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: could not find `xcrate` in the list of imported crates +error[E0433]: cannot find `xcrate` in the crate root --> $DIR/non-existent-2.rs:4:15 | LL | let s = ::xcrate::S; diff --git a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr index 043a4ca376184..c7c36c8410912 100644 --- a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr +++ b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr @@ -1,11 +1,14 @@ -error[E0433]: failed to resolve: you might be missing crate `core` +error[E0433]: cannot find `core` in the crate root --> $DIR/portable-intrinsics-arent-exposed.rs:5:5 | LL | use core::simd::intrinsics; - | ^^^^ - | | - | you might be missing crate `core` - | help: try using `std` instead of `core`: `std` + | ^^^^ you might be missing crate `core` + | +help: try using `std` instead of `core` + | +LL - use core::simd::intrinsics; +LL + use std::simd::intrinsics; + | error[E0432]: unresolved import `std::simd::intrinsics` --> $DIR/portable-intrinsics-arent-exposed.rs:6:5 diff --git a/tests/ui/span/visibility-ty-params.rs b/tests/ui/span/visibility-ty-params.rs index 05d93e5463604..7817d134c77bb 100644 --- a/tests/ui/span/visibility-ty-params.rs +++ b/tests/ui/span/visibility-ty-params.rs @@ -4,7 +4,7 @@ macro_rules! m { struct S(T); m!{ crate::S } //~ ERROR unexpected generic arguments in path - //~| ERROR failed to resolve: `S` is a struct, not a module [E0433] + //~| ERROR cannot find mod m { m!{ crate::m<> } //~ ERROR unexpected generic arguments in path diff --git a/tests/ui/span/visibility-ty-params.stderr b/tests/ui/span/visibility-ty-params.stderr index 7b02d79a1bc21..2fda6c70de0dd 100644 --- a/tests/ui/span/visibility-ty-params.stderr +++ b/tests/ui/span/visibility-ty-params.stderr @@ -4,7 +4,7 @@ error: unexpected generic arguments in path LL | m!{ crate::S } | ^^^^ -error[E0433]: failed to resolve: `S` is a struct, not a module +error[E0433]: cannot find module `S` in `crate` --> $DIR/visibility-ty-params.rs:6:12 | LL | m!{ crate::S } diff --git a/tests/ui/suggestions/core-std-import-order-issue-83564.no_std.fixed b/tests/ui/suggestions/core-std-import-order-issue-83564.no_std.fixed index b7b94a051212d..3ab6ad8b85f5a 100644 --- a/tests/ui/suggestions/core-std-import-order-issue-83564.no_std.fixed +++ b/tests/ui/suggestions/core-std-import-order-issue-83564.no_std.fixed @@ -12,7 +12,7 @@ use core::num::NonZero; fn main() { //~^ HELP consider importing this struct let _x = NonZero::new(5u32).unwrap(); - //~^ ERROR failed to resolve: use of undeclared type `NonZero` + //~^ ERROR cannot find type `NonZero` } #[allow(dead_code)] diff --git a/tests/ui/suggestions/core-std-import-order-issue-83564.no_std.stderr b/tests/ui/suggestions/core-std-import-order-issue-83564.no_std.stderr index d73f613bf9c8a..37bfb07b22956 100644 --- a/tests/ui/suggestions/core-std-import-order-issue-83564.no_std.stderr +++ b/tests/ui/suggestions/core-std-import-order-issue-83564.no_std.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of undeclared type `NonZero` +error[E0433]: cannot find type `NonZero` in this scope --> $DIR/core-std-import-order-issue-83564.rs:12:14 | LL | let _x = NonZero::new(5u32).unwrap(); diff --git a/tests/ui/suggestions/core-std-import-order-issue-83564.rs b/tests/ui/suggestions/core-std-import-order-issue-83564.rs index 4cfc9a6bf7425..e7a56a44d9214 100644 --- a/tests/ui/suggestions/core-std-import-order-issue-83564.rs +++ b/tests/ui/suggestions/core-std-import-order-issue-83564.rs @@ -10,7 +10,7 @@ fn main() { //~^ HELP consider importing this struct let _x = NonZero::new(5u32).unwrap(); - //~^ ERROR failed to resolve: use of undeclared type `NonZero` + //~^ ERROR cannot find type `NonZero` } #[allow(dead_code)] diff --git a/tests/ui/suggestions/core-std-import-order-issue-83564.std.fixed b/tests/ui/suggestions/core-std-import-order-issue-83564.std.fixed index 84c7c19d19e25..8021775788468 100644 --- a/tests/ui/suggestions/core-std-import-order-issue-83564.std.fixed +++ b/tests/ui/suggestions/core-std-import-order-issue-83564.std.fixed @@ -12,7 +12,7 @@ use std::num::NonZero; fn main() { //~^ HELP consider importing this struct let _x = NonZero::new(5u32).unwrap(); - //~^ ERROR failed to resolve: use of undeclared type `NonZero` + //~^ ERROR cannot find type `NonZero` } #[allow(dead_code)] diff --git a/tests/ui/suggestions/core-std-import-order-issue-83564.std.stderr b/tests/ui/suggestions/core-std-import-order-issue-83564.std.stderr index ebfe197b45d69..ad0ac7859a8d0 100644 --- a/tests/ui/suggestions/core-std-import-order-issue-83564.std.stderr +++ b/tests/ui/suggestions/core-std-import-order-issue-83564.std.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of undeclared type `NonZero` +error[E0433]: cannot find type `NonZero` in this scope --> $DIR/core-std-import-order-issue-83564.rs:12:14 | LL | let _x = NonZero::new(5u32).unwrap(); diff --git a/tests/ui/suggestions/crate-or-module-typo.rs b/tests/ui/suggestions/crate-or-module-typo.rs index 393fc7a1f72e0..8a6df258b4525 100644 --- a/tests/ui/suggestions/crate-or-module-typo.rs +++ b/tests/ui/suggestions/crate-or-module-typo.rs @@ -1,9 +1,9 @@ //@ edition:2018 -use st::cell::Cell; //~ ERROR failed to resolve: use of unresolved module or unlinked crate `st` +use st::cell::Cell; //~ ERROR cannot find module or crate `st` mod bar { - pub fn bar() { bar::baz(); } //~ ERROR failed to resolve: function `bar` is not a crate or module + pub fn bar() { bar::baz(); } //~ ERROR cannot find module or crate `bar` fn baz() {} } @@ -11,7 +11,7 @@ mod bar { use bas::bar; //~ ERROR unresolved import `bas` struct Foo { - bar: st::cell::Cell //~ ERROR failed to resolve: use of unresolved module or unlinked crate `st` + bar: st::cell::Cell //~ ERROR cannot find module or crate `st` } fn main() {} diff --git a/tests/ui/suggestions/crate-or-module-typo.stderr b/tests/ui/suggestions/crate-or-module-typo.stderr index 2ec4fc7ed6ccf..49ac1c89ab52a 100644 --- a/tests/ui/suggestions/crate-or-module-typo.stderr +++ b/tests/ui/suggestions/crate-or-module-typo.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `st` +error[E0433]: cannot find module or crate `st` in this scope --> $DIR/crate-or-module-typo.rs:3:5 | LL | use st::cell::Cell; @@ -21,7 +21,7 @@ LL - use bas::bar; LL + use bar::bar; | -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `st` +error[E0433]: cannot find module or crate `st` in this scope --> $DIR/crate-or-module-typo.rs:14:10 | LL | bar: st::cell::Cell @@ -41,7 +41,7 @@ LL - bar: st::cell::Cell LL + bar: cell::Cell | -error[E0433]: failed to resolve: function `bar` is not a crate or module +error[E0433]: cannot find module or crate `bar` in this scope --> $DIR/crate-or-module-typo.rs:6:20 | LL | pub fn bar() { bar::baz(); } diff --git a/tests/ui/suggestions/issue-103112.rs b/tests/ui/suggestions/issue-103112.rs index 111ae7c73080d..795fe60fd693c 100644 --- a/tests/ui/suggestions/issue-103112.rs +++ b/tests/ui/suggestions/issue-103112.rs @@ -1,4 +1,4 @@ fn main() { std::process::abort!(); - //~^ ERROR: failed to resolve + //~^ ERROR: cannot find } diff --git a/tests/ui/suggestions/issue-103112.stderr b/tests/ui/suggestions/issue-103112.stderr index b7de57bfd90ed..b644eff920d67 100644 --- a/tests/ui/suggestions/issue-103112.stderr +++ b/tests/ui/suggestions/issue-103112.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: could not find `abort` in `process` +error[E0433]: cannot find `abort` in `process` --> $DIR/issue-103112.rs:2:19 | LL | std::process::abort!(); diff --git a/tests/ui/suggestions/issue-112590-suggest-import.rs b/tests/ui/suggestions/issue-112590-suggest-import.rs index a7868b719190f..ec7a3cbac1ded 100644 --- a/tests/ui/suggestions/issue-112590-suggest-import.rs +++ b/tests/ui/suggestions/issue-112590-suggest-import.rs @@ -1,8 +1,9 @@ pub struct S; -impl fmt::Debug for S { //~ ERROR failed to resolve: use of unresolved module or unlinked crate `fmt` - fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { //~ ERROR failed to resolve: use of unresolved module or unlinked crate `fmt` - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `fmt` +impl fmt::Debug for S { //~ ERROR: cannot find module or crate `fmt` + fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { + //~^ ERROR: cannot find module or crate `fmt` + //~| ERROR: cannot find module or crate `fmt` Ok(()) } } diff --git a/tests/ui/suggestions/issue-112590-suggest-import.stderr b/tests/ui/suggestions/issue-112590-suggest-import.stderr index bbbd2c481c1cf..b44b59bea181d 100644 --- a/tests/ui/suggestions/issue-112590-suggest-import.stderr +++ b/tests/ui/suggestions/issue-112590-suggest-import.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `fmt` +error[E0433]: cannot find module or crate `fmt` in this scope --> $DIR/issue-112590-suggest-import.rs:3:6 | LL | impl fmt::Debug for S { @@ -10,7 +10,7 @@ help: consider importing this module LL + use std::fmt; | -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `fmt` +error[E0433]: cannot find module or crate `fmt` in this scope --> $DIR/issue-112590-suggest-import.rs:4:28 | LL | fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { @@ -22,7 +22,7 @@ help: consider importing this module LL + use std::fmt; | -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `fmt` +error[E0433]: cannot find module or crate `fmt` in this scope --> $DIR/issue-112590-suggest-import.rs:4:51 | LL | fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/tests/ui/suggestions/suggest-tryinto-edition-change.rs b/tests/ui/suggestions/suggest-tryinto-edition-change.rs index f45670ae7c1e2..06675a8e530b8 100644 --- a/tests/ui/suggestions/suggest-tryinto-edition-change.rs +++ b/tests/ui/suggestions/suggest-tryinto-edition-change.rs @@ -8,17 +8,17 @@ fn test() { //~| NOTE 'std::convert::TryInto' is included in the prelude starting in Edition 2021 let _i: i16 = TryFrom::try_from(0_i32).unwrap(); - //~^ ERROR failed to resolve: use of undeclared type + //~^ ERROR cannot find //~| NOTE use of undeclared type //~| NOTE 'std::convert::TryFrom' is included in the prelude starting in Edition 2021 let _i: i16 = TryInto::try_into(0_i32).unwrap(); - //~^ ERROR failed to resolve: use of undeclared type + //~^ ERROR cannot find //~| NOTE use of undeclared type //~| NOTE 'std::convert::TryInto' is included in the prelude starting in Edition 2021 let _v: Vec<_> = FromIterator::from_iter(&[1]); - //~^ ERROR failed to resolve: use of undeclared type + //~^ ERROR cannot find //~| NOTE use of undeclared type //~| NOTE 'std::iter::FromIterator' is included in the prelude starting in Edition 2021 } diff --git a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr index 8ab8a1716b14f..b0d150f49c735 100644 --- a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr +++ b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of undeclared type `TryFrom` +error[E0433]: cannot find type `TryFrom` in this scope --> $DIR/suggest-tryinto-edition-change.rs:10:19 | LL | let _i: i16 = TryFrom::try_from(0_i32).unwrap(); @@ -10,7 +10,7 @@ help: consider importing this trait LL + use std::convert::TryFrom; | -error[E0433]: failed to resolve: use of undeclared type `TryInto` +error[E0433]: cannot find type `TryInto` in this scope --> $DIR/suggest-tryinto-edition-change.rs:15:19 | LL | let _i: i16 = TryInto::try_into(0_i32).unwrap(); @@ -22,7 +22,7 @@ help: consider importing this trait LL + use std::convert::TryInto; | -error[E0433]: failed to resolve: use of undeclared type `FromIterator` +error[E0433]: cannot find type `FromIterator` in this scope --> $DIR/suggest-tryinto-edition-change.rs:20:22 | LL | let _v: Vec<_> = FromIterator::from_iter(&[1]); diff --git a/tests/ui/suggestions/undeclared-module-alloc.rs b/tests/ui/suggestions/undeclared-module-alloc.rs index a0bddc94471c1..a19e828f2a9b9 100644 --- a/tests/ui/suggestions/undeclared-module-alloc.rs +++ b/tests/ui/suggestions/undeclared-module-alloc.rs @@ -1,5 +1,5 @@ //@ edition:2018 -use alloc::rc::Rc; //~ ERROR failed to resolve: use of unresolved module or unlinked crate `alloc` +use alloc::rc::Rc; //~ ERROR cannot find module or crate `alloc` fn main() {} diff --git a/tests/ui/suggestions/undeclared-module-alloc.stderr b/tests/ui/suggestions/undeclared-module-alloc.stderr index 00e498aa9ba9d..c73efa8a36141 100644 --- a/tests/ui/suggestions/undeclared-module-alloc.stderr +++ b/tests/ui/suggestions/undeclared-module-alloc.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `alloc` +error[E0433]: cannot find module or crate `alloc` in this scope --> $DIR/undeclared-module-alloc.rs:3:5 | LL | use alloc::rc::Rc; diff --git a/tests/ui/test-attrs/issue-109816.rs b/tests/ui/test-attrs/issue-109816.rs index c7caae67fefa6..f40f99946da14 100644 --- a/tests/ui/test-attrs/issue-109816.rs +++ b/tests/ui/test-attrs/issue-109816.rs @@ -1,4 +1,5 @@ //@ compile-flags: --test +//@ reference: attributes.testing.test.allowed-positions fn align_offset_weird_strides() { #[test] diff --git a/tests/ui/test-attrs/issue-109816.stderr b/tests/ui/test-attrs/issue-109816.stderr index 270f4e0a66683..118c8d8782905 100644 --- a/tests/ui/test-attrs/issue-109816.stderr +++ b/tests/ui/test-attrs/issue-109816.stderr @@ -1,5 +1,5 @@ error: the `#[test]` attribute may only be used on a free function - --> $DIR/issue-109816.rs:4:5 + --> $DIR/issue-109816.rs:5:5 | LL | #[test] | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions diff --git a/tests/ui/test-attrs/test-attr-non-associated-functions.rs b/tests/ui/test-attrs/test-attr-non-associated-functions.rs index 4bf337d0f1b3c..9d28f59888a0c 100644 --- a/tests/ui/test-attrs/test-attr-non-associated-functions.rs +++ b/tests/ui/test-attrs/test-attr-non-associated-functions.rs @@ -1,4 +1,5 @@ //@ compile-flags:--test +//@ reference: attributes.testing.test.allowed-positions struct A {} diff --git a/tests/ui/test-attrs/test-attr-non-associated-functions.stderr b/tests/ui/test-attrs/test-attr-non-associated-functions.stderr index 13914971b558a..fda28ee28a07c 100644 --- a/tests/ui/test-attrs/test-attr-non-associated-functions.stderr +++ b/tests/ui/test-attrs/test-attr-non-associated-functions.stderr @@ -1,5 +1,5 @@ error: the `#[test]` attribute may only be used on a free function - --> $DIR/test-attr-non-associated-functions.rs:6:5 + --> $DIR/test-attr-non-associated-functions.rs:7:5 | LL | #[test] | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions @@ -11,7 +11,7 @@ LL + #[cfg(test)] | error: the `#[test]` attribute may only be used on a free function - --> $DIR/test-attr-non-associated-functions.rs:11:5 + --> $DIR/test-attr-non-associated-functions.rs:12:5 | LL | #[test] | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions diff --git a/tests/ui/test-attrs/test-function-signature.rs b/tests/ui/test-attrs/test-function-signature.rs index 0f43245be6f61..4a6c0e8450ce4 100644 --- a/tests/ui/test-attrs/test-function-signature.rs +++ b/tests/ui/test-attrs/test-function-signature.rs @@ -1,4 +1,5 @@ //@ compile-flags: --test +//@ reference: attributes.testing.test.allowed-positions #[test] fn foo() -> Result<(), ()> { diff --git a/tests/ui/test-attrs/test-function-signature.stderr b/tests/ui/test-attrs/test-function-signature.stderr index 55d09970b3203..7fdaaed1aebc0 100644 --- a/tests/ui/test-attrs/test-function-signature.stderr +++ b/tests/ui/test-attrs/test-function-signature.stderr @@ -1,29 +1,29 @@ error: functions used as tests can not have any arguments - --> $DIR/test-function-signature.rs:14:1 + --> $DIR/test-function-signature.rs:15:1 | LL | fn baz(val: i32) {} | ^^^^^^^^^^^^^^^^^^^ error: functions used as tests can not have any non-lifetime generic parameters - --> $DIR/test-function-signature.rs:22:1 + --> $DIR/test-function-signature.rs:23:1 | LL | fn type_generic() {} | ^^^^^^^^^^^^^^^^^^^^^^^ error: functions used as tests can not have any non-lifetime generic parameters - --> $DIR/test-function-signature.rs:25:1 + --> $DIR/test-function-signature.rs:26:1 | LL | fn const_generic() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: functions used as tests can not have any arguments - --> $DIR/test-function-signature.rs:30:5 + --> $DIR/test-function-signature.rs:31:5 | LL | fn foo(arg: ()) {} | ^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `i32: Termination` is not satisfied - --> $DIR/test-function-signature.rs:9:13 + --> $DIR/test-function-signature.rs:10:13 | LL | #[test] | ------- in this attribute macro expansion diff --git a/tests/ui/test-attrs/test-on-not-fn.rs b/tests/ui/test-attrs/test-on-not-fn.rs index 16e9cd8d5b8d7..57ae2b19cf5fb 100644 --- a/tests/ui/test-attrs/test-on-not-fn.rs +++ b/tests/ui/test-attrs/test-on-not-fn.rs @@ -1,4 +1,5 @@ //@ compile-flags: --test +//@ reference: attributes.testing.test.allowed-positions #[test] //~ ERROR: the `#[test]` attribute may only be used on a free function mod test {} diff --git a/tests/ui/test-attrs/test-on-not-fn.stderr b/tests/ui/test-attrs/test-on-not-fn.stderr index db8bed100a635..22e4792688563 100644 --- a/tests/ui/test-attrs/test-on-not-fn.stderr +++ b/tests/ui/test-attrs/test-on-not-fn.stderr @@ -1,5 +1,5 @@ error: the `#[test]` attribute may only be used on a free function - --> $DIR/test-on-not-fn.rs:3:1 + --> $DIR/test-on-not-fn.rs:4:1 | LL | #[test] | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions @@ -13,7 +13,7 @@ LL + #[cfg(test)] | error: the `#[test]` attribute may only be used on a free function - --> $DIR/test-on-not-fn.rs:6:1 + --> $DIR/test-on-not-fn.rs:7:1 | LL | #[test] | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions @@ -33,7 +33,7 @@ LL + #[cfg(test)] | error: the `#[test]` attribute may only be used on a free function - --> $DIR/test-on-not-fn.rs:20:1 + --> $DIR/test-on-not-fn.rs:21:1 | LL | #[test] | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions @@ -47,7 +47,7 @@ LL + #[cfg(test)] | error: the `#[test]` attribute may only be used on a free function - --> $DIR/test-on-not-fn.rs:23:1 + --> $DIR/test-on-not-fn.rs:24:1 | LL | #[test] | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions @@ -61,7 +61,7 @@ LL + #[cfg(test)] | error: the `#[test]` attribute may only be used on a free function - --> $DIR/test-on-not-fn.rs:26:1 + --> $DIR/test-on-not-fn.rs:27:1 | LL | #[test] | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions @@ -75,7 +75,7 @@ LL + #[cfg(test)] | error: the `#[test]` attribute may only be used on a free function - --> $DIR/test-on-not-fn.rs:29:1 + --> $DIR/test-on-not-fn.rs:30:1 | LL | #[test] | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions @@ -89,7 +89,7 @@ LL + #[cfg(test)] | error: the `#[test]` attribute may only be used on a free function - --> $DIR/test-on-not-fn.rs:32:1 + --> $DIR/test-on-not-fn.rs:33:1 | LL | #[test] | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions @@ -103,7 +103,7 @@ LL + #[cfg(test)] | error: the `#[test]` attribute may only be used on a free function - --> $DIR/test-on-not-fn.rs:35:1 + --> $DIR/test-on-not-fn.rs:36:1 | LL | #[test] | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions @@ -119,7 +119,7 @@ LL + #[cfg(test)] | error: the `#[test]` attribute may only be used on a free function - --> $DIR/test-on-not-fn.rs:40:1 + --> $DIR/test-on-not-fn.rs:41:1 | LL | #[test] | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions @@ -133,7 +133,7 @@ LL + #[cfg(test)] | error: the `#[test]` attribute may only be used on a free function - --> $DIR/test-on-not-fn.rs:43:1 + --> $DIR/test-on-not-fn.rs:44:1 | LL | #[test] | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions @@ -150,7 +150,7 @@ LL + #[cfg(test)] | error: the `#[test]` attribute may only be used on a free function - --> $DIR/test-on-not-fn.rs:50:1 + --> $DIR/test-on-not-fn.rs:51:1 | LL | #[test] | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions @@ -168,7 +168,7 @@ LL + #[cfg(test)] | warning: the `#[test]` attribute may only be used on a free function - --> $DIR/test-on-not-fn.rs:61:1 + --> $DIR/test-on-not-fn.rs:62:1 | LL | #[test] | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions diff --git a/tests/ui/test-attrs/test-passed.rs b/tests/ui/test-attrs/test-passed.rs index 959470adcc422..034051e4eb6d9 100644 --- a/tests/ui/test-attrs/test-passed.rs +++ b/tests/ui/test-attrs/test-passed.rs @@ -4,6 +4,7 @@ //@ run-pass //@ check-run-results //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ reference: attributes.testing.test.success // Tests the output of the test harness with only passed tests. diff --git a/tests/ui/test-attrs/test-should-panic-attr.rs b/tests/ui/test-attrs/test-should-panic-attr.rs index e6de07d009411..b095099daad0f 100644 --- a/tests/ui/test-attrs/test-should-panic-attr.rs +++ b/tests/ui/test-attrs/test-should-panic-attr.rs @@ -1,4 +1,5 @@ //@ compile-flags: --test +//@ reference: attributes.testing.should_panic.syntax #[test] #[should_panic = "foo"] diff --git a/tests/ui/test-attrs/test-should-panic-attr.stderr b/tests/ui/test-attrs/test-should-panic-attr.stderr index 475a55ad0cbc2..48f6b0d37cb10 100644 --- a/tests/ui/test-attrs/test-should-panic-attr.stderr +++ b/tests/ui/test-attrs/test-should-panic-attr.stderr @@ -1,5 +1,5 @@ error[E0539]: malformed `should_panic` attribute input - --> $DIR/test-should-panic-attr.rs:10:1 + --> $DIR/test-should-panic-attr.rs:11:1 | LL | #[should_panic(expected)] | ^^^^^^^^^^^^^^^--------^^ @@ -19,7 +19,7 @@ LL + #[should_panic] | error[E0539]: malformed `should_panic` attribute input - --> $DIR/test-should-panic-attr.rs:19:1 + --> $DIR/test-should-panic-attr.rs:20:1 | LL | #[should_panic(expect)] | ^^^^^^^^^^^^^^--------^ @@ -39,7 +39,7 @@ LL + #[should_panic] | error[E0539]: malformed `should_panic` attribute input - --> $DIR/test-should-panic-attr.rs:28:1 + --> $DIR/test-should-panic-attr.rs:29:1 | LL | #[should_panic(expected(foo, bar))] | ^^^^^^^^^^^^^^^------------------^^ @@ -60,7 +60,7 @@ LL + #[should_panic] | error[E0805]: malformed `should_panic` attribute input - --> $DIR/test-should-panic-attr.rs:37:1 + --> $DIR/test-should-panic-attr.rs:38:1 | LL | #[should_panic(expected = "foo", bar)] | ^^^^^^^^^^^^^^-----------------------^ diff --git a/tests/ui/test-attrs/test-should-panic-failed-show-span.rs b/tests/ui/test-attrs/test-should-panic-failed-show-span.rs index 22a6f4a835e23..f8c1840ab79f1 100644 --- a/tests/ui/test-attrs/test-should-panic-failed-show-span.rs +++ b/tests/ui/test-attrs/test-should-panic-failed-show-span.rs @@ -8,6 +8,7 @@ //@ normalize-stdout: "TypeId\(0x[0-9a-f]+\)" -> "TypeId($$HEX)" //@ needs-threads //@ needs-unwind (panic) +//@ reference: attributes.testing.should_panic.expected #[test] #[should_panic] diff --git a/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stderr b/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stderr index ab36bc2beb9e6..398479f15fa23 100644 --- a/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stderr +++ b/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stderr @@ -1,13 +1,13 @@ -thread 'should_panic_with_any_message' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:15:5: +thread 'should_panic_with_any_message' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:16:5: Panic! note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -thread 'should_panic_with_message' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:21:5: +thread 'should_panic_with_message' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:22:5: message -thread 'should_panic_with_substring_panics_with_incorrect_string' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:39:5: +thread 'should_panic_with_substring_panics_with_incorrect_string' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:40:5: ZOMGWTFBBQ -thread 'should_panic_with_substring_panics_with_non_string_value' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:46:5: +thread 'should_panic_with_substring_panics_with_non_string_value' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:47:5: Box diff --git a/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stdout b/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stdout index 492f54debc829..c28403a11e8ec 100644 --- a/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stdout +++ b/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stdout @@ -10,9 +10,9 @@ test should_panic_with_substring_panics_with_non_string_value - should panic ... failures: ---- should_panic_with_any_message_does_not_panic stdout ---- -note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:26:4 +note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:27:4 ---- should_panic_with_message_does_not_panic stdout ---- -note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:32:4 +note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:33:4 ---- should_panic_with_substring_panics_with_incorrect_string stdout ---- note: panic did not contain expected string panic message: "ZOMGWTFBBQ" diff --git a/tests/ui/test-attrs/test-vs-cfg-test.rs b/tests/ui/test-attrs/test-vs-cfg-test.rs index d7d9e61103c9a..634511fdff392 100644 --- a/tests/ui/test-attrs/test-vs-cfg-test.rs +++ b/tests/ui/test-attrs/test-vs-cfg-test.rs @@ -1,5 +1,6 @@ //@ run-pass //@ compile-flags: --cfg test +//@ reference: cfg.test // Make sure `--cfg test` does not inject test harness diff --git a/tests/ui/tool-attributes/tool-attributes-shadowing.rs b/tests/ui/tool-attributes/tool-attributes-shadowing.rs index 21bbaa3a7105d..582c99b089f5a 100644 --- a/tests/ui/tool-attributes/tool-attributes-shadowing.rs +++ b/tests/ui/tool-attributes/tool-attributes-shadowing.rs @@ -1,4 +1,4 @@ mod rustfmt {} -#[rustfmt::skip] //~ ERROR failed to resolve: could not find `skip` in `rustfmt` +#[rustfmt::skip] //~ ERROR: cannot find `skip` in `rustfmt` fn main() {} diff --git a/tests/ui/tool-attributes/tool-attributes-shadowing.stderr b/tests/ui/tool-attributes/tool-attributes-shadowing.stderr index f2da617272288..5ca1fdf586d42 100644 --- a/tests/ui/tool-attributes/tool-attributes-shadowing.stderr +++ b/tests/ui/tool-attributes/tool-attributes-shadowing.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: could not find `skip` in `rustfmt` +error[E0433]: cannot find `skip` in `rustfmt` --> $DIR/tool-attributes-shadowing.rs:3:12 | LL | #[rustfmt::skip] diff --git a/tests/ui/tool-attributes/unknown-tool-name.rs b/tests/ui/tool-attributes/unknown-tool-name.rs index ba21aecc230a8..a87385329effd 100644 --- a/tests/ui/tool-attributes/unknown-tool-name.rs +++ b/tests/ui/tool-attributes/unknown-tool-name.rs @@ -1,2 +1,3 @@ -#[foo::bar] //~ ERROR failed to resolve: use of unresolved module or unlinked crate `foo` +#[foo::bar] //~ ERROR: cannot find module or crate `foo` +//~^ NOTE: use of unresolved module or unlinked crate `foo` fn main() {} diff --git a/tests/ui/tool-attributes/unknown-tool-name.stderr b/tests/ui/tool-attributes/unknown-tool-name.stderr index 9b636fcb0bdd7..5a2b0e840be30 100644 --- a/tests/ui/tool-attributes/unknown-tool-name.stderr +++ b/tests/ui/tool-attributes/unknown-tool-name.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `foo` +error[E0433]: cannot find module or crate `foo` in this scope --> $DIR/unknown-tool-name.rs:1:3 | LL | #[foo::bar] diff --git a/tests/ui/traits/bound/unknown-assoc-with-const-arg.rs b/tests/ui/traits/bound/unknown-assoc-with-const-arg.rs index 0da68afb59261..1b04d8f918276 100644 --- a/tests/ui/traits/bound/unknown-assoc-with-const-arg.rs +++ b/tests/ui/traits/bound/unknown-assoc-with-const-arg.rs @@ -7,7 +7,7 @@ trait X { trait Y { fn a() -> NOT_EXIST::unknown<{}> {} - //~^ ERROR: failed to resolve: use of undeclared type `NOT_EXIST` + //~^ ERROR: cannot find type `NOT_EXIST` } trait Z { diff --git a/tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr b/tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr index 49e41f75ff35a..6a78fa04fe668 100644 --- a/tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr +++ b/tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr @@ -10,7 +10,7 @@ error[E0220]: associated type `unknown` not found for `T` LL | fn a() -> T::unknown<{}> {} | ^^^^^^^ associated type `unknown` not found -error[E0433]: failed to resolve: use of undeclared type `NOT_EXIST` +error[E0433]: cannot find type `NOT_EXIST` in this scope --> $DIR/unknown-assoc-with-const-arg.rs:9:15 | LL | fn a() -> NOT_EXIST::unknown<{}> {} diff --git a/tests/ui/traits/const-traits/issue-102156.stderr b/tests/ui/traits/const-traits/issue-102156.stderr index 20505b685f309..1fce5f1b18fea 100644 --- a/tests/ui/traits/const-traits/issue-102156.stderr +++ b/tests/ui/traits/const-traits/issue-102156.stderr @@ -1,22 +1,27 @@ -error[E0433]: failed to resolve: you might be missing crate `core` +error[E0433]: cannot find `core` in the crate root --> $DIR/issue-102156.rs:5:5 | LL | use core::convert::{From, TryFrom}; - | ^^^^ - | | - | you might be missing crate `core` - | help: try using `std` instead of `core`: `std` + | ^^^^ you might be missing crate `core` + | +help: try using `std` instead of `core` + | +LL - use core::convert::{From, TryFrom}; +LL + use std::convert::{From, TryFrom}; + | -error[E0433]: failed to resolve: you might be missing crate `core` +error[E0433]: cannot find `core` in the crate root --> $DIR/issue-102156.rs:5:5 | LL | use core::convert::{From, TryFrom}; - | ^^^^ - | | - | you might be missing crate `core` - | help: try using `std` instead of `core`: `std` + | ^^^^ you might be missing crate `core` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: try using `std` instead of `core` + | +LL - use core::convert::{From, TryFrom}; +LL + use std::convert::{From, TryFrom}; + | error: aborting due to 2 previous errors diff --git a/tests/ui/traits/const-traits/staged-api.rs b/tests/ui/traits/const-traits/staged-api.rs index 6d0a84797ea24..cd74bb45f651b 100644 --- a/tests/ui/traits/const-traits/staged-api.rs +++ b/tests/ui/traits/const-traits/staged-api.rs @@ -5,7 +5,7 @@ #![feature(local_feature)] #![feature(const_trait_impl)] #![feature(staged_api)] -#![feature(rustc_allow_const_fn_unstable)] +#![feature(rustc_attrs)] #![stable(feature = "rust1", since = "1.0.0")] //@ aux-build: staged-api.rs diff --git a/tests/ui/traits/final/final-kw.gated.stderr b/tests/ui/traits/final/final-kw.gated.stderr index a7967ebf08e2a..62a39d7ca2028 100644 --- a/tests/ui/traits/final/final-kw.gated.stderr +++ b/tests/ui/traits/final/final-kw.gated.stderr @@ -4,7 +4,7 @@ error[E0658]: `final` on trait functions is experimental LL | final fn foo() {} | ^^^^^ | - = note: see issue #1 for more information + = note: see issue #131179 for more information = help: add `#![feature(final_associated_functions)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date diff --git a/tests/ui/traits/final/final-kw.ungated.stderr b/tests/ui/traits/final/final-kw.ungated.stderr index a7967ebf08e2a..62a39d7ca2028 100644 --- a/tests/ui/traits/final/final-kw.ungated.stderr +++ b/tests/ui/traits/final/final-kw.ungated.stderr @@ -4,7 +4,7 @@ error[E0658]: `final` on trait functions is experimental LL | final fn foo() {} | ^^^^^ | - = note: see issue #1 for more information + = note: see issue #131179 for more information = help: add `#![feature(final_associated_functions)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date diff --git a/tests/ui/type-alias/issue-62263-self-in-atb.rs b/tests/ui/type-alias/issue-62263-self-in-atb.rs index 91522d8912f79..0f8d88310bcd1 100644 --- a/tests/ui/type-alias/issue-62263-self-in-atb.rs +++ b/tests/ui/type-alias/issue-62263-self-in-atb.rs @@ -3,6 +3,6 @@ pub trait Trait { } pub type Alias = dyn Trait; -//~^ ERROR failed to resolve: `Self` +//~^ ERROR cannot find `Self` fn main() {} diff --git a/tests/ui/type-alias/issue-62263-self-in-atb.stderr b/tests/ui/type-alias/issue-62263-self-in-atb.stderr index 18c8bc1a1b361..aa9e37ce71c76 100644 --- a/tests/ui/type-alias/issue-62263-self-in-atb.stderr +++ b/tests/ui/type-alias/issue-62263-self-in-atb.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions +error[E0433]: cannot find `Self` in this scope --> $DIR/issue-62263-self-in-atb.rs:5:32 | LL | pub type Alias = dyn Trait; diff --git a/tests/ui/type-alias/issue-62305-self-assoc-ty.rs b/tests/ui/type-alias/issue-62305-self-assoc-ty.rs index a4d9a285485e7..47a6838c9100c 100644 --- a/tests/ui/type-alias/issue-62305-self-assoc-ty.rs +++ b/tests/ui/type-alias/issue-62305-self-assoc-ty.rs @@ -1,4 +1,4 @@ type Alias = Self::Target; -//~^ ERROR failed to resolve: `Self` +//~^ ERROR cannot find `Self` fn main() {} diff --git a/tests/ui/type-alias/issue-62305-self-assoc-ty.stderr b/tests/ui/type-alias/issue-62305-self-assoc-ty.stderr index a35e644d3aa89..5bec48f007caa 100644 --- a/tests/ui/type-alias/issue-62305-self-assoc-ty.stderr +++ b/tests/ui/type-alias/issue-62305-self-assoc-ty.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions +error[E0433]: cannot find `Self` in this scope --> $DIR/issue-62305-self-assoc-ty.rs:1:14 | LL | type Alias = Self::Target; diff --git a/tests/ui/type/type-path-err-node-types.rs b/tests/ui/type/type-path-err-node-types.rs index b3795772e6fe2..a4ff4f497b471 100644 --- a/tests/ui/type/type-path-err-node-types.rs +++ b/tests/ui/type/type-path-err-node-types.rs @@ -12,7 +12,7 @@ fn ufcs_trait() { } fn ufcs_item() { - NonExistent::Assoc::; //~ ERROR undeclared type `NonExistent` + NonExistent::Assoc::; //~ ERROR cannot find type `NonExistent` } fn method() { diff --git a/tests/ui/type/type-path-err-node-types.stderr b/tests/ui/type/type-path-err-node-types.stderr index a9e999f80b3a0..d03d5d0b55c9a 100644 --- a/tests/ui/type/type-path-err-node-types.stderr +++ b/tests/ui/type/type-path-err-node-types.stderr @@ -16,7 +16,7 @@ error[E0425]: cannot find value `nonexistent` in this scope LL | nonexistent.nonexistent::(); | ^^^^^^^^^^^ not found in this scope -error[E0433]: failed to resolve: use of undeclared type `NonExistent` +error[E0433]: cannot find type `NonExistent` in this scope --> $DIR/type-path-err-node-types.rs:15:5 | LL | NonExistent::Assoc::; diff --git a/tests/ui/typeck/issue-120856.rs b/tests/ui/typeck/issue-120856.rs index 51dd63a6f89da..bd92adf529f82 100644 --- a/tests/ui/typeck/issue-120856.rs +++ b/tests/ui/typeck/issue-120856.rs @@ -1,5 +1,7 @@ pub type Archived = ::Archived; -//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `m` -//~| ERROR failed to resolve: use of unresolved module or unlinked crate `n` +//~^ ERROR: cannot find module or crate `m` in this scope +//~| ERROR: cannot find module or crate `n` in this scope +//~| NOTE: use of unresolved module or unlinked crate `m` +//~| NOTE: use of unresolved module or unlinked crate `n` fn main() {} diff --git a/tests/ui/typeck/issue-120856.stderr b/tests/ui/typeck/issue-120856.stderr index 4ff9f345c48b0..026c38da29596 100644 --- a/tests/ui/typeck/issue-120856.stderr +++ b/tests/ui/typeck/issue-120856.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `n` +error[E0433]: cannot find module or crate `n` in this scope --> $DIR/issue-120856.rs:1:37 | LL | pub type Archived = ::Archived; @@ -10,7 +10,7 @@ help: a trait with a similar name exists LL | pub type Archived = ::Archived; | + -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `m` +error[E0433]: cannot find module or crate `m` in this scope --> $DIR/issue-120856.rs:1:25 | LL | pub type Archived = ::Archived; diff --git a/tests/ui/typeck/path-to-method-sugg-unresolved-expr.cargo-invoked.stderr b/tests/ui/typeck/path-to-method-sugg-unresolved-expr.cargo-invoked.stderr index 8a3b87b0d11a5..8ff61b21ad1f7 100644 --- a/tests/ui/typeck/path-to-method-sugg-unresolved-expr.cargo-invoked.stderr +++ b/tests/ui/typeck/path-to-method-sugg-unresolved-expr.cargo-invoked.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `page_size` +error[E0433]: cannot find module or crate `page_size` in this scope --> $DIR/path-to-method-sugg-unresolved-expr.rs:5:21 | LL | let page_size = page_size::get(); diff --git a/tests/ui/typeck/path-to-method-sugg-unresolved-expr.only-rustc.stderr b/tests/ui/typeck/path-to-method-sugg-unresolved-expr.only-rustc.stderr index 34ed5c44d9313..0cf3394cfedd7 100644 --- a/tests/ui/typeck/path-to-method-sugg-unresolved-expr.only-rustc.stderr +++ b/tests/ui/typeck/path-to-method-sugg-unresolved-expr.only-rustc.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: use of unresolved module or unlinked crate `page_size` +error[E0433]: cannot find module or crate `page_size` in this scope --> $DIR/path-to-method-sugg-unresolved-expr.rs:5:21 | LL | let page_size = page_size::get(); diff --git a/tests/ui/typeck/path-to-method-sugg-unresolved-expr.rs b/tests/ui/typeck/path-to-method-sugg-unresolved-expr.rs index e095850879cde..035e7afb30d96 100644 --- a/tests/ui/typeck/path-to-method-sugg-unresolved-expr.rs +++ b/tests/ui/typeck/path-to-method-sugg-unresolved-expr.rs @@ -3,7 +3,7 @@ //@[cargo-invoked] rustc-env:CARGO_CRATE_NAME=foo fn main() { let page_size = page_size::get(); - //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `page_size` + //~^ ERROR cannot find module or crate `page_size` //~| NOTE use of unresolved module or unlinked crate `page_size` //[cargo-invoked]~^^^ HELP if you wanted to use a crate named `page_size`, use `cargo add //[only-rustc]~^^^^ HELP you might be missing a crate named `page_size` diff --git a/tests/ui/use/use-path-segment-kw.rs b/tests/ui/use/use-path-segment-kw.rs index 680ecd3d03d49..fffc027ac6fd3 100644 --- a/tests/ui/use/use-path-segment-kw.rs +++ b/tests/ui/use/use-path-segment-kw.rs @@ -9,43 +9,43 @@ macro_rules! macro_dollar_crate { use $crate; //~ ERROR `$crate` may not be imported pub use $crate as _dollar_crate; //~ ERROR `$crate` may not be imported - type A2 = ::$crate; //~ ERROR failed to resolve: global paths cannot start with `$crate` + type A2 = ::$crate; //~ ERROR global paths cannot start with `$crate` use ::$crate; //~ ERROR unresolved import `$crate` use ::$crate as _dollar_crate2; //~ ERROR unresolved import `$crate` use ::{$crate}; //~ ERROR unresolved import `$crate` use ::{$crate as _nested_dollar_crate2}; //~ ERROR unresolved import `$crate` - type A3 = foobar::$crate; //~ ERROR failed to resolve: `$crate` in paths can only be used in start position + type A3 = foobar::$crate; //~ ERROR `$crate` in paths can only be used in start position use foobar::$crate; //~ ERROR unresolved import `foobar::$crate` use foobar::$crate as _dollar_crate3; //~ ERROR unresolved import `foobar::$crate` use foobar::{$crate}; //~ ERROR unresolved import `foobar::$crate` use foobar::{$crate as _nested_dollar_crate3}; //~ ERROR unresolved import `foobar::$crate` - type A4 = crate::$crate; //~ ERROR failed to resolve: `$crate` in paths can only be used in start position + type A4 = crate::$crate; //~ ERROR `$crate` in paths can only be used in start position use crate::$crate; //~ ERROR unresolved import `crate::$crate` use crate::$crate as _dollar_crate4; //~ ERROR unresolved import `crate::$crate` use crate::{$crate}; //~ ERROR unresolved import `crate::$crate` use crate::{$crate as _nested_dollar_crate4}; //~ ERROR unresolved import `crate::$crate` - type A5 = super::$crate; //~ ERROR failed to resolve: `$crate` in paths can only be used in start position + type A5 = super::$crate; //~ ERROR `$crate` in paths can only be used in start position use super::$crate; //~ ERROR unresolved import `super::$crate` use super::$crate as _dollar_crate5; //~ ERROR unresolved import `super::$crate` use super::{$crate}; //~ ERROR unresolved import `super::$crate` use super::{$crate as _nested_dollar_crate5}; //~ ERROR unresolved import `super::$crate` - type A6 = self::$crate; //~ ERROR failed to resolve: `$crate` in paths can only be used in start position + type A6 = self::$crate; //~ ERROR `$crate` in paths can only be used in start position use self::$crate; use self::$crate as _dollar_crate6; use self::{$crate}; use self::{$crate as _nested_dollar_crate6}; - type A7 = $crate::$crate; //~ ERROR failed to resolve: `$crate` in paths can only be used in start position + type A7 = $crate::$crate; //~ ERROR `$crate` in paths can only be used in start position use $crate::$crate; //~ ERROR unresolved import `$crate::$crate` use $crate::$crate as _dollar_crate7; //~ ERROR unresolved import `$crate::$crate` use $crate::{$crate}; //~ ERROR unresolved import `$crate::$crate` use $crate::{$crate as _nested_dollar_crate7}; //~ ERROR unresolved import `$crate::$crate` - type A8 = $crate::crate; //~ ERROR failed to resolve: `crate` in paths can only be used in start position + type A8 = $crate::crate; //~ ERROR `crate` in paths can only be used in start position use $crate::crate; //~ ERROR unresolved import `$crate::crate` //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` use $crate::crate as _m_crate8; //~ ERROR unresolved import `$crate::crate` @@ -53,13 +53,13 @@ macro_rules! macro_dollar_crate { //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` use $crate::{crate as _m_nested_crate8}; //~ ERROR unresolved import `$crate::crate` - type A9 = $crate::super; //~ ERROR failed to resolve: `super` in paths can only be used in start position + type A9 = $crate::super; //~ ERROR `super` in paths can only be used in start position use $crate::super; //~ ERROR unresolved import `$crate::super` use $crate::super as _m_super8; //~ ERROR unresolved import `$crate::super` use $crate::{super}; //~ ERROR unresolved import `$crate::super` use $crate::{super as _m_nested_super8}; //~ ERROR unresolved import `$crate::super` - type A10 = $crate::self; //~ ERROR failed to resolve: `self` in paths can only be used in start position + type A10 = $crate::self; //~ ERROR `self` in paths can only be used in start position use $crate::self; //~ ERROR `$crate` may not be imported //~^ ERROR `self` imports are only allowed within a { } list //~^^ ERROR the name `` is defined multiple times @@ -98,7 +98,7 @@ mod foo { use crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;` pub use crate as _crate; // Good - type B2 = ::crate; //~ ERROR failed to resolve: global paths cannot start with `crate` + type B2 = ::crate; //~ ERROR `crate` use ::crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;` //~^ ERROR unresolved import `crate` use ::crate as _crate2; //~ ERROR unresolved import `crate` @@ -106,7 +106,7 @@ mod foo { //~^ ERROR unresolved import `crate` use ::{crate as _nested_crate2}; //~ ERROR unresolved import `crate` - type B3 = foobar::crate; //~ ERROR failed to resolve: `crate` in paths can only be used in start position + type B3 = foobar::crate; //~ ERROR `crate` in paths can only be used in start position use foobar::crate; //~ ERROR unresolved import `foobar::crate` //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` use foobar::crate as _crate3; //~ ERROR unresolved import `foobar::crate` @@ -114,7 +114,7 @@ mod foo { //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` use foobar::{crate as _nested_crate3}; //~ ERROR unresolved import `foobar::crate` - type B4 = crate::crate; //~ ERROR failed to resolve: `crate` in paths can only be used in start position + type B4 = crate::crate; //~ ERROR `crate` in paths can only be used in start position use crate::crate; //~ ERROR unresolved import `crate::crate` //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` use crate::crate as _crate4; //~ ERROR unresolved import `crate::crate` @@ -122,7 +122,7 @@ mod foo { //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` use crate::{crate as _nested_crate4}; //~ ERROR unresolved import `crate::crate` - type B5 = super::crate; //~ ERROR failed to resolve: `crate` in paths can only be used in start position + type B5 = super::crate; //~ ERROR `crate` in paths can only be used in start position use super::crate; //~ ERROR unresolved import `super::crate` //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` use super::crate as _crate5; //~ ERROR unresolved import `super::crate` @@ -130,7 +130,7 @@ mod foo { //~^ ERROR crate root imports need to be explicitly named: `use crate as name;` use super::{crate as _nested_crate5}; //~ ERROR unresolved import `super::crate` - type B6 = self::crate; //~ ERROR failed to resolve: `crate` in paths can only be used in start position + type B6 = self::crate; //~ ERROR `crate` in paths can only be used in start position use self::crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;` //~^ ERROR the name `crate` is defined multiple times use self::crate as _crate6; @@ -146,19 +146,19 @@ mod foo { use super; //~ ERROR unresolved import `super` pub use super as _super; //~ ERROR unresolved import `super` - type C2 = ::super; //~ ERROR failed to resolve: global paths cannot start with `super` + type C2 = ::super; //~ ERROR global paths cannot start with `super` use ::super; //~ ERROR unresolved import `super` use ::super as _super2; //~ ERROR unresolved import `super` use ::{super}; //~ ERROR unresolved import `super` use ::{super as _nested_super2}; //~ ERROR unresolved import `super` - type C3 = foobar::super; //~ ERROR failed to resolve: `super` in paths can only be used in start position + type C3 = foobar::super; //~ ERROR `super` in paths can only be used in start position use foobar::super; //~ ERROR unresolved import `foobar::super` use foobar::super as _super3; //~ ERROR unresolved import `foobar::super` use foobar::{super}; //~ ERROR unresolved import `foobar::super` use foobar::{super as _nested_super3}; //~ ERROR unresolved import `foobar::super` - type C4 = crate::super; //~ ERROR failed to resolve: `super` in paths can only be used in start position + type C4 = crate::super; //~ ERROR `super` in paths can only be used in start position use crate::super; //~ ERROR unresolved import `crate::super` use crate::super as _super4; //~ ERROR unresolved import `crate::super` use crate::{super}; //~ ERROR unresolved import `crate::super` @@ -184,7 +184,7 @@ mod foo { use self; //~ ERROR `self` imports are only allowed within a { } list pub use self as _self; //~ ERROR `self` imports are only allowed within a { } list - type D2 = ::self; //~ ERROR failed to resolve: global paths cannot start with `self` + type D2 = ::self; //~ ERROR global paths cannot start with `self` use ::self; //~ ERROR `self` imports are only allowed within a { } list //~^ ERROR unresolved import `{{root}}` use ::self as _self2; //~ ERROR `self` imports are only allowed within a { } list @@ -192,13 +192,13 @@ mod foo { use ::{self}; //~ ERROR `self` import can only appear in an import list with a non-empty prefix use ::{self as _nested_self2}; //~ ERROR `self` import can only appear in an import list with a non-empty prefix - type D3 = foobar::self; //~ ERROR failed to resolve: `self` in paths can only be used in start position + type D3 = foobar::self; //~ ERROR `self` in paths can only be used in start position pub use foobar::qux::self; //~ ERROR `self` imports are only allowed within a { } list pub use foobar::self as _self3; //~ ERROR `self` imports are only allowed within a { } list pub use foobar::baz::{self}; // Good pub use foobar::{self as _nested_self3}; // Good - type D4 = crate::self; //~ ERROR failed to resolve: `self` in paths can only be used in start position + type D4 = crate::self; //~ ERROR `self` in paths can only be used in start position use crate::self; //~ ERROR crate root imports need to be explicitly named: `use crate as name;` //~^ ERROR `self` imports are only allowed within a { } list //~^^ ERROR the name `crate` is defined multiple times @@ -207,7 +207,7 @@ mod foo { //~^ ERROR the name `crate` is defined multiple times pub use crate::{self as _nested_self4}; // Good - type D5 = super::self; //~ ERROR failed to resolve: `self` in paths can only be used in start position + type D5 = super::self; //~ ERROR `self` in paths can only be used in start position use super::self; //~ ERROR unresolved import `super` //~^ ERROR `self` imports are only allowed within a { } list pub use super::self as _self5; //~ ERROR `self` imports are only allowed within a { } list @@ -215,7 +215,7 @@ mod foo { use super::{self}; //~ ERROR unresolved import `super` pub use super::{self as _nested_self5}; //~ ERROR unresolved import `super` - type D6 = self::self; //~ ERROR failed to resolve: `self` in paths can only be used in start position + type D6 = self::self; //~ ERROR `self` in paths can only be used in start position use self::self; //~ ERROR `self` imports are only allowed within a { } list pub use self::self as _self6; //~ ERROR `self` imports are only allowed within a { } list use self::{self}; //~ ERROR unresolved import `self` diff --git a/tests/ui/use/use-path-segment-kw.stderr b/tests/ui/use/use-path-segment-kw.stderr index 407e99059b2a3..a5cfa47df3b2a 100644 --- a/tests/ui/use/use-path-segment-kw.stderr +++ b/tests/ui/use/use-path-segment-kw.stderr @@ -1062,182 +1062,182 @@ error[E0573]: expected type, found module `self` LL | type D1 = self; | ^^^^ not a type -error[E0433]: failed to resolve: global paths cannot start with `$crate` +error[E0433]: global paths cannot start with `$crate` --> $DIR/use-path-segment-kw.rs:12:21 | LL | type A2 = ::$crate; - | ^^^^^^ global paths cannot start with `$crate` + | ^^^^^^ cannot start with this ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0433]: failed to resolve: `$crate` in paths can only be used in start position +error[E0433]: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:18:27 | LL | type A3 = foobar::$crate; - | ^^^^^^ `$crate` in paths can only be used in start position + | ^^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0433]: failed to resolve: `$crate` in paths can only be used in start position +error[E0433]: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:24:26 | LL | type A4 = crate::$crate; - | ^^^^^^ `$crate` in paths can only be used in start position + | ^^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0433]: failed to resolve: `$crate` in paths can only be used in start position +error[E0433]: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:30:26 | LL | type A5 = super::$crate; - | ^^^^^^ `$crate` in paths can only be used in start position + | ^^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0433]: failed to resolve: `$crate` in paths can only be used in start position +error[E0433]: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:36:25 | LL | type A6 = self::$crate; - | ^^^^^^ `$crate` in paths can only be used in start position + | ^^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0433]: failed to resolve: `$crate` in paths can only be used in start position +error[E0433]: `$crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:42:27 | LL | type A7 = $crate::$crate; - | ^^^^^^ `$crate` in paths can only be used in start position + | ^^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0433]: failed to resolve: `crate` in paths can only be used in start position +error[E0433]: `crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:48:27 | LL | type A8 = $crate::crate; - | ^^^^^ `crate` in paths can only be used in start position + | ^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0433]: failed to resolve: `super` in paths can only be used in start position +error[E0433]: `super` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:56:27 | LL | type A9 = $crate::super; - | ^^^^^ `super` in paths can only be used in start position + | ^^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0433]: failed to resolve: `self` in paths can only be used in start position +error[E0433]: `self` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:62:28 | LL | type A10 = $crate::self; - | ^^^^ `self` in paths can only be used in start position + | ^^^^ can only be used in path start position ... LL | macro_dollar_crate!(); | --------------------- in this macro invocation | = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0433]: failed to resolve: global paths cannot start with `crate` +error[E0433]: global paths cannot start with `crate` --> $DIR/use-path-segment-kw.rs:101:21 | LL | type B2 = ::crate; - | ^^^^^ global paths cannot start with `crate` + | ^^^^^ cannot start with this -error[E0433]: failed to resolve: `crate` in paths can only be used in start position +error[E0433]: `crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:109:27 | LL | type B3 = foobar::crate; - | ^^^^^ `crate` in paths can only be used in start position + | ^^^^^ can only be used in path start position -error[E0433]: failed to resolve: `crate` in paths can only be used in start position +error[E0433]: `crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:117:26 | LL | type B4 = crate::crate; - | ^^^^^ `crate` in paths can only be used in start position + | ^^^^^ can only be used in path start position -error[E0433]: failed to resolve: `crate` in paths can only be used in start position +error[E0433]: `crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:125:26 | LL | type B5 = super::crate; - | ^^^^^ `crate` in paths can only be used in start position + | ^^^^^ can only be used in path start position -error[E0433]: failed to resolve: `crate` in paths can only be used in start position +error[E0433]: `crate` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:133:25 | LL | type B6 = self::crate; - | ^^^^^ `crate` in paths can only be used in start position + | ^^^^^ can only be used in path start position -error[E0433]: failed to resolve: global paths cannot start with `super` +error[E0433]: global paths cannot start with `super` --> $DIR/use-path-segment-kw.rs:149:21 | LL | type C2 = ::super; - | ^^^^^ global paths cannot start with `super` + | ^^^^^ cannot start with this -error[E0433]: failed to resolve: `super` in paths can only be used in start position +error[E0433]: `super` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:155:27 | LL | type C3 = foobar::super; - | ^^^^^ `super` in paths can only be used in start position + | ^^^^^ can only be used in path start position -error[E0433]: failed to resolve: `super` in paths can only be used in start position +error[E0433]: `super` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:161:26 | LL | type C4 = crate::super; - | ^^^^^ `super` in paths can only be used in start position + | ^^^^^ can only be used in path start position -error[E0433]: failed to resolve: global paths cannot start with `self` +error[E0433]: global paths cannot start with `self` --> $DIR/use-path-segment-kw.rs:187:21 | LL | type D2 = ::self; - | ^^^^ global paths cannot start with `self` + | ^^^^ cannot start with this -error[E0433]: failed to resolve: `self` in paths can only be used in start position +error[E0433]: `self` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:195:27 | LL | type D3 = foobar::self; - | ^^^^ `self` in paths can only be used in start position + | ^^^^ can only be used in path start position -error[E0433]: failed to resolve: `self` in paths can only be used in start position +error[E0433]: `self` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:201:26 | LL | type D4 = crate::self; - | ^^^^ `self` in paths can only be used in start position + | ^^^^ can only be used in path start position -error[E0433]: failed to resolve: `self` in paths can only be used in start position +error[E0433]: `self` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:210:26 | LL | type D5 = super::self; - | ^^^^ `self` in paths can only be used in start position + | ^^^^ can only be used in path start position -error[E0433]: failed to resolve: `self` in paths can only be used in start position +error[E0433]: `self` in paths can only be used in start position --> $DIR/use-path-segment-kw.rs:218:25 | LL | type D6 = self::self; - | ^^^^ `self` in paths can only be used in start position + | ^^^^ can only be used in path start position error: aborting due to 141 previous errors diff --git a/tests/ui/use/use-self-type.rs b/tests/ui/use/use-self-type.rs index 3b4ce42970197..4453049acff0a 100644 --- a/tests/ui/use/use-self-type.rs +++ b/tests/ui/use/use-self-type.rs @@ -4,7 +4,7 @@ impl S { fn f() {} fn g() { use Self::f; //~ ERROR unresolved import - pub(in Self::f) struct Z; //~ ERROR failed to resolve: `Self` + pub(in Self::f) struct Z; //~ ERROR cannot find `Self` } } diff --git a/tests/ui/use/use-self-type.stderr b/tests/ui/use/use-self-type.stderr index 498df34fe325e..086b7a4d8222c 100644 --- a/tests/ui/use/use-self-type.stderr +++ b/tests/ui/use/use-self-type.stderr @@ -1,4 +1,4 @@ -error[E0433]: failed to resolve: `Self` cannot be used in imports +error[E0433]: cannot find `Self` in this scope --> $DIR/use-self-type.rs:7:16 | LL | pub(in Self::f) struct Z; diff --git a/tests/ui/use/use-super-global-path.rs b/tests/ui/use/use-super-global-path.rs index 64bfd14b7e7da..d00c6964dea14 100644 --- a/tests/ui/use/use-super-global-path.rs +++ b/tests/ui/use/use-super-global-path.rs @@ -4,11 +4,12 @@ struct S; struct Z; mod foo { - use ::super::{S, Z}; //~ ERROR global paths cannot start with `super` - //~| ERROR global paths cannot start with `super` + use ::super::{S, Z}; + //~^ ERROR: global paths cannot start with `super` + //~| ERROR: global paths cannot start with `super` pub fn g() { - use ::super::main; //~ ERROR global paths cannot start with `super` + use ::super::main; //~ ERROR: global paths cannot start with `super` main(); } } diff --git a/tests/ui/use/use-super-global-path.stderr b/tests/ui/use/use-super-global-path.stderr index 00d172f4799ae..dd853aab48305 100644 --- a/tests/ui/use/use-super-global-path.stderr +++ b/tests/ui/use/use-super-global-path.stderr @@ -1,22 +1,22 @@ -error[E0433]: failed to resolve: global paths cannot start with `super` +error[E0433]: global paths cannot start with `super` --> $DIR/use-super-global-path.rs:7:11 | LL | use ::super::{S, Z}; - | ^^^^^ global paths cannot start with `super` + | ^^^^^ cannot start with this -error[E0433]: failed to resolve: global paths cannot start with `super` +error[E0433]: global paths cannot start with `super` --> $DIR/use-super-global-path.rs:7:11 | LL | use ::super::{S, Z}; - | ^^^^^ global paths cannot start with `super` + | ^^^^^ cannot start with this | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0433]: failed to resolve: global paths cannot start with `super` - --> $DIR/use-super-global-path.rs:11:15 +error[E0433]: global paths cannot start with `super` + --> $DIR/use-super-global-path.rs:12:15 | LL | use ::super::main; - | ^^^^^ global paths cannot start with `super` + | ^^^^^ cannot start with this error: aborting due to 3 previous errors diff --git a/typos.toml b/typos.toml index e486a7c1722cd..3c95a45d572d5 100644 --- a/typos.toml +++ b/typos.toml @@ -46,6 +46,7 @@ unstalled = "unstalled" # short for un-stalled # # tidy-alphabetical-start definitinon = "definition" +dependy = "" similarlty = "similarity" # tidy-alphabetical-end