authorbors <bors@rust-lang.org> 2026-02-18 11:12:36 UTC
committerbors <bors@rust-lang.org> 2026-02-18 11:12:36 UTC
logc043085801b7a884054add21a94882216df5971c
treea1a125e8def6f7efc221221c2a5652cfe5ed2e7f
parent8387095803f21a256a9a772ac1f9b41ed4d5aa0a
parent8a2c6ea4097f8bd2f282af2c491ff58622d12bbe

Auto merge of #152785 - Zalathar:rollup-UGtEsqh, r=Zalathar

Rollup of 20 pull requests Successful merges: - rust-lang/rust#145399 (Unify wording of resolve error) - rust-lang/rust#150473 (tail calls: fix copying non-scalar arguments to callee) - rust-lang/rust#152637 (Add a note about elided lifetime) - rust-lang/rust#152729 (compiler: Don't mark `SingleUseConsts` MIR pass as "required for soundness") - rust-lang/rust#152751 (Rename dep node "fingerprints" to distinguish key and value hashes) - rust-lang/rust#152753 (remove the explicit error for old `rental` versions) - rust-lang/rust#152758 (Remove ShallowInitBox.) - rust-lang/rust#151530 (Fix invalid `mut T` suggestion for `&mut T` in missing lifetime error) - rust-lang/rust#152179 (Add documentation note about signed overflow direction) - rust-lang/rust#152474 (Implement opt-bisect-limit for MIR) - rust-lang/rust#152509 (tests/ui/test-attrs: add annotations for reference rules) - rust-lang/rust#152672 (std: use libc version of `_NSGetArgc`/`_NSGetArgv`) - rust-lang/rust#152711 (resolve: Disable an assert that no longer holds) - rust-lang/rust#152725 (Rework explanation of CLI lint level flags) - rust-lang/rust#152732 (add regression test for 147958) - rust-lang/rust#152745 (Fix ICE in `suggest_param_env_shadowing` with incompatible args) - rust-lang/rust#152749 (make `rustc_allow_const_fn_unstable` an actual `rustc_attrs` attribute) - rust-lang/rust#152756 (Miri: recursive validity: also recurse into Boxes) - rust-lang/rust#152770 (carryless_mul: mention the base) - rust-lang/rust#152778 (Update tracking issue number for final_associated_functions)

365 files changed, 2074 insertions(+), 1582 deletions(-)

compiler/rustc_borrowck/src/lib.rs+1-2
......@@ -1544,8 +1544,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
15441544 Rvalue::Use(operand)
15451545 | Rvalue::Repeat(operand, _)
15461546 | Rvalue::UnaryOp(_ /*un_op*/, operand)
1547 | Rvalue::Cast(_ /*cast_kind*/, operand, _ /*ty*/)
1548 | Rvalue::ShallowInitBox(operand, _ /*ty*/) => {
1547 | Rvalue::Cast(_ /*cast_kind*/, operand, _ /*ty*/) => {
15491548 self.consume_operand(location, (operand, span), state)
15501549 }
15511550
compiler/rustc_borrowck/src/polonius/legacy/loan_invalidations.rs+3-2
......@@ -297,8 +297,9 @@ impl<'a, 'tcx> LoanInvalidationsGenerator<'a, 'tcx> {
297297 Rvalue::Use(operand)
298298 | Rvalue::Repeat(operand, _)
299299 | Rvalue::UnaryOp(_ /*un_op*/, operand)
300 | Rvalue::Cast(_ /*cast_kind*/, operand, _ /*ty*/)
301 | Rvalue::ShallowInitBox(operand, _ /*ty*/) => self.consume_operand(location, operand),
300 | Rvalue::Cast(_ /*cast_kind*/, operand, _ /*ty*/) => {
301 self.consume_operand(location, operand)
302 }
302303
303304 &Rvalue::Discriminant(place) => {
304305 self.access_place(
compiler/rustc_borrowck/src/type_check/mod.rs-12
......@@ -1004,17 +1004,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
10041004 }
10051005 }
10061006
1007 Rvalue::ShallowInitBox(_operand, ty) => {
1008 let trait_ref =
1009 ty::TraitRef::new(tcx, tcx.require_lang_item(LangItem::Sized, span), [*ty]);
1010
1011 self.prove_trait_ref(
1012 trait_ref,
1013 location.to_locations(),
1014 ConstraintCategory::SizedBound,
1015 );
1016 }
1017
10181007 Rvalue::Cast(cast_kind, op, ty) => {
10191008 match *cast_kind {
10201009 CastKind::PointerCoercion(
......@@ -2231,7 +2220,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
22312220 | Rvalue::Ref(..)
22322221 | Rvalue::RawPtr(..)
22332222 | Rvalue::Cast(..)
2234 | Rvalue::ShallowInitBox(..)
22352223 | Rvalue::BinaryOp(..)
22362224 | Rvalue::CopyForDeref(..)
22372225 | Rvalue::UnaryOp(..)
compiler/rustc_codegen_cranelift/src/base.rs-1
......@@ -902,7 +902,6 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
902902 lval.write_cvalue_transmute(fx, operand);
903903 }
904904 Rvalue::CopyForDeref(_) => bug!("`CopyForDeref` in codegen"),
905 Rvalue::ShallowInitBox(..) => bug!("`ShallowInitBox` in codegen"),
906905 }
907906 }
908907 StatementKind::StorageLive(_)
compiler/rustc_codegen_ssa/src/mir/rvalue.rs-1
......@@ -710,7 +710,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
710710 OperandRef { val: operand.val, layout, move_annotation: None }
711711 }
712712 mir::Rvalue::CopyForDeref(_) => bug!("`CopyForDeref` in codegen"),
713 mir::Rvalue::ShallowInitBox(..) => bug!("`ShallowInitBox` in codegen"),
714713 }
715714 }
716715
compiler/rustc_const_eval/src/check_consts/check.rs-2
......@@ -646,8 +646,6 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
646646
647647 Rvalue::Cast(_, _, _) => {}
648648
649 Rvalue::ShallowInitBox(_, _) => {}
650
651649 Rvalue::UnaryOp(op, operand) => {
652650 let ty = operand.ty(self.body, self.tcx);
653651 match op {
compiler/rustc_const_eval/src/check_consts/qualifs.rs+1-2
......@@ -237,8 +237,7 @@ where
237237 Rvalue::Use(operand)
238238 | Rvalue::Repeat(operand, _)
239239 | Rvalue::UnaryOp(_, operand)
240 | Rvalue::Cast(_, operand, _)
241 | Rvalue::ShallowInitBox(operand, _) => in_operand::<Q, _>(cx, in_local, operand),
240 | Rvalue::Cast(_, operand, _) => in_operand::<Q, _>(cx, in_local, operand),
242241
243242 Rvalue::BinaryOp(_, box (lhs, rhs)) => {
244243 in_operand::<Q, _>(cx, in_local, lhs) || in_operand::<Q, _>(cx, in_local, rhs)
compiler/rustc_const_eval/src/check_consts/resolver.rs-1
......@@ -192,7 +192,6 @@ where
192192 }
193193
194194 mir::Rvalue::Cast(..)
195 | mir::Rvalue::ShallowInitBox(..)
196195 | mir::Rvalue::Use(..)
197196 | mir::Rvalue::CopyForDeref(..)
198197 | mir::Rvalue::ThreadLocalRef(..)
compiler/rustc_const_eval/src/const_eval/machine.rs+1-1
......@@ -236,7 +236,7 @@ impl<'tcx> CompileTimeInterpCx<'tcx> {
236236 if self.tcx.is_lang_item(def_id, LangItem::PanicDisplay)
237237 || self.tcx.is_lang_item(def_id, LangItem::BeginPanic)
238238 {
239 let args = self.copy_fn_args(args);
239 let args = Self::copy_fn_args(args);
240240 // &str or &&str
241241 assert!(args.len() == 1);
242242
compiler/rustc_const_eval/src/interpret/call.rs+51-41
......@@ -19,8 +19,8 @@ use tracing::{info, instrument, trace};
1919
2020use super::{
2121 CtfeProvenance, FnVal, ImmTy, InterpCx, InterpResult, MPlaceTy, Machine, OpTy, PlaceTy,
22 Projectable, Provenance, ReturnAction, ReturnContinuation, Scalar, StackPopInfo, interp_ok,
23 throw_ub, throw_ub_custom,
22 Projectable, Provenance, ReturnAction, ReturnContinuation, Scalar, interp_ok, throw_ub,
23 throw_ub_custom,
2424};
2525use crate::enter_trace_span;
2626use crate::interpret::EnteredTraceSpan;
......@@ -43,25 +43,22 @@ impl<'tcx, Prov: Provenance> FnArg<'tcx, Prov> {
4343 FnArg::InPlace(mplace) => &mplace.layout,
4444 }
4545 }
46}
4746
48impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
4947 /// Make a copy of the given fn_arg. Any `InPlace` are degenerated to copies, no protection of the
5048 /// original memory occurs.
51 pub fn copy_fn_arg(&self, arg: &FnArg<'tcx, M::Provenance>) -> OpTy<'tcx, M::Provenance> {
52 match arg {
49 pub fn copy_fn_arg(&self) -> OpTy<'tcx, Prov> {
50 match self {
5351 FnArg::Copy(op) => op.clone(),
5452 FnArg::InPlace(mplace) => mplace.clone().into(),
5553 }
5654 }
55}
5756
57impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
5858 /// Make a copy of the given fn_args. Any `InPlace` are degenerated to copies, no protection of the
5959 /// original memory occurs.
60 pub fn copy_fn_args(
61 &self,
62 args: &[FnArg<'tcx, M::Provenance>],
63 ) -> Vec<OpTy<'tcx, M::Provenance>> {
64 args.iter().map(|fn_arg| self.copy_fn_arg(fn_arg)).collect()
60 pub fn copy_fn_args(args: &[FnArg<'tcx, M::Provenance>]) -> Vec<OpTy<'tcx, M::Provenance>> {
61 args.iter().map(|fn_arg| fn_arg.copy_fn_arg()).collect()
6562 }
6663
6764 /// Helper function for argument untupling.
......@@ -319,7 +316,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
319316 // We work with a copy of the argument for now; if this is in-place argument passing, we
320317 // will later protect the source it comes from. This means the callee cannot observe if we
321318 // did in-place of by-copy argument passing, except for pointer equality tests.
322 let caller_arg_copy = self.copy_fn_arg(caller_arg);
319 let caller_arg_copy = caller_arg.copy_fn_arg();
323320 if !already_live {
324321 let local = callee_arg.as_local().unwrap();
325322 let meta = caller_arg_copy.meta();
......@@ -616,7 +613,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
616613 if let Some(fallback) = M::call_intrinsic(
617614 self,
618615 instance,
619 &self.copy_fn_args(args),
616 &Self::copy_fn_args(args),
620617 destination,
621618 target,
622619 unwind,
......@@ -703,7 +700,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
703700 // An `InPlace` does nothing here, we keep the original receiver intact. We can't
704701 // really pass the argument in-place anyway, and we are constructing a new
705702 // `Immediate` receiver.
706 let mut receiver = self.copy_fn_arg(&args[0]);
703 let mut receiver = args[0].copy_fn_arg();
707704 let receiver_place = loop {
708705 match receiver.layout.ty.kind() {
709706 ty::Ref(..) | ty::RawPtr(..) => {
......@@ -824,41 +821,50 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
824821 with_caller_location: bool,
825822 ) -> InterpResult<'tcx> {
826823 trace!("init_fn_tail_call: {:#?}", fn_val);
827
828824 // This is the "canonical" implementation of tails calls,
829825 // a pop of the current stack frame, followed by a normal call
830826 // which pushes a new stack frame, with the return address from
831827 // the popped stack frame.
832828 //
833 // Note that we are using `pop_stack_frame_raw` and not `return_from_current_stack_frame`,
834 // as the latter "executes" the goto to the return block, but we don't want to,
829 // Note that we cannot use `return_from_current_stack_frame`,
830 // as that "executes" the goto to the return block, but we don't want to,
835831 // only the tail called function should return to the current return block.
836 let StackPopInfo { return_action, return_cont, return_place } =
837 self.pop_stack_frame_raw(false, |_this, _return_place| {
838 // This function's return value is just discarded, the tail-callee will fill in the return place instead.
839 interp_ok(())
840 })?;
841832
842 assert_eq!(return_action, ReturnAction::Normal);
843
844 // Take the "stack pop cleanup" info, and use that to initiate the next call.
845 let ReturnContinuation::Goto { ret, unwind } = return_cont else {
846 bug!("can't tailcall as root");
833 // The arguments need to all be copied since the current stack frame will be removed
834 // before the callee even starts executing.
835 // FIXME(explicit_tail_calls,#144855): does this match what codegen does?
836 let args = args.iter().map(|fn_arg| FnArg::Copy(fn_arg.copy_fn_arg())).collect::<Vec<_>>();
837 // Remove the frame from the stack.
838 let frame = self.pop_stack_frame_raw()?;
839 // Remember where this frame would have returned to.
840 let ReturnContinuation::Goto { ret, unwind } = frame.return_cont() else {
841 bug!("can't tailcall as root of the stack");
847842 };
848
843 // There's no return value to deal with! Instead, we forward the old return place
844 // to the new function.
849845 // FIXME(explicit_tail_calls):
850846 // we should check if both caller&callee can/n't unwind,
851847 // see <https://github.com/rust-lang/rust/pull/113128#issuecomment-1614979803>
852848
849 // Now push the new stack frame.
853850 self.init_fn_call(
854851 fn_val,
855852 (caller_abi, caller_fn_abi),
856 args,
853 &*args,
857854 with_caller_location,
858 &return_place,
855 frame.return_place(),
859856 ret,
860857 unwind,
861 )
858 )?;
859
860 // Finally, clear the local variables. Has to be done after pushing to support
861 // non-scalar arguments.
862 // FIXME(explicit_tail_calls,#144855): revisit this once codegen supports indirect
863 // arguments, to ensure the semantics are compatible.
864 let return_action = self.cleanup_stack_frame(/* unwinding */ false, frame)?;
865 assert_eq!(return_action, ReturnAction::Normal);
866
867 interp_ok(())
862868 }
863869
864870 pub(super) fn init_drop_in_place_call(
......@@ -953,14 +959,18 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
953959 // local's value out.
954960 let return_op =
955961 self.local_to_op(mir::RETURN_PLACE, None).expect("return place should always be live");
956 // Do the actual pop + copy.
957 let stack_pop_info = self.pop_stack_frame_raw(unwinding, |this, return_place| {
958 this.copy_op_allow_transmute(&return_op, return_place)?;
959 trace!("return value: {:?}", this.dump_place(return_place));
960 interp_ok(())
961 })?;
962
963 match stack_pop_info.return_action {
962 // Remove the frame from the stack.
963 let frame = self.pop_stack_frame_raw()?;
964 // Copy the return value and remember the return continuation.
965 if !unwinding {
966 self.copy_op_allow_transmute(&return_op, frame.return_place())?;
967 trace!("return value: {:?}", self.dump_place(frame.return_place()));
968 }
969 let return_cont = frame.return_cont();
970 // Finish popping the stack frame.
971 let return_action = self.cleanup_stack_frame(unwinding, frame)?;
972 // Jump to the next block.
973 match return_action {
964974 ReturnAction::Normal => {}
965975 ReturnAction::NoJump => {
966976 // The hook already did everything.
......@@ -978,7 +988,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
978988 // Normal return, figure out where to jump.
979989 if unwinding {
980990 // Follow the unwind edge.
981 match stack_pop_info.return_cont {
991 match return_cont {
982992 ReturnContinuation::Goto { unwind, .. } => {
983993 // This must be the very last thing that happens, since it can in fact push a new stack frame.
984994 self.unwind_to_block(unwind)
......@@ -989,7 +999,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
989999 }
9901000 } else {
9911001 // Follow the normal return edge.
992 match stack_pop_info.return_cont {
1002 match return_cont {
9931003 ReturnContinuation::Goto { ret, .. } => self.return_to_block(ret),
9941004 ReturnContinuation::Stop { .. } => {
9951005 assert!(
compiler/rustc_const_eval/src/interpret/mod.rs+1-1
......@@ -36,7 +36,7 @@ pub use self::operand::{ImmTy, Immediate, OpTy};
3636pub use self::place::{MPlaceTy, MemPlaceMeta, PlaceTy, Writeable};
3737use self::place::{MemPlace, Place};
3838pub use self::projection::{OffsetMode, Projectable};
39pub use self::stack::{Frame, FrameInfo, LocalState, ReturnContinuation, StackPopInfo};
39pub use self::stack::{Frame, FrameInfo, LocalState, ReturnContinuation};
4040pub use self::util::EnteredTraceSpan;
4141pub(crate) use self::util::create_static_alloc;
4242pub use self::validity::{CtfeValidationMode, RangeSet, RefTracking};
compiler/rustc_const_eval/src/interpret/stack.rs+27-43
......@@ -81,7 +81,7 @@ pub struct Frame<'tcx, Prov: Provenance = CtfeProvenance, Extra = ()> {
8181 /// and its layout in the caller. This place is to be interpreted relative to the
8282 /// *caller's* stack frame. We use a `PlaceTy` instead of an `MPlaceTy` since this
8383 /// avoids having to move *all* return places into Miri's memory.
84 pub return_place: PlaceTy<'tcx, Prov>,
84 return_place: PlaceTy<'tcx, Prov>,
8585
8686 /// The list of locals for this stack frame, stored in order as
8787 /// `[return_ptr, arguments..., variables..., temporaries...]`.
......@@ -127,19 +127,6 @@ pub enum ReturnContinuation {
127127 Stop { cleanup: bool },
128128}
129129
130/// Return type of [`InterpCx::pop_stack_frame_raw`].
131pub struct StackPopInfo<'tcx, Prov: Provenance> {
132 /// Additional information about the action to be performed when returning from the popped
133 /// stack frame.
134 pub return_action: ReturnAction,
135
136 /// [`return_cont`](Frame::return_cont) of the popped stack frame.
137 pub return_cont: ReturnContinuation,
138
139 /// [`return_place`](Frame::return_place) of the popped stack frame.
140 pub return_place: PlaceTy<'tcx, Prov>,
141}
142
143130/// State of a local variable including a memoized layout
144131#[derive(Clone)]
145132pub struct LocalState<'tcx, Prov: Provenance = CtfeProvenance> {
......@@ -292,6 +279,14 @@ impl<'tcx, Prov: Provenance, Extra> Frame<'tcx, Prov, Extra> {
292279 self.instance
293280 }
294281
282 pub fn return_place(&self) -> &PlaceTy<'tcx, Prov> {
283 &self.return_place
284 }
285
286 pub fn return_cont(&self) -> ReturnContinuation {
287 self.return_cont
288 }
289
295290 /// Return the `SourceInfo` of the current instruction.
296291 pub fn current_source_info(&self) -> Option<&mir::SourceInfo> {
297292 self.loc.left().map(|loc| self.body.source_info(loc))
......@@ -417,35 +412,26 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
417412 interp_ok(())
418413 }
419414
420 /// Low-level helper that pops a stack frame from the stack and returns some information about
421 /// it.
422 ///
423 /// This also deallocates locals, if necessary.
424 /// `copy_ret_val` gets called after the frame has been taken from the stack but before the locals have been deallocated.
425 ///
426 /// [`M::before_stack_pop`] and [`M::after_stack_pop`] are called by this function
427 /// automatically.
428 ///
429 /// The high-level version of this is `return_from_current_stack_frame`.
430 ///
431 /// [`M::before_stack_pop`]: Machine::before_stack_pop
432 /// [`M::after_stack_pop`]: Machine::after_stack_pop
415 /// Low-level helper that pops a stack frame from the stack without any cleanup.
416 /// This invokes `before_stack_pop`.
417 /// After calling this function, you need to deal with the return value, and then
418 /// invoke `cleanup_stack_frame`.
433419 pub(super) fn pop_stack_frame_raw(
434420 &mut self,
435 unwinding: bool,
436 copy_ret_val: impl FnOnce(&mut Self, &PlaceTy<'tcx, M::Provenance>) -> InterpResult<'tcx>,
437 ) -> InterpResult<'tcx, StackPopInfo<'tcx, M::Provenance>> {
421 ) -> InterpResult<'tcx, Frame<'tcx, M::Provenance, M::FrameExtra>> {
438422 M::before_stack_pop(self)?;
439423 let frame =
440424 self.stack_mut().pop().expect("tried to pop a stack frame, but there were none");
425 interp_ok(frame)
426 }
441427
442 // Copy return value (unless we are unwinding).
443 if !unwinding {
444 copy_ret_val(self, &frame.return_place)?;
445 }
446
428 /// Deallocate local variables in the stack frame, and invoke `after_stack_pop`.
429 pub(super) fn cleanup_stack_frame(
430 &mut self,
431 unwinding: bool,
432 frame: Frame<'tcx, M::Provenance, M::FrameExtra>,
433 ) -> InterpResult<'tcx, ReturnAction> {
447434 let return_cont = frame.return_cont;
448 let return_place = frame.return_place.clone();
449435
450436 // Cleanup: deallocate locals.
451437 // 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> {
455441 ReturnContinuation::Stop { cleanup, .. } => cleanup,
456442 };
457443
458 let return_action = if cleanup {
444 if cleanup {
459445 for local in &frame.locals {
460446 self.deallocate_local(local.value)?;
461447 }
......@@ -466,13 +452,11 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
466452 // Call the machine hook, which determines the next steps.
467453 let return_action = M::after_stack_pop(self, frame, unwinding)?;
468454 assert_ne!(return_action, ReturnAction::NoCleanup);
469 return_action
455 interp_ok(return_action)
470456 } else {
471457 // We also skip the machine hook when there's no cleanup. This not a real "pop" anyway.
472 ReturnAction::NoCleanup
473 };
474
475 interp_ok(StackPopInfo { return_action, return_cont, return_place })
458 interp_ok(ReturnAction::NoCleanup)
459 }
476460 }
477461
478462 /// 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> {
655639 let (_idx, callee_abi) = callee_abis.next().unwrap();
656640 assert!(self.check_argument_compat(caller_abi, callee_abi)?);
657641 // FIXME: do we have to worry about in-place argument passing?
658 let op = self.copy_fn_arg(fn_arg);
642 let op = fn_arg.copy_fn_arg();
659643 let mplace = self.allocate(op.layout, MemoryKind::Stack)?;
660644 self.copy_op(&op, &mplace)?;
661645
compiler/rustc_const_eval/src/interpret/step.rs-6
......@@ -249,12 +249,6 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
249249 self.write_immediate(*val, &dest)?;
250250 }
251251
252 ShallowInitBox(ref operand, _) => {
253 let src = self.eval_operand(operand, None)?;
254 let v = self.read_immediate(&src)?;
255 self.write_immediate(*v, &dest)?;
256 }
257
258252 Cast(cast_kind, ref operand, cast_ty) => {
259253 let src = self.eval_operand(operand, None)?;
260254 let cast_ty =
compiler/rustc_const_eval/src/interpret/validity.rs+1-6
......@@ -647,13 +647,8 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
647647 }
648648 } else {
649649 // This is not CTFE, so it's Miri with recursive checking.
650 // FIXME: we do *not* check behind boxes, since creating a new box first creates it uninitialized
651 // and then puts the value in there, so briefly we have a box with uninit contents.
652 // FIXME: should we also skip `UnsafeCell` behind shared references? Currently that is not
650 // FIXME: should we also `UnsafeCell` behind shared references? Currently that is not
653651 // needed since validation reads bypass Stacked Borrows and data race checks.
654 if matches!(ptr_kind, PointerKind::Box) {
655 return interp_ok(());
656 }
657652 }
658653 let path = &self.path;
659654 ref_tracking.track(place, || {
compiler/rustc_expand/src/base.rs+3-81
......@@ -2,12 +2,11 @@ use std::any::Any;
22use std::default::Default;
33use std::iter;
44use std::path::Component::Prefix;
5use std::path::{Path, PathBuf};
5use std::path::PathBuf;
66use std::rc::Rc;
77use std::sync::Arc;
88
99use rustc_ast::attr::MarkedAttrs;
10use rustc_ast::token::MetaVarKind;
1110use rustc_ast::tokenstream::TokenStream;
1211use rustc_ast::visit::{AssocCtxt, Visitor};
1312use rustc_ast::{self as ast, AttrVec, Attribute, HasAttrs, Item, NodeId, PatKind, Safety};
......@@ -22,14 +21,14 @@ use rustc_hir::limit::Limit;
2221use rustc_hir::{Stability, find_attr};
2322use rustc_lint_defs::RegisteredTools;
2423use rustc_parse::MACRO_ARGUMENTS;
25use rustc_parse::parser::{AllowConstBlockItems, ForceCollect, Parser};
24use rustc_parse::parser::Parser;
2625use rustc_session::Session;
2726use rustc_session::parse::ParseSess;
2827use rustc_span::def_id::{CrateNum, DefId, LocalDefId};
2928use rustc_span::edition::Edition;
3029use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId, MacroKind};
3130use rustc_span::source_map::SourceMap;
32use rustc_span::{DUMMY_SP, FileName, Ident, Span, Symbol, kw, sym};
31use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw};
3332use smallvec::{SmallVec, smallvec};
3433use thin_vec::ThinVec;
3534
......@@ -1421,80 +1420,3 @@ pub fn resolve_path(sess: &Session, path: impl Into<PathBuf>, span: Span) -> PRe
14211420 }
14221421 }
14231422}
1424
1425/// If this item looks like a specific enums from `rental`, emit a fatal error.
1426/// See #73345 and #83125 for more details.
1427/// FIXME(#73933): Remove this eventually.
1428fn pretty_printing_compatibility_hack(item: &Item, psess: &ParseSess) {
1429 if let ast::ItemKind::Enum(ident, _, enum_def) = &item.kind
1430 && ident.name == sym::ProceduralMasqueradeDummyType
1431 && let [variant] = &*enum_def.variants
1432 && variant.ident.name == sym::Input
1433 && let FileName::Real(real) = psess.source_map().span_to_filename(ident.span)
1434 && let Some(c) = real
1435 .local_path()
1436 .unwrap_or(Path::new(""))
1437 .components()
1438 .flat_map(|c| c.as_os_str().to_str())
1439 .find(|c| c.starts_with("rental") || c.starts_with("allsorts-rental"))
1440 {
1441 let crate_matches = if c.starts_with("allsorts-rental") {
1442 true
1443 } else {
1444 let mut version = c.trim_start_matches("rental-").split('.');
1445 version.next() == Some("0")
1446 && version.next() == Some("5")
1447 && version.next().and_then(|c| c.parse::<u32>().ok()).is_some_and(|v| v < 6)
1448 };
1449
1450 if crate_matches {
1451 psess.dcx().emit_fatal(errors::ProcMacroBackCompat {
1452 crate_name: "rental".to_string(),
1453 fixed_version: "0.5.6".to_string(),
1454 });
1455 }
1456 }
1457}
1458
1459pub(crate) fn ann_pretty_printing_compatibility_hack(ann: &Annotatable, psess: &ParseSess) {
1460 let item = match ann {
1461 Annotatable::Item(item) => item,
1462 Annotatable::Stmt(stmt) => match &stmt.kind {
1463 ast::StmtKind::Item(item) => item,
1464 _ => return,
1465 },
1466 _ => return,
1467 };
1468 pretty_printing_compatibility_hack(item, psess)
1469}
1470
1471pub(crate) fn stream_pretty_printing_compatibility_hack(
1472 kind: MetaVarKind,
1473 stream: &TokenStream,
1474 psess: &ParseSess,
1475) {
1476 let item = match kind {
1477 MetaVarKind::Item => {
1478 let mut parser = Parser::new(psess, stream.clone(), None);
1479 // No need to collect tokens for this simple check.
1480 parser
1481 .parse_item(ForceCollect::No, AllowConstBlockItems::No)
1482 .expect("failed to reparse item")
1483 .expect("an actual item")
1484 }
1485 MetaVarKind::Stmt => {
1486 let mut parser = Parser::new(psess, stream.clone(), None);
1487 // No need to collect tokens for this simple check.
1488 let stmt = parser
1489 .parse_stmt(ForceCollect::No)
1490 .expect("failed to reparse")
1491 .expect("an actual stmt");
1492 match &stmt.kind {
1493 ast::StmtKind::Item(item) => item.clone(),
1494 _ => return,
1495 }
1496 }
1497 _ => return,
1498 };
1499 pretty_printing_compatibility_hack(&item, psess)
1500}
compiler/rustc_expand/src/errors.rs-12
......@@ -446,18 +446,6 @@ pub(crate) struct GlobDelegationTraitlessQpath {
446446 pub span: Span,
447447}
448448
449// This used to be the `proc_macro_back_compat` lint (#83125). It was later
450// turned into a hard error.
451#[derive(Diagnostic)]
452#[diag("using an old version of `{$crate_name}`")]
453#[note(
454 "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"
455)]
456pub(crate) struct ProcMacroBackCompat {
457 pub crate_name: String,
458 pub fixed_version: String,
459}
460
461449pub(crate) use metavar_exprs::*;
462450mod metavar_exprs {
463451 use super::*;
compiler/rustc_expand/src/proc_macro.rs-5
......@@ -105,11 +105,6 @@ impl MultiItemModifier for DeriveProcMacro {
105105 // (e.g. `fn foo() { #[derive(Debug)] struct Bar; }`)
106106 let is_stmt = matches!(item, Annotatable::Stmt(..));
107107
108 // We used to have an alternative behaviour for crates that needed it.
109 // We had a lint for a long time, but now we just emit a hard error.
110 // Eventually we might remove the special case hard error check
111 // altogether. See #73345.
112 crate::base::ann_pretty_printing_compatibility_hack(&item, &ecx.sess.psess);
113108 let input = item.to_tokens();
114109
115110 let invoc_id = ecx.current_expansion.id;
compiler/rustc_expand/src/proc_macro_server.rs+3-19
......@@ -103,8 +103,8 @@ impl ToInternal<token::LitKind> for LitKind {
103103 }
104104}
105105
106impl FromInternal<(TokenStream, &mut Rustc<'_, '_>)> for Vec<TokenTree<TokenStream, Span, Symbol>> {
107 fn from_internal((stream, rustc): (TokenStream, &mut Rustc<'_, '_>)) -> Self {
106impl FromInternal<TokenStream> for Vec<TokenTree<TokenStream, Span, Symbol>> {
107 fn from_internal(stream: TokenStream) -> Self {
108108 use rustc_ast::token::*;
109109
110110 // Estimate the capacity as `stream.len()` rounded up to the next power
......@@ -115,22 +115,6 @@ impl FromInternal<(TokenStream, &mut Rustc<'_, '_>)> for Vec<TokenTree<TokenStre
115115 while let Some(tree) = iter.next() {
116116 let (Token { kind, span }, joint) = match tree.clone() {
117117 tokenstream::TokenTree::Delimited(span, _, mut delim, mut stream) => {
118 // We used to have an alternative behaviour for crates that
119 // needed it: a hack used to pass AST fragments to
120 // attribute and derive macros as a single nonterminal
121 // token instead of a token stream. Such token needs to be
122 // "unwrapped" and not represented as a delimited group. We
123 // had a lint for a long time, but now we just emit a hard
124 // error. Eventually we might remove the special case hard
125 // error check altogether. See #73345.
126 if let Delimiter::Invisible(InvisibleOrigin::MetaVar(kind)) = delim {
127 crate::base::stream_pretty_printing_compatibility_hack(
128 kind,
129 &stream,
130 rustc.psess(),
131 );
132 }
133
134118 // In `mk_delimited` we avoid nesting invisible delimited
135119 // of the same `MetaVarKind`. Here we do the same but
136120 // ignore the `MetaVarKind` because it is discarded when we
......@@ -687,7 +671,7 @@ impl server::Server for Rustc<'_, '_> {
687671 &mut self,
688672 stream: Self::TokenStream,
689673 ) -> Vec<TokenTree<Self::TokenStream, Self::Span, Self::Symbol>> {
690 FromInternal::from_internal((stream, self))
674 FromInternal::from_internal(stream)
691675 }
692676
693677 fn span_debug(&mut self, span: Self::Span) -> String {
compiler/rustc_feature/src/builtin_attrs.rs+1-1
......@@ -1208,7 +1208,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
12081208 rustc_intrinsic_const_stable_indirect, Normal,
12091209 template!(Word), WarnFollowing, EncodeCrossCrate::No, "this is an internal implementation detail",
12101210 ),
1211 gated!(
1211 rustc_attr!(
12121212 rustc_allow_const_fn_unstable, Normal,
12131213 template!(Word, List: &["feat1, feat2, ..."]), DuplicatesOk, EncodeCrossCrate::No,
12141214 "rustc_allow_const_fn_unstable side-steps feature gating and stability checks"
compiler/rustc_feature/src/unstable.rs+1-5
......@@ -287,10 +287,6 @@ declare_features! (
287287 (internal, panic_runtime, "1.10.0", Some(32837)),
288288 /// Allows using pattern types.
289289 (internal, pattern_types, "1.79.0", Some(123646)),
290 /// Allows using `#[rustc_allow_const_fn_unstable]`.
291 /// This is an attribute on `const fn` for the same
292 /// purpose as `#[allow_internal_unstable]`.
293 (internal, rustc_allow_const_fn_unstable, "1.49.0", Some(69399)),
294290 /// Allows using compiler's own crates.
295291 (unstable, rustc_private, "1.0.0", Some(27812)),
296292 /// Allows using internal rustdoc features like `doc(keyword)`.
......@@ -493,7 +489,7 @@ declare_features! (
493489 /// Allows the use of `#[ffi_pure]` on foreign functions.
494490 (unstable, ffi_pure, "1.45.0", Some(58329)),
495491 /// Allows marking trait functions as `final` to prevent overriding impls
496 (unstable, final_associated_functions, "CURRENT_RUSTC_VERSION", Some(1)),
492 (unstable, final_associated_functions, "CURRENT_RUSTC_VERSION", Some(131179)),
497493 /// Controlling the behavior of fmt::Debug
498494 (unstable, fmt_debug, "1.82.0", Some(129709)),
499495 /// Allows using `#[align(...)]` on function items
compiler/rustc_incremental/src/persist/clean.rs+1-1
......@@ -322,7 +322,7 @@ impl<'tcx> CleanVisitor<'tcx> {
322322 if let Some(def_id) = dep_node.extract_def_id(self.tcx) {
323323 format!("{:?}({})", dep_node.kind, self.tcx.def_path_str(def_id))
324324 } else {
325 format!("{:?}({:?})", dep_node.kind, dep_node.hash)
325 format!("{:?}({:?})", dep_node.kind, dep_node.key_fingerprint)
326326 }
327327 }
328328
compiler/rustc_middle/src/dep_graph/dep_node.rs+44-42
......@@ -1,10 +1,10 @@
11//! This module defines the [`DepNode`] type which the compiler uses to represent
22//! nodes in the [dependency graph]. A `DepNode` consists of a [`DepKind`] (which
33//! specifies the kind of thing it represents, like a piece of HIR, MIR, etc.)
4//! and a [`Fingerprint`], a 128-bit hash value, the exact meaning of which
5//! depends on the node's `DepKind`. Together, the kind and the fingerprint
4//! and a "key fingerprint", a 128-bit hash value, the exact meaning of which
5//! depends on the node's `DepKind`. Together, the kind and the key fingerprint
66//! fully identify a dependency node, even across multiple compilation sessions.
7//! In other words, the value of the fingerprint does not depend on anything
7//! In other words, the value of the key fingerprint does not depend on anything
88//! that is specific to a given compilation session, like an unpredictable
99//! interning key (e.g., `NodeId`, `DefId`, `Symbol`) or the numeric value of a
1010//! pointer. The concept behind this could be compared to how git commit hashes
......@@ -41,17 +41,9 @@
4141//! `DepNode`s could represent global concepts with only one value.
4242//! * Whether it is possible, in principle, to reconstruct a query key from a
4343//! given `DepNode`. Many `DepKind`s only require a single `DefId` parameter,
44//! in which case it is possible to map the node's fingerprint back to the
44//! in which case it is possible to map the node's key fingerprint back to the
4545//! `DefId` it was computed from. In other cases, too much information gets
46//! lost during fingerprint computation.
47//!
48//! `make_compile_codegen_unit` and `make_compile_mono_items`, together with
49//! `DepNode::new()`, ensure that only valid `DepNode` instances can be
50//! constructed. For example, the API does not allow for constructing
51//! parameterless `DepNode`s with anything other than a zeroed out fingerprint.
52//! More generally speaking, it relieves the user of the `DepNode` API of
53//! having to know how to compute the expected fingerprint for a given set of
54//! node parameters.
46//! lost when computing a key fingerprint.
5547//!
5648//! [dependency graph]: https://rustc-dev-guide.rust-lang.org/query.html
5749
......@@ -65,7 +57,7 @@ use rustc_hir::definitions::DefPathHash;
6557use rustc_macros::{Decodable, Encodable};
6658use rustc_span::Symbol;
6759
68use super::{FingerprintStyle, SerializedDepNodeIndex};
60use super::{KeyFingerprintStyle, SerializedDepNodeIndex};
6961use crate::ich::StableHashingContext;
7062use crate::mir::mono::MonoItem;
7163use crate::ty::{TyCtxt, tls};
......@@ -125,10 +117,20 @@ impl fmt::Debug for DepKind {
125117 }
126118}
127119
120/// Combination of a [`DepKind`] and a key fingerprint that uniquely identifies
121/// a node in the dep graph.
128122#[derive(Clone, Copy, PartialEq, Eq, Hash)]
129123pub struct DepNode {
130124 pub kind: DepKind,
131 pub hash: PackedFingerprint,
125
126 /// This is _typically_ a hash of the query key, but sometimes not.
127 ///
128 /// For example, `anon` nodes have a fingerprint that is derived from their
129 /// dependencies instead of a key.
130 ///
131 /// In some cases the key value can be reconstructed from this fingerprint;
132 /// see [`KeyFingerprintStyle`].
133 pub key_fingerprint: PackedFingerprint,
132134}
133135
134136impl DepNode {
......@@ -136,24 +138,23 @@ impl DepNode {
136138 /// that the DepNode corresponding to the given DepKind actually
137139 /// does not require any parameters.
138140 pub fn new_no_params<'tcx>(tcx: TyCtxt<'tcx>, kind: DepKind) -> DepNode {
139 debug_assert_eq!(tcx.fingerprint_style(kind), FingerprintStyle::Unit);
140 DepNode { kind, hash: Fingerprint::ZERO.into() }
141 debug_assert_eq!(tcx.key_fingerprint_style(kind), KeyFingerprintStyle::Unit);
142 DepNode { kind, key_fingerprint: Fingerprint::ZERO.into() }
141143 }
142144
143 pub fn construct<'tcx, Key>(tcx: TyCtxt<'tcx>, kind: DepKind, arg: &Key) -> DepNode
145 pub fn construct<'tcx, Key>(tcx: TyCtxt<'tcx>, kind: DepKind, key: &Key) -> DepNode
144146 where
145147 Key: DepNodeKey<'tcx>,
146148 {
147 let hash = arg.to_fingerprint(tcx);
148 let dep_node = DepNode { kind, hash: hash.into() };
149 let dep_node = DepNode { kind, key_fingerprint: key.to_fingerprint(tcx).into() };
149150
150151 #[cfg(debug_assertions)]
151152 {
152 if !tcx.fingerprint_style(kind).reconstructible()
153 if !tcx.key_fingerprint_style(kind).reconstructible()
153154 && (tcx.sess.opts.unstable_opts.incremental_info
154155 || tcx.sess.opts.unstable_opts.query_dep_graph)
155156 {
156 tcx.dep_graph.register_dep_node_debug_str(dep_node, || arg.to_debug_str(tcx));
157 tcx.dep_graph.register_dep_node_debug_str(dep_node, || key.to_debug_str(tcx));
157158 }
158159 }
159160
......@@ -168,8 +169,8 @@ impl DepNode {
168169 def_path_hash: DefPathHash,
169170 kind: DepKind,
170171 ) -> Self {
171 debug_assert!(tcx.fingerprint_style(kind) == FingerprintStyle::DefPathHash);
172 DepNode { kind, hash: def_path_hash.0.into() }
172 debug_assert!(tcx.key_fingerprint_style(kind) == KeyFingerprintStyle::DefPathHash);
173 DepNode { kind, key_fingerprint: def_path_hash.0.into() }
173174 }
174175}
175176
......@@ -184,10 +185,10 @@ impl fmt::Debug for DepNode {
184185 } else if let Some(ref s) = tcx.dep_graph.dep_node_debug_str(*self) {
185186 write!(f, "{s}")?;
186187 } else {
187 write!(f, "{}", self.hash)?;
188 write!(f, "{}", self.key_fingerprint)?;
188189 }
189190 } else {
190 write!(f, "{}", self.hash)?;
191 write!(f, "{}", self.key_fingerprint)?;
191192 }
192193 Ok(())
193194 })?;
......@@ -198,7 +199,7 @@ impl fmt::Debug for DepNode {
198199
199200/// Trait for query keys as seen by dependency-node tracking.
200201pub trait DepNodeKey<'tcx>: fmt::Debug + Sized {
201 fn fingerprint_style() -> FingerprintStyle;
202 fn key_fingerprint_style() -> KeyFingerprintStyle;
202203
203204 /// This method turns a query key into an opaque `Fingerprint` to be used
204205 /// in `DepNode`.
......@@ -212,7 +213,7 @@ pub trait DepNodeKey<'tcx>: fmt::Debug + Sized {
212213 /// `fingerprint_style()` is not `FingerprintStyle::Opaque`.
213214 /// It is always valid to return `None` here, in which case incremental
214215 /// compilation will treat the query as having changed instead of forcing it.
215 fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self>;
216 fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self>;
216217}
217218
218219// Blanket impl of `DepNodeKey`, which is specialized by other impls elsewhere.
......@@ -221,8 +222,8 @@ where
221222 T: for<'a> HashStable<StableHashingContext<'a>> + fmt::Debug,
222223{
223224 #[inline(always)]
224 default fn fingerprint_style() -> FingerprintStyle {
225 FingerprintStyle::Opaque
225 default fn key_fingerprint_style() -> KeyFingerprintStyle {
226 KeyFingerprintStyle::Opaque
226227 }
227228
228229 #[inline(always)]
......@@ -243,7 +244,7 @@ where
243244 }
244245
245246 #[inline(always)]
246 default fn recover(_: TyCtxt<'tcx>, _: &DepNode) -> Option<Self> {
247 default fn try_recover_key(_: TyCtxt<'tcx>, _: &DepNode) -> Option<Self> {
247248 None
248249 }
249250}
......@@ -264,10 +265,11 @@ pub struct DepKindVTable<'tcx> {
264265 /// cached within one compiler invocation.
265266 pub is_eval_always: bool,
266267
267 /// Indicates whether and how the query key can be recovered from its hashed fingerprint.
268 /// Indicates whether and how a query key can be reconstructed from the
269 /// key fingerprint of a dep node with this [`DepKind`].
268270 ///
269271 /// The [`DepNodeKey`] trait determines the fingerprint style for each key type.
270 pub fingerprint_style: FingerprintStyle,
272 pub key_fingerprint_style: KeyFingerprintStyle,
271273
272274 /// The red/green evaluation system will try to mark a specific DepNode in the
273275 /// dependency graph as green by recursively trying to mark the dependencies of
......@@ -279,7 +281,7 @@ pub struct DepKindVTable<'tcx> {
279281 /// `force_from_dep_node()` implements.
280282 ///
281283 /// In the general case, a `DepNode` consists of a `DepKind` and an opaque
282 /// GUID/fingerprint that will uniquely identify the node. This GUID/fingerprint
284 /// "key fingerprint" that will uniquely identify the node. This key fingerprint
283285 /// is usually constructed by computing a stable hash of the query-key that the
284286 /// `DepNode` corresponds to. Consequently, it is not in general possible to go
285287 /// back from hash to query-key (since hash functions are not reversible). For
......@@ -293,7 +295,7 @@ pub struct DepKindVTable<'tcx> {
293295 /// Now, if `force_from_dep_node()` would always fail, it would be pretty useless.
294296 /// Fortunately, we can use some contextual information that will allow us to
295297 /// reconstruct query-keys for certain kinds of `DepNode`s. In particular, we
296 /// enforce by construction that the GUID/fingerprint of certain `DepNode`s is a
298 /// enforce by construction that the key fingerprint of certain `DepNode`s is a
297299 /// valid `DefPathHash`. Since we also always build a huge table that maps every
298300 /// `DefPathHash` in the current codebase to the corresponding `DefId`, we have
299301 /// everything we need to re-run the query.
......@@ -301,7 +303,7 @@ pub struct DepKindVTable<'tcx> {
301303 /// Take the `mir_promoted` query as an example. Like many other queries, it
302304 /// just has a single parameter: the `DefId` of the item it will compute the
303305 /// validated MIR for. Now, when we call `force_from_dep_node()` on a `DepNode`
304 /// with kind `MirValidated`, we know that the GUID/fingerprint of the `DepNode`
306 /// with kind `mir_promoted`, we know that the key fingerprint of the `DepNode`
305307 /// is actually a `DefPathHash`, and can therefore just look up the corresponding
306308 /// `DefId` in `tcx.def_path_hash_to_def_id`.
307309 pub force_from_dep_node: Option<
......@@ -472,8 +474,8 @@ impl DepNode {
472474 /// refers to something from the previous compilation session that
473475 /// has been removed.
474476 pub fn extract_def_id(&self, tcx: TyCtxt<'_>) -> Option<DefId> {
475 if tcx.fingerprint_style(self.kind) == FingerprintStyle::DefPathHash {
476 tcx.def_path_hash_to_def_id(DefPathHash(self.hash.into()))
477 if tcx.key_fingerprint_style(self.kind) == KeyFingerprintStyle::DefPathHash {
478 tcx.def_path_hash_to_def_id(DefPathHash(self.key_fingerprint.into()))
477479 } else {
478480 None
479481 }
......@@ -486,10 +488,10 @@ impl DepNode {
486488 ) -> Result<DepNode, ()> {
487489 let kind = dep_kind_from_label_string(label)?;
488490
489 match tcx.fingerprint_style(kind) {
490 FingerprintStyle::Opaque | FingerprintStyle::HirId => Err(()),
491 FingerprintStyle::Unit => Ok(DepNode::new_no_params(tcx, kind)),
492 FingerprintStyle::DefPathHash => {
491 match tcx.key_fingerprint_style(kind) {
492 KeyFingerprintStyle::Opaque | KeyFingerprintStyle::HirId => Err(()),
493 KeyFingerprintStyle::Unit => Ok(DepNode::new_no_params(tcx, kind)),
494 KeyFingerprintStyle::DefPathHash => {
493495 Ok(DepNode::from_def_path_hash(tcx, def_path_hash, kind))
494496 }
495497 }
compiler/rustc_middle/src/dep_graph/dep_node_key.rs+31-31
......@@ -3,13 +3,13 @@ use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE, LocalDefId, LocalModDefId,
33use rustc_hir::definitions::DefPathHash;
44use rustc_hir::{HirId, ItemLocalId, OwnerId};
55
6use crate::dep_graph::{DepNode, DepNodeKey, FingerprintStyle};
6use crate::dep_graph::{DepNode, DepNodeKey, KeyFingerprintStyle};
77use crate::ty::TyCtxt;
88
99impl<'tcx> DepNodeKey<'tcx> for () {
1010 #[inline(always)]
11 fn fingerprint_style() -> FingerprintStyle {
12 FingerprintStyle::Unit
11 fn key_fingerprint_style() -> KeyFingerprintStyle {
12 KeyFingerprintStyle::Unit
1313 }
1414
1515 #[inline(always)]
......@@ -18,15 +18,15 @@ impl<'tcx> DepNodeKey<'tcx> for () {
1818 }
1919
2020 #[inline(always)]
21 fn recover(_: TyCtxt<'tcx>, _: &DepNode) -> Option<Self> {
21 fn try_recover_key(_: TyCtxt<'tcx>, _: &DepNode) -> Option<Self> {
2222 Some(())
2323 }
2424}
2525
2626impl<'tcx> DepNodeKey<'tcx> for DefId {
2727 #[inline(always)]
28 fn fingerprint_style() -> FingerprintStyle {
29 FingerprintStyle::DefPathHash
28 fn key_fingerprint_style() -> KeyFingerprintStyle {
29 KeyFingerprintStyle::DefPathHash
3030 }
3131
3232 #[inline(always)]
......@@ -40,15 +40,15 @@ impl<'tcx> DepNodeKey<'tcx> for DefId {
4040 }
4141
4242 #[inline(always)]
43 fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
43 fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
4444 dep_node.extract_def_id(tcx)
4545 }
4646}
4747
4848impl<'tcx> DepNodeKey<'tcx> for LocalDefId {
4949 #[inline(always)]
50 fn fingerprint_style() -> FingerprintStyle {
51 FingerprintStyle::DefPathHash
50 fn key_fingerprint_style() -> KeyFingerprintStyle {
51 KeyFingerprintStyle::DefPathHash
5252 }
5353
5454 #[inline(always)]
......@@ -62,15 +62,15 @@ impl<'tcx> DepNodeKey<'tcx> for LocalDefId {
6262 }
6363
6464 #[inline(always)]
65 fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
65 fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
6666 dep_node.extract_def_id(tcx).map(|id| id.expect_local())
6767 }
6868}
6969
7070impl<'tcx> DepNodeKey<'tcx> for OwnerId {
7171 #[inline(always)]
72 fn fingerprint_style() -> FingerprintStyle {
73 FingerprintStyle::DefPathHash
72 fn key_fingerprint_style() -> KeyFingerprintStyle {
73 KeyFingerprintStyle::DefPathHash
7474 }
7575
7676 #[inline(always)]
......@@ -84,15 +84,15 @@ impl<'tcx> DepNodeKey<'tcx> for OwnerId {
8484 }
8585
8686 #[inline(always)]
87 fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
87 fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
8888 dep_node.extract_def_id(tcx).map(|id| OwnerId { def_id: id.expect_local() })
8989 }
9090}
9191
9292impl<'tcx> DepNodeKey<'tcx> for CrateNum {
9393 #[inline(always)]
94 fn fingerprint_style() -> FingerprintStyle {
95 FingerprintStyle::DefPathHash
94 fn key_fingerprint_style() -> KeyFingerprintStyle {
95 KeyFingerprintStyle::DefPathHash
9696 }
9797
9898 #[inline(always)]
......@@ -107,15 +107,15 @@ impl<'tcx> DepNodeKey<'tcx> for CrateNum {
107107 }
108108
109109 #[inline(always)]
110 fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
110 fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
111111 dep_node.extract_def_id(tcx).map(|id| id.krate)
112112 }
113113}
114114
115115impl<'tcx> DepNodeKey<'tcx> for (DefId, DefId) {
116116 #[inline(always)]
117 fn fingerprint_style() -> FingerprintStyle {
118 FingerprintStyle::Opaque
117 fn key_fingerprint_style() -> KeyFingerprintStyle {
118 KeyFingerprintStyle::Opaque
119119 }
120120
121121 // We actually would not need to specialize the implementation of this
......@@ -141,8 +141,8 @@ impl<'tcx> DepNodeKey<'tcx> for (DefId, DefId) {
141141
142142impl<'tcx> DepNodeKey<'tcx> for HirId {
143143 #[inline(always)]
144 fn fingerprint_style() -> FingerprintStyle {
145 FingerprintStyle::HirId
144 fn key_fingerprint_style() -> KeyFingerprintStyle {
145 KeyFingerprintStyle::HirId
146146 }
147147
148148 // We actually would not need to specialize the implementation of this
......@@ -166,9 +166,9 @@ impl<'tcx> DepNodeKey<'tcx> for HirId {
166166 }
167167
168168 #[inline(always)]
169 fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
170 if tcx.fingerprint_style(dep_node.kind) == FingerprintStyle::HirId {
171 let (local_hash, local_id) = Fingerprint::from(dep_node.hash).split();
169 fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
170 if tcx.key_fingerprint_style(dep_node.kind) == KeyFingerprintStyle::HirId {
171 let (local_hash, local_id) = Fingerprint::from(dep_node.key_fingerprint).split();
172172 let def_path_hash = DefPathHash::new(tcx.stable_crate_id(LOCAL_CRATE), local_hash);
173173 let def_id = tcx.def_path_hash_to_def_id(def_path_hash)?.expect_local();
174174 let local_id = local_id
......@@ -184,8 +184,8 @@ impl<'tcx> DepNodeKey<'tcx> for HirId {
184184
185185impl<'tcx> DepNodeKey<'tcx> for ModDefId {
186186 #[inline(always)]
187 fn fingerprint_style() -> FingerprintStyle {
188 FingerprintStyle::DefPathHash
187 fn key_fingerprint_style() -> KeyFingerprintStyle {
188 KeyFingerprintStyle::DefPathHash
189189 }
190190
191191 #[inline(always)]
......@@ -199,15 +199,15 @@ impl<'tcx> DepNodeKey<'tcx> for ModDefId {
199199 }
200200
201201 #[inline(always)]
202 fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
203 DefId::recover(tcx, dep_node).map(ModDefId::new_unchecked)
202 fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
203 DefId::try_recover_key(tcx, dep_node).map(ModDefId::new_unchecked)
204204 }
205205}
206206
207207impl<'tcx> DepNodeKey<'tcx> for LocalModDefId {
208208 #[inline(always)]
209 fn fingerprint_style() -> FingerprintStyle {
210 FingerprintStyle::DefPathHash
209 fn key_fingerprint_style() -> KeyFingerprintStyle {
210 KeyFingerprintStyle::DefPathHash
211211 }
212212
213213 #[inline(always)]
......@@ -221,7 +221,7 @@ impl<'tcx> DepNodeKey<'tcx> for LocalModDefId {
221221 }
222222
223223 #[inline(always)]
224 fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
225 LocalDefId::recover(tcx, dep_node).map(LocalModDefId::new_unchecked)
224 fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
225 LocalDefId::try_recover_key(tcx, dep_node).map(LocalModDefId::new_unchecked)
226226 }
227227}
compiler/rustc_middle/src/dep_graph/graph.rs+40-30
......@@ -142,15 +142,17 @@ impl DepGraph {
142142
143143 // Instantiate a node with zero dependencies only once for anonymous queries.
144144 let _green_node_index = current.alloc_new_node(
145 DepNode { kind: DepKind::ANON_ZERO_DEPS, hash: current.anon_id_seed.into() },
145 DepNode { kind: DepKind::ANON_ZERO_DEPS, key_fingerprint: current.anon_id_seed.into() },
146146 EdgesVec::new(),
147147 Fingerprint::ZERO,
148148 );
149149 assert_eq!(_green_node_index, DepNodeIndex::SINGLETON_ZERO_DEPS_ANON_NODE);
150150
151 // Instantiate a dependy-less red node only once for anonymous queries.
151 // Create a single always-red node, with no dependencies of its own.
152 // Other nodes can use the always-red node as a fake dependency, to
153 // ensure that their dependency list will never be all-green.
152154 let red_node_index = current.alloc_new_node(
153 DepNode { kind: DepKind::RED, hash: Fingerprint::ZERO.into() },
155 DepNode { kind: DepKind::RED, key_fingerprint: Fingerprint::ZERO.into() },
154156 EdgesVec::new(),
155157 Fingerprint::ZERO,
156158 );
......@@ -418,7 +420,7 @@ impl DepGraphData {
418420 // Fingerprint::combine() is faster than sending Fingerprint
419421 // through the StableHasher (at least as long as StableHasher
420422 // is so slow).
421 hash: self.current.anon_id_seed.combine(hasher.finish()).into(),
423 key_fingerprint: self.current.anon_id_seed.combine(hasher.finish()).into(),
422424 };
423425
424426 // The DepNodes generated by the process above are not unique. 2 queries could
......@@ -585,7 +587,7 @@ impl DepGraph {
585587 data.current.record_edge(
586588 dep_node_index,
587589 node,
588 data.prev_fingerprint_of(prev_index),
590 data.prev_value_fingerprint_of(prev_index),
589591 );
590592 }
591593
......@@ -658,8 +660,8 @@ impl DepGraphData {
658660 }
659661
660662 #[inline]
661 pub fn prev_fingerprint_of(&self, prev_index: SerializedDepNodeIndex) -> Fingerprint {
662 self.previous.fingerprint_by_index(prev_index)
663 pub fn prev_value_fingerprint_of(&self, prev_index: SerializedDepNodeIndex) -> Fingerprint {
664 self.previous.value_fingerprint_for_index(prev_index)
663665 }
664666
665667 #[inline]
......@@ -679,7 +681,7 @@ impl DepGraphData {
679681 let dep_node_index = self.current.encoder.send_new(
680682 DepNode {
681683 kind: DepKind::SIDE_EFFECT,
682 hash: PackedFingerprint::from(Fingerprint::ZERO),
684 key_fingerprint: PackedFingerprint::from(Fingerprint::ZERO),
683685 },
684686 Fingerprint::ZERO,
685687 // We want the side effect node to always be red so it will be forced and emit the
......@@ -712,7 +714,7 @@ impl DepGraphData {
712714 &self.colors,
713715 DepNode {
714716 kind: DepKind::SIDE_EFFECT,
715 hash: PackedFingerprint::from(Fingerprint::ZERO),
717 key_fingerprint: PackedFingerprint::from(Fingerprint::ZERO),
716718 },
717719 Fingerprint::ZERO,
718720 std::iter::once(DepNodeIndex::FOREVER_RED_NODE).collect(),
......@@ -727,12 +729,12 @@ impl DepGraphData {
727729 &self,
728730 key: DepNode,
729731 edges: EdgesVec,
730 fingerprint: Option<Fingerprint>,
732 value_fingerprint: Option<Fingerprint>,
731733 ) -> DepNodeIndex {
732734 if let Some(prev_index) = self.previous.node_to_index_opt(&key) {
733735 // Determine the color and index of the new `DepNode`.
734 let is_green = if let Some(fingerprint) = fingerprint {
735 if fingerprint == self.previous.fingerprint_by_index(prev_index) {
736 let is_green = if let Some(value_fingerprint) = value_fingerprint {
737 if value_fingerprint == self.previous.value_fingerprint_for_index(prev_index) {
736738 // This is a green node: it existed in the previous compilation,
737739 // its query was re-executed, and it has the same result as before.
738740 true
......@@ -749,22 +751,22 @@ impl DepGraphData {
749751 false
750752 };
751753
752 let fingerprint = fingerprint.unwrap_or(Fingerprint::ZERO);
754 let value_fingerprint = value_fingerprint.unwrap_or(Fingerprint::ZERO);
753755
754756 let dep_node_index = self.current.encoder.send_and_color(
755757 prev_index,
756758 &self.colors,
757759 key,
758 fingerprint,
760 value_fingerprint,
759761 edges,
760762 is_green,
761763 );
762764
763 self.current.record_node(dep_node_index, key, fingerprint);
765 self.current.record_node(dep_node_index, key, value_fingerprint);
764766
765767 dep_node_index
766768 } else {
767 self.current.alloc_new_node(key, edges, fingerprint.unwrap_or(Fingerprint::ZERO))
769 self.current.alloc_new_node(key, edges, value_fingerprint.unwrap_or(Fingerprint::ZERO))
768770 }
769771 }
770772
......@@ -781,7 +783,7 @@ impl DepGraphData {
781783 self.current.record_edge(
782784 dep_node_index,
783785 *self.previous.index_to_node(prev_index),
784 self.previous.fingerprint_by_index(prev_index),
786 self.previous.value_fingerprint_for_index(prev_index),
785787 );
786788 }
787789
......@@ -925,7 +927,7 @@ impl DepGraphData {
925927 if !tcx.is_eval_always(dep_dep_node.kind) {
926928 debug!(
927929 "state of dependency {:?} ({}) is unknown, trying to mark it green",
928 dep_dep_node, dep_dep_node.hash,
930 dep_dep_node, dep_dep_node.key_fingerprint,
929931 );
930932
931933 let node_index = self.try_mark_previous_green(tcx, parent_dep_node_index, Some(frame));
......@@ -1154,10 +1156,10 @@ pub(super) struct CurrentDepGraph {
11541156 encoder: GraphEncoder,
11551157 anon_node_to_index: ShardedHashMap<DepNode, DepNodeIndex>,
11561158
1157 /// This is used to verify that fingerprints do not change between the creation of a node
1158 /// and its recomputation.
1159 /// This is used to verify that value fingerprints do not change between the
1160 /// creation of a node and its recomputation.
11591161 #[cfg(debug_assertions)]
1160 fingerprints: Lock<IndexVec<DepNodeIndex, Option<Fingerprint>>>,
1162 value_fingerprints: Lock<IndexVec<DepNodeIndex, Option<Fingerprint>>>,
11611163
11621164 /// Used to trap when a specific edge is added to the graph.
11631165 /// This is used for debug purposes and is only active with `debug_assertions`.
......@@ -1224,7 +1226,7 @@ impl CurrentDepGraph {
12241226 #[cfg(debug_assertions)]
12251227 forbidden_edge,
12261228 #[cfg(debug_assertions)]
1227 fingerprints: Lock::new(IndexVec::from_elem_n(None, new_node_count_estimate)),
1229 value_fingerprints: Lock::new(IndexVec::from_elem_n(None, new_node_count_estimate)),
12281230 nodes_in_current_session: new_node_dbg.then(|| {
12291231 Lock::new(FxHashMap::with_capacity_and_hasher(
12301232 new_node_count_estimate,
......@@ -1237,12 +1239,20 @@ impl CurrentDepGraph {
12371239 }
12381240
12391241 #[cfg(debug_assertions)]
1240 fn record_edge(&self, dep_node_index: DepNodeIndex, key: DepNode, fingerprint: Fingerprint) {
1242 fn record_edge(
1243 &self,
1244 dep_node_index: DepNodeIndex,
1245 key: DepNode,
1246 value_fingerprint: Fingerprint,
1247 ) {
12411248 if let Some(forbidden_edge) = &self.forbidden_edge {
12421249 forbidden_edge.index_to_node.lock().insert(dep_node_index, key);
12431250 }
1244 let previous = *self.fingerprints.lock().get_or_insert_with(dep_node_index, || fingerprint);
1245 assert_eq!(previous, fingerprint, "Unstable fingerprints for {:?}", key);
1251 let prior_value_fingerprint = *self
1252 .value_fingerprints
1253 .lock()
1254 .get_or_insert_with(dep_node_index, || value_fingerprint);
1255 assert_eq!(prior_value_fingerprint, value_fingerprint, "Unstable fingerprints for {key:?}");
12461256 }
12471257
12481258 #[inline(always)]
......@@ -1250,10 +1260,10 @@ impl CurrentDepGraph {
12501260 &self,
12511261 dep_node_index: DepNodeIndex,
12521262 key: DepNode,
1253 _current_fingerprint: Fingerprint,
1263 _value_fingerprint: Fingerprint,
12541264 ) {
12551265 #[cfg(debug_assertions)]
1256 self.record_edge(dep_node_index, key, _current_fingerprint);
1266 self.record_edge(dep_node_index, key, _value_fingerprint);
12571267
12581268 if let Some(ref nodes_in_current_session) = self.nodes_in_current_session {
12591269 outline(|| {
......@@ -1271,11 +1281,11 @@ impl CurrentDepGraph {
12711281 &self,
12721282 key: DepNode,
12731283 edges: EdgesVec,
1274 current_fingerprint: Fingerprint,
1284 value_fingerprint: Fingerprint,
12751285 ) -> DepNodeIndex {
1276 let dep_node_index = self.encoder.send_new(key, current_fingerprint, edges);
1286 let dep_node_index = self.encoder.send_new(key, value_fingerprint, edges);
12771287
1278 self.record_node(dep_node_index, key, current_fingerprint);
1288 self.record_node(dep_node_index, key, value_fingerprint);
12791289
12801290 dep_node_index
12811291 }
compiler/rustc_middle/src/dep_graph/mod.rs+8-8
......@@ -30,7 +30,7 @@ mod serialized;
3030/// This is mainly for determining whether and how we can reconstruct a key
3131/// from the fingerprint.
3232#[derive(Debug, PartialEq, Eq, Copy, Clone)]
33pub enum FingerprintStyle {
33pub enum KeyFingerprintStyle {
3434 /// The fingerprint is actually a DefPathHash.
3535 DefPathHash,
3636 /// The fingerprint is actually a HirId.
......@@ -41,14 +41,14 @@ pub enum FingerprintStyle {
4141 Opaque,
4242}
4343
44impl FingerprintStyle {
44impl KeyFingerprintStyle {
4545 #[inline]
4646 pub const fn reconstructible(self) -> bool {
4747 match self {
48 FingerprintStyle::DefPathHash | FingerprintStyle::Unit | FingerprintStyle::HirId => {
49 true
50 }
51 FingerprintStyle::Opaque => false,
48 KeyFingerprintStyle::DefPathHash
49 | KeyFingerprintStyle::Unit
50 | KeyFingerprintStyle::HirId => true,
51 KeyFingerprintStyle::Opaque => false,
5252 }
5353 }
5454}
......@@ -86,8 +86,8 @@ impl<'tcx> TyCtxt<'tcx> {
8686 }
8787
8888 #[inline(always)]
89 pub fn fingerprint_style(self, kind: DepKind) -> FingerprintStyle {
90 self.dep_kind_vtable(kind).fingerprint_style
89 pub fn key_fingerprint_style(self, kind: DepKind) -> KeyFingerprintStyle {
90 self.dep_kind_vtable(kind).key_fingerprint_style
9191 }
9292
9393 /// Try to force a dep node to execute and see if it's green.
compiler/rustc_middle/src/dep_graph/serialized.rs+57-41
......@@ -90,9 +90,13 @@ const DEP_NODE_WIDTH_BITS: usize = DEP_NODE_SIZE / 2;
9090pub struct SerializedDepGraph {
9191 /// The set of all DepNodes in the graph
9292 nodes: IndexVec<SerializedDepNodeIndex, DepNode>,
93 /// The set of all Fingerprints in the graph. Each Fingerprint corresponds to
94 /// the DepNode at the same index in the nodes vector.
95 fingerprints: IndexVec<SerializedDepNodeIndex, Fingerprint>,
93 /// A value fingerprint associated with each [`DepNode`] in [`Self::nodes`],
94 /// typically a hash of the value returned by the node's query in the
95 /// previous incremental-compilation session.
96 ///
97 /// Some nodes don't have a meaningful value hash (e.g. queries with `no_hash`),
98 /// so they store a dummy value here instead (e.g. [`Fingerprint::ZERO`]).
99 value_fingerprints: IndexVec<SerializedDepNodeIndex, Fingerprint>,
96100 /// For each DepNode, stores the list of edges originating from that
97101 /// DepNode. Encoded as a [start, end) pair indexing into edge_list_data,
98102 /// which holds the actual DepNodeIndices of the target nodes.
......@@ -100,8 +104,8 @@ pub struct SerializedDepGraph {
100104 /// A flattened list of all edge targets in the graph, stored in the same
101105 /// varint encoding that we use on disk. Edge sources are implicit in edge_list_indices.
102106 edge_list_data: Vec<u8>,
103 /// Stores a map from fingerprints to nodes per dep node kind.
104 /// This is the reciprocal of `nodes`.
107 /// For each dep kind, stores a map from key fingerprints back to the index
108 /// of the corresponding node. This is the inverse of `nodes`.
105109 index: Vec<UnhashMap<PackedFingerprint, SerializedDepNodeIndex>>,
106110 /// The number of previous compilation sessions. This is used to generate
107111 /// unique anon dep nodes per session.
......@@ -138,12 +142,15 @@ impl SerializedDepGraph {
138142
139143 #[inline]
140144 pub fn node_to_index_opt(&self, dep_node: &DepNode) -> Option<SerializedDepNodeIndex> {
141 self.index.get(dep_node.kind.as_usize())?.get(&dep_node.hash).cloned()
145 self.index.get(dep_node.kind.as_usize())?.get(&dep_node.key_fingerprint).copied()
142146 }
143147
144148 #[inline]
145 pub fn fingerprint_by_index(&self, dep_node_index: SerializedDepNodeIndex) -> Fingerprint {
146 self.fingerprints[dep_node_index]
149 pub fn value_fingerprint_for_index(
150 &self,
151 dep_node_index: SerializedDepNodeIndex,
152 ) -> Fingerprint {
153 self.value_fingerprints[dep_node_index]
147154 }
148155
149156 #[inline]
......@@ -212,10 +219,13 @@ impl SerializedDepGraph {
212219 let graph_bytes = d.len() - (3 * IntEncodedWithFixedSize::ENCODED_SIZE) - d.position();
213220
214221 let mut nodes = IndexVec::from_elem_n(
215 DepNode { kind: DepKind::NULL, hash: PackedFingerprint::from(Fingerprint::ZERO) },
222 DepNode {
223 kind: DepKind::NULL,
224 key_fingerprint: PackedFingerprint::from(Fingerprint::ZERO),
225 },
216226 node_max,
217227 );
218 let mut fingerprints = IndexVec::from_elem_n(Fingerprint::ZERO, node_max);
228 let mut value_fingerprints = IndexVec::from_elem_n(Fingerprint::ZERO, node_max);
219229 let mut edge_list_indices =
220230 IndexVec::from_elem_n(EdgeHeader { repr: 0, num_edges: 0 }, node_max);
221231
......@@ -243,7 +253,7 @@ impl SerializedDepGraph {
243253 assert!(node_header.node().kind != DepKind::NULL && node.kind == DepKind::NULL);
244254 *node = node_header.node();
245255
246 fingerprints[index] = node_header.fingerprint();
256 value_fingerprints[index] = node_header.value_fingerprint();
247257
248258 // If the length of this node's edge list is small, the length is stored in the header.
249259 // If it is not, we fall back to another decoder call.
......@@ -275,7 +285,7 @@ impl SerializedDepGraph {
275285 let session_count = d.read_u64();
276286
277287 for (idx, node) in nodes.iter_enumerated() {
278 if index[node.kind.as_usize()].insert(node.hash, idx).is_some() {
288 if index[node.kind.as_usize()].insert(node.key_fingerprint, idx).is_some() {
279289 // Empty nodes and side effect nodes can have duplicates
280290 if node.kind != DepKind::NULL && node.kind != DepKind::SIDE_EFFECT {
281291 let name = node.kind.name();
......@@ -291,7 +301,7 @@ impl SerializedDepGraph {
291301
292302 Arc::new(SerializedDepGraph {
293303 nodes,
294 fingerprints,
304 value_fingerprints,
295305 edge_list_indices,
296306 edge_list_data,
297307 index,
......@@ -303,8 +313,8 @@ impl SerializedDepGraph {
303313/// A packed representation of all the fixed-size fields in a `NodeInfo`.
304314///
305315/// This stores in one byte array:
306/// * The `Fingerprint` in the `NodeInfo`
307/// * The `Fingerprint` in `DepNode` that is in this `NodeInfo`
316/// * The value `Fingerprint` in the `NodeInfo`
317/// * The key `Fingerprint` in `DepNode` that is in this `NodeInfo`
308318/// * The `DepKind`'s discriminant (a u16, but not all bits are used...)
309319/// * The byte width of the encoded edges for this node
310320/// * In whatever bits remain, the length of the edge list for this node, if it fits
......@@ -323,8 +333,8 @@ struct Unpacked {
323333 bytes_per_index: usize,
324334 kind: DepKind,
325335 index: SerializedDepNodeIndex,
326 hash: PackedFingerprint,
327 fingerprint: Fingerprint,
336 key_fingerprint: PackedFingerprint,
337 value_fingerprint: Fingerprint,
328338}
329339
330340// Bit fields, where
......@@ -345,7 +355,7 @@ impl SerializedNodeHeader {
345355 fn new(
346356 node: &DepNode,
347357 index: DepNodeIndex,
348 fingerprint: Fingerprint,
358 value_fingerprint: Fingerprint,
349359 edge_max_index: u32,
350360 edge_count: usize,
351361 ) -> Self {
......@@ -363,19 +373,19 @@ impl SerializedNodeHeader {
363373 head |= (edge_count as u16 + 1) << (Self::KIND_BITS + Self::WIDTH_BITS);
364374 }
365375
366 let hash: Fingerprint = node.hash.into();
376 let hash: Fingerprint = node.key_fingerprint.into();
367377
368378 // Using half-open ranges ensures an unconditional panic if we get the magic numbers wrong.
369379 let mut bytes = [0u8; 38];
370380 bytes[..2].copy_from_slice(&head.to_le_bytes());
371381 bytes[2..6].copy_from_slice(&index.as_u32().to_le_bytes());
372382 bytes[6..22].copy_from_slice(&hash.to_le_bytes());
373 bytes[22..].copy_from_slice(&fingerprint.to_le_bytes());
383 bytes[22..].copy_from_slice(&value_fingerprint.to_le_bytes());
374384
375385 #[cfg(debug_assertions)]
376386 {
377387 let res = Self { bytes };
378 assert_eq!(fingerprint, res.fingerprint());
388 assert_eq!(value_fingerprint, res.value_fingerprint());
379389 assert_eq!(*node, res.node());
380390 if let Some(len) = res.len() {
381391 assert_eq!(edge_count, len as usize);
......@@ -388,8 +398,8 @@ impl SerializedNodeHeader {
388398 fn unpack(&self) -> Unpacked {
389399 let head = u16::from_le_bytes(self.bytes[..2].try_into().unwrap());
390400 let index = u32::from_le_bytes(self.bytes[2..6].try_into().unwrap());
391 let hash = self.bytes[6..22].try_into().unwrap();
392 let fingerprint = self.bytes[22..].try_into().unwrap();
401 let key_fingerprint = self.bytes[6..22].try_into().unwrap();
402 let value_fingerprint = self.bytes[22..].try_into().unwrap();
393403
394404 let kind = head & mask(Self::KIND_BITS) as u16;
395405 let bytes_per_index = (head >> Self::KIND_BITS) & mask(Self::WIDTH_BITS) as u16;
......@@ -400,8 +410,8 @@ impl SerializedNodeHeader {
400410 bytes_per_index: bytes_per_index as usize + 1,
401411 kind: DepKind::new(kind),
402412 index: SerializedDepNodeIndex::from_u32(index),
403 hash: Fingerprint::from_le_bytes(hash).into(),
404 fingerprint: Fingerprint::from_le_bytes(fingerprint),
413 key_fingerprint: Fingerprint::from_le_bytes(key_fingerprint).into(),
414 value_fingerprint: Fingerprint::from_le_bytes(value_fingerprint),
405415 }
406416 }
407417
......@@ -421,14 +431,14 @@ impl SerializedNodeHeader {
421431 }
422432
423433 #[inline]
424 fn fingerprint(&self) -> Fingerprint {
425 self.unpack().fingerprint
434 fn value_fingerprint(&self) -> Fingerprint {
435 self.unpack().value_fingerprint
426436 }
427437
428438 #[inline]
429439 fn node(&self) -> DepNode {
430 let Unpacked { kind, hash, .. } = self.unpack();
431 DepNode { kind, hash }
440 let Unpacked { kind, key_fingerprint, .. } = self.unpack();
441 DepNode { kind, key_fingerprint }
432442 }
433443
434444 #[inline]
......@@ -443,15 +453,20 @@ impl SerializedNodeHeader {
443453#[derive(Debug)]
444454struct NodeInfo {
445455 node: DepNode,
446 fingerprint: Fingerprint,
456 value_fingerprint: Fingerprint,
447457 edges: EdgesVec,
448458}
449459
450460impl NodeInfo {
451461 fn encode(&self, e: &mut MemEncoder, index: DepNodeIndex) {
452 let NodeInfo { ref node, fingerprint, ref edges } = *self;
453 let header =
454 SerializedNodeHeader::new(node, index, fingerprint, edges.max_index(), edges.len());
462 let NodeInfo { ref node, value_fingerprint, ref edges } = *self;
463 let header = SerializedNodeHeader::new(
464 node,
465 index,
466 value_fingerprint,
467 edges.max_index(),
468 edges.len(),
469 );
455470 e.write_array(header.bytes);
456471
457472 if header.len().is_none() {
......@@ -476,7 +491,7 @@ impl NodeInfo {
476491 e: &mut MemEncoder,
477492 node: &DepNode,
478493 index: DepNodeIndex,
479 fingerprint: Fingerprint,
494 value_fingerprint: Fingerprint,
480495 prev_index: SerializedDepNodeIndex,
481496 colors: &DepNodeColorMap,
482497 previous: &SerializedDepGraph,
......@@ -488,7 +503,8 @@ impl NodeInfo {
488503 let edge_max =
489504 edges.clone().map(|i| colors.current(i).unwrap().as_u32()).max().unwrap_or(0);
490505
491 let header = SerializedNodeHeader::new(node, index, fingerprint, edge_max, edge_count);
506 let header =
507 SerializedNodeHeader::new(node, index, value_fingerprint, edge_max, edge_count);
492508 e.write_array(header.bytes);
493509
494510 if header.len().is_none() {
......@@ -676,12 +692,12 @@ impl EncoderState {
676692 local: &mut LocalEncoderState,
677693 ) {
678694 let node = self.previous.index_to_node(prev_index);
679 let fingerprint = self.previous.fingerprint_by_index(prev_index);
695 let value_fingerprint = self.previous.value_fingerprint_for_index(prev_index);
680696 let edge_count = NodeInfo::encode_promoted(
681697 &mut local.encoder,
682698 node,
683699 index,
684 fingerprint,
700 value_fingerprint,
685701 prev_index,
686702 colors,
687703 &self.previous,
......@@ -857,11 +873,11 @@ impl GraphEncoder {
857873 pub(crate) fn send_new(
858874 &self,
859875 node: DepNode,
860 fingerprint: Fingerprint,
876 value_fingerprint: Fingerprint,
861877 edges: EdgesVec,
862878 ) -> DepNodeIndex {
863879 let _prof_timer = self.profiler.generic_activity("incr_comp_encode_dep_graph");
864 let node = NodeInfo { node, fingerprint, edges };
880 let node = NodeInfo { node, value_fingerprint, edges };
865881 let mut local = self.status.local.borrow_mut();
866882 let index = self.status.next_index(&mut *local);
867883 self.status.bump_index(&mut *local);
......@@ -877,12 +893,12 @@ impl GraphEncoder {
877893 prev_index: SerializedDepNodeIndex,
878894 colors: &DepNodeColorMap,
879895 node: DepNode,
880 fingerprint: Fingerprint,
896 value_fingerprint: Fingerprint,
881897 edges: EdgesVec,
882898 is_green: bool,
883899 ) -> DepNodeIndex {
884900 let _prof_timer = self.profiler.generic_activity("incr_comp_encode_dep_graph");
885 let node = NodeInfo { node, fingerprint, edges };
901 let node = NodeInfo { node, value_fingerprint, edges };
886902
887903 let mut local = self.status.local.borrow_mut();
888904
compiler/rustc_middle/src/mir/pretty.rs-4
......@@ -1237,10 +1237,6 @@ impl<'tcx> Debug for Rvalue<'tcx> {
12371237 }
12381238 }
12391239
1240 ShallowInitBox(ref place, ref ty) => {
1241 with_no_trimmed_paths!(write!(fmt, "ShallowInitBox({place:?}, {ty})"))
1242 }
1243
12441240 WrapUnsafeBinder(ref op, ty) => {
12451241 with_no_trimmed_paths!(write!(fmt, "wrap_binder!({op:?}; {ty})"))
12461242 }
compiler/rustc_middle/src/mir/statement.rs-17
......@@ -747,11 +747,6 @@ impl<'tcx> ConstOperand<'tcx> {
747747///////////////////////////////////////////////////////////////////////////
748748// Rvalues
749749
750pub enum RvalueInitializationState {
751 Shallow,
752 Deep,
753}
754
755750impl<'tcx> Rvalue<'tcx> {
756751 /// Returns true if rvalue can be safely removed when the result is unused.
757752 #[inline]
......@@ -786,7 +781,6 @@ impl<'tcx> Rvalue<'tcx> {
786781 | Rvalue::UnaryOp(_, _)
787782 | Rvalue::Discriminant(_)
788783 | Rvalue::Aggregate(_, _)
789 | Rvalue::ShallowInitBox(_, _)
790784 | Rvalue::WrapUnsafeBinder(_, _) => true,
791785 }
792786 }
......@@ -833,21 +827,10 @@ impl<'tcx> Rvalue<'tcx> {
833827 }
834828 AggregateKind::RawPtr(ty, mutability) => Ty::new_ptr(tcx, ty, mutability),
835829 },
836 Rvalue::ShallowInitBox(_, ty) => Ty::new_box(tcx, ty),
837830 Rvalue::CopyForDeref(ref place) => place.ty(local_decls, tcx).ty,
838831 Rvalue::WrapUnsafeBinder(_, ty) => ty,
839832 }
840833 }
841
842 #[inline]
843 /// Returns `true` if this rvalue is deeply initialized (most rvalues) or
844 /// whether its only shallowly initialized (`Rvalue::Box`).
845 pub fn initialization_state(&self) -> RvalueInitializationState {
846 match *self {
847 Rvalue::ShallowInitBox(_, _) => RvalueInitializationState::Shallow,
848 _ => RvalueInitializationState::Deep,
849 }
850 }
851834}
852835
853836impl BorrowKind {
compiler/rustc_middle/src/mir/syntax.rs-7
......@@ -1458,13 +1458,6 @@ pub enum Rvalue<'tcx> {
14581458 /// coroutine lowering, `Coroutine` aggregate kinds are disallowed too.
14591459 Aggregate(Box<AggregateKind<'tcx>>, IndexVec<FieldIdx, Operand<'tcx>>),
14601460
1461 /// Transmutes a `*mut u8` into shallow-initialized `Box<T>`.
1462 ///
1463 /// This is different from a normal transmute because dataflow analysis will treat the box as
1464 /// initialized but its content as uninitialized. Like other pointer casts, this in general
1465 /// affects alias analysis.
1466 ShallowInitBox(Operand<'tcx>, Ty<'tcx>),
1467
14681461 /// A CopyForDeref is equivalent to a read from a place at the
14691462 /// codegen level, but is treated specially by drop elaboration. When such a read happens, it
14701463 /// is guaranteed (via nature of the mir_opt `Derefer` in rustc_mir_transform/src/deref_separator)
compiler/rustc_middle/src/mir/visit.rs-5
......@@ -810,11 +810,6 @@ macro_rules! make_mir_visitor {
810810 }
811811 }
812812
813 Rvalue::ShallowInitBox(operand, ty) => {
814 self.visit_operand(operand, location);
815 self.visit_ty($(& $mutability)? *ty, TyContext::Location(location));
816 }
817
818813 Rvalue::WrapUnsafeBinder(op, ty) => {
819814 self.visit_operand(op, location);
820815 self.visit_ty($(& $mutability)? *ty, TyContext::Location(location));
compiler/rustc_middle/src/query/caches.rs+1-1
......@@ -67,7 +67,7 @@ where
6767 #[inline]
6868 fn complete(&self, key: K, value: V, index: DepNodeIndex) {
6969 // We may be overwriting another value. This is all right, since the dep-graph
70 // will check that the fingerprint matches.
70 // will check that the value fingerprint matches.
7171 self.cache.insert(key, (value, index));
7272 }
7373
compiler/rustc_middle/src/verify_ich.rs+1-1
......@@ -25,7 +25,7 @@ pub fn incremental_verify_ich<'tcx, V>(
2525 tcx.with_stable_hashing_context(|mut hcx| f(&mut hcx, result))
2626 });
2727
28 let old_hash = dep_graph_data.prev_fingerprint_of(prev_index);
28 let old_hash = dep_graph_data.prev_value_fingerprint_of(prev_index);
2929
3030 if new_hash != old_hash {
3131 incremental_verify_ich_failed(tcx, prev_index, &|| format_value(result));
compiler/rustc_mir_dataflow/src/impls/borrowed_locals.rs-1
......@@ -86,7 +86,6 @@ where
8686
8787 Rvalue::Cast(..)
8888 | Rvalue::Ref(_, BorrowKind::Fake(_), _)
89 | Rvalue::ShallowInitBox(..)
9089 | Rvalue::Use(..)
9190 | Rvalue::ThreadLocalRef(..)
9291 | Rvalue::Repeat(..)
compiler/rustc_mir_dataflow/src/move_paths/builder.rs+1-10
......@@ -391,15 +391,7 @@ impl<'a, 'tcx, F: Fn(Ty<'tcx>) -> bool> MoveDataBuilder<'a, 'tcx, F> {
391391 }
392392 StatementKind::Assign(box (place, rval)) => {
393393 self.create_move_path(*place);
394 if let RvalueInitializationState::Shallow = rval.initialization_state() {
395 // Box starts out uninitialized - need to create a separate
396 // move-path for the interior so it will be separate from
397 // the exterior.
398 self.create_move_path(self.tcx.mk_place_deref(*place));
399 self.gather_init(place.as_ref(), InitKind::Shallow);
400 } else {
401 self.gather_init(place.as_ref(), InitKind::Deep);
402 }
394 self.gather_init(place.as_ref(), InitKind::Deep);
403395 self.gather_rvalue(rval);
404396 }
405397 StatementKind::FakeRead(box (_, place)) => {
......@@ -435,7 +427,6 @@ impl<'a, 'tcx, F: Fn(Ty<'tcx>) -> bool> MoveDataBuilder<'a, 'tcx, F> {
435427 Rvalue::Use(ref operand)
436428 | Rvalue::Repeat(ref operand, _)
437429 | Rvalue::Cast(_, ref operand, _)
438 | Rvalue::ShallowInitBox(ref operand, _)
439430 | Rvalue::UnaryOp(_, ref operand)
440431 | Rvalue::WrapUnsafeBinder(ref operand, _) => self.gather_operand(operand),
441432 Rvalue::BinaryOp(ref _binop, box (ref lhs, ref rhs)) => {
compiler/rustc_mir_transform/src/dataflow_const_prop.rs-1
......@@ -467,7 +467,6 @@ impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> {
467467 Rvalue::Discriminant(place) => state.get_discr(place.as_ref(), &self.map),
468468 Rvalue::Use(operand) => return self.handle_operand(operand, state),
469469 Rvalue::CopyForDeref(_) => bug!("`CopyForDeref` in runtime MIR"),
470 Rvalue::ShallowInitBox(..) => bug!("`ShallowInitBox` in runtime MIR"),
471470 Rvalue::Ref(..) | Rvalue::RawPtr(..) => {
472471 // We don't track such places.
473472 return ValueOrPlace::TOP;
compiler/rustc_mir_transform/src/elaborate_box_derefs.rs+1-67
......@@ -1,12 +1,8 @@
11//! This pass transforms derefs of Box into a deref of the pointer inside Box.
22//!
33//! Box is not actually a pointer so it is incorrect to dereference it directly.
4//!
5//! `ShallowInitBox` being a device for drop elaboration to understand deferred assignment to box
6//! contents, we do not need this any more on runtime MIR.
74
8use rustc_abi::{FieldIdx, VariantIdx};
9use rustc_index::{IndexVec, indexvec};
5use rustc_abi::FieldIdx;
106use rustc_middle::mir::visit::MutVisitor;
117use rustc_middle::mir::*;
128use rustc_middle::span_bug;
......@@ -89,68 +85,6 @@ impl<'a, 'tcx> MutVisitor<'tcx> for ElaborateBoxDerefVisitor<'a, 'tcx> {
8985
9086 self.super_place(place, context, location);
9187 }
92
93 fn visit_statement(&mut self, stmt: &mut Statement<'tcx>, location: Location) {
94 self.super_statement(stmt, location);
95
96 let tcx = self.tcx;
97 let source_info = stmt.source_info;
98
99 if let StatementKind::Assign(box (_, ref mut rvalue)) = stmt.kind
100 && let Rvalue::ShallowInitBox(ref mut mutptr_to_u8, pointee) = *rvalue
101 && let ty::Adt(box_adt, box_args) = Ty::new_box(tcx, pointee).kind()
102 {
103 let args = tcx.mk_args(&[pointee.into()]);
104 let (unique_ty, nonnull_ty, ptr_ty) =
105 build_ptr_tys(tcx, pointee, self.unique_def, self.nonnull_def);
106 let adt_kind = |def: ty::AdtDef<'tcx>, args| {
107 Box::new(AggregateKind::Adt(def.did(), VariantIdx::ZERO, args, None, None))
108 };
109 let zst = |ty| {
110 Operand::Constant(Box::new(ConstOperand {
111 span: source_info.span,
112 user_ty: None,
113 const_: Const::zero_sized(ty),
114 }))
115 };
116
117 let constptr = self.patch.new_temp(ptr_ty, source_info.span);
118 self.patch.add_assign(
119 location,
120 constptr.into(),
121 Rvalue::Cast(CastKind::Transmute, mutptr_to_u8.clone(), ptr_ty),
122 );
123
124 let nonnull = self.patch.new_temp(nonnull_ty, source_info.span);
125 self.patch.add_assign(
126 location,
127 nonnull.into(),
128 Rvalue::Aggregate(
129 adt_kind(self.nonnull_def, args),
130 indexvec![Operand::Move(constptr.into())],
131 ),
132 );
133
134 let unique = self.patch.new_temp(unique_ty, source_info.span);
135 let phantomdata_ty =
136 self.unique_def.non_enum_variant().fields[FieldIdx::ONE].ty(tcx, args);
137 self.patch.add_assign(
138 location,
139 unique.into(),
140 Rvalue::Aggregate(
141 adt_kind(self.unique_def, args),
142 indexvec![Operand::Move(nonnull.into()), zst(phantomdata_ty)],
143 ),
144 );
145
146 let global_alloc_ty =
147 box_adt.non_enum_variant().fields[FieldIdx::ONE].ty(tcx, box_args);
148 *rvalue = Rvalue::Aggregate(
149 adt_kind(*box_adt, box_args),
150 indexvec![Operand::Move(unique.into()), zst(global_alloc_ty)],
151 );
152 }
153 }
15488}
15589
15690pub(super) struct ElaborateBoxDerefs;
compiler/rustc_mir_transform/src/gvn.rs+1-1
......@@ -1069,7 +1069,7 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> {
10691069
10701070 // Unsupported values.
10711071 Rvalue::ThreadLocalRef(..) => return None,
1072 Rvalue::CopyForDeref(_) | Rvalue::ShallowInitBox(..) => {
1072 Rvalue::CopyForDeref(_) => {
10731073 bug!("forbidden in runtime MIR: {rvalue:?}")
10741074 }
10751075 };
compiler/rustc_mir_transform/src/known_panics_lint.rs-3
......@@ -443,7 +443,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
443443 | Rvalue::CopyForDeref(..)
444444 | Rvalue::Repeat(..)
445445 | Rvalue::Cast(..)
446 | Rvalue::ShallowInitBox(..)
447446 | Rvalue::Discriminant(..)
448447 | Rvalue::WrapUnsafeBinder(..) => {}
449448 }
......@@ -605,8 +604,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
605604
606605 Ref(..) | RawPtr(..) => return None,
607606
608 ShallowInitBox(..) => return None,
609
610607 Cast(ref kind, ref value, to) => match kind {
611608 CastKind::IntToInt | CastKind::IntToFloat => {
612609 let value = self.eval_operand(value)?;
compiler/rustc_mir_transform/src/lint.rs-1
......@@ -85,7 +85,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Lint<'a, 'tcx> {
8585 | Rvalue::Repeat(..)
8686 | Rvalue::Aggregate(..)
8787 | Rvalue::Cast(..)
88 | Rvalue::ShallowInitBox(..)
8988 | Rvalue::WrapUnsafeBinder(..) => true,
9089 Rvalue::ThreadLocalRef(..)
9190 | Rvalue::UnaryOp(..)
compiler/rustc_mir_transform/src/pass_manager.rs+57
......@@ -1,5 +1,6 @@
11use std::cell::RefCell;
22use std::collections::hash_map::Entry;
3use std::sync::atomic::Ordering;
34
45use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
56use rustc_middle::mir::{Body, MirDumper, MirPhase, RuntimePhase};
......@@ -285,6 +286,19 @@ fn run_passes_inner<'tcx>(
285286 continue;
286287 };
287288
289 if is_optimization_stage(body, phase_change, optimizations)
290 && let Some(limit) = &tcx.sess.opts.unstable_opts.mir_opt_bisect_limit
291 {
292 if limited_by_opt_bisect(
293 tcx,
294 tcx.def_path_debug_str(body.source.def_id()),
295 *limit,
296 *pass,
297 ) {
298 continue;
299 }
300 }
301
288302 let dumper = if pass.is_mir_dump_enabled()
289303 && let Some(dumper) = MirDumper::new(tcx, pass_name, body)
290304 {
......@@ -356,3 +370,46 @@ pub(super) fn dump_mir_for_phase_change<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tc
356370 dumper.set_show_pass_num().set_disambiguator(&"after").dump_mir(body)
357371 }
358372}
373
374fn is_optimization_stage(
375 body: &Body<'_>,
376 phase_change: Option<MirPhase>,
377 optimizations: Optimizations,
378) -> bool {
379 optimizations == Optimizations::Allowed
380 && body.phase == MirPhase::Runtime(RuntimePhase::PostCleanup)
381 && phase_change == Some(MirPhase::Runtime(RuntimePhase::Optimized))
382}
383
384fn limited_by_opt_bisect<'tcx, P>(
385 tcx: TyCtxt<'tcx>,
386 def_path: String,
387 limit: usize,
388 pass: &P,
389) -> bool
390where
391 P: MirPass<'tcx> + ?Sized,
392{
393 let current_opt_bisect_count =
394 tcx.sess.mir_opt_bisect_eval_count.fetch_add(1, Ordering::Relaxed);
395
396 let can_run = current_opt_bisect_count < limit;
397
398 if can_run {
399 eprintln!(
400 "BISECT: running pass ({}) {} on {}",
401 current_opt_bisect_count + 1,
402 pass.name(),
403 def_path
404 );
405 } else {
406 eprintln!(
407 "BISECT: NOT running pass ({}) {} on {}",
408 current_opt_bisect_count + 1,
409 pass.name(),
410 def_path
411 );
412 }
413
414 !can_run
415}
compiler/rustc_mir_transform/src/promote_consts.rs-2
......@@ -449,8 +449,6 @@ impl<'tcx> Validator<'_, 'tcx> {
449449 self.validate_operand(operand)?;
450450 }
451451
452 Rvalue::ShallowInitBox(_, _) => return Err(Unpromotable),
453
454452 Rvalue::UnaryOp(op, operand) => {
455453 match op {
456454 // These operations can never fail.
compiler/rustc_mir_transform/src/single_use_consts.rs+1-1
......@@ -85,7 +85,7 @@ impl<'tcx> crate::MirPass<'tcx> for SingleUseConsts {
8585 }
8686
8787 fn is_required(&self) -> bool {
88 true
88 false
8989 }
9090}
9191
compiler/rustc_mir_transform/src/validate.rs-8
......@@ -1259,14 +1259,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
12591259 }
12601260 }
12611261 }
1262 Rvalue::ShallowInitBox(operand, _) => {
1263 if self.body.phase >= MirPhase::Runtime(RuntimePhase::Initial) {
1264 self.fail(location, format!("ShallowInitBox after ElaborateBoxDerefs"))
1265 }
1266
1267 let a = operand.ty(&self.body.local_decls, self.tcx);
1268 check_kinds!(a, "Cannot shallow init type {:?}", ty::RawPtr(..));
1269 }
12701262 Rvalue::Cast(kind, operand, target_type) => {
12711263 let op_ty = operand.ty(self.body, self.tcx);
12721264 match kind {
compiler/rustc_public/src/mir/body.rs-8
......@@ -567,13 +567,6 @@ pub enum Rvalue {
567567 /// [#74836]: https://github.com/rust-lang/rust/issues/74836
568568 Repeat(Operand, TyConst),
569569
570 /// Transmutes a `*mut u8` into shallow-initialized `Box<T>`.
571 ///
572 /// This is different from a normal transmute because dataflow analysis will treat the box as
573 /// initialized but its content as uninitialized. Like other pointer casts, this in general
574 /// affects alias analysis.
575 ShallowInitBox(Operand, Ty),
576
577570 /// Creates a pointer/reference to the given thread local.
578571 ///
579572 /// 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 {
651644 }
652645 AggregateKind::RawPtr(ty, mutability) => Ok(Ty::new_ptr(ty, mutability)),
653646 },
654 Rvalue::ShallowInitBox(_, ty) => Ok(Ty::new_box(*ty)),
655647 Rvalue::CopyForDeref(place) => place.ty(locals),
656648 }
657649 }
compiler/rustc_public/src/mir/pretty.rs-1
......@@ -383,7 +383,6 @@ fn pretty_rvalue<W: Write>(writer: &mut W, rval: &Rvalue) -> io::Result<()> {
383383 Rvalue::Repeat(op, cnst) => {
384384 write!(writer, "[{}; {}]", pretty_operand(op), pretty_ty_const(cnst))
385385 }
386 Rvalue::ShallowInitBox(_, _) => Ok(()),
387386 Rvalue::ThreadLocalRef(item) => {
388387 write!(writer, "thread_local_ref{item:?}")
389388 }
compiler/rustc_public/src/mir/visit.rs-4
......@@ -277,10 +277,6 @@ macro_rules! make_mir_visitor {
277277 self.visit_operand(op, location);
278278 self.visit_ty_const(constant, location);
279279 }
280 Rvalue::ShallowInitBox(op, ty) => {
281 self.visit_ty(ty, location);
282 self.visit_operand(op, location)
283 }
284280 Rvalue::ThreadLocalRef(_) => {}
285281 Rvalue::UnaryOp(_, op) | Rvalue::Use(op) => {
286282 self.visit_operand(op, location);
compiler/rustc_public/src/unstable/convert/stable/mir.rs-3
......@@ -240,9 +240,6 @@ impl<'tcx> Stable<'tcx> for mir::Rvalue<'tcx> {
240240 let operands = operands.iter().map(|op| op.stable(tables, cx)).collect();
241241 crate::mir::Rvalue::Aggregate(agg_kind.stable(tables, cx), operands)
242242 }
243 ShallowInitBox(op, ty) => {
244 crate::mir::Rvalue::ShallowInitBox(op.stable(tables, cx), ty.stable(tables, cx))
245 }
246243 CopyForDeref(place) => crate::mir::Rvalue::CopyForDeref(place.stable(tables, cx)),
247244 WrapUnsafeBinder(..) => todo!("FIXME(unsafe_binders):"),
248245 }
compiler/rustc_query_impl/src/dep_kind_vtables.rs+15-15
......@@ -1,5 +1,5 @@
11use rustc_middle::bug;
2use rustc_middle::dep_graph::{DepKindVTable, DepNodeKey, FingerprintStyle};
2use rustc_middle::dep_graph::{DepKindVTable, DepNodeKey, KeyFingerprintStyle};
33use rustc_middle::query::QueryCache;
44
55use crate::plumbing::{force_from_dep_node_inner, try_load_from_on_disk_cache_inner};
......@@ -15,7 +15,7 @@ mod non_query {
1515 DepKindVTable {
1616 is_anon: false,
1717 is_eval_always: false,
18 fingerprint_style: FingerprintStyle::Unit,
18 key_fingerprint_style: KeyFingerprintStyle::Unit,
1919 force_from_dep_node: Some(|_, dep_node, _| {
2020 bug!("force_from_dep_node: encountered {dep_node:?}")
2121 }),
......@@ -29,7 +29,7 @@ mod non_query {
2929 DepKindVTable {
3030 is_anon: false,
3131 is_eval_always: false,
32 fingerprint_style: FingerprintStyle::Unit,
32 key_fingerprint_style: KeyFingerprintStyle::Unit,
3333 force_from_dep_node: Some(|_, dep_node, _| {
3434 bug!("force_from_dep_node: encountered {dep_node:?}")
3535 }),
......@@ -42,7 +42,7 @@ mod non_query {
4242 DepKindVTable {
4343 is_anon: false,
4444 is_eval_always: false,
45 fingerprint_style: FingerprintStyle::Unit,
45 key_fingerprint_style: KeyFingerprintStyle::Unit,
4646 force_from_dep_node: Some(|tcx, _, prev_index| {
4747 tcx.dep_graph.force_diagnostic_node(tcx, prev_index);
4848 true
......@@ -56,7 +56,7 @@ mod non_query {
5656 DepKindVTable {
5757 is_anon: true,
5858 is_eval_always: false,
59 fingerprint_style: FingerprintStyle::Opaque,
59 key_fingerprint_style: KeyFingerprintStyle::Opaque,
6060 force_from_dep_node: Some(|_, _, _| bug!("cannot force an anon node")),
6161 try_load_from_on_disk_cache: None,
6262 name: &"AnonZeroDeps",
......@@ -67,7 +67,7 @@ mod non_query {
6767 DepKindVTable {
6868 is_anon: true,
6969 is_eval_always: false,
70 fingerprint_style: FingerprintStyle::Unit,
70 key_fingerprint_style: KeyFingerprintStyle::Unit,
7171 force_from_dep_node: None,
7272 try_load_from_on_disk_cache: None,
7373 name: &"TraitSelect",
......@@ -78,7 +78,7 @@ mod non_query {
7878 DepKindVTable {
7979 is_anon: false,
8080 is_eval_always: false,
81 fingerprint_style: FingerprintStyle::Opaque,
81 key_fingerprint_style: KeyFingerprintStyle::Opaque,
8282 force_from_dep_node: None,
8383 try_load_from_on_disk_cache: None,
8484 name: &"CompileCodegenUnit",
......@@ -89,7 +89,7 @@ mod non_query {
8989 DepKindVTable {
9090 is_anon: false,
9191 is_eval_always: false,
92 fingerprint_style: FingerprintStyle::Opaque,
92 key_fingerprint_style: KeyFingerprintStyle::Opaque,
9393 force_from_dep_node: None,
9494 try_load_from_on_disk_cache: None,
9595 name: &"CompileMonoItem",
......@@ -100,7 +100,7 @@ mod non_query {
100100 DepKindVTable {
101101 is_anon: false,
102102 is_eval_always: false,
103 fingerprint_style: FingerprintStyle::Unit,
103 key_fingerprint_style: KeyFingerprintStyle::Unit,
104104 force_from_dep_node: None,
105105 try_load_from_on_disk_cache: None,
106106 name: &"Metadata",
......@@ -118,17 +118,17 @@ where
118118 Cache: QueryCache + 'tcx,
119119{
120120 let is_anon = FLAGS.is_anon;
121 let fingerprint_style = if is_anon {
122 FingerprintStyle::Opaque
121 let key_fingerprint_style = if is_anon {
122 KeyFingerprintStyle::Opaque
123123 } else {
124 <Cache::Key as DepNodeKey<'tcx>>::fingerprint_style()
124 <Cache::Key as DepNodeKey<'tcx>>::key_fingerprint_style()
125125 };
126126
127 if is_anon || !fingerprint_style.reconstructible() {
127 if is_anon || !key_fingerprint_style.reconstructible() {
128128 return DepKindVTable {
129129 is_anon,
130130 is_eval_always,
131 fingerprint_style,
131 key_fingerprint_style,
132132 force_from_dep_node: None,
133133 try_load_from_on_disk_cache: None,
134134 name: Q::NAME,
......@@ -138,7 +138,7 @@ where
138138 DepKindVTable {
139139 is_anon,
140140 is_eval_always,
141 fingerprint_style,
141 key_fingerprint_style,
142142 force_from_dep_node: Some(|tcx, dep_node, _| {
143143 force_from_dep_node_inner(Q::query_dispatcher(tcx), tcx, dep_node)
144144 }),
compiler/rustc_query_impl/src/execution.rs+2-2
......@@ -509,7 +509,7 @@ fn try_load_from_disk_and_cache_in_memory<'tcx, C: QueryCache, const FLAGS: Quer
509509 dep_graph_data.mark_debug_loaded_from_disk(*dep_node)
510510 }
511511
512 let prev_fingerprint = dep_graph_data.prev_fingerprint_of(prev_dep_node_index);
512 let prev_fingerprint = dep_graph_data.prev_value_fingerprint_of(prev_dep_node_index);
513513 // If `-Zincremental-verify-ich` is specified, re-hash results from
514514 // the cache and make sure that they have the expected fingerprint.
515515 //
......@@ -538,7 +538,7 @@ fn try_load_from_disk_and_cache_in_memory<'tcx, C: QueryCache, const FLAGS: Quer
538538 // can be forced from `DepNode`.
539539 debug_assert!(
540540 !query.will_cache_on_disk_for_key(tcx, key)
541 || !tcx.fingerprint_style(dep_node.kind).reconstructible(),
541 || !tcx.key_fingerprint_style(dep_node.kind).reconstructible(),
542542 "missing on-disk cache entry for {dep_node:?}"
543543 );
544544
compiler/rustc_query_impl/src/plumbing.rs+6-3
......@@ -396,8 +396,11 @@ pub(crate) fn try_load_from_on_disk_cache_inner<'tcx, C: QueryCache, const FLAGS
396396) {
397397 debug_assert!(tcx.dep_graph.is_green(&dep_node));
398398
399 let key = C::Key::recover(tcx, &dep_node).unwrap_or_else(|| {
400 panic!("Failed to recover key for {:?} with hash {}", dep_node, dep_node.hash)
399 let key = C::Key::try_recover_key(tcx, &dep_node).unwrap_or_else(|| {
400 panic!(
401 "Failed to recover key for {dep_node:?} with key fingerprint {}",
402 dep_node.key_fingerprint
403 )
401404 });
402405 if query.will_cache_on_disk_for_key(tcx, &key) {
403406 // 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
462465 "calling force_from_dep_node() on dep_kinds::codegen_unit"
463466 );
464467
465 if let Some(key) = C::Key::recover(tcx, &dep_node) {
468 if let Some(key) = C::Key::try_recover_key(tcx, &dep_node) {
466469 force_query(query, tcx, key, dep_node);
467470 true
468471 } else {
compiler/rustc_resolve/src/build_reduced_graph.rs+9-3
......@@ -469,9 +469,15 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
469469 PathResult::NonModule(partial_res) => {
470470 expected_found_error(partial_res.expect_full_res())
471471 }
472 PathResult::Failed { span, label, suggestion, .. } => {
473 Err(VisResolutionError::FailedToResolve(span, label, suggestion))
474 }
472 PathResult::Failed {
473 span, label, suggestion, message, segment_name, ..
474 } => Err(VisResolutionError::FailedToResolve(
475 span,
476 segment_name,
477 label,
478 suggestion,
479 message,
480 )),
475481 PathResult::Indeterminate => Err(VisResolutionError::Indeterminate(path.span)),
476482 }
477483 }
compiler/rustc_resolve/src/diagnostics.rs+76-36
......@@ -32,7 +32,7 @@ use rustc_span::edit_distance::find_best_match_for_name;
3232use rustc_span::edition::Edition;
3333use rustc_span::hygiene::MacroKind;
3434use rustc_span::source_map::{SourceMap, Spanned};
35use rustc_span::{BytePos, Ident, Span, Symbol, SyntaxContext, kw, sym};
35use rustc_span::{BytePos, Ident, RemapPathScopeComponents, Span, Symbol, SyntaxContext, kw, sym};
3636use thin_vec::{ThinVec, thin_vec};
3737use tracing::{debug, instrument};
3838
......@@ -899,9 +899,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
899899 ResolutionError::SelfImportOnlyInImportListWithNonEmptyPrefix => {
900900 self.dcx().create_err(errs::SelfImportOnlyInImportListWithNonEmptyPrefix { span })
901901 }
902 ResolutionError::FailedToResolve { segment, label, suggestion, module } => {
903 let mut err =
904 struct_span_code_err!(self.dcx(), span, E0433, "failed to resolve: {label}");
902 ResolutionError::FailedToResolve { segment, label, suggestion, module, message } => {
903 let mut err = struct_span_code_err!(self.dcx(), span, E0433, "{message}");
905904 err.span_label(span, label);
906905
907906 if let Some((suggestions, msg, applicability)) = suggestion {
......@@ -909,16 +908,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
909908 err.help(msg);
910909 return err;
911910 }
912 err.multipart_suggestion(msg, suggestions, applicability);
911 err.multipart_suggestion_verbose(msg, suggestions, applicability);
913912 }
914913
915 if let Some(segment) = segment {
916 let module = match module {
917 Some(ModuleOrUniformRoot::Module(m)) if let Some(id) = m.opt_def_id() => id,
918 _ => CRATE_DEF_ID.to_def_id(),
919 };
920 self.find_cfg_stripped(&mut err, &segment, module);
921 }
914 let module = match module {
915 Some(ModuleOrUniformRoot::Module(m)) if let Some(id) = m.opt_def_id() => id,
916 _ => CRATE_DEF_ID.to_def_id(),
917 };
918 self.find_cfg_stripped(&mut err, &segment, module);
922919
923920 err
924921 }
......@@ -1108,10 +1105,17 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
11081105 VisResolutionError::AncestorOnly(span) => {
11091106 self.dcx().create_err(errs::AncestorOnly(span))
11101107 }
1111 VisResolutionError::FailedToResolve(span, label, suggestion) => self.into_struct_error(
1112 span,
1113 ResolutionError::FailedToResolve { segment: None, label, suggestion, module: None },
1114 ),
1108 VisResolutionError::FailedToResolve(span, segment, label, suggestion, message) => self
1109 .into_struct_error(
1110 span,
1111 ResolutionError::FailedToResolve {
1112 segment,
1113 label,
1114 suggestion,
1115 module: None,
1116 message,
1117 },
1118 ),
11151119 VisResolutionError::ExpectedFound(span, path_str, res) => {
11161120 self.dcx().create_err(errs::ExpectedModuleFound { span, res, path_str })
11171121 }
......@@ -2438,13 +2442,25 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
24382442 failed_segment_idx: usize,
24392443 ident: Ident,
24402444 diag_metadata: Option<&DiagMetadata<'_>>,
2441 ) -> (String, Option<Suggestion>) {
2445 ) -> (String, String, Option<Suggestion>) {
24422446 let is_last = failed_segment_idx == path.len() - 1;
24432447 let ns = if is_last { opt_ns.unwrap_or(TypeNS) } else { TypeNS };
24442448 let module_res = match module {
24452449 Some(ModuleOrUniformRoot::Module(module)) => module.res(),
24462450 _ => None,
24472451 };
2452 let scope = match &path[..failed_segment_idx] {
2453 [.., prev] => {
2454 if prev.ident.name == kw::PathRoot {
2455 format!("the crate root")
2456 } else {
2457 format!("`{}`", prev.ident)
2458 }
2459 }
2460 _ => format!("this scope"),
2461 };
2462 let message = format!("cannot find `{ident}` in {scope}");
2463
24482464 if module_res == self.graph_root.res() {
24492465 let is_mod = |res| matches!(res, Res::Def(DefKind::Mod, _));
24502466 let mut candidates = self.lookup_import_candidates(ident, TypeNS, parent_scope, is_mod);
......@@ -2462,6 +2478,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
24622478 Path { segments, span: Span::default(), tokens: None }
24632479 };
24642480 (
2481 message,
24652482 String::from("unresolved import"),
24662483 Some((
24672484 vec![(ident.span, pprust::path_to_string(&path))],
......@@ -2471,6 +2488,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
24712488 )
24722489 } else if ident.name == sym::core {
24732490 (
2491 message,
24742492 format!("you might be missing crate `{ident}`"),
24752493 Some((
24762494 vec![(ident.span, "std".to_string())],
......@@ -2479,9 +2497,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
24792497 )),
24802498 )
24812499 } else if ident.name == kw::Underscore {
2482 (format!("`_` is not a valid crate or module name"), None)
2500 (
2501 "invalid crate or module name `_`".to_string(),
2502 "`_` is not a valid crate or module name".to_string(),
2503 None,
2504 )
24832505 } else if self.tcx.sess.is_rust_2015() {
24842506 (
2507 format!("cannot find module or crate `{ident}` in {scope}"),
24852508 format!("use of unresolved module or unlinked crate `{ident}`"),
24862509 Some((
24872510 vec![(
......@@ -2490,8 +2513,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
24902513 )],
24912514 if was_invoked_from_cargo() {
24922515 format!(
2493 "if you wanted to use a crate named `{ident}`, use `cargo add {ident}` \
2494 to add it to your `Cargo.toml` and import it in your code",
2516 "if you wanted to use a crate named `{ident}`, use `cargo add \
2517 {ident}` to add it to your `Cargo.toml` and import it in your \
2518 code",
24952519 )
24962520 } else {
24972521 format!(
......@@ -2503,7 +2527,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
25032527 )),
25042528 )
25052529 } else {
2506 (format!("could not find `{ident}` in the crate root"), None)
2530 (message, format!("could not find `{ident}` in the crate root"), None)
25072531 }
25082532 } else if failed_segment_idx > 0 {
25092533 let parent = path[failed_segment_idx - 1].ident.name;
......@@ -2569,15 +2593,16 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
25692593 );
25702594 };
25712595 }
2572 (msg, None)
2596 (message, msg, None)
25732597 } else if ident.name == kw::SelfUpper {
25742598 // As mentioned above, `opt_ns` being `None` indicates a module path in import.
25752599 // We can use this to improve a confusing error for, e.g. `use Self::Variant` in an
25762600 // impl
25772601 if opt_ns.is_none() {
2578 ("`Self` cannot be used in imports".to_string(), None)
2602 (message, "`Self` cannot be used in imports".to_string(), None)
25792603 } else {
25802604 (
2605 message,
25812606 "`Self` is only available in impls, traits, and type definitions".to_string(),
25822607 None,
25832608 )
......@@ -2608,12 +2633,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
26082633 // }
26092634 // ```
26102635 Some(LateDecl::RibDef(Res::Local(id))) => {
2611 Some(*self.pat_span_map.get(&id).unwrap())
2636 Some((*self.pat_span_map.get(&id).unwrap(), "a", "local binding"))
26122637 }
26132638 // Name matches item from a local name binding
26142639 // created by `use` declaration. For example:
26152640 // ```
2616 // pub Foo: &str = "";
2641 // pub const Foo: &str = "";
26172642 //
26182643 // mod submod {
26192644 // use super::Foo;
......@@ -2621,18 +2646,27 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
26212646 // // binding `Foo`.
26222647 // }
26232648 // ```
2624 Some(LateDecl::Decl(name_binding)) => Some(name_binding.span),
2649 Some(LateDecl::Decl(name_binding)) => Some((
2650 name_binding.span,
2651 name_binding.res().article(),
2652 name_binding.res().descr(),
2653 )),
26252654 _ => None,
26262655 };
2627 let suggestion = match_span.map(|span| {
2628 (
2629 vec![(span, String::from(""))],
2630 format!("`{ident}` is defined here, but is not a type"),
2631 Applicability::MaybeIncorrect,
2632 )
2633 });
26342656
2635 (format!("use of undeclared type `{ident}`"), suggestion)
2657 let message = format!("cannot find type `{ident}` in {scope}");
2658 let label = if let Some((span, article, descr)) = match_span {
2659 format!(
2660 "`{ident}` is declared as {article} {descr} at `{}`, not a type",
2661 self.tcx
2662 .sess
2663 .source_map()
2664 .span_to_short_string(span, RemapPathScopeComponents::DIAGNOSTICS)
2665 )
2666 } else {
2667 format!("use of undeclared type `{ident}`")
2668 };
2669 (message, label, None)
26362670 } else {
26372671 let mut suggestion = None;
26382672 if ident.name == sym::alloc {
......@@ -2663,7 +2697,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
26632697 ignore_import,
26642698 ) {
26652699 let descr = binding.res().descr();
2666 (format!("{descr} `{ident}` is not a crate or module"), suggestion)
2700 let message = format!("cannot find module or crate `{ident}` in {scope}");
2701 (message, format!("{descr} `{ident}` is not a crate or module"), suggestion)
26672702 } else {
26682703 let suggestion = if suggestion.is_some() {
26692704 suggestion
......@@ -2685,7 +2720,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
26852720 Applicability::MaybeIncorrect,
26862721 ))
26872722 };
2688 (format!("use of unresolved module or unlinked crate `{ident}`"), suggestion)
2723 let message = format!("cannot find module or crate `{ident}` in {scope}");
2724 (
2725 message,
2726 format!("use of unresolved module or unlinked crate `{ident}`"),
2727 suggestion,
2728 )
26892729 }
26902730 }
26912731 }
compiler/rustc_resolve/src/ident.rs+34-7
......@@ -1775,7 +1775,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
17751775 finalize.is_some(),
17761776 module_had_parse_errors,
17771777 module,
1778 || ("there are too many leading `super` keywords".to_string(), None),
1778 || {
1779 (
1780 "too many leading `super` keywords".to_string(),
1781 "there are too many leading `super` keywords".to_string(),
1782 None,
1783 )
1784 },
17791785 );
17801786 }
17811787 if segment_idx == 0 {
......@@ -1823,16 +1829,24 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
18231829 module,
18241830 || {
18251831 let name_str = if name == kw::PathRoot {
1826 "crate root".to_string()
1832 "the crate root".to_string()
18271833 } else {
18281834 format!("`{name}`")
18291835 };
1830 let label = if segment_idx == 1 && path[0].ident.name == kw::PathRoot {
1831 format!("global paths cannot start with {name_str}")
1836 let (message, label) = if segment_idx == 1
1837 && path[0].ident.name == kw::PathRoot
1838 {
1839 (
1840 format!("global paths cannot start with {name_str}"),
1841 "cannot start with this".to_string(),
1842 )
18321843 } else {
1833 format!("{name_str} in paths can only be used in start position")
1844 (
1845 format!("{name_str} in paths can only be used in start position"),
1846 "can only be used in path start position".to_string(),
1847 )
18341848 };
1835 (label, None)
1849 (message, label, None)
18361850 },
18371851 );
18381852 }
......@@ -1948,7 +1962,20 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
19481962 res.article(),
19491963 res.descr()
19501964 );
1951 (label, None)
1965 let scope = match &path[..segment_idx] {
1966 [.., prev] => {
1967 if prev.ident.name == kw::PathRoot {
1968 format!("the crate root")
1969 } else {
1970 format!("`{}`", prev.ident)
1971 }
1972 }
1973 _ => format!("this scope"),
1974 };
1975 // FIXME: reword, as the reason we expected a module is because of
1976 // the following path segment.
1977 let message = format!("cannot find module `{ident}` in {scope}");
1978 (message, label, None)
19521979 },
19531980 );
19541981 }
compiler/rustc_resolve/src/imports.rs+7-2
......@@ -371,6 +371,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
371371 // - A glob decl is overwritten by its clone after setting ambiguity in it.
372372 // FIXME: avoid this by removing `warn_ambiguity`, or by triggering glob re-fetch
373373 // with the same decl in some way.
374 // - A glob decl is overwritten by a glob decl with larger visibility.
375 // FIXME: avoid this by updating this visibility in place.
374376 // - A glob decl is overwritten by a glob decl re-fetching an
375377 // overwritten decl from other module (the recursive case).
376378 // Here we are detecting all such re-fetches and overwrite old decls
......@@ -384,7 +386,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
384386 // FIXME: reenable the asserts when `warn_ambiguity` is removed (#149195).
385387 // assert_ne!(old_deep_decl, deep_decl);
386388 // assert!(old_deep_decl.is_glob_import());
387 assert!(!deep_decl.is_glob_import());
389 // FIXME: reenable the assert when visibility is updated in place.
390 // assert!(!deep_decl.is_glob_import());
388391 if old_glob_decl.ambiguity.get().is_some() && glob_decl.ambiguity.get().is_none() {
389392 // Do not lose glob ambiguities when re-fetching the glob.
390393 glob_decl.ambiguity.set_unchecked(old_glob_decl.ambiguity.get());
......@@ -1042,16 +1045,18 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
10421045 suggestion,
10431046 module,
10441047 error_implied_by_parse_error: _,
1048 message,
10451049 } => {
10461050 if no_ambiguity {
10471051 assert!(import.imported_module.get().is_none());
10481052 self.report_error(
10491053 span,
10501054 ResolutionError::FailedToResolve {
1051 segment: Some(segment_name),
1055 segment: segment_name,
10521056 label,
10531057 suggestion,
10541058 module,
1059 message,
10551060 },
10561061 );
10571062 }
compiler/rustc_resolve/src/late.rs+3-1
......@@ -4890,14 +4890,16 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
48904890 module,
48914891 segment_name,
48924892 error_implied_by_parse_error: _,
4893 message,
48934894 } => {
48944895 return Err(respan(
48954896 span,
48964897 ResolutionError::FailedToResolve {
4897 segment: Some(segment_name),
4898 segment: segment_name,
48984899 label,
48994900 suggestion,
49004901 module,
4902 message,
49014903 },
49024904 ));
49034905 }
compiler/rustc_resolve/src/late/diagnostics.rs+65-13
......@@ -4060,25 +4060,32 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
40604060 "instead, you are more likely to want"
40614061 };
40624062 let mut owned_sugg = lt.kind == MissingLifetimeKind::Ampersand;
4063 let mut sugg_is_str_to_string = false;
40634064 let mut sugg = vec![(lt.span, String::new())];
40644065 if let Some((kind, _span)) = self.diag_metadata.current_function
40654066 && let FnKind::Fn(_, _, ast::Fn { sig, .. }) = kind
4066 && let ast::FnRetTy::Ty(ty) = &sig.decl.output
40674067 {
40684068 let mut lt_finder =
40694069 LifetimeFinder { lifetime: lt.span, found: None, seen: vec![] };
4070 lt_finder.visit_ty(&ty);
4071
4072 if let [Ty { span, kind: TyKind::Ref(_, mut_ty), .. }] =
4073 &lt_finder.seen[..]
4074 {
4075 // We might have a situation like
4076 // fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()>
4077 // but `lt.span` only points at `'_`, so to suggest `-> Option<()>`
4078 // we need to find a more accurate span to end up with
4079 // fn g<'a>(mut x: impl Iterator<Item = &'_ ()>) -> Option<()>
4080 sugg = vec![(span.with_hi(mut_ty.ty.span.lo()), String::new())];
4081 owned_sugg = true;
4070 for param in &sig.decl.inputs {
4071 lt_finder.visit_ty(&param.ty);
4072 }
4073 if let ast::FnRetTy::Ty(ret_ty) = &sig.decl.output {
4074 lt_finder.visit_ty(ret_ty);
4075 let mut ret_lt_finder =
4076 LifetimeFinder { lifetime: lt.span, found: None, seen: vec![] };
4077 ret_lt_finder.visit_ty(ret_ty);
4078 if let [Ty { span, kind: TyKind::Ref(_, mut_ty), .. }] =
4079 &ret_lt_finder.seen[..]
4080 {
4081 // We might have a situation like
4082 // fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()>
4083 // but `lt.span` only points at `'_`, so to suggest `-> Option<()>`
4084 // we need to find a more accurate span to end up with
4085 // fn g<'a>(mut x: impl Iterator<Item = &'_ ()>) -> Option<()>
4086 sugg = vec![(span.with_hi(mut_ty.ty.span.lo()), String::new())];
4087 owned_sugg = true;
4088 }
40824089 }
40834090 if let Some(ty) = lt_finder.found {
40844091 if let TyKind::Path(None, path) = &ty.kind {
......@@ -4098,6 +4105,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
40984105 lt.span.with_hi(ty.span.hi()),
40994106 "String".to_string(),
41004107 )];
4108 sugg_is_str_to_string = true;
41014109 }
41024110 Some(Res::PrimTy(..)) => {}
41034111 Some(Res::Def(
......@@ -4124,6 +4132,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
41244132 lt.span.with_hi(ty.span.hi()),
41254133 "String".to_string(),
41264134 )];
4135 sugg_is_str_to_string = true;
41274136 }
41284137 Res::PrimTy(..) => {}
41294138 Res::Def(
......@@ -4158,6 +4167,12 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
41584167 }
41594168 }
41604169 if owned_sugg {
4170 if let Some(span) =
4171 self.find_ref_prefix_span_for_owned_suggestion(lt.span)
4172 && !sugg_is_str_to_string
4173 {
4174 sugg = vec![(span, String::new())];
4175 }
41614176 err.multipart_suggestion_verbose(
41624177 format!("{pre} to return an owned value"),
41634178 sugg,
......@@ -4184,6 +4199,23 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
41844199 }
41854200 }
41864201 }
4202
4203 fn find_ref_prefix_span_for_owned_suggestion(&self, lifetime: Span) -> Option<Span> {
4204 let mut finder = RefPrefixSpanFinder { lifetime, span: None };
4205 if let Some(item) = self.diag_metadata.current_item {
4206 finder.visit_item(item);
4207 } else if let Some((kind, _span)) = self.diag_metadata.current_function
4208 && let FnKind::Fn(_, _, ast::Fn { sig, .. }) = kind
4209 {
4210 for param in &sig.decl.inputs {
4211 finder.visit_ty(&param.ty);
4212 }
4213 if let ast::FnRetTy::Ty(ret_ty) = &sig.decl.output {
4214 finder.visit_ty(ret_ty);
4215 }
4216 }
4217 finder.span
4218 }
41874219}
41884220
41894221fn mk_where_bound_predicate(
......@@ -4285,6 +4317,26 @@ impl<'ast> Visitor<'ast> for LifetimeFinder<'ast> {
42854317 }
42864318}
42874319
4320struct RefPrefixSpanFinder {
4321 lifetime: Span,
4322 span: Option<Span>,
4323}
4324
4325impl<'ast> Visitor<'ast> for RefPrefixSpanFinder {
4326 fn visit_ty(&mut self, t: &'ast Ty) {
4327 if self.span.is_some() {
4328 return;
4329 }
4330 if let TyKind::Ref(_, mut_ty) | TyKind::PinnedRef(_, mut_ty) = &t.kind
4331 && t.span.lo() == self.lifetime.lo()
4332 {
4333 self.span = Some(t.span.with_hi(mut_ty.ty.span.lo()));
4334 return;
4335 }
4336 walk_ty(self, t);
4337 }
4338}
4339
42884340/// Shadowing involving a label is only a warning for historical reasons.
42894341//FIXME: make this a proper lint.
42904342pub(super) fn signal_label_shadowing(sess: &Session, orig: Span, shadower: Ident) {
compiler/rustc_resolve/src/lib.rs+12-5
......@@ -280,10 +280,11 @@ enum ResolutionError<'ra> {
280280 SelfImportOnlyInImportListWithNonEmptyPrefix,
281281 /// Error E0433: failed to resolve.
282282 FailedToResolve {
283 segment: Option<Symbol>,
283 segment: Symbol,
284284 label: String,
285285 suggestion: Option<Suggestion>,
286286 module: Option<ModuleOrUniformRoot<'ra>>,
287 message: String,
287288 },
288289 /// Error E0434: can't capture dynamic environment in a fn item.
289290 CannotCaptureDynamicEnvironmentInFnItem,
......@@ -342,7 +343,7 @@ enum ResolutionError<'ra> {
342343enum VisResolutionError<'a> {
343344 Relative2018(Span, &'a ast::Path),
344345 AncestorOnly(Span),
345 FailedToResolve(Span, String, Option<Suggestion>),
346 FailedToResolve(Span, Symbol, String, Option<Suggestion>, String),
346347 ExpectedFound(Span, String, Res),
347348 Indeterminate(Span),
348349 ModuleOnly(Span),
......@@ -486,6 +487,7 @@ enum PathResult<'ra> {
486487 /// The segment name of target
487488 segment_name: Symbol,
488489 error_implied_by_parse_error: bool,
490 message: String,
489491 },
490492}
491493
......@@ -496,10 +498,14 @@ impl<'ra> PathResult<'ra> {
496498 finalize: bool,
497499 error_implied_by_parse_error: bool,
498500 module: Option<ModuleOrUniformRoot<'ra>>,
499 label_and_suggestion: impl FnOnce() -> (String, Option<Suggestion>),
501 label_and_suggestion: impl FnOnce() -> (String, String, Option<Suggestion>),
500502 ) -> PathResult<'ra> {
501 let (label, suggestion) =
502 if finalize { label_and_suggestion() } else { (String::new(), None) };
503 let (message, label, suggestion) = if finalize {
504 label_and_suggestion()
505 } else {
506 // FIXME: this output isn't actually present in the test suite.
507 (format!("cannot find `{ident}` in this scope"), String::new(), None)
508 };
503509 PathResult::Failed {
504510 span: ident.span,
505511 segment_name: ident.name,
......@@ -508,6 +514,7 @@ impl<'ra> PathResult<'ra> {
508514 is_error_from_last_segment,
509515 module,
510516 error_implied_by_parse_error,
517 message,
511518 }
512519 }
513520}
compiler/rustc_resolve/src/macros.rs+37-11
......@@ -908,10 +908,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
908908 ),
909909 path_res @ (PathResult::NonModule(..) | PathResult::Failed { .. }) => {
910910 let mut suggestion = None;
911 let (span, label, module, segment) =
912 if let PathResult::Failed { span, label, module, segment_name, .. } =
913 path_res
914 {
911 let (span, message, label, module, segment) = match path_res {
912 PathResult::Failed {
913 span, label, module, segment_name, message, ..
914 } => {
915915 // try to suggest if it's not a macro, maybe a function
916916 if let PathResult::NonModule(partial_res) = self
917917 .cm()
......@@ -930,26 +930,52 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
930930 Applicability::MaybeIncorrect,
931931 ));
932932 }
933 (span, label, module, segment_name)
934 } else {
933 (span, message, label, module, segment_name)
934 }
935 PathResult::NonModule(partial_res) => {
936 let found_an = partial_res.base_res().article();
937 let found_descr = partial_res.base_res().descr();
938 let scope = match &path[..partial_res.unresolved_segments()] {
939 [.., prev] => {
940 format!("{found_descr} `{}`", prev.ident)
941 }
942 _ => found_descr.to_string(),
943 };
944 let expected_an = kind.article();
945 let expected_descr = kind.descr();
946 let expected_name = path[partial_res.unresolved_segments()].ident;
947
935948 (
936949 path_span,
937950 format!(
938 "partially resolved path in {} {}",
939 kind.article(),
940 kind.descr()
951 "cannot find {expected_descr} `{expected_name}` in {scope}"
941952 ),
953 match partial_res.base_res() {
954 Res::Def(
955 DefKind::Mod | DefKind::Macro(..) | DefKind::ExternCrate,
956 _,
957 ) => format!(
958 "partially resolved path in {expected_an} {expected_descr}",
959 ),
960 _ => format!(
961 "{expected_an} {expected_descr} can't exist within \
962 {found_an} {found_descr}"
963 ),
964 },
942965 None,
943966 path.last().map(|segment| segment.ident.name).unwrap(),
944967 )
945 };
968 }
969 _ => unreachable!(),
970 };
946971 self.report_error(
947972 span,
948973 ResolutionError::FailedToResolve {
949 segment: Some(segment),
974 segment,
950975 label,
951976 suggestion,
952977 module,
978 message,
953979 },
954980 );
955981 }
compiler/rustc_session/src/options.rs+3
......@@ -2481,6 +2481,9 @@ options! {
24812481 mir_include_spans: MirIncludeSpans = (MirIncludeSpans::default(), parse_mir_include_spans, [UNTRACKED],
24822482 "include extra comments in mir pretty printing, like line numbers and statement indices, \
24832483 details about types, etc. (boolean for all passes, 'nll' to enable in NLL MIR only, default: 'nll')"),
2484 mir_opt_bisect_limit: Option<usize> = (None, parse_opt_number, [TRACKED],
2485 "limit the number of MIR optimization pass executions (global across all bodies). \
2486 Pass executions after this limit are skipped and reported. (default: no limit)"),
24842487 #[rustc_lint_opt_deny_field_access("use `Session::mir_opt_level` instead of this field")]
24852488 mir_opt_level: Option<usize> = (None, parse_opt_number, [TRACKED],
24862489 "MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)"),
compiler/rustc_session/src/session.rs+8-1
......@@ -2,7 +2,7 @@ use std::any::Any;
22use std::path::PathBuf;
33use std::str::FromStr;
44use std::sync::Arc;
5use std::sync::atomic::AtomicBool;
5use std::sync::atomic::{AtomicBool, AtomicUsize};
66use std::{env, io};
77
88use rand::{RngCore, rng};
......@@ -161,6 +161,12 @@ pub struct Session {
161161
162162 /// Does the codegen backend support ThinLTO?
163163 pub thin_lto_supported: bool,
164
165 /// Global per-session counter for MIR optimization pass applications.
166 ///
167 /// Used by `-Zmir-opt-bisect-limit` to assign an index to each
168 /// optimization-pass execution candidate during this compilation.
169 pub mir_opt_bisect_eval_count: AtomicUsize,
164170}
165171
166172#[derive(Clone, Copy)]
......@@ -1101,6 +1107,7 @@ pub fn build_session(
11011107 invocation_temp,
11021108 replaced_intrinsics: FxHashSet::default(), // filled by `run_compiler`
11031109 thin_lto_supported: true, // filled by `run_compiler`
1110 mir_opt_bisect_eval_count: AtomicUsize::new(0),
11041111 };
11051112
11061113 validate_commandline_args_with_session_available(&sess);
compiler/rustc_span/src/symbol.rs-1
......@@ -327,7 +327,6 @@ symbols! {
327327 Pointer,
328328 Poll,
329329 ProcMacro,
330 ProceduralMasqueradeDummyType,
331330 Range,
332331 RangeBounds,
333332 RangeCopy,
compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs+3
......@@ -300,6 +300,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
300300 let rebased_args = alias.args.rebase_onto(tcx, trait_def_id, impl_substs);
301301
302302 let impl_item_def_id = leaf_def.item.def_id;
303 if !tcx.check_args_compatible(impl_item_def_id, rebased_args) {
304 return false;
305 }
303306 let impl_assoc_ty = tcx.type_of(impl_item_def_id).instantiate(tcx, rebased_args);
304307
305308 self.infcx.can_eq(param_env, impl_assoc_ty, concrete)
compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs+117-3
......@@ -11,7 +11,7 @@ use rustc_middle::traits::ObligationCauseCode;
1111use rustc_middle::ty::error::ExpectedFound;
1212use rustc_middle::ty::print::RegionHighlightMode;
1313use rustc_middle::ty::{self, TyCtxt, TypeVisitable};
14use rustc_span::Span;
14use rustc_span::{Ident, Span};
1515use tracing::debug;
1616
1717use crate::error_reporting::infer::nice_region_error::NiceRegionError;
......@@ -99,7 +99,8 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
9999
100100 // Get the span of all the used type parameters in the method.
101101 let assoc_item = self.tcx().associated_item(trait_item_def_id);
102 let mut visitor = TypeParamSpanVisitor { tcx: self.tcx(), types: vec![] };
102 let mut visitor =
103 TypeParamSpanVisitor { tcx: self.tcx(), types: vec![], elided_lifetime_paths: vec![] };
103104 match assoc_item.kind {
104105 ty::AssocKind::Fn { .. } => {
105106 if let Some(hir_id) =
......@@ -122,13 +123,49 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
122123 found,
123124 };
124125
125 self.tcx().dcx().emit_err(diag)
126 let mut diag = self.tcx().dcx().create_err(diag);
127 // A limit not to make diag verbose.
128 const ELIDED_LIFETIME_NOTE_LIMIT: usize = 5;
129 let elided_lifetime_paths = visitor.elided_lifetime_paths;
130 let total_elided_lifetime_paths = elided_lifetime_paths.len();
131 let shown_elided_lifetime_paths = if tcx.sess.opts.verbose {
132 total_elided_lifetime_paths
133 } else {
134 ELIDED_LIFETIME_NOTE_LIMIT
135 };
136
137 for elided in elided_lifetime_paths.into_iter().take(shown_elided_lifetime_paths) {
138 diag.span_note(
139 elided.span,
140 format!("`{}` here is elided as `{}`", elided.ident, elided.shorthand),
141 );
142 }
143 if total_elided_lifetime_paths > shown_elided_lifetime_paths {
144 diag.note(format!(
145 "and {} more elided lifetime{} in type paths",
146 total_elided_lifetime_paths - shown_elided_lifetime_paths,
147 if total_elided_lifetime_paths - shown_elided_lifetime_paths == 1 {
148 ""
149 } else {
150 "s"
151 },
152 ));
153 }
154 diag.emit()
126155 }
127156}
128157
158#[derive(Clone)]
159struct ElidedLifetimeInPath {
160 span: Span,
161 ident: Ident,
162 shorthand: String,
163}
164
129165struct TypeParamSpanVisitor<'tcx> {
130166 tcx: TyCtxt<'tcx>,
131167 types: Vec<Span>,
168 elided_lifetime_paths: Vec<ElidedLifetimeInPath>,
132169}
133170
134171impl<'tcx> Visitor<'tcx> for TypeParamSpanVisitor<'tcx> {
......@@ -138,6 +175,83 @@ impl<'tcx> Visitor<'tcx> for TypeParamSpanVisitor<'tcx> {
138175 self.tcx
139176 }
140177
178 fn visit_qpath(&mut self, qpath: &'tcx hir::QPath<'tcx>, id: hir::HirId, _span: Span) {
179 fn record_elided_lifetimes(
180 tcx: TyCtxt<'_>,
181 elided_lifetime_paths: &mut Vec<ElidedLifetimeInPath>,
182 segment: &hir::PathSegment<'_>,
183 ) {
184 let Some(args) = segment.args else { return };
185 if args.parenthesized != hir::GenericArgsParentheses::No {
186 // Our diagnostic rendering below uses `<...>` syntax; skip cases like `Fn(..) -> ..`.
187 return;
188 }
189 let elided_count = args
190 .args
191 .iter()
192 .filter(|arg| {
193 let hir::GenericArg::Lifetime(l) = arg else { return false };
194 l.syntax == hir::LifetimeSyntax::Implicit
195 && matches!(l.source, hir::LifetimeSource::Path { .. })
196 })
197 .count();
198 if elided_count == 0
199 || elided_lifetime_paths.iter().any(|p| p.span == segment.ident.span)
200 {
201 return;
202 }
203
204 let sm = tcx.sess.source_map();
205 let mut parts = args
206 .args
207 .iter()
208 .map(|arg| match arg {
209 hir::GenericArg::Lifetime(l) => {
210 if l.syntax == hir::LifetimeSyntax::Implicit
211 && matches!(l.source, hir::LifetimeSource::Path { .. })
212 {
213 "'_".to_string()
214 } else {
215 sm.span_to_snippet(l.ident.span)
216 .unwrap_or_else(|_| format!("'{}", l.ident.name))
217 }
218 }
219 hir::GenericArg::Type(ty) => {
220 sm.span_to_snippet(ty.span).unwrap_or_else(|_| "..".to_string())
221 }
222 hir::GenericArg::Const(ct) => {
223 sm.span_to_snippet(ct.span).unwrap_or_else(|_| "..".to_string())
224 }
225 hir::GenericArg::Infer(_) => "_".to_string(),
226 })
227 .collect::<Vec<_>>();
228 parts.extend(args.constraints.iter().map(|constraint| {
229 sm.span_to_snippet(constraint.span)
230 .unwrap_or_else(|_| format!("{} = ..", constraint.ident))
231 }));
232 let shorthand = format!("{}<{}>", segment.ident, parts.join(", "));
233
234 elided_lifetime_paths.push(ElidedLifetimeInPath {
235 span: segment.ident.span,
236 ident: segment.ident,
237 shorthand,
238 });
239 }
240
241 match qpath {
242 hir::QPath::Resolved(_, path) => {
243 for segment in path.segments {
244 record_elided_lifetimes(self.tcx, &mut self.elided_lifetime_paths, segment);
245 }
246 }
247 hir::QPath::TypeRelative(_, segment) => {
248 record_elided_lifetimes(self.tcx, &mut self.elided_lifetime_paths, segment);
249 }
250 }
251
252 hir::intravisit::walk_qpath(self, qpath, id);
253 }
254
141255 fn visit_ty(&mut self, arg: &'tcx hir::Ty<'tcx, AmbigArg>) {
142256 match arg.kind {
143257 hir::TyKind::Ref(_, ref mut_ty) => {
library/alloc/src/lib.rs-1
......@@ -182,7 +182,6 @@
182182#![feature(negative_impls)]
183183#![feature(never_type)]
184184#![feature(optimize_attribute)]
185#![feature(rustc_allow_const_fn_unstable)]
186185#![feature(rustc_attrs)]
187186#![feature(slice_internals)]
188187#![feature(staged_api)]
library/core/src/lib.rs-1
......@@ -159,7 +159,6 @@
159159#![feature(pattern_types)]
160160#![feature(prelude_import)]
161161#![feature(repr_simd)]
162#![feature(rustc_allow_const_fn_unstable)]
163162#![feature(rustc_attrs)]
164163#![feature(rustdoc_internals)]
165164#![feature(simd_ffi)]
library/core/src/num/int_macros.rs+10-2
......@@ -2481,7 +2481,8 @@ macro_rules! int_impl {
24812481 ///
24822482 /// Returns a tuple of the addition along with a boolean indicating
24832483 /// whether an arithmetic overflow would occur. If an overflow would have
2484 /// occurred then the wrapped value is returned.
2484 /// occurred then the wrapped value is returned (negative if overflowed
2485 /// above [`MAX`](Self::MAX), non-negative if below [`MIN`](Self::MIN)).
24852486 ///
24862487 /// # Examples
24872488 ///
......@@ -2516,6 +2517,9 @@ macro_rules! int_impl {
25162517 /// The output boolean returned by this method is *not* a carry flag,
25172518 /// and should *not* be added to a more significant word.
25182519 ///
2520 /// If overflow occurred, the wrapped value is returned (negative if overflowed
2521 /// above [`MAX`](Self::MAX), non-negative if below [`MIN`](Self::MIN)).
2522 ///
25192523 /// If the input carry is false, this method is equivalent to
25202524 /// [`overflowing_add`](Self::overflowing_add).
25212525 ///
......@@ -2583,7 +2587,8 @@ macro_rules! int_impl {
25832587 /// Calculates `self` - `rhs`.
25842588 ///
25852589 /// Returns a tuple of the subtraction along with a boolean indicating whether an arithmetic overflow
2586 /// would occur. If an overflow would have occurred then the wrapped value is returned.
2590 /// would occur. If an overflow would have occurred then the wrapped value is returned
2591 /// (negative if overflowed above [`MAX`](Self::MAX), non-negative if below [`MIN`](Self::MIN)).
25872592 ///
25882593 /// # Examples
25892594 ///
......@@ -2619,6 +2624,9 @@ macro_rules! int_impl {
26192624 /// The output boolean returned by this method is *not* a borrow flag,
26202625 /// and should *not* be subtracted from a more significant word.
26212626 ///
2627 /// If overflow occurred, the wrapped value is returned (negative if overflowed
2628 /// above [`MAX`](Self::MAX), non-negative if below [`MIN`](Self::MIN)).
2629 ///
26222630 /// If the input borrow is false, this method is equivalent to
26232631 /// [`overflowing_sub`](Self::overflowing_sub).
26242632 ///
library/core/src/num/uint_macros.rs+2-2
......@@ -487,8 +487,8 @@ macro_rules! uint_impl {
487487
488488 /// Performs a carry-less multiplication, returning the lower bits.
489489 ///
490 /// This operation is similar to long multiplication, except that exclusive or is used
491 /// instead of addition. The implementation is equivalent to:
490 /// This operation is similar to long multiplication in base 2, except that exclusive or is
491 /// used instead of addition. The implementation is equivalent to:
492492 ///
493493 /// ```no_run
494494 #[doc = concat!("pub fn carryless_mul(lhs: ", stringify!($SelfT), ", rhs: ", stringify!($SelfT), ") -> ", stringify!($SelfT), "{")]
library/std/src/sys/args/unix.rs+3-9
......@@ -164,7 +164,7 @@ mod imp {
164164// of this used `[[NSProcessInfo processInfo] arguments]`.
165165#[cfg(target_vendor = "apple")]
166166mod imp {
167 use crate::ffi::{c_char, c_int};
167 use crate::ffi::c_char;
168168
169169 pub unsafe fn init(_argc: isize, _argv: *const *const u8) {
170170 // No need to initialize anything in here, `libdyld.dylib` has already
......@@ -172,12 +172,6 @@ mod imp {
172172 }
173173
174174 pub fn argc_argv() -> (isize, *const *const c_char) {
175 unsafe extern "C" {
176 // These functions are in crt_externs.h.
177 fn _NSGetArgc() -> *mut c_int;
178 fn _NSGetArgv() -> *mut *mut *mut c_char;
179 }
180
181175 // SAFETY: The returned pointer points to a static initialized early
182176 // in the program lifetime by `libdyld.dylib`, and as such is always
183177 // valid.
......@@ -187,9 +181,9 @@ mod imp {
187181 // doesn't exist a lock that we can take. Instead, it is generally
188182 // expected that it's only modified in `main` / before other code
189183 // runs, so reading this here should be fine.
190 let argc = unsafe { _NSGetArgc().read() };
184 let argc = unsafe { libc::_NSGetArgc().read() };
191185 // SAFETY: Same as above.
192 let argv = unsafe { _NSGetArgv().read() };
186 let argv = unsafe { libc::_NSGetArgv().read() };
193187
194188 // Cast from `*mut *mut c_char` to `*const *const c_char`
195189 (argc as isize, argv.cast())
src/doc/rustc/src/lints/levels.md+1-1
......@@ -393,7 +393,7 @@ Here’s how these different lint controls interact:
393393 warning: 1 warning emitted
394394 ```
395395
3963. [CLI level flags](#via-compiler-flag) take precedence over attributes.
3963. [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.
397397
398398 The order of the flags matter; flags on the right take precedence over earlier flags.
399399
src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs-1
......@@ -194,7 +194,6 @@ fn check_rvalue<'tcx>(
194194 ))
195195 }
196196 },
197 Rvalue::ShallowInitBox(_, _) => Ok(()),
198197 Rvalue::UnaryOp(_, operand) => {
199198 let ty = operand.ty(body, cx.tcx);
200199 if ty.is_integral() || ty.is_bool() {
src/tools/clippy/tests/ui/crashes/unreachable-array-or-slice.rs+1-1
......@@ -2,7 +2,7 @@ struct Foo(isize, isize, isize, isize);
22
33pub fn main() {
44 let Self::anything_here_kills_it(a, b, ..) = Foo(5, 5, 5, 5);
5 //~^ ERROR: failed to resolve
5 //~^ ERROR: cannot find `Self` in this scope
66 match [5, 5, 5, 5] {
77 [..] => {},
88 }
src/tools/clippy/tests/ui/crashes/unreachable-array-or-slice.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
1error[E0433]: cannot find `Self` in this scope
22 --> tests/ui/crashes/unreachable-array-or-slice.rs:4:9
33 |
44LL | let Self::anything_here_kills_it(a, b, ..) = Foo(5, 5, 5, 5);
src/tools/miri/src/concurrency/thread.rs+1-1
......@@ -343,8 +343,8 @@ impl VisitProvenance for Thread<'_> {
343343
344344impl VisitProvenance for Frame<'_, Provenance, FrameExtra<'_>> {
345345 fn visit_provenance(&self, visit: &mut VisitWith<'_>) {
346 let return_place = self.return_place();
346347 let Frame {
347 return_place,
348348 locals,
349349 extra,
350350 // There are some private fields we cannot access; they contain no tags.
src/tools/miri/src/diagnostics.rs+1-1
......@@ -493,7 +493,7 @@ pub fn report_result<'tcx>(
493493 for (i, frame) in ecx.active_thread_stack().iter().enumerate() {
494494 trace!("-------------------");
495495 trace!("Frame {}", i);
496 trace!(" return: {:?}", frame.return_place);
496 trace!(" return: {:?}", frame.return_place());
497497 for (i, local) in frame.locals.iter().enumerate() {
498498 trace!(" local {}: {:?}", i, local);
499499 }
src/tools/miri/src/machine.rs+2-2
......@@ -1235,7 +1235,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
12351235 // to run extra MIR), and Ok(Some(body)) if we found MIR to run for the
12361236 // foreign function
12371237 // Any needed call to `goto_block` will be performed by `emulate_foreign_item`.
1238 let args = ecx.copy_fn_args(args); // FIXME: Should `InPlace` arguments be reset to uninit?
1238 let args = MiriInterpCx::copy_fn_args(args); // FIXME: Should `InPlace` arguments be reset to uninit?
12391239 let link_name = Symbol::intern(ecx.tcx.symbol_name(instance).name);
12401240 return ecx.emulate_foreign_item(link_name, abi, &args, dest, ret, unwind);
12411241 }
......@@ -1262,7 +1262,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
12621262 ret: Option<mir::BasicBlock>,
12631263 unwind: mir::UnwindAction,
12641264 ) -> InterpResult<'tcx> {
1265 let args = ecx.copy_fn_args(args); // FIXME: Should `InPlace` arguments be reset to uninit?
1265 let args = MiriInterpCx::copy_fn_args(args); // FIXME: Should `InPlace` arguments be reset to uninit?
12661266 ecx.emulate_dyn_sym(fn_val, abi, &args, dest, ret, unwind)
12671267 }
12681268
src/tools/miri/tests/fail/rustc-error2.rs+1-1
......@@ -4,7 +4,7 @@ struct Struct<T>(T);
44impl<T> std::ops::Deref for Struct<T> {
55 type Target = dyn Fn(T);
66 fn deref(&self) -> &assert_mem_uninitialized_valid::Target {
7 //~^ERROR: use of unresolved module or unlinked crate
7 //~^ERROR: cannot find module or crate `assert_mem_uninitialized_valid` in this scope
88 unimplemented!()
99 }
1010}
src/tools/miri/tests/fail/rustc-error2.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `assert_mem_uninitialized_valid`
1error[E0433]: cannot find module or crate `assert_mem_uninitialized_valid` in this scope
22 --> tests/fail/rustc-error2.rs:LL:CC
33 |
44LL | fn deref(&self) -> &assert_mem_uninitialized_valid::Target {
src/tools/miri/tests/fail/tail_calls/dangling-local-var.stderr+2-2
......@@ -14,8 +14,8 @@ LL | let local = 0;
1414help: ALLOC was deallocated here:
1515 --> tests/fail/tail_calls/dangling-local-var.rs:LL:CC
1616 |
17LL | f(std::ptr::null());
18 | ^^^^^^^^^^^^^^^^^^^
17LL | let _val = unsafe { *x };
18 | ^^^^
1919 = note: stack backtrace:
2020 0: g
2121 at tests/fail/tail_calls/dangling-local-var.rs:LL:CC
src/tools/miri/tests/fail/validity/recursive-validity-box-bool.rs created+8
......@@ -0,0 +1,8 @@
1//@compile-flags: -Zmiri-recursive-validation
2
3fn main() {
4 let x = 3u8;
5 let xref = &x;
6 let xref_wrong_type: Box<bool> = unsafe { std::mem::transmute(xref) }; //~ERROR: encountered 0x03, but expected a boolean
7 let _val = *xref_wrong_type;
8}
src/tools/miri/tests/fail/validity/recursive-validity-box-bool.stderr created+13
......@@ -0,0 +1,13 @@
1error: Undefined Behavior: constructing invalid value at .<deref>: encountered 0x03, but expected a boolean
2 --> tests/fail/validity/recursive-validity-box-bool.rs:LL:CC
3 |
4LL | let xref_wrong_type: Box<bool> = unsafe { std::mem::transmute(xref) };
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
6 |
7 = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
8 = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
9
10note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
11
12error: aborting due to 1 previous error
13
src/tools/miri/tests/pass/function_calls/tail_call.rs created+51
......@@ -0,0 +1,51 @@
1#![allow(incomplete_features)]
2#![feature(explicit_tail_calls)]
3
4fn main() {
5 assert_eq!(factorial(10), 3_628_800);
6 assert_eq!(mutually_recursive_identity(1000), 1000);
7 non_scalar();
8}
9
10fn factorial(n: u32) -> u32 {
11 fn factorial_acc(n: u32, acc: u32) -> u32 {
12 match n {
13 0 => acc,
14 _ => become factorial_acc(n - 1, acc * n),
15 }
16 }
17
18 factorial_acc(n, 1)
19}
20
21// this is of course very silly, but we need to demonstrate mutual recursion somehow so...
22fn mutually_recursive_identity(x: u32) -> u32 {
23 fn switch(src: u32, tgt: u32) -> u32 {
24 match src {
25 0 => tgt,
26 _ if src % 7 == 0 => become advance_with_extra_steps(src, tgt),
27 _ => become advance(src, tgt),
28 }
29 }
30
31 fn advance(src: u32, tgt: u32) -> u32 {
32 become switch(src - 1, tgt + 1)
33 }
34
35 fn advance_with_extra_steps(src: u32, tgt: u32) -> u32 {
36 become advance(src, tgt)
37 }
38
39 switch(x, 0)
40}
41
42fn non_scalar() {
43 fn f(x: [usize; 2], i: u32) {
44 if i == 0 {
45 return;
46 }
47 become f(x, i - 1);
48 }
49
50 f([5, 5], 2);
51}
src/tools/miri/tests/pass/tail_call.rs deleted-39
......@@ -1,39 +0,0 @@
1#![allow(incomplete_features)]
2#![feature(explicit_tail_calls)]
3
4fn main() {
5 assert_eq!(factorial(10), 3_628_800);
6 assert_eq!(mutually_recursive_identity(1000), 1000);
7}
8
9fn factorial(n: u32) -> u32 {
10 fn factorial_acc(n: u32, acc: u32) -> u32 {
11 match n {
12 0 => acc,
13 _ => become factorial_acc(n - 1, acc * n),
14 }
15 }
16
17 factorial_acc(n, 1)
18}
19
20// this is of course very silly, but we need to demonstrate mutual recursion somehow so...
21fn mutually_recursive_identity(x: u32) -> u32 {
22 fn switch(src: u32, tgt: u32) -> u32 {
23 match src {
24 0 => tgt,
25 _ if src % 7 == 0 => become advance_with_extra_steps(src, tgt),
26 _ => become advance(src, tgt),
27 }
28 }
29
30 fn advance(src: u32, tgt: u32) -> u32 {
31 become switch(src - 1, tgt + 1)
32 }
33
34 fn advance_with_extra_steps(src: u32, tgt: u32) -> u32 {
35 become advance(src, tgt)
36 }
37
38 switch(x, 0)
39}
tests/codegen-llvm/intrinsics/likely_assert.rs+1-1
......@@ -1,5 +1,5 @@
11//@ compile-flags: -Copt-level=3
2#![feature(panic_internals, const_eval_select, rustc_allow_const_fn_unstable, core_intrinsics)]
2#![feature(panic_internals, const_eval_select, rustc_attrs, core_intrinsics)]
33#![crate_type = "lib"]
44
55// check that assert! and const_assert! emit branch weights
tests/mir-opt/optimize_none.rs+4-3
......@@ -15,13 +15,14 @@ pub fn add_noopt() -> i32 {
1515#[optimize(none)]
1616pub fn const_branch() -> i32 {
1717 // CHECK-LABEL: fn const_branch(
18 // CHECK: switchInt(const true) -> [0: [[FALSE:bb[0-9]+]], otherwise: [[TRUE:bb[0-9]+]]];
18 // CHECK: [[BOOL:_[0-9]+]] = const true;
19 // CHECK: switchInt(move [[BOOL]]) -> [0: [[BB_FALSE:bb[0-9]+]], otherwise: [[BB_TRUE:bb[0-9]+]]];
1920 // CHECK-NEXT: }
20 // CHECK: [[FALSE]]: {
21 // CHECK: [[BB_FALSE]]: {
2122 // CHECK-NEXT: _0 = const 0
2223 // CHECK-NEXT: goto
2324 // CHECK-NEXT: }
24 // CHECK: [[TRUE]]: {
25 // CHECK: [[BB_TRUE]]: {
2526 // CHECK-NEXT: _0 = const 1
2627 // CHECK-NEXT: goto
2728 // CHECK-NEXT: }
tests/run-make/issue-149402-suggest-unresolve/nightly.err+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of undeclared type `Complete`
1error[E0433]: cannot find type `Complete` in this scope
22 --> foo.rs:3:12
33 |
443 | x.push(Complete::Item { name: "hello" });
tests/run-make/issue-149402-suggest-unresolve/stable.err+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of undeclared type `Complete`
1error[E0433]: cannot find type `Complete` in this scope
22 --> foo.rs:3:12
33 |
443 | x.push(Complete::Item { name: "hello" });
tests/run-make/mir-opt-bisect-limit/main.rs created+11
......@@ -0,0 +1,11 @@
1#![crate_type = "lib"]
2#![no_std]
3
4#[inline(never)]
5pub fn callee(x: u64) -> u64 {
6 x.wrapping_mul(3).wrapping_add(7)
7}
8
9pub fn caller(a: u64, b: u64) -> u64 {
10 callee(a) + callee(b)
11}
tests/run-make/mir-opt-bisect-limit/rmake.rs created+119
......@@ -0,0 +1,119 @@
1use std::path::Path;
2
3use run_make_support::{CompletedProcess, rfs, rustc};
4
5struct Case {
6 name: &'static str,
7 flags: &'static [&'static str],
8 expect_inline_dump: bool,
9 expect_running: ExpectedCount,
10 expect_not_running: ExpectedCount,
11}
12
13enum ExpectedCount {
14 Exactly(usize),
15 AtLeastOne,
16 Zero,
17}
18
19fn main() {
20 let cases = [
21 Case {
22 name: "limit0",
23 flags: &["-Zmir-opt-bisect-limit=0"],
24 expect_inline_dump: false,
25 expect_running: ExpectedCount::Exactly(0),
26 expect_not_running: ExpectedCount::AtLeastOne,
27 },
28 Case {
29 name: "limit1",
30 flags: &["-Zmir-opt-bisect-limit=1"],
31 expect_inline_dump: false,
32 expect_running: ExpectedCount::Exactly(1),
33 expect_not_running: ExpectedCount::AtLeastOne,
34 },
35 Case {
36 name: "huge_limit",
37 flags: &["-Zmir-opt-bisect-limit=1000000000"],
38 expect_inline_dump: true,
39 expect_running: ExpectedCount::AtLeastOne,
40 expect_not_running: ExpectedCount::Zero,
41 },
42 Case {
43 name: "limit0_with_force_enable_inline",
44 flags: &["-Zmir-opt-bisect-limit=0", "-Zmir-enable-passes=+Inline"],
45 expect_inline_dump: false,
46 expect_running: ExpectedCount::Exactly(0),
47 expect_not_running: ExpectedCount::AtLeastOne,
48 },
49 ];
50
51 for case in cases {
52 let (inline_dumped, running_count, not_running_count, output) =
53 compile_case(case.name, case.flags);
54
55 assert_eq!(
56 inline_dumped, case.expect_inline_dump,
57 "{}: unexpected Inline dump presence",
58 case.name
59 );
60
61 assert_expected_count(
62 running_count,
63 case.expect_running,
64 &format!("{}: running count", case.name),
65 );
66 assert_expected_count(
67 not_running_count,
68 case.expect_not_running,
69 &format!("{}: NOT running count", case.name),
70 );
71 }
72}
73
74fn compile_case(dump_dir: &str, extra_flags: &[&str]) -> (bool, usize, usize, CompletedProcess) {
75 if Path::new(dump_dir).exists() {
76 rfs::remove_dir_all(dump_dir);
77 }
78 rfs::create_dir_all(dump_dir);
79
80 let mut cmd = rustc();
81 cmd.input("main.rs")
82 .arg("--emit=mir")
83 .arg("-Zmir-opt-level=2")
84 .arg("-Copt-level=2")
85 .arg("-Zthreads=1")
86 .arg("-Zdump-mir=Inline")
87 .arg(format!("-Zdump-mir-dir={dump_dir}"));
88
89 for &flag in extra_flags {
90 cmd.arg(flag);
91 }
92
93 let output = cmd.run();
94 let (running_count, not_running_count) = bisect_line_counts(&output);
95 (has_inline_dump_file(dump_dir), running_count, not_running_count, output)
96}
97
98fn assert_expected_count(actual: usize, expected: ExpectedCount, context: &str) {
99 match expected {
100 ExpectedCount::Exactly(n) => assert_eq!(actual, n, "{context}"),
101 ExpectedCount::AtLeastOne => assert!(actual > 0, "{context}"),
102 ExpectedCount::Zero => assert_eq!(actual, 0, "{context}"),
103 }
104}
105
106fn has_inline_dump_file(dir: &str) -> bool {
107 rfs::read_dir(dir)
108 .flatten()
109 .any(|entry| entry.file_name().to_string_lossy().contains(".Inline."))
110}
111
112fn bisect_line_counts(output: &CompletedProcess) -> (usize, usize) {
113 let stderr = output.stderr_utf8();
114 let running_count =
115 stderr.lines().filter(|line| line.starts_with("BISECT: running pass (")).count();
116 let not_running_count =
117 stderr.lines().filter(|line| line.starts_with("BISECT: NOT running pass (")).count();
118 (running_count, not_running_count)
119}
tests/rustdoc-ui/intra-doc/unresolved-import-recovery.rs+1-1
......@@ -1,6 +1,6 @@
11// Regression test for issue #95879.
22
3use unresolved_crate::module::Name; //~ ERROR failed to resolve
3use unresolved_crate::module::Name; //~ ERROR cannot find
44
55/// [Name]
66pub struct S;
tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `unresolved_crate`
1error[E0433]: cannot find module or crate `unresolved_crate` in the crate root
22 --> $DIR/unresolved-import-recovery.rs:3:5
33 |
44LL | use unresolved_crate::module::Name;
tests/rustdoc-ui/issues/issue-61732.rs+1-1
......@@ -1,4 +1,4 @@
11// This previously triggered an ICE.
22
33pub(in crate::r#mod) fn main() {}
4//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `r#mod`
4//~^ ERROR cannot find module or crate `r#mod` in `crate`
tests/rustdoc-ui/issues/issue-61732.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `r#mod`
1error[E0433]: cannot find module or crate `r#mod` in `crate`
22 --> $DIR/issue-61732.rs:3:15
33 |
44LL | pub(in crate::r#mod) fn main() {}
tests/ui-fulldeps/session-diagnostic/diagnostic-derive-inline.rs+1-1
......@@ -137,7 +137,7 @@ struct MessageWrongType {
137137struct InvalidPathFieldAttr {
138138 #[nonsense]
139139 //~^ ERROR `#[nonsense]` is not a valid attribute
140 //~^^ ERROR cannot find attribute `nonsense` in this scope
140 //~| ERROR cannot find attribute `nonsense` in this scope
141141 foo: String,
142142}
143143
tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-inline.rs+8
......@@ -90,6 +90,14 @@ struct G {
9090 var: String,
9191}
9292
93#[derive(Subdiagnostic)]
94#[label("...")]
95struct H {
96 #[primary_span]
97 span: Span,
98 var: String,
99}
100
93101#[derive(Subdiagnostic)]
94102#[label(slug = 4)]
95103//~^ ERROR no nested attribute expected here
tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive-inline.stderr+80-80
......@@ -35,109 +35,109 @@ LL | #[label(bug = "...")]
3535 | ^
3636
3737error: derive(Diagnostic): no nested attribute expected here
38 --> $DIR/subdiagnostic-derive-inline.rs:94:9
38 --> $DIR/subdiagnostic-derive-inline.rs:102:9
3939 |
4040LL | #[label(slug = 4)]
4141 | ^^^^
4242
4343error: derive(Diagnostic): diagnostic message must be first argument of a `#[label(...)]` attribute
44 --> $DIR/subdiagnostic-derive-inline.rs:94:1
44 --> $DIR/subdiagnostic-derive-inline.rs:102:1
4545 |
4646LL | #[label(slug = 4)]
4747 | ^
4848
4949error: derive(Diagnostic): no nested attribute expected here
50 --> $DIR/subdiagnostic-derive-inline.rs:104:9
50 --> $DIR/subdiagnostic-derive-inline.rs:112:9
5151 |
5252LL | #[label(slug("..."))]
5353 | ^^^^
5454
5555error: derive(Diagnostic): diagnostic message must be first argument of a `#[label(...)]` attribute
56 --> $DIR/subdiagnostic-derive-inline.rs:104:1
56 --> $DIR/subdiagnostic-derive-inline.rs:112:1
5757 |
5858LL | #[label(slug("..."))]
5959 | ^
6060
6161error: derive(Diagnostic): diagnostic message must be first argument of a `#[label(...)]` attribute
62 --> $DIR/subdiagnostic-derive-inline.rs:114:1
62 --> $DIR/subdiagnostic-derive-inline.rs:122:1
6363 |
6464LL | #[label()]
6565 | ^
6666
6767error: derive(Diagnostic): no nested attribute expected here
68 --> $DIR/subdiagnostic-derive-inline.rs:123:28
68 --> $DIR/subdiagnostic-derive-inline.rs:131:28
6969 |
7070LL | #[label("example message", code = "...")]
7171 | ^^^^
7272
7373error: derive(Diagnostic): no nested attribute expected here
74 --> $DIR/subdiagnostic-derive-inline.rs:132:28
74 --> $DIR/subdiagnostic-derive-inline.rs:140:28
7575 |
7676LL | #[label("example message", applicability = "machine-applicable")]
7777 | ^^^^^^^^^^^^^
7878
7979error: derive(Diagnostic): unsupported type attribute for subdiagnostic enum
80 --> $DIR/subdiagnostic-derive-inline.rs:141:1
80 --> $DIR/subdiagnostic-derive-inline.rs:149:1
8181 |
8282LL | #[foo]
8383 | ^
8484
8585error: derive(Diagnostic): `#[bar]` is not a valid attribute
86 --> $DIR/subdiagnostic-derive-inline.rs:155:5
86 --> $DIR/subdiagnostic-derive-inline.rs:163:5
8787 |
8888LL | #[bar]
8989 | ^
9090
9191error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute
92 --> $DIR/subdiagnostic-derive-inline.rs:167:5
92 --> $DIR/subdiagnostic-derive-inline.rs:175:5
9393 |
9494LL | #[bar = "..."]
9595 | ^
9696
9797error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute
98 --> $DIR/subdiagnostic-derive-inline.rs:179:5
98 --> $DIR/subdiagnostic-derive-inline.rs:187:5
9999 |
100100LL | #[bar = 4]
101101 | ^
102102
103103error: derive(Diagnostic): `#[bar(...)]` is not a valid attribute
104 --> $DIR/subdiagnostic-derive-inline.rs:191:5
104 --> $DIR/subdiagnostic-derive-inline.rs:199:5
105105 |
106106LL | #[bar("...")]
107107 | ^
108108
109109error: derive(Diagnostic): no nested attribute expected here
110 --> $DIR/subdiagnostic-derive-inline.rs:203:13
110 --> $DIR/subdiagnostic-derive-inline.rs:211:13
111111 |
112112LL | #[label(code = "...")]
113113 | ^^^^
114114
115115error: derive(Diagnostic): diagnostic message must be first argument of a `#[label(...)]` attribute
116 --> $DIR/subdiagnostic-derive-inline.rs:203:5
116 --> $DIR/subdiagnostic-derive-inline.rs:211:5
117117 |
118118LL | #[label(code = "...")]
119119 | ^
120120
121121error: derive(Diagnostic): the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan`
122 --> $DIR/subdiagnostic-derive-inline.rs:232:5
122 --> $DIR/subdiagnostic-derive-inline.rs:240:5
123123 |
124124LL | #[primary_span]
125125 | ^
126126
127127error: derive(Diagnostic): label without `#[primary_span]` field
128 --> $DIR/subdiagnostic-derive-inline.rs:229:1
128 --> $DIR/subdiagnostic-derive-inline.rs:237:1
129129 |
130130LL | #[label("example message")]
131131 | ^
132132
133133error: derive(Diagnostic): `#[applicability]` is only valid on suggestions
134 --> $DIR/subdiagnostic-derive-inline.rs:242:5
134 --> $DIR/subdiagnostic-derive-inline.rs:250:5
135135 |
136136LL | #[applicability]
137137 | ^
138138
139139error: derive(Diagnostic): `#[bar]` is not a valid attribute
140 --> $DIR/subdiagnostic-derive-inline.rs:252:5
140 --> $DIR/subdiagnostic-derive-inline.rs:260:5
141141 |
142142LL | #[bar]
143143 | ^
......@@ -145,13 +145,13 @@ LL | #[bar]
145145 = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes
146146
147147error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute
148 --> $DIR/subdiagnostic-derive-inline.rs:263:5
148 --> $DIR/subdiagnostic-derive-inline.rs:271:5
149149 |
150150LL | #[bar = "..."]
151151 | ^
152152
153153error: derive(Diagnostic): `#[bar(...)]` is not a valid attribute
154 --> $DIR/subdiagnostic-derive-inline.rs:274:5
154 --> $DIR/subdiagnostic-derive-inline.rs:282:5
155155 |
156156LL | #[bar("...")]
157157 | ^
......@@ -159,7 +159,7 @@ LL | #[bar("...")]
159159 = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes
160160
161161error: unexpected unsupported untagged union
162 --> $DIR/subdiagnostic-derive-inline.rs:290:1
162 --> $DIR/subdiagnostic-derive-inline.rs:298:1
163163 |
164164LL | / union AC {
165165LL | |
......@@ -169,97 +169,97 @@ LL | | }
169169 | |_^
170170
171171error: expected this path to be an identifier
172 --> $DIR/subdiagnostic-derive-inline.rs:305:28
172 --> $DIR/subdiagnostic-derive-inline.rs:313:28
173173 |
174174LL | #[label("example message", no_crate::example)]
175175 | ^^^^^^^^^^^^^^^^^
176176
177177error: derive(Diagnostic): attribute specified multiple times
178 --> $DIR/subdiagnostic-derive-inline.rs:318:5
178 --> $DIR/subdiagnostic-derive-inline.rs:326:5
179179 |
180180LL | #[primary_span]
181181 | ^
182182 |
183183note: previously specified here
184 --> $DIR/subdiagnostic-derive-inline.rs:315:5
184 --> $DIR/subdiagnostic-derive-inline.rs:323:5
185185 |
186186LL | #[primary_span]
187187 | ^
188188
189189error: derive(Diagnostic): subdiagnostic kind not specified
190 --> $DIR/subdiagnostic-derive-inline.rs:324:8
190 --> $DIR/subdiagnostic-derive-inline.rs:332:8
191191 |
192192LL | struct AG {
193193 | ^^
194194
195195error: derive(Diagnostic): attribute specified multiple times
196 --> $DIR/subdiagnostic-derive-inline.rs:361:47
196 --> $DIR/subdiagnostic-derive-inline.rs:369:47
197197 |
198198LL | #[suggestion("example message", code = "...", code = "...")]
199199 | ^^^^
200200 |
201201note: previously specified here
202 --> $DIR/subdiagnostic-derive-inline.rs:361:33
202 --> $DIR/subdiagnostic-derive-inline.rs:369:33
203203 |
204204LL | #[suggestion("example message", code = "...", code = "...")]
205205 | ^^^^
206206
207207error: derive(Diagnostic): attribute specified multiple times
208 --> $DIR/subdiagnostic-derive-inline.rs:379:5
208 --> $DIR/subdiagnostic-derive-inline.rs:387:5
209209 |
210210LL | #[applicability]
211211 | ^
212212 |
213213note: previously specified here
214 --> $DIR/subdiagnostic-derive-inline.rs:376:5
214 --> $DIR/subdiagnostic-derive-inline.rs:384:5
215215 |
216216LL | #[applicability]
217217 | ^
218218
219219error: derive(Diagnostic): the `#[applicability]` attribute can only be applied to fields of type `Applicability`
220 --> $DIR/subdiagnostic-derive-inline.rs:389:5
220 --> $DIR/subdiagnostic-derive-inline.rs:397:5
221221 |
222222LL | #[applicability]
223223 | ^
224224
225225error: derive(Diagnostic): suggestion without `code = "..."`
226 --> $DIR/subdiagnostic-derive-inline.rs:402:1
226 --> $DIR/subdiagnostic-derive-inline.rs:410:1
227227 |
228228LL | #[suggestion("example message")]
229229 | ^
230230
231231error: derive(Diagnostic): invalid applicability
232 --> $DIR/subdiagnostic-derive-inline.rs:412:63
232 --> $DIR/subdiagnostic-derive-inline.rs:420:63
233233 |
234234LL | #[suggestion("example message", code = "...", applicability = "foo")]
235235 | ^^^^^
236236
237237error: derive(Diagnostic): suggestion without `#[primary_span]` field
238 --> $DIR/subdiagnostic-derive-inline.rs:430:1
238 --> $DIR/subdiagnostic-derive-inline.rs:438:1
239239 |
240240LL | #[suggestion("example message", code = "...")]
241241 | ^
242242
243243error: derive(Diagnostic): unsupported type attribute for subdiagnostic enum
244 --> $DIR/subdiagnostic-derive-inline.rs:444:1
244 --> $DIR/subdiagnostic-derive-inline.rs:452:1
245245 |
246246LL | #[label]
247247 | ^
248248
249249error: derive(Diagnostic): `var` doesn't refer to a field on this type
250 --> $DIR/subdiagnostic-derive-inline.rs:464:40
250 --> $DIR/subdiagnostic-derive-inline.rs:472:40
251251 |
252252LL | #[suggestion("example message", code = "{var}", applicability = "machine-applicable")]
253253 | ^^^^^^^
254254
255255error: derive(Diagnostic): `var` doesn't refer to a field on this type
256 --> $DIR/subdiagnostic-derive-inline.rs:483:44
256 --> $DIR/subdiagnostic-derive-inline.rs:491:44
257257 |
258258LL | #[suggestion("example message", code = "{var}", applicability = "machine-applicable")]
259259 | ^^^^^^^
260260
261261error: derive(Diagnostic): `#[suggestion_part]` is not a valid attribute
262 --> $DIR/subdiagnostic-derive-inline.rs:506:5
262 --> $DIR/subdiagnostic-derive-inline.rs:514:5
263263 |
264264LL | #[suggestion_part]
265265 | ^
......@@ -267,7 +267,7 @@ LL | #[suggestion_part]
267267 = help: `#[suggestion_part(...)]` is only valid in multipart suggestions, use `#[primary_span]` instead
268268
269269error: derive(Diagnostic): `#[suggestion_part(...)]` is not a valid attribute
270 --> $DIR/subdiagnostic-derive-inline.rs:509:5
270 --> $DIR/subdiagnostic-derive-inline.rs:517:5
271271 |
272272LL | #[suggestion_part(code = "...")]
273273 | ^
......@@ -275,13 +275,13 @@ LL | #[suggestion_part(code = "...")]
275275 = help: `#[suggestion_part(...)]` is only valid in multipart suggestions
276276
277277error: derive(Diagnostic): suggestion without `#[primary_span]` field
278 --> $DIR/subdiagnostic-derive-inline.rs:503:1
278 --> $DIR/subdiagnostic-derive-inline.rs:511:1
279279 |
280280LL | #[suggestion("example message", code = "...")]
281281 | ^
282282
283283error: derive(Diagnostic): invalid nested attribute
284 --> $DIR/subdiagnostic-derive-inline.rs:518:43
284 --> $DIR/subdiagnostic-derive-inline.rs:526:43
285285 |
286286LL | #[multipart_suggestion("example message", code = "...", applicability = "machine-applicable")]
287287 | ^^^^
......@@ -289,25 +289,25 @@ LL | #[multipart_suggestion("example message", code = "...", applicability = "ma
289289 = help: only `style` and `applicability` are valid nested attributes
290290
291291error: derive(Diagnostic): multipart suggestion without any `#[suggestion_part(...)]` fields
292 --> $DIR/subdiagnostic-derive-inline.rs:518:1
292 --> $DIR/subdiagnostic-derive-inline.rs:526:1
293293 |
294294LL | #[multipart_suggestion("example message", code = "...", applicability = "machine-applicable")]
295295 | ^
296296
297297error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."`
298 --> $DIR/subdiagnostic-derive-inline.rs:528:5
298 --> $DIR/subdiagnostic-derive-inline.rs:536:5
299299 |
300300LL | #[suggestion_part]
301301 | ^
302302
303303error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."`
304 --> $DIR/subdiagnostic-derive-inline.rs:536:5
304 --> $DIR/subdiagnostic-derive-inline.rs:544:5
305305 |
306306LL | #[suggestion_part()]
307307 | ^
308308
309309error: derive(Diagnostic): `#[primary_span]` is not a valid attribute
310 --> $DIR/subdiagnostic-derive-inline.rs:545:5
310 --> $DIR/subdiagnostic-derive-inline.rs:553:5
311311 |
312312LL | #[primary_span]
313313 | ^
......@@ -315,127 +315,127 @@ LL | #[primary_span]
315315 = help: multipart suggestions use one or more `#[suggestion_part]`s rather than one `#[primary_span]`
316316
317317error: derive(Diagnostic): multipart suggestion without any `#[suggestion_part(...)]` fields
318 --> $DIR/subdiagnostic-derive-inline.rs:542:1
318 --> $DIR/subdiagnostic-derive-inline.rs:550:1
319319 |
320320LL | #[multipart_suggestion("example message")]
321321 | ^
322322
323323error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."`
324 --> $DIR/subdiagnostic-derive-inline.rs:553:5
324 --> $DIR/subdiagnostic-derive-inline.rs:561:5
325325 |
326326LL | #[suggestion_part]
327327 | ^
328328
329329error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."`
330 --> $DIR/subdiagnostic-derive-inline.rs:556:5
330 --> $DIR/subdiagnostic-derive-inline.rs:564:5
331331 |
332332LL | #[suggestion_part()]
333333 | ^
334334
335335error: derive(Diagnostic): `code` is the only valid nested attribute
336 --> $DIR/subdiagnostic-derive-inline.rs:559:23
336 --> $DIR/subdiagnostic-derive-inline.rs:567:23
337337 |
338338LL | #[suggestion_part(foo = "bar")]
339339 | ^^^
340340
341341error: derive(Diagnostic): the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
342 --> $DIR/subdiagnostic-derive-inline.rs:563:5
342 --> $DIR/subdiagnostic-derive-inline.rs:571:5
343343 |
344344LL | #[suggestion_part(code = "...")]
345345 | ^
346346
347347error: derive(Diagnostic): the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
348 --> $DIR/subdiagnostic-derive-inline.rs:566:5
348 --> $DIR/subdiagnostic-derive-inline.rs:574:5
349349 |
350350LL | #[suggestion_part()]
351351 | ^
352352
353353error: expected `,`
354 --> $DIR/subdiagnostic-derive-inline.rs:559:27
354 --> $DIR/subdiagnostic-derive-inline.rs:567:27
355355 |
356356LL | #[suggestion_part(foo = "bar")]
357357 | ^
358358
359359error: derive(Diagnostic): attribute specified multiple times
360 --> $DIR/subdiagnostic-derive-inline.rs:574:37
360 --> $DIR/subdiagnostic-derive-inline.rs:582:37
361361 |
362362LL | #[suggestion_part(code = "...", code = ",,,")]
363363 | ^^^^
364364 |
365365note: previously specified here
366 --> $DIR/subdiagnostic-derive-inline.rs:574:23
366 --> $DIR/subdiagnostic-derive-inline.rs:582:23
367367 |
368368LL | #[suggestion_part(code = "...", code = ",,,")]
369369 | ^^^^
370370
371371error: derive(Diagnostic): `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_suggestion]` attributes have a static `applicability = "..."`
372 --> $DIR/subdiagnostic-derive-inline.rs:603:5
372 --> $DIR/subdiagnostic-derive-inline.rs:611:5
373373 |
374374LL | #[applicability]
375375 | ^
376376
377377error: derive(Diagnostic): expected exactly one string literal for `code = ...`
378 --> $DIR/subdiagnostic-derive-inline.rs:651:28
378 --> $DIR/subdiagnostic-derive-inline.rs:659:28
379379 |
380380LL | #[suggestion_part(code("foo"))]
381381 | ^^^^^
382382
383383error: unexpected token, expected `)`
384 --> $DIR/subdiagnostic-derive-inline.rs:651:28
384 --> $DIR/subdiagnostic-derive-inline.rs:659:28
385385 |
386386LL | #[suggestion_part(code("foo"))]
387387 | ^^^^^
388388
389389error: derive(Diagnostic): expected exactly one string literal for `code = ...`
390 --> $DIR/subdiagnostic-derive-inline.rs:661:28
390 --> $DIR/subdiagnostic-derive-inline.rs:669:28
391391 |
392392LL | #[suggestion_part(code("foo", "bar"))]
393393 | ^^^^^
394394
395395error: unexpected token, expected `)`
396 --> $DIR/subdiagnostic-derive-inline.rs:661:28
396 --> $DIR/subdiagnostic-derive-inline.rs:669:28
397397 |
398398LL | #[suggestion_part(code("foo", "bar"))]
399399 | ^^^^^
400400
401401error: derive(Diagnostic): expected exactly one string literal for `code = ...`
402 --> $DIR/subdiagnostic-derive-inline.rs:671:28
402 --> $DIR/subdiagnostic-derive-inline.rs:679:28
403403 |
404404LL | #[suggestion_part(code(3))]
405405 | ^
406406
407407error: unexpected token, expected `)`
408 --> $DIR/subdiagnostic-derive-inline.rs:671:28
408 --> $DIR/subdiagnostic-derive-inline.rs:679:28
409409 |
410410LL | #[suggestion_part(code(3))]
411411 | ^
412412
413413error: derive(Diagnostic): expected exactly one string literal for `code = ...`
414 --> $DIR/subdiagnostic-derive-inline.rs:681:28
414 --> $DIR/subdiagnostic-derive-inline.rs:689:28
415415 |
416416LL | #[suggestion_part(code())]
417417 | ^
418418
419419error: expected string literal
420 --> $DIR/subdiagnostic-derive-inline.rs:690:30
420 --> $DIR/subdiagnostic-derive-inline.rs:698:30
421421 |
422422LL | #[suggestion_part(code = 3)]
423423 | ^
424424
425425error: derive(Diagnostic): attribute specified multiple times
426 --> $DIR/subdiagnostic-derive-inline.rs:732:1
426 --> $DIR/subdiagnostic-derive-inline.rs:740:1
427427 |
428428LL | #[suggestion("example message", code = "", style = "hidden", style = "normal")]
429429 | ^
430430 |
431431note: previously specified here
432 --> $DIR/subdiagnostic-derive-inline.rs:732:1
432 --> $DIR/subdiagnostic-derive-inline.rs:740:1
433433 |
434434LL | #[suggestion("example message", code = "", style = "hidden", style = "normal")]
435435 | ^
436436
437437error: derive(Diagnostic): `#[suggestion_hidden(...)]` is not a valid attribute
438 --> $DIR/subdiagnostic-derive-inline.rs:741:1
438 --> $DIR/subdiagnostic-derive-inline.rs:749:1
439439 |
440440LL | #[suggestion_hidden("example message", code = "")]
441441 | ^
......@@ -443,7 +443,7 @@ LL | #[suggestion_hidden("example message", code = "")]
443443 = help: Use `#[suggestion(..., style = "hidden")]` instead
444444
445445error: derive(Diagnostic): `#[suggestion_hidden(...)]` is not a valid attribute
446 --> $DIR/subdiagnostic-derive-inline.rs:749:1
446 --> $DIR/subdiagnostic-derive-inline.rs:757:1
447447 |
448448LL | #[suggestion_hidden("example message", code = "", style = "normal")]
449449 | ^
......@@ -451,7 +451,7 @@ LL | #[suggestion_hidden("example message", code = "", style = "normal")]
451451 = help: Use `#[suggestion(..., style = "hidden")]` instead
452452
453453error: derive(Diagnostic): invalid suggestion style
454 --> $DIR/subdiagnostic-derive-inline.rs:757:52
454 --> $DIR/subdiagnostic-derive-inline.rs:765:52
455455 |
456456LL | #[suggestion("example message", code = "", style = "foo")]
457457 | ^^^^^
......@@ -459,25 +459,25 @@ LL | #[suggestion("example message", code = "", style = "foo")]
459459 = help: valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only`
460460
461461error: expected string literal
462 --> $DIR/subdiagnostic-derive-inline.rs:765:52
462 --> $DIR/subdiagnostic-derive-inline.rs:773:52
463463 |
464464LL | #[suggestion("example message", code = "", style = 42)]
465465 | ^^
466466
467467error: expected `=`
468 --> $DIR/subdiagnostic-derive-inline.rs:773:49
468 --> $DIR/subdiagnostic-derive-inline.rs:781:49
469469 |
470470LL | #[suggestion("example message", code = "", style)]
471471 | ^
472472
473473error: expected `=`
474 --> $DIR/subdiagnostic-derive-inline.rs:781:49
474 --> $DIR/subdiagnostic-derive-inline.rs:789:49
475475 |
476476LL | #[suggestion("example message", code = "", style("foo"))]
477477 | ^
478478
479479error: derive(Diagnostic): `#[primary_span]` is not a valid attribute
480 --> $DIR/subdiagnostic-derive-inline.rs:792:5
480 --> $DIR/subdiagnostic-derive-inline.rs:800:5
481481 |
482482LL | #[primary_span]
483483 | ^
......@@ -486,7 +486,7 @@ LL | #[primary_span]
486486 = help: to create a suggestion with multiple spans, use `#[multipart_suggestion]` instead
487487
488488error: derive(Diagnostic): suggestion without `#[primary_span]` field
489 --> $DIR/subdiagnostic-derive-inline.rs:789:1
489 --> $DIR/subdiagnostic-derive-inline.rs:797:1
490490 |
491491LL | #[suggestion("example message", code = "")]
492492 | ^
......@@ -498,49 +498,49 @@ LL | #[foo]
498498 | ^^^
499499
500500error: cannot find attribute `foo` in this scope
501 --> $DIR/subdiagnostic-derive-inline.rs:141:3
501 --> $DIR/subdiagnostic-derive-inline.rs:149:3
502502 |
503503LL | #[foo]
504504 | ^^^
505505
506506error: cannot find attribute `bar` in this scope
507 --> $DIR/subdiagnostic-derive-inline.rs:155:7
507 --> $DIR/subdiagnostic-derive-inline.rs:163:7
508508 |
509509LL | #[bar]
510510 | ^^^
511511
512512error: cannot find attribute `bar` in this scope
513 --> $DIR/subdiagnostic-derive-inline.rs:167:7
513 --> $DIR/subdiagnostic-derive-inline.rs:175:7
514514 |
515515LL | #[bar = "..."]
516516 | ^^^
517517
518518error: cannot find attribute `bar` in this scope
519 --> $DIR/subdiagnostic-derive-inline.rs:179:7
519 --> $DIR/subdiagnostic-derive-inline.rs:187:7
520520 |
521521LL | #[bar = 4]
522522 | ^^^
523523
524524error: cannot find attribute `bar` in this scope
525 --> $DIR/subdiagnostic-derive-inline.rs:191:7
525 --> $DIR/subdiagnostic-derive-inline.rs:199:7
526526 |
527527LL | #[bar("...")]
528528 | ^^^
529529
530530error: cannot find attribute `bar` in this scope
531 --> $DIR/subdiagnostic-derive-inline.rs:252:7
531 --> $DIR/subdiagnostic-derive-inline.rs:260:7
532532 |
533533LL | #[bar]
534534 | ^^^
535535
536536error: cannot find attribute `bar` in this scope
537 --> $DIR/subdiagnostic-derive-inline.rs:263:7
537 --> $DIR/subdiagnostic-derive-inline.rs:271:7
538538 |
539539LL | #[bar = "..."]
540540 | ^^^
541541
542542error: cannot find attribute `bar` in this scope
543 --> $DIR/subdiagnostic-derive-inline.rs:274:7
543 --> $DIR/subdiagnostic-derive-inline.rs:282:7
544544 |
545545LL | #[bar("...")]
546546 | ^^^
tests/ui/asm/naked-invalid-attr.rs+1-1
......@@ -56,7 +56,7 @@ fn main() {
5656// Check that the path of an attribute without a name is printed correctly (issue #140082)
5757#[::a]
5858//~^ ERROR attribute incompatible with `#[unsafe(naked)]`
59//~| ERROR failed to resolve: use of unresolved module or unlinked crate `a`
59//~| ERROR cannot find module or crate `a` in the crate root
6060#[unsafe(naked)]
6161extern "C" fn issue_140082() {
6262 naked_asm!("")
tests/ui/asm/naked-invalid-attr.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `a`
1error[E0433]: cannot find module or crate `a` in the crate root
22 --> $DIR/naked-invalid-attr.rs:57:5
33 |
44LL | #[::a]
tests/ui/associated-types/suggest-param-env-shadowing-incompatible-args.rs created+18
......@@ -0,0 +1,18 @@
1//@ compile-flags: -Znext-solver=globally
2
3// Regression test for https://github.com/rust-lang/rust/issues/152684.
4
5#![feature(associated_type_defaults)]
6
7trait Foo {
8 type Assoc<T = u8> = T;
9 //~^ ERROR defaults for generic parameters are not allowed here
10 fn foo() -> Self::Assoc;
11}
12impl Foo for () {
13 fn foo() -> Self::Assoc {
14 [] //~ ERROR mismatched types
15 }
16}
17
18fn main() {}
tests/ui/associated-types/suggest-param-env-shadowing-incompatible-args.stderr created+20
......@@ -0,0 +1,20 @@
1error: defaults for generic parameters are not allowed here
2 --> $DIR/suggest-param-env-shadowing-incompatible-args.rs:8:16
3 |
4LL | type Assoc<T = u8> = T;
5 | ^^^^^^
6
7error[E0308]: mismatched types
8 --> $DIR/suggest-param-env-shadowing-incompatible-args.rs:14:9
9 |
10LL | fn foo() -> Self::Assoc {
11 | ----------- expected `<() as Foo>::Assoc` because of return type
12LL | []
13 | ^^ expected `u8`, found `[_; 0]`
14 |
15 = note: expected type `u8`
16 found array `[_; 0]`
17
18error: aborting due to 2 previous errors
19
20For more information about this error, try `rustc --explain E0308`.
tests/ui/attributes/builtin-attribute-prefix.rs+2-2
......@@ -1,8 +1,8 @@
11// Regression test for https://github.com/rust-lang/rust/issues/143789
22#[must_use::skip]
3//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `must_use`
3//~^ ERROR: cannot find module or crate `must_use`
44fn main() { }
55
66// Regression test for https://github.com/rust-lang/rust/issues/137590
77struct S(#[stable::skip] u8, u16, u32);
8//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `stable`
8//~^ ERROR: cannot find module or crate `stable`
tests/ui/attributes/builtin-attribute-prefix.stderr+2-2
......@@ -1,10 +1,10 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `stable`
1error[E0433]: cannot find module or crate `stable` in this scope
22 --> $DIR/builtin-attribute-prefix.rs:7:12
33 |
44LL | struct S(#[stable::skip] u8, u16, u32);
55 | ^^^^^^ use of unresolved module or unlinked crate `stable`
66
7error[E0433]: failed to resolve: use of unresolved module or unlinked crate `must_use`
7error[E0433]: cannot find module or crate `must_use` in this scope
88 --> $DIR/builtin-attribute-prefix.rs:2:3
99 |
1010LL | #[must_use::skip]
tests/ui/attributes/check-builtin-attr-ice.rs+3-3
......@@ -43,11 +43,11 @@
4343
4444struct Foo {
4545 #[should_panic::skip]
46 //~^ ERROR failed to resolve
46 //~^ ERROR cannot find
4747 pub field: u8,
4848
4949 #[should_panic::a::b::c]
50 //~^ ERROR failed to resolve
50 //~^ ERROR cannot find
5151 pub field2: u8,
5252}
5353
......@@ -55,6 +55,6 @@ fn foo() {}
5555
5656fn main() {
5757 #[deny::skip]
58 //~^ ERROR failed to resolve
58 //~^ ERROR cannot find
5959 foo();
6060}
tests/ui/attributes/check-builtin-attr-ice.stderr+3-3
......@@ -1,16 +1,16 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `should_panic`
1error[E0433]: cannot find module or crate `should_panic` in this scope
22 --> $DIR/check-builtin-attr-ice.rs:45:7
33 |
44LL | #[should_panic::skip]
55 | ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic`
66
7error[E0433]: failed to resolve: use of unresolved module or unlinked crate `should_panic`
7error[E0433]: cannot find module or crate `should_panic` in this scope
88 --> $DIR/check-builtin-attr-ice.rs:49:7
99 |
1010LL | #[should_panic::a::b::c]
1111 | ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic`
1212
13error[E0433]: failed to resolve: use of unresolved module or unlinked crate `deny`
13error[E0433]: cannot find module or crate `deny` in this scope
1414 --> $DIR/check-builtin-attr-ice.rs:57:7
1515 |
1616LL | #[deny::skip]
tests/ui/attributes/check-cfg_attr-ice.rs+13-13
......@@ -10,27 +10,27 @@
1010#![crate_type = "lib"]
1111
1212#[cfg_attr::no_such_thing]
13//~^ ERROR failed to resolve
13//~^ ERROR cannot find
1414mod we_are_no_strangers_to_love {}
1515
1616#[cfg_attr::no_such_thing]
17//~^ ERROR failed to resolve
17//~^ ERROR cannot find
1818struct YouKnowTheRules {
1919 #[cfg_attr::no_such_thing]
20 //~^ ERROR failed to resolve
20 //~^ ERROR cannot find
2121 and_so_do_i: u8,
2222}
2323
2424#[cfg_attr::no_such_thing]
25//~^ ERROR failed to resolve
25//~^ ERROR cannot find
2626fn a_full_commitment() {
2727 #[cfg_attr::no_such_thing]
28 //~^ ERROR failed to resolve
28 //~^ ERROR cannot find
2929 let is_what_i_am_thinking_of = ();
3030}
3131
3232#[cfg_attr::no_such_thing]
33//~^ ERROR failed to resolve
33//~^ ERROR cannot find
3434union AnyOtherGuy {
3535 owo: ()
3636}
......@@ -39,30 +39,30 @@ struct This;
3939#[cfg_attr(FALSE, doc = "you wouldn't get this")]
4040impl From<AnyOtherGuy> for This {
4141 #[cfg_attr::no_such_thing]
42 //~^ ERROR failed to resolve
42 //~^ ERROR cannot find
4343 fn from(#[cfg_attr::no_such_thing] any_other_guy: AnyOtherGuy) -> This {
44 //~^ ERROR failed to resolve
44 //~^ ERROR cannot find
4545 #[cfg_attr::no_such_thing]
4646 //~^ ERROR attributes on expressions are experimental
47 //~| ERROR failed to resolve
47 //~| ERROR cannot find
4848 unreachable!()
4949 }
5050}
5151
5252#[cfg_attr::no_such_thing]
53//~^ ERROR failed to resolve
53//~^ ERROR cannot find
5454enum NeverGonna {
5555 #[cfg_attr::no_such_thing]
56 //~^ ERROR failed to resolve
56 //~^ ERROR cannot find
5757 GiveYouUp(#[cfg_attr::no_such_thing] u8),
58 //~^ ERROR failed to resolve
58 //~^ ERROR cannot find
5959 LetYouDown {
6060 #![cfg_attr::no_such_thing]
6161 //~^ ERROR an inner attribute is not permitted in this context
6262 never_gonna: (),
6363 round_around: (),
6464 #[cfg_attr::no_such_thing]
65 //~^ ERROR failed to resolve
65 //~^ ERROR cannot find
6666 and_desert_you: (),
6767 },
6868}
tests/ui/attributes/check-cfg_attr-ice.stderr+13-13
......@@ -17,79 +17,79 @@ LL | #[cfg_attr::no_such_thing]
1717 = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
1818 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1919
20error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
20error[E0433]: cannot find module or crate `cfg_attr` in this scope
2121 --> $DIR/check-cfg_attr-ice.rs:52:3
2222 |
2323LL | #[cfg_attr::no_such_thing]
2424 | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
2525
26error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
26error[E0433]: cannot find module or crate `cfg_attr` in this scope
2727 --> $DIR/check-cfg_attr-ice.rs:55:7
2828 |
2929LL | #[cfg_attr::no_such_thing]
3030 | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
3131
32error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
32error[E0433]: cannot find module or crate `cfg_attr` in this scope
3333 --> $DIR/check-cfg_attr-ice.rs:57:17
3434 |
3535LL | GiveYouUp(#[cfg_attr::no_such_thing] u8),
3636 | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
3737
38error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
38error[E0433]: cannot find module or crate `cfg_attr` in this scope
3939 --> $DIR/check-cfg_attr-ice.rs:64:11
4040 |
4141LL | #[cfg_attr::no_such_thing]
4242 | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
4343
44error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
44error[E0433]: cannot find module or crate `cfg_attr` in this scope
4545 --> $DIR/check-cfg_attr-ice.rs:41:7
4646 |
4747LL | #[cfg_attr::no_such_thing]
4848 | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
4949
50error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
50error[E0433]: cannot find module or crate `cfg_attr` in this scope
5151 --> $DIR/check-cfg_attr-ice.rs:43:15
5252 |
5353LL | fn from(#[cfg_attr::no_such_thing] any_other_guy: AnyOtherGuy) -> This {
5454 | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
5555
56error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
56error[E0433]: cannot find module or crate `cfg_attr` in this scope
5757 --> $DIR/check-cfg_attr-ice.rs:45:11
5858 |
5959LL | #[cfg_attr::no_such_thing]
6060 | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
6161
62error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
62error[E0433]: cannot find module or crate `cfg_attr` in this scope
6363 --> $DIR/check-cfg_attr-ice.rs:32:3
6464 |
6565LL | #[cfg_attr::no_such_thing]
6666 | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
6767
68error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
68error[E0433]: cannot find module or crate `cfg_attr` in this scope
6969 --> $DIR/check-cfg_attr-ice.rs:24:3
7070 |
7171LL | #[cfg_attr::no_such_thing]
7272 | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
7373
74error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
74error[E0433]: cannot find module or crate `cfg_attr` in this scope
7575 --> $DIR/check-cfg_attr-ice.rs:27:7
7676 |
7777LL | #[cfg_attr::no_such_thing]
7878 | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
7979
80error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
80error[E0433]: cannot find module or crate `cfg_attr` in this scope
8181 --> $DIR/check-cfg_attr-ice.rs:16:3
8282 |
8383LL | #[cfg_attr::no_such_thing]
8484 | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
8585
86error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
86error[E0433]: cannot find module or crate `cfg_attr` in this scope
8787 --> $DIR/check-cfg_attr-ice.rs:19:7
8888 |
8989LL | #[cfg_attr::no_such_thing]
9090 | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
9191
92error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
92error[E0433]: cannot find module or crate `cfg_attr` in this scope
9393 --> $DIR/check-cfg_attr-ice.rs:12:3
9494 |
9595LL | #[cfg_attr::no_such_thing]
tests/ui/attributes/custom_attr_multisegment_error.rs+1-1
......@@ -2,5 +2,5 @@
22
33mod existent {}
44
5#[existent::nonexistent] //~ ERROR failed to resolve: could not find `nonexistent` in `existent`
5#[existent::nonexistent] //~ ERROR cannot find `nonexistent` in `existent`
66fn main() {}
tests/ui/attributes/custom_attr_multisegment_error.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: could not find `nonexistent` in `existent`
1error[E0433]: cannot find `nonexistent` in `existent`
22 --> $DIR/custom_attr_multisegment_error.rs:5:13
33 |
44LL | #[existent::nonexistent]
tests/ui/attributes/field-attributes-vis-unresolved.rs+2-2
......@@ -15,12 +15,12 @@ mod internal {
1515
1616struct S {
1717 #[rustfmt::skip]
18 pub(in nonexistent) field: u8 //~ ERROR failed to resolve
18 pub(in nonexistent) field: u8 //~ ERROR cannot find
1919}
2020
2121struct Z(
2222 #[rustfmt::skip]
23 pub(in nonexistent) u8 //~ ERROR failed to resolve
23 pub(in nonexistent) u8 //~ ERROR cannot find
2424);
2525
2626fn main() {}
tests/ui/attributes/field-attributes-vis-unresolved.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistent`
1error[E0433]: cannot find module or crate `nonexistent` in the crate root
22 --> $DIR/field-attributes-vis-unresolved.rs:18:12
33 |
44LL | pub(in nonexistent) field: u8
......@@ -9,7 +9,7 @@ help: you might be missing a crate named `nonexistent`, add it to your project a
99LL + extern crate nonexistent;
1010 |
1111
12error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistent`
12error[E0433]: cannot find module or crate `nonexistent` in the crate root
1313 --> $DIR/field-attributes-vis-unresolved.rs:23:12
1414 |
1515LL | pub(in nonexistent) u8
tests/ui/attributes/illegal-macro-use.rs+4-4
......@@ -1,15 +1,15 @@
11// issue#140255
22
3#[macro_use::a] //~ ERROR failed to resolve: use of unresolved module or unlinked crate `macro_use`
3#[macro_use::a] //~ ERROR cannot find
44fn f0() {}
55
6#[macro_use::a::b] //~ ERROR failed to resolve: use of unresolved module or unlinked crate `macro_use`
6#[macro_use::a::b] //~ ERROR cannot find
77fn f1() {}
88
9#[macro_escape::a] //~ ERROR failed to resolve: use of unresolved module or unlinked crate `macro_escape`
9#[macro_escape::a] //~ ERROR cannot find
1010fn f2() {}
1111
12#[macro_escape::a::b] //~ ERROR failed to resolve: use of unresolved module or unlinked crate `macro_escape`
12#[macro_escape::a::b] //~ ERROR cannot find
1313fn f3() {}
1414
1515fn main() {}
tests/ui/attributes/illegal-macro-use.stderr+4-4
......@@ -1,22 +1,22 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `macro_escape`
1error[E0433]: cannot find module or crate `macro_escape` in this scope
22 --> $DIR/illegal-macro-use.rs:12:3
33 |
44LL | #[macro_escape::a::b]
55 | ^^^^^^^^^^^^ use of unresolved module or unlinked crate `macro_escape`
66
7error[E0433]: failed to resolve: use of unresolved module or unlinked crate `macro_escape`
7error[E0433]: cannot find module or crate `macro_escape` in this scope
88 --> $DIR/illegal-macro-use.rs:9:3
99 |
1010LL | #[macro_escape::a]
1111 | ^^^^^^^^^^^^ use of unresolved module or unlinked crate `macro_escape`
1212
13error[E0433]: failed to resolve: use of unresolved module or unlinked crate `macro_use`
13error[E0433]: cannot find module or crate `macro_use` in this scope
1414 --> $DIR/illegal-macro-use.rs:6:3
1515 |
1616LL | #[macro_use::a::b]
1717 | ^^^^^^^^^ use of unresolved module or unlinked crate `macro_use`
1818
19error[E0433]: failed to resolve: use of unresolved module or unlinked crate `macro_use`
19error[E0433]: cannot find module or crate `macro_use` in this scope
2020 --> $DIR/illegal-macro-use.rs:3:3
2121 |
2222LL | #[macro_use::a]
tests/ui/attributes/malformed-attrs.rs-1
......@@ -2,7 +2,6 @@
22// We enable a bunch of features to not get feature-gate errs in this test.
33#![deny(invalid_doc_attributes)]
44#![feature(rustc_attrs)]
5#![feature(rustc_allow_const_fn_unstable)]
65#![feature(allow_internal_unstable)]
76// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
87#![feature(fn_align)]
tests/ui/attributes/malformed-attrs.stderr+89-89
......@@ -1,5 +1,5 @@
11error[E0539]: malformed `cfg` attribute input
2 --> $DIR/malformed-attrs.rs:107:1
2 --> $DIR/malformed-attrs.rs:106:1
33 |
44LL | #[cfg]
55 | ^^^^^^
......@@ -10,7 +10,7 @@ LL | #[cfg]
1010 = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
1111
1212error[E0539]: malformed `cfg_attr` attribute input
13 --> $DIR/malformed-attrs.rs:109:1
13 --> $DIR/malformed-attrs.rs:108:1
1414 |
1515LL | #[cfg_attr]
1616 | ^^^^^^^^^^^
......@@ -21,13 +21,13 @@ LL | #[cfg_attr]
2121 = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
2222
2323error[E0463]: can't find crate for `wloop`
24 --> $DIR/malformed-attrs.rs:215:1
24 --> $DIR/malformed-attrs.rs:214:1
2525 |
2626LL | extern crate wloop;
2727 | ^^^^^^^^^^^^^^^^^^^ can't find crate
2828
2929error: malformed `allow` attribute input
30 --> $DIR/malformed-attrs.rs:181:1
30 --> $DIR/malformed-attrs.rs:180:1
3131 |
3232LL | #[allow]
3333 | ^^^^^^^^
......@@ -43,7 +43,7 @@ LL | #[allow(lint1, lint2, lint3, reason = "...")]
4343 | +++++++++++++++++++++++++++++++++++++
4444
4545error: malformed `expect` attribute input
46 --> $DIR/malformed-attrs.rs:183:1
46 --> $DIR/malformed-attrs.rs:182:1
4747 |
4848LL | #[expect]
4949 | ^^^^^^^^^
......@@ -59,7 +59,7 @@ LL | #[expect(lint1, lint2, lint3, reason = "...")]
5959 | +++++++++++++++++++++++++++++++++++++
6060
6161error: malformed `warn` attribute input
62 --> $DIR/malformed-attrs.rs:185:1
62 --> $DIR/malformed-attrs.rs:184:1
6363 |
6464LL | #[warn]
6565 | ^^^^^^^
......@@ -75,7 +75,7 @@ LL | #[warn(lint1, lint2, lint3, reason = "...")]
7575 | +++++++++++++++++++++++++++++++++++++
7676
7777error: malformed `deny` attribute input
78 --> $DIR/malformed-attrs.rs:187:1
78 --> $DIR/malformed-attrs.rs:186:1
7979 |
8080LL | #[deny]
8181 | ^^^^^^^
......@@ -91,7 +91,7 @@ LL | #[deny(lint1, lint2, lint3, reason = "...")]
9191 | +++++++++++++++++++++++++++++++++++++
9292
9393error: malformed `forbid` attribute input
94 --> $DIR/malformed-attrs.rs:189:1
94 --> $DIR/malformed-attrs.rs:188:1
9595 |
9696LL | #[forbid]
9797 | ^^^^^^^^^
......@@ -107,25 +107,25 @@ LL | #[forbid(lint1, lint2, lint3, reason = "...")]
107107 | +++++++++++++++++++++++++++++++++++++
108108
109109error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type
110 --> $DIR/malformed-attrs.rs:104:1
110 --> $DIR/malformed-attrs.rs:103:1
111111 |
112112LL | #[proc_macro = 18]
113113 | ^^^^^^^^^^^^^^^^^^
114114
115115error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type
116 --> $DIR/malformed-attrs.rs:121:1
116 --> $DIR/malformed-attrs.rs:120:1
117117 |
118118LL | #[proc_macro_attribute = 19]
119119 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
120120
121121error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type
122 --> $DIR/malformed-attrs.rs:128:1
122 --> $DIR/malformed-attrs.rs:127:1
123123 |
124124LL | #[proc_macro_derive]
125125 | ^^^^^^^^^^^^^^^^^^^^
126126
127127error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint
128 --> $DIR/malformed-attrs.rs:220:1
128 --> $DIR/malformed-attrs.rs:219:1
129129 |
130130LL | #[allow_internal_unsafe = 1]
131131 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -134,7 +134,7 @@ LL | #[allow_internal_unsafe = 1]
134134 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
135135
136136error[E0539]: malformed `windows_subsystem` attribute input
137 --> $DIR/malformed-attrs.rs:27:1
137 --> $DIR/malformed-attrs.rs:26:1
138138 |
139139LL | #![windows_subsystem]
140140 | ^^^-----------------^
......@@ -150,25 +150,25 @@ LL | #![windows_subsystem = "windows"]
150150 | +++++++++++
151151
152152error[E0539]: malformed `export_name` attribute input
153 --> $DIR/malformed-attrs.rs:30:1
153 --> $DIR/malformed-attrs.rs:29:1
154154 |
155155LL | #[unsafe(export_name)]
156156 | ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]`
157157
158158error: `rustc_allow_const_fn_unstable` expects a list of feature names
159 --> $DIR/malformed-attrs.rs:32:1
159 --> $DIR/malformed-attrs.rs:31:1
160160 |
161161LL | #[rustc_allow_const_fn_unstable]
162162 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
163163
164164error: `allow_internal_unstable` expects a list of feature names
165 --> $DIR/malformed-attrs.rs:35:1
165 --> $DIR/malformed-attrs.rs:34:1
166166 |
167167LL | #[allow_internal_unstable]
168168 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
169169
170170error[E0539]: malformed `rustc_confusables` attribute input
171 --> $DIR/malformed-attrs.rs:37:1
171 --> $DIR/malformed-attrs.rs:36:1
172172 |
173173LL | #[rustc_confusables]
174174 | ^^^^^^^^^^^^^^^^^^^^
......@@ -177,7 +177,7 @@ LL | #[rustc_confusables]
177177 | help: must be of the form: `#[rustc_confusables("name1", "name2", ...)]`
178178
179179error: `#[rustc_confusables]` attribute cannot be used on functions
180 --> $DIR/malformed-attrs.rs:37:1
180 --> $DIR/malformed-attrs.rs:36:1
181181 |
182182LL | #[rustc_confusables]
183183 | ^^^^^^^^^^^^^^^^^^^^
......@@ -185,7 +185,7 @@ LL | #[rustc_confusables]
185185 = help: `#[rustc_confusables]` can only be applied to inherent methods
186186
187187error[E0539]: malformed `deprecated` attribute input
188 --> $DIR/malformed-attrs.rs:40:1
188 --> $DIR/malformed-attrs.rs:39:1
189189 |
190190LL | #[deprecated = 5]
191191 | ^^^^^^^^^^^^^^^-^
......@@ -193,7 +193,7 @@ LL | #[deprecated = 5]
193193 | expected a string literal here
194194
195195error[E0539]: malformed `rustc_macro_transparency` attribute input
196 --> $DIR/malformed-attrs.rs:44:1
196 --> $DIR/malformed-attrs.rs:43:1
197197 |
198198LL | #[rustc_macro_transparency]
199199 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -208,7 +208,7 @@ LL | #[rustc_macro_transparency = "transparent"]
208208 | +++++++++++++++
209209
210210error: `#[rustc_macro_transparency]` attribute cannot be used on functions
211 --> $DIR/malformed-attrs.rs:44:1
211 --> $DIR/malformed-attrs.rs:43:1
212212 |
213213LL | #[rustc_macro_transparency]
214214 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -216,7 +216,7 @@ LL | #[rustc_macro_transparency]
216216 = help: `#[rustc_macro_transparency]` can only be applied to macro defs
217217
218218error[E0539]: malformed `repr` attribute input
219 --> $DIR/malformed-attrs.rs:47:1
219 --> $DIR/malformed-attrs.rs:46:1
220220 |
221221LL | #[repr]
222222 | ^^^^^^^ expected this to be a list
......@@ -224,7 +224,7 @@ LL | #[repr]
224224 = note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html#representations>
225225
226226error[E0565]: malformed `rustc_as_ptr` attribute input
227 --> $DIR/malformed-attrs.rs:50:1
227 --> $DIR/malformed-attrs.rs:49:1
228228 |
229229LL | #[rustc_as_ptr = 5]
230230 | ^^^^^^^^^^^^^^^---^
......@@ -233,7 +233,7 @@ LL | #[rustc_as_ptr = 5]
233233 | help: must be of the form: `#[rustc_as_ptr]`
234234
235235error[E0539]: malformed `rustc_align` attribute input
236 --> $DIR/malformed-attrs.rs:55:1
236 --> $DIR/malformed-attrs.rs:54:1
237237 |
238238LL | #[rustc_align]
239239 | ^^^^^^^^^^^^^^
......@@ -242,7 +242,7 @@ LL | #[rustc_align]
242242 | help: must be of the form: `#[rustc_align(<alignment in bytes>)]`
243243
244244error[E0539]: malformed `optimize` attribute input
245 --> $DIR/malformed-attrs.rs:57:1
245 --> $DIR/malformed-attrs.rs:56:1
246246 |
247247LL | #[optimize]
248248 | ^^^^^^^^^^^ expected this to be a list
......@@ -257,7 +257,7 @@ LL | #[optimize(speed)]
257257 | +++++++
258258
259259error[E0565]: malformed `cold` attribute input
260 --> $DIR/malformed-attrs.rs:59:1
260 --> $DIR/malformed-attrs.rs:58:1
261261 |
262262LL | #[cold = 1]
263263 | ^^^^^^^---^
......@@ -266,7 +266,7 @@ LL | #[cold = 1]
266266 | help: must be of the form: `#[cold]`
267267
268268error[E0539]: malformed `must_use` attribute input
269 --> $DIR/malformed-attrs.rs:61:1
269 --> $DIR/malformed-attrs.rs:60:1
270270 |
271271LL | #[must_use()]
272272 | ^^^^^^^^^^--^
......@@ -284,7 +284,7 @@ LL + #[must_use]
284284 |
285285
286286error[E0565]: malformed `no_mangle` attribute input
287 --> $DIR/malformed-attrs.rs:63:1
287 --> $DIR/malformed-attrs.rs:62:1
288288 |
289289LL | #[no_mangle = 1]
290290 | ^^^^^^^^^^^^---^
......@@ -293,7 +293,7 @@ LL | #[no_mangle = 1]
293293 | help: must be of the form: `#[no_mangle]`
294294
295295error[E0565]: malformed `naked` attribute input
296 --> $DIR/malformed-attrs.rs:65:1
296 --> $DIR/malformed-attrs.rs:64:1
297297 |
298298LL | #[unsafe(naked())]
299299 | ^^^^^^^^^^^^^^--^^
......@@ -302,7 +302,7 @@ LL | #[unsafe(naked())]
302302 | help: must be of the form: `#[naked]`
303303
304304error[E0565]: malformed `track_caller` attribute input
305 --> $DIR/malformed-attrs.rs:67:1
305 --> $DIR/malformed-attrs.rs:66:1
306306 |
307307LL | #[track_caller()]
308308 | ^^^^^^^^^^^^^^--^
......@@ -311,13 +311,13 @@ LL | #[track_caller()]
311311 | help: must be of the form: `#[track_caller]`
312312
313313error[E0539]: malformed `export_name` attribute input
314 --> $DIR/malformed-attrs.rs:69:1
314 --> $DIR/malformed-attrs.rs:68:1
315315 |
316316LL | #[export_name()]
317317 | ^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]`
318318
319319error[E0805]: malformed `used` attribute input
320 --> $DIR/malformed-attrs.rs:71:1
320 --> $DIR/malformed-attrs.rs:70:1
321321 |
322322LL | #[used()]
323323 | ^^^^^^--^
......@@ -335,7 +335,7 @@ LL + #[used]
335335 |
336336
337337error: `#[used]` attribute cannot be used on functions
338 --> $DIR/malformed-attrs.rs:71:1
338 --> $DIR/malformed-attrs.rs:70:1
339339 |
340340LL | #[used()]
341341 | ^^^^^^^^^
......@@ -343,13 +343,13 @@ LL | #[used()]
343343 = help: `#[used]` can only be applied to statics
344344
345345error[E0539]: malformed `crate_name` attribute input
346 --> $DIR/malformed-attrs.rs:74:1
346 --> $DIR/malformed-attrs.rs:73:1
347347 |
348348LL | #[crate_name]
349349 | ^^^^^^^^^^^^^ help: must be of the form: `#[crate_name = "name"]`
350350
351351error[E0539]: malformed `target_feature` attribute input
352 --> $DIR/malformed-attrs.rs:79:1
352 --> $DIR/malformed-attrs.rs:78:1
353353 |
354354LL | #[target_feature]
355355 | ^^^^^^^^^^^^^^^^^
......@@ -358,7 +358,7 @@ LL | #[target_feature]
358358 | help: must be of the form: `#[target_feature(enable = "feat1, feat2")]`
359359
360360error[E0565]: malformed `export_stable` attribute input
361 --> $DIR/malformed-attrs.rs:81:1
361 --> $DIR/malformed-attrs.rs:80:1
362362 |
363363LL | #[export_stable = 1]
364364 | ^^^^^^^^^^^^^^^^---^
......@@ -367,7 +367,7 @@ LL | #[export_stable = 1]
367367 | help: must be of the form: `#[export_stable]`
368368
369369error[E0539]: malformed `link` attribute input
370 --> $DIR/malformed-attrs.rs:83:1
370 --> $DIR/malformed-attrs.rs:82:1
371371 |
372372LL | #[link]
373373 | ^^^^^^^ expected this to be a list
......@@ -375,7 +375,7 @@ LL | #[link]
375375 = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
376376
377377error[E0539]: malformed `link_name` attribute input
378 --> $DIR/malformed-attrs.rs:87:1
378 --> $DIR/malformed-attrs.rs:86:1
379379 |
380380LL | #[link_name]
381381 | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]`
......@@ -383,7 +383,7 @@ LL | #[link_name]
383383 = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_name-attribute>
384384
385385error[E0539]: malformed `link_section` attribute input
386 --> $DIR/malformed-attrs.rs:91:1
386 --> $DIR/malformed-attrs.rs:90:1
387387 |
388388LL | #[link_section]
389389 | ^^^^^^^^^^^^^^^ help: must be of the form: `#[link_section = "name"]`
......@@ -391,7 +391,7 @@ LL | #[link_section]
391391 = note: for more information, visit <https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute>
392392
393393error[E0539]: malformed `coverage` attribute input
394 --> $DIR/malformed-attrs.rs:93:1
394 --> $DIR/malformed-attrs.rs:92:1
395395 |
396396LL | #[coverage]
397397 | ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
......@@ -404,13 +404,13 @@ LL | #[coverage(on)]
404404 | ++++
405405
406406error[E0539]: malformed `sanitize` attribute input
407 --> $DIR/malformed-attrs.rs:95:1
407 --> $DIR/malformed-attrs.rs:94:1
408408 |
409409LL | #[sanitize]
410410 | ^^^^^^^^^^^ expected this to be a list
411411
412412error[E0565]: malformed `no_implicit_prelude` attribute input
413 --> $DIR/malformed-attrs.rs:100:1
413 --> $DIR/malformed-attrs.rs:99:1
414414 |
415415LL | #[no_implicit_prelude = 23]
416416 | ^^^^^^^^^^^^^^^^^^^^^^----^
......@@ -419,7 +419,7 @@ LL | #[no_implicit_prelude = 23]
419419 | help: must be of the form: `#[no_implicit_prelude]`
420420
421421error[E0565]: malformed `proc_macro` attribute input
422 --> $DIR/malformed-attrs.rs:104:1
422 --> $DIR/malformed-attrs.rs:103:1
423423 |
424424LL | #[proc_macro = 18]
425425 | ^^^^^^^^^^^^^----^
......@@ -428,7 +428,7 @@ LL | #[proc_macro = 18]
428428 | help: must be of the form: `#[proc_macro]`
429429
430430error[E0539]: malformed `instruction_set` attribute input
431 --> $DIR/malformed-attrs.rs:111:1
431 --> $DIR/malformed-attrs.rs:110:1
432432 |
433433LL | #[instruction_set]
434434 | ^^^^^^^^^^^^^^^^^^
......@@ -439,7 +439,7 @@ LL | #[instruction_set]
439439 = note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-instruction_set-attribute>
440440
441441error[E0539]: malformed `patchable_function_entry` attribute input
442 --> $DIR/malformed-attrs.rs:113:1
442 --> $DIR/malformed-attrs.rs:112:1
443443 |
444444LL | #[patchable_function_entry]
445445 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -448,7 +448,7 @@ LL | #[patchable_function_entry]
448448 | help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]`
449449
450450error[E0565]: malformed `coroutine` attribute input
451 --> $DIR/malformed-attrs.rs:116:5
451 --> $DIR/malformed-attrs.rs:115:5
452452 |
453453LL | #[coroutine = 63] || {}
454454 | ^^^^^^^^^^^^----^
......@@ -457,7 +457,7 @@ LL | #[coroutine = 63] || {}
457457 | help: must be of the form: `#[coroutine]`
458458
459459error[E0565]: malformed `proc_macro_attribute` attribute input
460 --> $DIR/malformed-attrs.rs:121:1
460 --> $DIR/malformed-attrs.rs:120:1
461461 |
462462LL | #[proc_macro_attribute = 19]
463463 | ^^^^^^^^^^^^^^^^^^^^^^^----^
......@@ -466,7 +466,7 @@ LL | #[proc_macro_attribute = 19]
466466 | help: must be of the form: `#[proc_macro_attribute]`
467467
468468error[E0539]: malformed `must_use` attribute input
469 --> $DIR/malformed-attrs.rs:124:1
469 --> $DIR/malformed-attrs.rs:123:1
470470 |
471471LL | #[must_use = 1]
472472 | ^^^^^^^^^^^^^-^
......@@ -484,7 +484,7 @@ LL + #[must_use]
484484 |
485485
486486error[E0539]: malformed `proc_macro_derive` attribute input
487 --> $DIR/malformed-attrs.rs:128:1
487 --> $DIR/malformed-attrs.rs:127:1
488488 |
489489LL | #[proc_macro_derive]
490490 | ^^^^^^^^^^^^^^^^^^^^ expected this to be a list
......@@ -498,7 +498,7 @@ LL | #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
498498 | ++++++++++++++++++++++++++++++++++++++++++
499499
500500error[E0539]: malformed `rustc_layout_scalar_valid_range_start` attribute input
501 --> $DIR/malformed-attrs.rs:133:1
501 --> $DIR/malformed-attrs.rs:132:1
502502 |
503503LL | #[rustc_layout_scalar_valid_range_start]
504504 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -507,7 +507,7 @@ LL | #[rustc_layout_scalar_valid_range_start]
507507 | help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]`
508508
509509error[E0539]: malformed `rustc_layout_scalar_valid_range_end` attribute input
510 --> $DIR/malformed-attrs.rs:135:1
510 --> $DIR/malformed-attrs.rs:134:1
511511 |
512512LL | #[rustc_layout_scalar_valid_range_end]
513513 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -516,7 +516,7 @@ LL | #[rustc_layout_scalar_valid_range_end]
516516 | help: must be of the form: `#[rustc_layout_scalar_valid_range_end(end)]`
517517
518518error[E0539]: malformed `must_not_suspend` attribute input
519 --> $DIR/malformed-attrs.rs:137:1
519 --> $DIR/malformed-attrs.rs:136:1
520520 |
521521LL | #[must_not_suspend()]
522522 | ^^^^^^^^^^^^^^^^^^--^
......@@ -532,7 +532,7 @@ LL + #[must_not_suspend]
532532 |
533533
534534error[E0539]: malformed `cfi_encoding` attribute input
535 --> $DIR/malformed-attrs.rs:139:1
535 --> $DIR/malformed-attrs.rs:138:1
536536 |
537537LL | #[cfi_encoding = ""]
538538 | ^^^^^^^^^^^^^^^^^--^
......@@ -541,7 +541,7 @@ LL | #[cfi_encoding = ""]
541541 | help: must be of the form: `#[cfi_encoding = "encoding"]`
542542
543543error[E0565]: malformed `marker` attribute input
544 --> $DIR/malformed-attrs.rs:158:1
544 --> $DIR/malformed-attrs.rs:157:1
545545 |
546546LL | #[marker = 3]
547547 | ^^^^^^^^^---^
......@@ -550,7 +550,7 @@ LL | #[marker = 3]
550550 | help: must be of the form: `#[marker]`
551551
552552error[E0565]: malformed `fundamental` attribute input
553 --> $DIR/malformed-attrs.rs:160:1
553 --> $DIR/malformed-attrs.rs:159:1
554554 |
555555LL | #[fundamental()]
556556 | ^^^^^^^^^^^^^--^
......@@ -559,7 +559,7 @@ LL | #[fundamental()]
559559 | help: must be of the form: `#[fundamental]`
560560
561561error[E0565]: malformed `ffi_pure` attribute input
562 --> $DIR/malformed-attrs.rs:168:5
562 --> $DIR/malformed-attrs.rs:167:5
563563 |
564564LL | #[unsafe(ffi_pure = 1)]
565565 | ^^^^^^^^^^^^^^^^^^---^^
......@@ -568,7 +568,7 @@ LL | #[unsafe(ffi_pure = 1)]
568568 | help: must be of the form: `#[ffi_pure]`
569569
570570error[E0539]: malformed `link_ordinal` attribute input
571 --> $DIR/malformed-attrs.rs:170:5
571 --> $DIR/malformed-attrs.rs:169:5
572572 |
573573LL | #[link_ordinal]
574574 | ^^^^^^^^^^^^^^^
......@@ -579,7 +579,7 @@ LL | #[link_ordinal]
579579 = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute>
580580
581581error[E0565]: malformed `ffi_const` attribute input
582 --> $DIR/malformed-attrs.rs:174:5
582 --> $DIR/malformed-attrs.rs:173:5
583583 |
584584LL | #[unsafe(ffi_const = 1)]
585585 | ^^^^^^^^^^^^^^^^^^^---^^
......@@ -588,13 +588,13 @@ LL | #[unsafe(ffi_const = 1)]
588588 | help: must be of the form: `#[ffi_const]`
589589
590590error[E0539]: malformed `linkage` attribute input
591 --> $DIR/malformed-attrs.rs:176:5
591 --> $DIR/malformed-attrs.rs:175:5
592592 |
593593LL | #[linkage]
594594 | ^^^^^^^^^^ expected this to be of the form `linkage = "..."`
595595
596596error[E0539]: malformed `debugger_visualizer` attribute input
597 --> $DIR/malformed-attrs.rs:191:1
597 --> $DIR/malformed-attrs.rs:190:1
598598 |
599599LL | #[debugger_visualizer]
600600 | ^^^^^^^^^^^^^^^^^^^^^^
......@@ -605,7 +605,7 @@ LL | #[debugger_visualizer]
605605 = note: for more information, visit <https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute>
606606
607607error[E0565]: malformed `automatically_derived` attribute input
608 --> $DIR/malformed-attrs.rs:193:1
608 --> $DIR/malformed-attrs.rs:192:1
609609 |
610610LL | #[automatically_derived = 18]
611611 | ^^^^^^^^^^^^^^^^^^^^^^^^----^
......@@ -614,7 +614,7 @@ LL | #[automatically_derived = 18]
614614 | help: must be of the form: `#[automatically_derived]`
615615
616616error[E0565]: malformed `non_exhaustive` attribute input
617 --> $DIR/malformed-attrs.rs:201:1
617 --> $DIR/malformed-attrs.rs:200:1
618618 |
619619LL | #[non_exhaustive = 1]
620620 | ^^^^^^^^^^^^^^^^^---^
......@@ -623,7 +623,7 @@ LL | #[non_exhaustive = 1]
623623 | help: must be of the form: `#[non_exhaustive]`
624624
625625error[E0565]: malformed `thread_local` attribute input
626 --> $DIR/malformed-attrs.rs:207:1
626 --> $DIR/malformed-attrs.rs:206:1
627627 |
628628LL | #[thread_local()]
629629 | ^^^^^^^^^^^^^^--^
......@@ -632,7 +632,7 @@ LL | #[thread_local()]
632632 | help: must be of the form: `#[thread_local]`
633633
634634error[E0565]: malformed `no_link` attribute input
635 --> $DIR/malformed-attrs.rs:211:1
635 --> $DIR/malformed-attrs.rs:210:1
636636 |
637637LL | #[no_link()]
638638 | ^^^^^^^^^--^
......@@ -641,7 +641,7 @@ LL | #[no_link()]
641641 | help: must be of the form: `#[no_link]`
642642
643643error[E0539]: malformed `macro_use` attribute input
644 --> $DIR/malformed-attrs.rs:213:1
644 --> $DIR/malformed-attrs.rs:212:1
645645 |
646646LL | #[macro_use = 1]
647647 | ^^^^^^^^^^^^---^
......@@ -659,7 +659,7 @@ LL + #[macro_use]
659659 |
660660
661661error[E0539]: malformed `macro_export` attribute input
662 --> $DIR/malformed-attrs.rs:218:1
662 --> $DIR/malformed-attrs.rs:217:1
663663 |
664664LL | #[macro_export = 18]
665665 | ^^^^^^^^^^^^^^^----^
......@@ -676,7 +676,7 @@ LL + #[macro_export]
676676 |
677677
678678error[E0565]: malformed `allow_internal_unsafe` attribute input
679 --> $DIR/malformed-attrs.rs:220:1
679 --> $DIR/malformed-attrs.rs:219:1
680680 |
681681LL | #[allow_internal_unsafe = 1]
682682 | ^^^^^^^^^^^^^^^^^^^^^^^^---^
......@@ -685,7 +685,7 @@ LL | #[allow_internal_unsafe = 1]
685685 | help: must be of the form: `#[allow_internal_unsafe]`
686686
687687error: attribute should be applied to `const fn`
688 --> $DIR/malformed-attrs.rs:32:1
688 --> $DIR/malformed-attrs.rs:31:1
689689 |
690690LL | #[rustc_allow_const_fn_unstable]
691691 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -697,7 +697,7 @@ LL | | }
697697 | |_- not a `const fn`
698698
699699warning: attribute should be applied to an `extern` block with non-Rust ABI
700 --> $DIR/malformed-attrs.rs:83:1
700 --> $DIR/malformed-attrs.rs:82:1
701701 |
702702LL | #[link]
703703 | ^^^^^^^
......@@ -712,19 +712,19 @@ LL | | }
712712 = note: requested on the command line with `-W unused-attributes`
713713
714714error: `#[repr(align(...))]` is not supported on functions
715 --> $DIR/malformed-attrs.rs:47:1
715 --> $DIR/malformed-attrs.rs:46:1
716716 |
717717LL | #[repr]
718718 | ^^^^^^^
719719 |
720720help: use `#[rustc_align(...)]` instead
721 --> $DIR/malformed-attrs.rs:47:1
721 --> $DIR/malformed-attrs.rs:46:1
722722 |
723723LL | #[repr]
724724 | ^^^^^^^
725725
726726warning: missing options for `on_unimplemented` attribute
727 --> $DIR/malformed-attrs.rs:143:1
727 --> $DIR/malformed-attrs.rs:142:1
728728 |
729729LL | #[diagnostic::on_unimplemented]
730730 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -733,7 +733,7 @@ LL | #[diagnostic::on_unimplemented]
733733 = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default
734734
735735warning: malformed `on_unimplemented` attribute
736 --> $DIR/malformed-attrs.rs:145:1
736 --> $DIR/malformed-attrs.rs:144:1
737737 |
738738LL | #[diagnostic::on_unimplemented = 1]
739739 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
......@@ -741,7 +741,7 @@ LL | #[diagnostic::on_unimplemented = 1]
741741 = help: only `message`, `note` and `label` are allowed as options
742742
743743error: 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)]`
744 --> $DIR/malformed-attrs.rs:42:1
744 --> $DIR/malformed-attrs.rs:41:1
745745 |
746746LL | #[doc]
747747 | ^^^^^^
......@@ -753,7 +753,7 @@ LL | #![deny(invalid_doc_attributes)]
753753 | ^^^^^^^^^^^^^^^^^^^^^^
754754
755755error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]`
756 --> $DIR/malformed-attrs.rs:52:1
756 --> $DIR/malformed-attrs.rs:51:1
757757 |
758758LL | #[inline = 5]
759759 | ^^^^^^^^^^^^^
......@@ -763,13 +763,13 @@ LL | #[inline = 5]
763763 = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
764764
765765warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]`
766 --> $DIR/malformed-attrs.rs:74:1
766 --> $DIR/malformed-attrs.rs:73:1
767767 |
768768LL | #[crate_name]
769769 | ^^^^^^^^^^^^^
770770 |
771771note: this attribute does not have an `!`, which means it is applied to this function
772 --> $DIR/malformed-attrs.rs:115:1
772 --> $DIR/malformed-attrs.rs:114:1
773773 |
774774LL | / fn test() {
775775LL | | #[coroutine = 63] || {}
......@@ -778,13 +778,13 @@ LL | | }
778778 | |_^
779779
780780error: 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)]`
781 --> $DIR/malformed-attrs.rs:77:1
781 --> $DIR/malformed-attrs.rs:76:1
782782 |
783783LL | #[doc]
784784 | ^^^^^^
785785
786786warning: `#[link_name]` attribute cannot be used on functions
787 --> $DIR/malformed-attrs.rs:87:1
787 --> $DIR/malformed-attrs.rs:86:1
788788 |
789789LL | #[link_name]
790790 | ^^^^^^^^^^^^
......@@ -793,7 +793,7 @@ LL | #[link_name]
793793 = help: `#[link_name]` can be applied to foreign functions and foreign statics
794794
795795error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
796 --> $DIR/malformed-attrs.rs:97:1
796 --> $DIR/malformed-attrs.rs:96:1
797797 |
798798LL | #[ignore()]
799799 | ^^^^^^^^^^^
......@@ -802,7 +802,7 @@ LL | #[ignore()]
802802 = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
803803
804804warning: `#[no_implicit_prelude]` attribute cannot be used on functions
805 --> $DIR/malformed-attrs.rs:100:1
805 --> $DIR/malformed-attrs.rs:99:1
806806 |
807807LL | #[no_implicit_prelude = 23]
808808 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -811,13 +811,13 @@ LL | #[no_implicit_prelude = 23]
811811 = help: `#[no_implicit_prelude]` can be applied to crates and modules
812812
813813warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
814 --> $DIR/malformed-attrs.rs:152:1
814 --> $DIR/malformed-attrs.rs:151:1
815815 |
816816LL | #[diagnostic::do_not_recommend()]
817817 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
818818
819819warning: `#[automatically_derived]` attribute cannot be used on modules
820 --> $DIR/malformed-attrs.rs:193:1
820 --> $DIR/malformed-attrs.rs:192:1
821821 |
822822LL | #[automatically_derived = 18]
823823 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -826,7 +826,7 @@ LL | #[automatically_derived = 18]
826826 = help: `#[automatically_derived]` can only be applied to trait impl blocks
827827
828828error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
829 --> $DIR/malformed-attrs.rs:227:1
829 --> $DIR/malformed-attrs.rs:226:1
830830 |
831831LL | #[ignore = 1]
832832 | ^^^^^^^^^^^^^
......@@ -835,7 +835,7 @@ LL | #[ignore = 1]
835835 = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
836836
837837error[E0308]: mismatched types
838 --> $DIR/malformed-attrs.rs:116:23
838 --> $DIR/malformed-attrs.rs:115:23
839839 |
840840LL | fn test() {
841841 | - help: a return type might be missing here: `-> _`
......@@ -843,7 +843,7 @@ LL | #[coroutine = 63] || {}
843843 | ^^^^^ expected `()`, found coroutine
844844 |
845845 = note: expected unit type `()`
846 found coroutine `{coroutine@$DIR/malformed-attrs.rs:116:23: 116:25}`
846 found coroutine `{coroutine@$DIR/malformed-attrs.rs:115:23: 115:25}`
847847
848848error: aborting due to 75 previous errors; 8 warnings emitted
849849
......@@ -851,7 +851,7 @@ Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805
851851For more information about an error, try `rustc --explain E0308`.
852852Future incompatibility report: Future breakage diagnostic:
853853error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]`
854 --> $DIR/malformed-attrs.rs:52:1
854 --> $DIR/malformed-attrs.rs:51:1
855855 |
856856LL | #[inline = 5]
857857 | ^^^^^^^^^^^^^
......@@ -862,7 +862,7 @@ LL | #[inline = 5]
862862
863863Future breakage diagnostic:
864864error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
865 --> $DIR/malformed-attrs.rs:97:1
865 --> $DIR/malformed-attrs.rs:96:1
866866 |
867867LL | #[ignore()]
868868 | ^^^^^^^^^^^
......@@ -873,7 +873,7 @@ LL | #[ignore()]
873873
874874Future breakage diagnostic:
875875error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
876 --> $DIR/malformed-attrs.rs:227:1
876 --> $DIR/malformed-attrs.rs:226:1
877877 |
878878LL | #[ignore = 1]
879879 | ^^^^^^^^^^^^^
tests/ui/attributes/use-doc-alias-name.rs+2-2
......@@ -42,7 +42,7 @@ fn main() {
4242 //~| HELP: `S5` has a name defined in the doc alias attribute as `DocAliasS5`
4343
4444 not_exist_module::DocAliasS1;
45 //~^ ERROR: use of unresolved module or unlinked crate `not_exist_module`
45 //~^ ERROR: cannot find module or crate `not_exist_module`
4646 //~| HELP: you might be missing a crate named `not_exist_module`
4747
4848 use_doc_alias_name_extern::DocAliasS1;
......@@ -50,7 +50,7 @@ fn main() {
5050 //~| HELP: `S1` has a name defined in the doc alias attribute as `DocAliasS1`
5151
5252 m::n::DocAliasX::y::S6;
53 //~^ ERROR: could not find `DocAliasX` in `n`
53 //~^ ERROR: cannot find `DocAliasX` in `n`
5454 //~| HELP: `x` has a name defined in the doc alias attribute as `DocAliasX`
5555
5656 m::n::x::y::DocAliasS6;
tests/ui/attributes/use-doc-alias-name.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: could not find `DocAliasX` in `n`
1error[E0433]: cannot find `DocAliasX` in `n`
22 --> $DIR/use-doc-alias-name.rs:52:11
33 |
44LL | m::n::DocAliasX::y::S6;
......@@ -136,7 +136,7 @@ LL - doc_alias_f2();
136136LL + f();
137137 |
138138
139error[E0433]: failed to resolve: use of unresolved module or unlinked crate `not_exist_module`
139error[E0433]: cannot find module or crate `not_exist_module` in this scope
140140 --> $DIR/use-doc-alias-name.rs:44:5
141141 |
142142LL | not_exist_module::DocAliasS1;
tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.rs+2-2
......@@ -4,9 +4,9 @@
44
55fn main() {
66 let mut a = E::StructVar { boxed: Box::new(5_i32) };
7 //~^ ERROR failed to resolve: use of undeclared type `E`
7 //~^ ERROR cannot find type `E`
88 match a {
99 E::StructVar { box boxed } => { }
10 //~^ ERROR failed to resolve: use of undeclared type `E`
10 //~^ ERROR cannot find type `E`
1111 }
1212}
tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of undeclared type `E`
1error[E0433]: cannot find type `E` in this scope
22 --> $DIR/non-ADT-struct-pattern-box-pattern-ice-121463.rs:6:17
33 |
44LL | let mut a = E::StructVar { boxed: Box::new(5_i32) };
......@@ -9,7 +9,7 @@ help: a trait with a similar name exists
99LL | let mut a = Eq::StructVar { boxed: Box::new(5_i32) };
1010 | +
1111
12error[E0433]: failed to resolve: use of undeclared type `E`
12error[E0433]: cannot find type `E` in this scope
1313 --> $DIR/non-ADT-struct-pattern-box-pattern-ice-121463.rs:9:9
1414 |
1515LL | E::StructVar { box boxed } => { }
tests/ui/cfg/diagnostics-cross-crate.rs+1-1
......@@ -14,7 +14,7 @@ fn main() {
1414
1515 // The module isn't found - we would like to get a diagnostic, but currently don't due to
1616 // the awkward way the resolver diagnostics are currently implemented.
17 cfged_out::inner::doesnt_exist::hello(); //~ ERROR failed to resolve
17 cfged_out::inner::doesnt_exist::hello(); //~ ERROR cannot find
1818 //~^ NOTE could not find `doesnt_exist` in `inner`
1919 //~| NOTE found an item that was configured out
2020
tests/ui/cfg/diagnostics-cross-crate.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: could not find `doesnt_exist` in `inner`
1error[E0433]: cannot find `doesnt_exist` in `inner`
22 --> $DIR/diagnostics-cross-crate.rs:17:23
33 |
44LL | cfged_out::inner::doesnt_exist::hello();
tests/ui/cfg/diagnostics-reexport-2.rs+5-5
......@@ -40,22 +40,22 @@ mod reexport32 {
4040
4141fn main() {
4242 reexport::gated::foo();
43 //~^ ERROR failed to resolve: could not find `gated` in `reexport`
43 //~^ ERROR cannot find
4444 //~| NOTE could not find `gated` in `reexport`
4545
4646 reexport2::gated::foo();
47 //~^ ERROR failed to resolve: could not find `gated` in `reexport2`
47 //~^ ERROR cannot find
4848 //~| NOTE could not find `gated` in `reexport2`
4949
5050 reexport30::gated::foo();
51 //~^ ERROR failed to resolve: could not find `gated` in `reexport30`
51 //~^ ERROR cannot find
5252 //~| NOTE could not find `gated` in `reexport30`
5353
5454 reexport31::gated::foo();
55 //~^ ERROR failed to resolve: could not find `gated` in `reexport31`
55 //~^ ERROR cannot find
5656 //~| NOTE could not find `gated` in `reexport31`
5757
5858 reexport32::gated::foo();
59 //~^ ERROR failed to resolve: could not find `gated` in `reexport32`
59 //~^ ERROR cannot find
6060 //~| NOTE could not find `gated` in `reexport32`
6161}
tests/ui/cfg/diagnostics-reexport-2.stderr+5-5
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: could not find `gated` in `reexport`
1error[E0433]: cannot find `gated` in `reexport`
22 --> $DIR/diagnostics-reexport-2.rs:42:15
33 |
44LL | reexport::gated::foo();
......@@ -13,7 +13,7 @@ LL | #[cfg(false)]
1313LL | pub mod gated {
1414 | ^^^^^
1515
16error[E0433]: failed to resolve: could not find `gated` in `reexport2`
16error[E0433]: cannot find `gated` in `reexport2`
1717 --> $DIR/diagnostics-reexport-2.rs:46:16
1818 |
1919LL | reexport2::gated::foo();
......@@ -28,7 +28,7 @@ LL | #[cfg(false)]
2828LL | pub mod gated {
2929 | ^^^^^
3030
31error[E0433]: failed to resolve: could not find `gated` in `reexport30`
31error[E0433]: cannot find `gated` in `reexport30`
3232 --> $DIR/diagnostics-reexport-2.rs:50:17
3333 |
3434LL | reexport30::gated::foo();
......@@ -43,7 +43,7 @@ LL | #[cfg(false)]
4343LL | pub mod gated {
4444 | ^^^^^
4545
46error[E0433]: failed to resolve: could not find `gated` in `reexport31`
46error[E0433]: cannot find `gated` in `reexport31`
4747 --> $DIR/diagnostics-reexport-2.rs:54:17
4848 |
4949LL | reexport31::gated::foo();
......@@ -58,7 +58,7 @@ LL | #[cfg(false)]
5858LL | pub mod gated {
5959 | ^^^^^
6060
61error[E0433]: failed to resolve: could not find `gated` in `reexport32`
61error[E0433]: cannot find `gated` in `reexport32`
6262 --> $DIR/diagnostics-reexport-2.rs:58:17
6363 |
6464LL | reexport32::gated::foo();
tests/ui/cfg/diagnostics-same-crate.rs+1-1
......@@ -50,7 +50,7 @@ fn main() {
5050 //~| NOTE not found in `inner`
5151
5252 // The module isn't found - we get a diagnostic.
53 inner::doesnt_exist::hello(); //~ ERROR failed to resolve
53 inner::doesnt_exist::hello(); //~ ERROR cannot find
5454 //~| NOTE could not find `doesnt_exist` in `inner`
5555
5656 // It should find the one in the right module, not the wrong one.
tests/ui/cfg/diagnostics-same-crate.stderr+1-1
......@@ -28,7 +28,7 @@ LL | #[cfg(false)]
2828LL | pub mod doesnt_exist {
2929 | ^^^^^^^^^^^^
3030
31error[E0433]: failed to resolve: could not find `doesnt_exist` in `inner`
31error[E0433]: cannot find `doesnt_exist` in `inner`
3232 --> $DIR/diagnostics-same-crate.rs:53:12
3333 |
3434LL | inner::doesnt_exist::hello();
tests/ui/coherence/conflicting-impl-with-err.rs+2-2
......@@ -1,8 +1,8 @@
11struct ErrorKind;
22struct Error(ErrorKind);
33
4impl From<nope::Thing> for Error { //~ ERROR failed to resolve
5 fn from(_: nope::Thing) -> Self { //~ ERROR failed to resolve
4impl From<nope::Thing> for Error { //~ ERROR cannot find
5 fn from(_: nope::Thing) -> Self { //~ ERROR cannot find
66 unimplemented!()
77 }
88}
tests/ui/coherence/conflicting-impl-with-err.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nope`
1error[E0433]: cannot find module or crate `nope` in this scope
22 --> $DIR/conflicting-impl-with-err.rs:4:11
33 |
44LL | impl From<nope::Thing> for Error {
......@@ -6,7 +6,7 @@ LL | impl From<nope::Thing> for Error {
66 |
77 = help: you might be missing a crate named `nope`
88
9error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nope`
9error[E0433]: cannot find module or crate `nope` in this scope
1010 --> $DIR/conflicting-impl-with-err.rs:5:16
1111 |
1212LL | fn from(_: nope::Thing) -> Self {
tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.rs+1-1
......@@ -11,7 +11,7 @@ where
1111 //~^ ERROR only lifetime parameters can be used in this context
1212 //~| ERROR defaults for generic parameters are not allowed in `for<...>` binders
1313 //~| ERROR defaults for generic parameters are not allowed in `for<...>` binders
14 //~| ERROR failed to resolve: use of undeclared type `COT`
14 //~| ERROR cannot find
1515 //~| ERROR the name `N` is already used for a generic parameter in this item's generic parameters
1616{
1717}
tests/ui/const-generics/generic_const_exprs/ice-predicates-of-no-entry-found-for-key-119275.stderr+1-1
......@@ -43,7 +43,7 @@ error: defaults for generic parameters are not allowed in `for<...>` binders
4343LL | for<const N: usize = 3, T = u32> [(); COT::BYTES]:,
4444 | ^^^^^^^
4545
46error[E0433]: failed to resolve: use of undeclared type `COT`
46error[E0433]: cannot find type `COT` in this scope
4747 --> $DIR/ice-predicates-of-no-entry-found-for-key-119275.rs:10:43
4848 |
4949LL | for<const N: usize = 3, T = u32> [(); COT::BYTES]:,
tests/ui/const-generics/issues/issue-82956.rs+1-1
......@@ -24,7 +24,7 @@ where
2424
2525 fn pop(self) -> (Self::Newlen, Self::Output) {
2626 let mut iter = IntoIter::new(self);
27 //~^ ERROR: failed to resolve: use of undeclared type `IntoIter`
27 //~^ ERROR: cannot find
2828 let end = iter.next_back().unwrap();
2929 let new = [(); N - 1].map(move |()| iter.next().unwrap());
3030 (new, end)
tests/ui/const-generics/issues/issue-82956.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of undeclared type `IntoIter`
1error[E0433]: cannot find type `IntoIter` in this scope
22 --> $DIR/issue-82956.rs:26:24
33 |
44LL | let mut iter = IntoIter::new(self);
tests/ui/consts/const_refs_to_static-ice-121413.rs+1-1
......@@ -7,7 +7,7 @@
77const REF_INTERIOR_MUT: &usize = {
88 //~^ HELP consider importing this struct
99 static FOO: Sync = AtomicUsize::new(0);
10 //~^ ERROR failed to resolve: use of undeclared type `AtomicUsize`
10 //~^ ERROR cannot find
1111 //~| WARN trait objects without an explicit `dyn` are deprecated
1212 //~| ERROR the size for values of type `(dyn Sync + 'static)` cannot be known at compilation time
1313 //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
tests/ui/consts/const_refs_to_static-ice-121413.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of undeclared type `AtomicUsize`
1error[E0433]: cannot find type `AtomicUsize` in this scope
22 --> $DIR/const_refs_to_static-ice-121413.rs:9:24
33 |
44LL | static FOO: Sync = AtomicUsize::new(0);
tests/ui/consts/precise-drop-allow-const-fn-unstable.rs+1-1
......@@ -2,7 +2,7 @@
22//@ compile-flags: --crate-type=lib -Cinstrument-coverage -Zno-profiler-runtime
33//@[allow] check-pass
44
5#![feature(staged_api, rustc_allow_const_fn_unstable)]
5#![feature(staged_api, rustc_attrs)]
66#![stable(feature = "rust_test", since = "1.0.0")]
77
88#[stable(feature = "rust_test", since = "1.0.0")]
tests/ui/delegation/bad-resolve.rs+1-1
......@@ -40,7 +40,7 @@ impl Trait for S {
4040}
4141
4242mod prefix {}
43reuse unresolved_prefix::{a, b, c}; //~ ERROR use of unresolved module or unlinked crate
43reuse unresolved_prefix::{a, b, c}; //~ ERROR cannot find module or crate `unresolved_prefix`
4444reuse prefix::{self, super, crate}; //~ ERROR `crate` in paths can only be used in start position
4545
4646fn main() {}
tests/ui/delegation/bad-resolve.stderr+3-3
......@@ -91,7 +91,7 @@ LL | type Type;
9191LL | impl Trait for S {
9292 | ^^^^^^^^^^^^^^^^ missing `Type` in implementation
9393
94error[E0433]: failed to resolve: use of unresolved module or unlinked crate `unresolved_prefix`
94error[E0433]: cannot find module or crate `unresolved_prefix` in this scope
9595 --> $DIR/bad-resolve.rs:43:7
9696 |
9797LL | reuse unresolved_prefix::{a, b, c};
......@@ -99,11 +99,11 @@ LL | reuse unresolved_prefix::{a, b, c};
9999 |
100100 = help: you might be missing a crate named `unresolved_prefix`
101101
102error[E0433]: failed to resolve: `crate` in paths can only be used in start position
102error[E0433]: `crate` in paths can only be used in start position
103103 --> $DIR/bad-resolve.rs:44:29
104104 |
105105LL | reuse prefix::{self, super, crate};
106 | ^^^^^ `crate` in paths can only be used in start position
106 | ^^^^^ can only be used in path start position
107107
108108error: aborting due to 12 previous errors
109109
tests/ui/delegation/glob-bad-path.rs+1-1
......@@ -5,7 +5,7 @@ trait Trait {}
55struct S;
66
77impl Trait for u8 {
8 reuse unresolved::*; //~ ERROR failed to resolve: use of unresolved module or unlinked crate `unresolved`
8 reuse unresolved::*; //~ ERROR cannot find module or crate `unresolved`
99 reuse S::*; //~ ERROR expected trait, found struct `S`
1010}
1111
tests/ui/delegation/glob-bad-path.stderr+1-1
......@@ -4,7 +4,7 @@ error: expected trait, found struct `S`
44LL | reuse S::*;
55 | ^ not a trait
66
7error[E0433]: failed to resolve: use of unresolved module or unlinked crate `unresolved`
7error[E0433]: cannot find module or crate `unresolved` in this scope
88 --> $DIR/glob-bad-path.rs:8:11
99 |
1010LL | reuse unresolved::*;
tests/ui/delegation/impl-reuse-bad-path.rs+1-1
......@@ -4,7 +4,7 @@
44mod unresolved {
55 struct S;
66 reuse impl unresolved for S { self.0 }
7 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `unresolved`
7 //~^ ERROR cannot find module or crate `unresolved` in this scope
88 //~| ERROR cannot find trait `unresolved` in this scope
99
1010 trait T {}
tests/ui/delegation/impl-reuse-bad-path.stderr+1-1
......@@ -16,7 +16,7 @@ error: expected trait, found module `TraitModule`
1616LL | reuse impl TraitModule for S { self.0 }
1717 | ^^^^^^^^^^^ not a trait
1818
19error[E0433]: failed to resolve: use of unresolved module or unlinked crate `unresolved`
19error[E0433]: cannot find module or crate `unresolved` in this scope
2020 --> $DIR/impl-reuse-bad-path.rs:6:16
2121 |
2222LL | reuse impl unresolved for S { self.0 }
tests/ui/derived-errors/issue-31997-1.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of undeclared type `HashMap`
1error[E0433]: cannot find type `HashMap` in this scope
22 --> $DIR/issue-31997-1.rs:20:19
33 |
44LL | let mut map = HashMap::new();
tests/ui/dollar-crate/dollar-crate-is-keyword-2.rs+9-3
......@@ -2,12 +2,18 @@ mod a {}
22
33macro_rules! m {
44 () => {
5 use a::$crate; //~ ERROR unresolved import `a::$crate`
6 use a::$crate::b; //~ ERROR `$crate` in paths can only be used in start position
7 type A = a::$crate; //~ ERROR `$crate` in paths can only be used in start position
5 use a::$crate; //~ ERROR: unresolved import `a::$crate`
6 //~^ NOTE: no `$crate` in `a`
7 use a::$crate::b; //~ ERROR: `$crate` in paths can only be used in start position
8 //~^ NOTE: can only be used in path start position
9 type A = a::$crate; //~ ERROR: `$crate` in paths can only be used in start position
10 //~^ NOTE: can only be used in path start position
811 }
912}
1013
1114m!();
15//~^ NOTE: in this expansion
16//~| NOTE: in this expansion
17//~| NOTE: in this expansion
1218
1319fn main() {}
tests/ui/dollar-crate/dollar-crate-is-keyword-2.stderr+6-6
......@@ -1,8 +1,8 @@
1error[E0433]: failed to resolve: `$crate` in paths can only be used in start position
2 --> $DIR/dollar-crate-is-keyword-2.rs:6:16
1error[E0433]: `$crate` in paths can only be used in start position
2 --> $DIR/dollar-crate-is-keyword-2.rs:7:16
33 |
44LL | use a::$crate::b;
5 | ^^^^^^ `$crate` in paths can only be used in start position
5 | ^^^^^^ can only be used in path start position
66...
77LL | m!();
88 | ---- in this macro invocation
......@@ -20,11 +20,11 @@ LL | m!();
2020 |
2121 = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
2222
23error[E0433]: failed to resolve: `$crate` in paths can only be used in start position
24 --> $DIR/dollar-crate-is-keyword-2.rs:7:21
23error[E0433]: `$crate` in paths can only be used in start position
24 --> $DIR/dollar-crate-is-keyword-2.rs:9:21
2525 |
2626LL | type A = a::$crate;
27 | ^^^^^^ `$crate` in paths can only be used in start position
27 | ^^^^^^ can only be used in path start position
2828...
2929LL | m!();
3030 | ---- in this macro invocation
tests/ui/eii/privacy2.rs+1-1
......@@ -13,7 +13,7 @@ fn eii1_impl(x: u64) {
1313 println!("{x:?}")
1414}
1515
16#[codegen::eii3] //~ ERROR failed to resolve: could not find `eii3` in `codegen`
16#[codegen::eii3] //~ ERROR cannot find `eii3` in `codegen`
1717fn eii3_impl(x: u64) {
1818 println!("{x:?}")
1919}
tests/ui/eii/privacy2.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: could not find `eii3` in `codegen`
1error[E0433]: cannot find `eii3` in `codegen`
22 --> $DIR/privacy2.rs:16:12
33 |
44LL | #[codegen::eii3]
tests/ui/enum/assoc-fn-call-on-variant.rs+2-1
......@@ -12,5 +12,6 @@ impl E {
1212}
1313
1414fn main() {
15 E::A::f(); //~ ERROR failed to resolve: `A` is a variant, not a module
15 E::A::f(); //~ ERROR cannot find module `A` in `E`
16 //~^ NOTE: `A` is a variant, not a module
1617}
tests/ui/enum/assoc-fn-call-on-variant.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: `A` is a variant, not a module
1error[E0433]: cannot find module `A` in `E`
22 --> $DIR/assoc-fn-call-on-variant.rs:15:8
33 |
44LL | E::A::f();
tests/ui/error-codes/E0433.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of undeclared type `NonExistingMap`
1error[E0433]: cannot find type `NonExistingMap` in this scope
22 --> $DIR/E0433.rs:2:15
33 |
44LL | let map = NonExistingMap::new();
tests/ui/extern-flag/multiple-opts.rs+1-1
......@@ -16,5 +16,5 @@ pub mod m {
1616}
1717
1818fn main() {
19 somedep::somefun(); //~ ERROR failed to resolve
19 somedep::somefun(); //~ ERROR cannot find
2020}
tests/ui/extern-flag/multiple-opts.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `somedep`
1error[E0433]: cannot find module or crate `somedep` in this scope
22 --> $DIR/multiple-opts.rs:19:5
33 |
44LL | somedep::somefun();
tests/ui/extern-flag/noprelude.rs+1-1
......@@ -3,5 +3,5 @@
33//@ edition:2018
44
55fn main() {
6 somedep::somefun(); //~ ERROR failed to resolve
6 somedep::somefun(); //~ ERROR cannot find
77}
tests/ui/extern-flag/noprelude.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `somedep`
1error[E0433]: cannot find module or crate `somedep` in this scope
22 --> $DIR/noprelude.rs:6:5
33 |
44LL | somedep::somefun();
tests/ui/extern/extern-macro.rs+1-1
......@@ -2,5 +2,5 @@
22
33fn main() {
44 enum Foo {}
5 let _ = Foo::bar!(); //~ ERROR failed to resolve: partially resolved path in a macro
5 let _ = Foo::bar!(); //~ ERROR cannot find macro `bar` in enum `Foo`
66}
tests/ui/extern/extern-macro.stderr+2-2
......@@ -1,8 +1,8 @@
1error[E0433]: failed to resolve: partially resolved path in a macro
1error[E0433]: cannot find macro `bar` in enum `Foo`
22 --> $DIR/extern-macro.rs:5:13
33 |
44LL | let _ = Foo::bar!();
5 | ^^^^^^^^ partially resolved path in a macro
5 | ^^^^^^^^ a macro can't exist within an enum
66
77error: aborting due to 1 previous error
88
tests/ui/feature-gates/feature-gate-extern_absolute_paths.rs+1-1
......@@ -2,5 +2,5 @@
22use core::default; //~ ERROR unresolved import `core`
33
44fn main() {
5 let _: u8 = ::core::default::Default(); //~ ERROR failed to resolve
5 let _: u8 = ::core::default::Default(); //~ ERROR cannot find
66}
tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr+1-1
......@@ -7,7 +7,7 @@ LL | use core::default;
77 | you might be missing crate `core`
88 | help: try using `std` instead of `core`: `std`
99
10error[E0433]: failed to resolve: you might be missing crate `core`
10error[E0433]: cannot find `core` in the crate root
1111 --> $DIR/feature-gate-extern_absolute_paths.rs:5:19
1212 |
1313LL | let _: u8 = ::core::default::Default();
tests/ui/feature-gates/feature-gate-final-associated-functions.stderr+1-1
......@@ -4,7 +4,7 @@ error[E0658]: `final` on trait functions is experimental
44LL | final fn bar() {}
55 | ^^^^^
66 |
7 = note: see issue #1 <https://github.com/rust-lang/rust/issues/1> for more information
7 = note: see issue #131179 <https://github.com/rust-lang/rust/issues/131179> for more information
88 = help: add `#![feature(final_associated_functions)]` to the crate attributes to enable
99 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010
tests/ui/feature-gates/feature-gate-rustc-allow-const-fn-unstable.rs+1-1
......@@ -1,6 +1,6 @@
11#![allow(unused_macros)]
22
3#[rustc_allow_const_fn_unstable()] //~ ERROR rustc_allow_const_fn_unstable side-steps
3#[rustc_allow_const_fn_unstable()] //~ ERROR use of an internal attribute
44const fn foo() { }
55
66fn main() {}
tests/ui/feature-gates/feature-gate-rustc-allow-const-fn-unstable.stderr+4-4
......@@ -1,12 +1,12 @@
1error[E0658]: rustc_allow_const_fn_unstable side-steps feature gating and stability checks
1error[E0658]: use of an internal attribute
22 --> $DIR/feature-gate-rustc-allow-const-fn-unstable.rs:3:1
33 |
44LL | #[rustc_allow_const_fn_unstable()]
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66 |
7 = note: see issue #69399 <https://github.com/rust-lang/rust/issues/69399> for more information
8 = help: add `#![feature(rustc_allow_const_fn_unstable)]` to the crate attributes to enable
9 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
7 = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
8 = note: the `#[rustc_allow_const_fn_unstable]` attribute is an internal implementation detail that will never be stable
9 = note: rustc_allow_const_fn_unstable side-steps feature gating and stability checks
1010
1111error: aborting due to 1 previous error
1212
tests/ui/foreign/stashed-issue-121451.rs+1-1
......@@ -1,4 +1,4 @@
11extern "C" fn _f() -> libc::uintptr_t {}
2//~^ ERROR failed to resolve
2//~^ ERROR cannot find
33
44fn main() {}
tests/ui/foreign/stashed-issue-121451.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `libc`
1error[E0433]: cannot find module or crate `libc` in this scope
22 --> $DIR/stashed-issue-121451.rs:1:23
33 |
44LL | extern "C" fn _f() -> libc::uintptr_t {}
tests/ui/generic-associated-types/equality-bound.rs+1-1
......@@ -8,7 +8,7 @@ fn sum2<I: Iterator>(i: I) -> i32 where I::Item = i32 {
88}
99fn sum3<J: Iterator>(i: J) -> i32 where I::Item = i32 {
1010//~^ ERROR equality constraints are not yet supported in `where` clauses
11//~| ERROR failed to resolve: use of undeclared type `I`
11//~| ERROR cannot find type `I`
1212 panic!()
1313}
1414
tests/ui/generic-associated-types/equality-bound.stderr+1-1
......@@ -200,7 +200,7 @@ LL - fn from_iter<T>(_: T) -> Self where T::Item = A, T: IntoIterator,
200200LL + fn from_iter<T>(_: T) -> Self where T::Item = K, T: IntoIterator,
201201 |
202202
203error[E0433]: failed to resolve: use of undeclared type `I`
203error[E0433]: cannot find type `I` in this scope
204204 --> $DIR/equality-bound.rs:9:41
205205 |
206206LL | fn sum3<J: Iterator>(i: J) -> i32 where I::Item = i32 {
tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs+2-2
......@@ -10,7 +10,7 @@ macro a() {
1010 mod u {
1111 // Late resolution.
1212 fn f() { my_core::mem::drop(0); }
13 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `my_core`
13 //~^ ERROR cannot find
1414 }
1515}
1616
......@@ -23,7 +23,7 @@ mod v {
2323mod u {
2424 // Late resolution.
2525 fn f() { my_core::mem::drop(0); }
26 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `my_core`
26 //~^ ERROR cannot find
2727}
2828
2929fn main() {}
tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr+2-2
......@@ -15,7 +15,7 @@ LL | a!();
1515 |
1616 = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
1717
18error[E0433]: failed to resolve: use of unresolved module or unlinked crate `my_core`
18error[E0433]: cannot find module or crate `my_core` in this scope
1919 --> $DIR/extern-prelude-from-opaque-fail-2018.rs:12:18
2020 |
2121LL | fn f() { my_core::mem::drop(0); }
......@@ -29,7 +29,7 @@ LL | a!();
2929 std::mem
3030 = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
3131
32error[E0433]: failed to resolve: use of unresolved module or unlinked crate `my_core`
32error[E0433]: cannot find module or crate `my_core` in this scope
3333 --> $DIR/extern-prelude-from-opaque-fail-2018.rs:25:14
3434 |
3535LL | fn f() { my_core::mem::drop(0); }
tests/ui/hygiene/extern-prelude-from-opaque-fail.rs+2-2
......@@ -10,7 +10,7 @@ macro a() {
1010 mod u {
1111 // Late resolution.
1212 fn f() { my_core::mem::drop(0); }
13 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `my_core`
13 //~^ ERROR cannot find
1414 }
1515}
1616
......@@ -23,7 +23,7 @@ mod v {
2323mod u {
2424 // Late resolution.
2525 fn f() { my_core::mem::drop(0); }
26 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `my_core`
26 //~^ ERROR cannot find
2727}
2828
2929fn main() {}
tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr+2-2
......@@ -15,7 +15,7 @@ LL | a!();
1515 |
1616 = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
1717
18error[E0433]: failed to resolve: use of unresolved module or unlinked crate `my_core`
18error[E0433]: cannot find module or crate `my_core` in this scope
1919 --> $DIR/extern-prelude-from-opaque-fail.rs:12:18
2020 |
2121LL | fn f() { my_core::mem::drop(0); }
......@@ -29,7 +29,7 @@ LL | a!();
2929 my_core::mem
3030 = note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
3131
32error[E0433]: failed to resolve: use of unresolved module or unlinked crate `my_core`
32error[E0433]: cannot find module or crate `my_core` in this scope
3333 --> $DIR/extern-prelude-from-opaque-fail.rs:25:14
3434 |
3535LL | fn f() { my_core::mem::drop(0); }
tests/ui/hygiene/no_implicit_prelude.rs+1-1
......@@ -9,7 +9,7 @@ mod foo {
99#[no_implicit_prelude]
1010mod bar {
1111 pub macro m() {
12 Vec::new(); //~ ERROR failed to resolve
12 Vec::new(); //~ ERROR cannot find
1313 ().clone() //~ ERROR no method named `clone` found
1414 }
1515 fn f() {
tests/ui/hygiene/no_implicit_prelude.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of undeclared type `Vec`
1error[E0433]: cannot find type `Vec` in this scope
22 --> $DIR/no_implicit_prelude.rs:12:9
33 |
44LL | fn f() { ::bar::m!(); }
tests/ui/impl-trait/issues/issue-72911.rs+2-2
......@@ -9,12 +9,12 @@ pub fn gather_all() -> impl Iterator<Item = Lint> {
99}
1010
1111fn gather_from_file(dir_entry: &foo::MissingItem) -> impl Iterator<Item = Lint> {
12 //~^ ERROR: failed to resolve
12 //~^ ERROR: cannot find
1313 unimplemented!()
1414}
1515
1616fn lint_files() -> impl Iterator<Item = foo::MissingItem> {
17 //~^ ERROR: failed to resolve
17 //~^ ERROR: cannot find
1818 unimplemented!()
1919}
2020
tests/ui/impl-trait/issues/issue-72911.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `foo`
1error[E0433]: cannot find module or crate `foo` in this scope
22 --> $DIR/issue-72911.rs:11:33
33 |
44LL | fn gather_from_file(dir_entry: &foo::MissingItem) -> impl Iterator<Item = Lint> {
......@@ -6,7 +6,7 @@ LL | fn gather_from_file(dir_entry: &foo::MissingItem) -> impl Iterator<Item = L
66 |
77 = help: you might be missing a crate named `foo`
88
9error[E0433]: failed to resolve: use of unresolved module or unlinked crate `foo`
9error[E0433]: cannot find module or crate `foo` in this scope
1010 --> $DIR/issue-72911.rs:16:41
1111 |
1212LL | fn lint_files() -> impl Iterator<Item = foo::MissingItem> {
tests/ui/impl-trait/stashed-diag-issue-121504.rs+1-1
......@@ -4,7 +4,7 @@ trait MyTrait {
44 async fn foo(self) -> (Self, i32);
55}
66
7impl MyTrait for xyz::T { //~ ERROR failed to resolve: use of unresolved module or unlinked crate `xyz`
7impl MyTrait for xyz::T { //~ ERROR cannot find module or crate `xyz`
88 async fn foo(self, key: i32) -> (u32, i32) {
99 (self, key)
1010 }
tests/ui/impl-trait/stashed-diag-issue-121504.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `xyz`
1error[E0433]: cannot find module or crate `xyz` in this scope
22 --> $DIR/stashed-diag-issue-121504.rs:7:18
33 |
44LL | impl MyTrait for xyz::T {
tests/ui/imports/absolute-paths-in-nested-use-groups.rs+6-3
......@@ -3,9 +3,12 @@
33mod foo {}
44
55use foo::{
6 ::bar, //~ ERROR crate root in paths can only be used in start position
7 super::bar, //~ ERROR `super` in paths can only be used in start position
8 self::bar, //~ ERROR `self` in paths can only be used in start position
6 ::bar,
7 //~^ ERROR: crate root in paths can only be used in start position
8 super::bar,
9 //~^ ERROR: `super` in paths can only be used in start position
10 self::bar,
11 //~^ ERROR: `self` in paths can only be used in start position
912};
1013
1114fn main() {}
tests/ui/imports/absolute-paths-in-nested-use-groups.stderr+8-8
......@@ -1,20 +1,20 @@
1error[E0433]: failed to resolve: crate root in paths can only be used in start position
1error[E0433]: the crate root in paths can only be used in start position
22 --> $DIR/absolute-paths-in-nested-use-groups.rs:6:5
33 |
44LL | ::bar,
5 | ^ crate root in paths can only be used in start position
5 | ^ can only be used in path start position
66
7error[E0433]: failed to resolve: `super` in paths can only be used in start position
8 --> $DIR/absolute-paths-in-nested-use-groups.rs:7:5
7error[E0433]: `super` in paths can only be used in start position
8 --> $DIR/absolute-paths-in-nested-use-groups.rs:8:5
99 |
1010LL | super::bar,
11 | ^^^^^ `super` in paths can only be used in start position
11 | ^^^^^ can only be used in path start position
1212
13error[E0433]: failed to resolve: `self` in paths can only be used in start position
14 --> $DIR/absolute-paths-in-nested-use-groups.rs:8:5
13error[E0433]: `self` in paths can only be used in start position
14 --> $DIR/absolute-paths-in-nested-use-groups.rs:10:5
1515 |
1616LL | self::bar,
17 | ^^^^ `self` in paths can only be used in start position
17 | ^^^^ can only be used in path start position
1818
1919error: aborting due to 3 previous errors
2020
tests/ui/imports/extern-prelude-extern-crate-fail.rs+1-1
......@@ -7,7 +7,7 @@ mod n {
77
88mod m {
99 fn check() {
10 two_macros::m!(); //~ ERROR failed to resolve: use of unresolved module or unlinked crate `two_macros`
10 two_macros::m!(); //~ ERROR cannot find
1111 }
1212}
1313
tests/ui/imports/extern-prelude-extern-crate-fail.stderr+1-1
......@@ -9,7 +9,7 @@ LL | define_std_as_non_existent!();
99 |
1010 = note: this error originates in the macro `define_std_as_non_existent` (in Nightly builds, run with -Z macro-backtrace for more info)
1111
12error[E0433]: failed to resolve: use of unresolved module or unlinked crate `two_macros`
12error[E0433]: cannot find module or crate `two_macros` in this scope
1313 --> $DIR/extern-prelude-extern-crate-fail.rs:10:9
1414 |
1515LL | two_macros::m!();
tests/ui/imports/nested-import-root-symbol-150103.rs+2-2
......@@ -3,11 +3,11 @@
33// caused by `{{root}}` appearing in diagnostic suggestions
44
55mod A {
6 use Iuse::{ ::Fish }; //~ ERROR failed to resolve: use of unresolved module or unlinked crate
6 use Iuse::{ ::Fish }; //~ ERROR cannot find module or crate `Iuse` in the crate root
77}
88
99mod B {
10 use A::{::Fish}; //~ ERROR failed to resolve: crate root in paths can only be used in start position
10 use A::{::Fish}; //~ ERROR the crate root in paths can only be used in start position
1111}
1212
1313fn main() {}
tests/ui/imports/nested-import-root-symbol-150103.stderr+3-3
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `Iuse`
1error[E0433]: cannot find module or crate `Iuse` in the crate root
22 --> $DIR/nested-import-root-symbol-150103.rs:6:9
33 |
44LL | use Iuse::{ ::Fish };
......@@ -9,11 +9,11 @@ help: you might be missing a crate named `Iuse`, add it to your project and impo
99LL + extern crate Iuse;
1010 |
1111
12error[E0433]: failed to resolve: crate root in paths can only be used in start position
12error[E0433]: the crate root in paths can only be used in start position
1313 --> $DIR/nested-import-root-symbol-150103.rs:10:13
1414 |
1515LL | use A::{::Fish};
16 | ^ crate root in paths can only be used in start position
16 | ^ can only be used in path start position
1717
1818error: aborting due to 2 previous errors
1919
tests/ui/imports/overwrite-different-vis-3.rs created+14
......@@ -0,0 +1,14 @@
1// Regression test for issue #152606.
2
3//@ check-pass
4
5mod outer {
6 mod inner {
7 use super::*; // should go before the ambiguous glob imports
8 }
9
10 use crate::*;
11 pub use crate::*;
12}
13
14fn main() {}
tests/ui/imports/suggest-import-issue-120074.edition2015.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: unresolved import
1error[E0433]: cannot find `bar` in `crate`
22 --> $DIR/suggest-import-issue-120074.rs:14:35
33 |
44LL | println!("Hello, {}!", crate::bar::do_the_thing);
tests/ui/imports/suggest-import-issue-120074.edition2021.stderr deleted-23
......@@ -1,23 +0,0 @@
1error[E0433]: failed to resolve: unresolved import
2 --> $DIR/suggest-import-issue-120074.rs:14:35
3 |
4LL | println!("Hello, {}!", crate::bar::do_the_thing);
5 | ^^^ unresolved import
6 |
7help: a similar path exists
8 |
9LL | println!("Hello, {}!", crate::foo::bar::do_the_thing);
10 | +++++
11help: consider importing this module
12 |
13LL + use foo::bar;
14 |
15help: if you import `bar`, refer to it directly
16 |
17LL - println!("Hello, {}!", crate::bar::do_the_thing);
18LL + println!("Hello, {}!", bar::do_the_thing);
19 |
20
21error: aborting due to 1 previous error
22
23For more information about this error, try `rustc --explain E0433`.
tests/ui/imports/suggest-import-issue-120074.post2015.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: unresolved import
1error[E0433]: cannot find `bar` in `crate`
22 --> $DIR/suggest-import-issue-120074.rs:14:35
33 |
44LL | println!("Hello, {}!", crate::bar::do_the_thing);
tests/ui/imports/suggest-import-issue-120074.rs+1-1
......@@ -11,5 +11,5 @@ pub mod foo {
1111}
1212
1313fn main() {
14 println!("Hello, {}!", crate::bar::do_the_thing); //~ ERROR failed to resolve: unresolved import
14 println!("Hello, {}!", crate::bar::do_the_thing); //~ ERROR cannot find `bar` in `crate`
1515}
tests/ui/imports/tool-mod-child.rs+2-2
......@@ -1,8 +1,8 @@
11//@ edition:2015
22use clippy::a; //~ ERROR unresolved import `clippy`
3use clippy::a::b; //~ ERROR failed to resolve: use of unresolved module or unlinked crate `clippy`
3use clippy::a::b; //~ ERROR cannot find
44
55use rustdoc::a; //~ ERROR unresolved import `rustdoc`
6use rustdoc::a::b; //~ ERROR failed to resolve: use of unresolved module or unlinked crate `rustdoc`
6use rustdoc::a::b; //~ ERROR cannot find
77
88fn main() {}
tests/ui/imports/tool-mod-child.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `clippy`
1error[E0433]: cannot find module or crate `clippy` in the crate root
22 --> $DIR/tool-mod-child.rs:3:5
33 |
44LL | use clippy::a::b;
......@@ -20,7 +20,7 @@ help: you might be missing a crate named `clippy`, add it to your project and im
2020LL + extern crate clippy;
2121 |
2222
23error[E0433]: failed to resolve: use of unresolved module or unlinked crate `rustdoc`
23error[E0433]: cannot find module or crate `rustdoc` in the crate root
2424 --> $DIR/tool-mod-child.rs:6:5
2525 |
2626LL | use rustdoc::a::b;
tests/ui/issues/issue-38857.rs+2-2
......@@ -1,5 +1,5 @@
11fn main() {
22 let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() };
3 //~^ ERROR failed to resolve: could not find `imp` in `sys` [E0433]
4 //~^^ ERROR module `sys` is private [E0603]
3 //~^ ERROR: cannot find `imp` in `sys` [E0433]
4 //~| ERROR: module `sys` is private [E0603]
55}
tests/ui/issues/issue-38857.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: could not find `imp` in `sys`
1error[E0433]: cannot find `imp` in `sys`
22 --> $DIR/issue-38857.rs:2:23
33 |
44LL | let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() };
tests/ui/issues/issue-46101.rs+2-2
......@@ -1,6 +1,6 @@
11trait Foo {}
2#[derive(Foo::Anything)] //~ ERROR failed to resolve: partially resolved path in a derive macro
3 //~| ERROR failed to resolve: partially resolved path in a derive macro
2#[derive(Foo::Anything)] //~ ERROR cannot find
3 //~| ERROR cannot find
44struct S;
55
66fn main() {}
tests/ui/issues/issue-46101.stderr+4-4
......@@ -1,14 +1,14 @@
1error[E0433]: failed to resolve: partially resolved path in a derive macro
1error[E0433]: cannot find derive macro `Anything` in trait `Foo`
22 --> $DIR/issue-46101.rs:2:10
33 |
44LL | #[derive(Foo::Anything)]
5 | ^^^^^^^^^^^^^ partially resolved path in a derive macro
5 | ^^^^^^^^^^^^^ a derive macro can't exist within a trait
66
7error[E0433]: failed to resolve: partially resolved path in a derive macro
7error[E0433]: cannot find derive macro `Anything` in trait `Foo`
88 --> $DIR/issue-46101.rs:2:10
99 |
1010LL | #[derive(Foo::Anything)]
11 | ^^^^^^^^^^^^^ partially resolved path in a derive macro
11 | ^^^^^^^^^^^^^ a derive macro can't exist within a trait
1212 |
1313 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
1414
tests/ui/keyword/keyword-super-as-identifier.rs+1-1
......@@ -1,3 +1,3 @@
11fn main() {
2 let super = 22; //~ ERROR failed to resolve: there are too many leading `super` keywords
2 let super = 22; //~ ERROR too many leading `super` keywords
33}
tests/ui/keyword/keyword-super-as-identifier.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: there are too many leading `super` keywords
1error[E0433]: too many leading `super` keywords
22 --> $DIR/keyword-super-as-identifier.rs:2:9
33 |
44LL | let super = 22;
tests/ui/keyword/keyword-super.rs+1-1
......@@ -1,3 +1,3 @@
11fn main() {
2 let super: isize; //~ ERROR failed to resolve: there are too many leading `super` keywords
2 let super: isize; //~ ERROR: too many leading `super` keywords
33}
tests/ui/keyword/keyword-super.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: there are too many leading `super` keywords
1error[E0433]: too many leading `super` keywords
22 --> $DIR/keyword-super.rs:2:9
33 |
44LL | let super: isize;
tests/ui/lifetimes/issue-97194.rs+3-3
......@@ -1,8 +1,8 @@
11extern "C" {
22 fn bget(&self, index: [usize; Self::DIM]) -> bool {
3 //~^ ERROR incorrect function inside `extern` block
4 //~| ERROR `self` parameter is only allowed in associated functions
5 //~| ERROR failed to resolve: `Self`
3 //~^ ERROR: incorrect function inside `extern` block
4 //~| ERROR: `self` parameter is only allowed in associated functions
5 //~| ERROR: cannot find `Self`
66 type T<'a> = &'a str;
77 }
88}
tests/ui/lifetimes/issue-97194.stderr+1-1
......@@ -22,7 +22,7 @@ LL | fn bget(&self, index: [usize; Self::DIM]) -> bool {
2222 |
2323 = note: associated functions are those in `impl` or `trait` definitions
2424
25error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
25error[E0433]: cannot find `Self` in this scope
2626 --> $DIR/issue-97194.rs:2:35
2727 |
2828LL | fn bget(&self, index: [usize; Self::DIM]) -> bool {
tests/ui/lifetimes/mut-ref-owned-suggestion.rs created+29
......@@ -0,0 +1,29 @@
1//! Regression test for <https://github.com/rust-lang/rust/issues/150077>
2//! Tests that `&mut T` suggests `T`, not `mut T`, `&mut str` suggests `String`, not `str`,
3//! when recommending an owned value.
4fn with_fn(_f: impl Fn() -> &mut ()) {}
5//~^ ERROR: missing lifetime specifier
6
7fn with_ref_mut_str(_f: impl Fn() -> &mut str) {}
8//~^ ERROR: missing lifetime specifier
9
10fn with_fn_has_return(_f: impl Fn() -> &mut ()) -> i32 {
11 //~^ ERROR: missing lifetime specifier
12 2
13}
14
15fn with_dyn(_f: Box<dyn Fn() -> &mut i32>) {}
16//~^ ERROR: missing lifetime specifier
17
18fn trait_bound<F: Fn() -> &mut i32>(_f: F) {}
19//~^ ERROR: missing lifetime specifier
20
21fn nested_result(_f: impl Fn() -> Result<&mut i32, ()>) {}
22//~^ ERROR: missing lifetime specifier
23
24struct Holder<F: Fn() -> &mut i32> {
25 //~^ ERROR: missing lifetime specifier
26 f: F,
27}
28
29fn main() {}
tests/ui/lifetimes/mut-ref-owned-suggestion.stderr created+137
......@@ -0,0 +1,137 @@
1error[E0106]: missing lifetime specifier
2 --> $DIR/mut-ref-owned-suggestion.rs:4:29
3 |
4LL | fn with_fn(_f: impl Fn() -> &mut ()) {}
5 | ^ expected named lifetime parameter
6 |
7 = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
8help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
9 |
10LL | fn with_fn(_f: impl Fn() -> &'static mut ()) {}
11 | +++++++
12help: instead, you are more likely to want to return an owned value
13 |
14LL - fn with_fn(_f: impl Fn() -> &mut ()) {}
15LL + fn with_fn(_f: impl Fn() -> ()) {}
16 |
17
18error[E0106]: missing lifetime specifier
19 --> $DIR/mut-ref-owned-suggestion.rs:7:38
20 |
21LL | fn with_ref_mut_str(_f: impl Fn() -> &mut str) {}
22 | ^ expected named lifetime parameter
23 |
24 = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
25help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
26 |
27LL | fn with_ref_mut_str(_f: impl Fn() -> &'static mut str) {}
28 | +++++++
29help: instead, you are more likely to want to return an owned value
30 |
31LL - fn with_ref_mut_str(_f: impl Fn() -> &mut str) {}
32LL + fn with_ref_mut_str(_f: impl Fn() -> String) {}
33 |
34
35error[E0106]: missing lifetime specifier
36 --> $DIR/mut-ref-owned-suggestion.rs:10:40
37 |
38LL | fn with_fn_has_return(_f: impl Fn() -> &mut ()) -> i32 {
39 | ^ expected named lifetime parameter
40 |
41 = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
42 = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
43help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
44 |
45LL | fn with_fn_has_return(_f: impl Fn() -> &'static mut ()) -> i32 {
46 | +++++++
47help: consider making the bound lifetime-generic with a new `'a` lifetime
48 |
49LL - fn with_fn_has_return(_f: impl Fn() -> &mut ()) -> i32 {
50LL + fn with_fn_has_return(_f: impl for<'a> Fn() -> &'a ()) -> i32 {
51 |
52help: consider introducing a named lifetime parameter
53 |
54LL - fn with_fn_has_return(_f: impl Fn() -> &mut ()) -> i32 {
55LL + fn with_fn_has_return<'a>(_f: impl Fn() -> &'a ()) -> i32 {
56 |
57help: alternatively, you might want to return an owned value
58 |
59LL - fn with_fn_has_return(_f: impl Fn() -> &mut ()) -> i32 {
60LL + fn with_fn_has_return(_f: impl Fn() -> ()) -> i32 {
61 |
62
63error[E0106]: missing lifetime specifier
64 --> $DIR/mut-ref-owned-suggestion.rs:15:33
65 |
66LL | fn with_dyn(_f: Box<dyn Fn() -> &mut i32>) {}
67 | ^ expected named lifetime parameter
68 |
69 = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
70help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
71 |
72LL | fn with_dyn(_f: Box<dyn Fn() -> &'static mut i32>) {}
73 | +++++++
74help: instead, you are more likely to want to return an owned value
75 |
76LL - fn with_dyn(_f: Box<dyn Fn() -> &mut i32>) {}
77LL + fn with_dyn(_f: Box<dyn Fn() -> i32>) {}
78 |
79
80error[E0106]: missing lifetime specifier
81 --> $DIR/mut-ref-owned-suggestion.rs:18:27
82 |
83LL | fn trait_bound<F: Fn() -> &mut i32>(_f: F) {}
84 | ^ expected named lifetime parameter
85 |
86 = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
87help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
88 |
89LL | fn trait_bound<F: Fn() -> &'static mut i32>(_f: F) {}
90 | +++++++
91help: instead, you are more likely to want to change the argument to be borrowed...
92 |
93LL | fn trait_bound<F: Fn() -> &mut i32>(_f: &F) {}
94 | +
95help: ...or alternatively, you might want to return an owned value
96 |
97LL - fn trait_bound<F: Fn() -> &mut i32>(_f: F) {}
98LL + fn trait_bound<F: Fn() -> i32>(_f: F) {}
99 |
100
101error[E0106]: missing lifetime specifier
102 --> $DIR/mut-ref-owned-suggestion.rs:21:42
103 |
104LL | fn nested_result(_f: impl Fn() -> Result<&mut i32, ()>) {}
105 | ^ expected named lifetime parameter
106 |
107 = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
108help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
109 |
110LL | fn nested_result(_f: impl Fn() -> Result<&'static mut i32, ()>) {}
111 | +++++++
112help: instead, you are more likely to want to return an owned value
113 |
114LL - fn nested_result(_f: impl Fn() -> Result<&mut i32, ()>) {}
115LL + fn nested_result(_f: impl Fn() -> Result<i32, ()>) {}
116 |
117
118error[E0106]: missing lifetime specifier
119 --> $DIR/mut-ref-owned-suggestion.rs:24:26
120 |
121LL | struct Holder<F: Fn() -> &mut i32> {
122 | ^ expected named lifetime parameter
123 |
124 = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
125help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
126 |
127LL | struct Holder<F: Fn() -> &'static mut i32> {
128 | +++++++
129help: instead, you are more likely to want to return an owned value
130 |
131LL - struct Holder<F: Fn() -> &mut i32> {
132LL + struct Holder<F: Fn() -> i32> {
133 |
134
135error: aborting due to 7 previous errors
136
137For more information about this error, try `rustc --explain E0106`.
tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.rs created+49
......@@ -0,0 +1,49 @@
1// Regression test for https://github.com/rust-lang/rust/issues/65866.
2
3mod plain {
4 struct Foo;
5
6 struct Re<'a> {
7 _data: &'a u16,
8 }
9
10 trait Bar {
11 fn bar(&self, r: &mut Re);
12 //~^ NOTE expected
13 //~| NOTE `Re` here is elided as `Re<'_>`
14 }
15
16 impl Bar for Foo {
17 fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a>) {}
18 //~^ ERROR `impl` item signature doesn't match `trait` item signature
19 //~| NOTE expected signature
20 //~| NOTE found
21 //~| HELP the lifetime requirements
22 //~| HELP verify the lifetime relationships
23 }
24}
25
26mod with_type_args {
27 struct Foo;
28
29 struct Re<'a, T> {
30 _data: (&'a u16, T),
31 }
32
33 trait Bar {
34 fn bar(&self, r: &mut Re<u8>);
35 //~^ NOTE expected
36 //~| NOTE `Re` here is elided as `Re<'_, u8>`
37 }
38
39 impl Bar for Foo {
40 fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a, u8>) {}
41 //~^ ERROR `impl` item signature doesn't match `trait` item signature
42 //~| NOTE expected signature
43 //~| NOTE found
44 //~| HELP the lifetime requirements
45 //~| HELP verify the lifetime relationships
46 }
47}
48
49fn main() {}
tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr created+40
......@@ -0,0 +1,40 @@
1error: `impl` item signature doesn't match `trait` item signature
2 --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:17:9
3 |
4LL | fn bar(&self, r: &mut Re);
5 | -------------------------- expected `fn(&'1 plain::Foo, &'2 mut plain::Re<'3>)`
6...
7LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a>) {}
8 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 plain::Foo, &'2 mut plain::Re<'1>)`
9 |
10 = note: expected signature `fn(&'1 plain::Foo, &'2 mut plain::Re<'3>)`
11 found signature `fn(&'1 plain::Foo, &'2 mut plain::Re<'1>)`
12 = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`
13 = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output
14note: `Re` here is elided as `Re<'_>`
15 --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:11:31
16 |
17LL | fn bar(&self, r: &mut Re);
18 | ^^
19
20error: `impl` item signature doesn't match `trait` item signature
21 --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:40:9
22 |
23LL | fn bar(&self, r: &mut Re<u8>);
24 | ------------------------------ expected `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'3, u8>)`
25...
26LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a, u8>) {}
27 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'1, u8>)`
28 |
29 = note: expected signature `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'3, u8>)`
30 found signature `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'1, u8>)`
31 = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`
32 = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output
33note: `Re` here is elided as `Re<'_, u8>`
34 --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:34:31
35 |
36LL | fn bar(&self, r: &mut Re<u8>);
37 | ^^
38
39error: aborting due to 2 previous errors
40
tests/ui/lint/ice-array-into-iter-lint-issue-121532.rs+1-1
......@@ -4,7 +4,7 @@
44
55 // Typeck fails for the arg type as
66 // `Self` makes no sense here
7fn func(a: Self::ItemsIterator) { //~ ERROR failed to resolve: `Self` is only available in impls, traits, and type definitions
7fn func(a: Self::ItemsIterator) { //~ ERROR cannot find `Self`
88 a.into_iter();
99}
1010
tests/ui/lint/ice-array-into-iter-lint-issue-121532.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
1error[E0433]: cannot find `Self` in this scope
22 --> $DIR/ice-array-into-iter-lint-issue-121532.rs:7:12
33 |
44LL | fn func(a: Self::ItemsIterator) {
tests/ui/macros/builtin-prelude-no-accidents.rs+3-3
......@@ -2,7 +2,7 @@
22// because macros with the same names are in prelude.
33
44fn main() {
5 env::current_dir; //~ ERROR use of unresolved module or unlinked crate `env`
6 type A = panic::PanicInfo; //~ ERROR use of unresolved module or unlinked crate `panic`
7 type B = vec::Vec<u8>; //~ ERROR use of unresolved module or unlinked crate `vec`
5 env::current_dir; //~ ERROR cannot find module or crate `env`
6 type A = panic::PanicInfo; //~ ERROR cannot find module or crate `panic`
7 type B = vec::Vec<u8>; //~ ERROR cannot find module or crate `vec`
88}
tests/ui/macros/builtin-prelude-no-accidents.stderr+3-3
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `env`
1error[E0433]: cannot find module or crate `env` in this scope
22 --> $DIR/builtin-prelude-no-accidents.rs:5:5
33 |
44LL | env::current_dir;
......@@ -10,7 +10,7 @@ help: consider importing this module
1010LL + use std::env;
1111 |
1212
13error[E0433]: failed to resolve: use of unresolved module or unlinked crate `panic`
13error[E0433]: cannot find module or crate `panic` in this scope
1414 --> $DIR/builtin-prelude-no-accidents.rs:6:14
1515 |
1616LL | type A = panic::PanicInfo;
......@@ -22,7 +22,7 @@ help: consider importing this module
2222LL + use std::panic;
2323 |
2424
25error[E0433]: failed to resolve: use of unresolved module or unlinked crate `vec`
25error[E0433]: cannot find module or crate `vec` in this scope
2626 --> $DIR/builtin-prelude-no-accidents.rs:7:14
2727 |
2828LL | type B = vec::Vec<u8>;
tests/ui/macros/builtin-std-paths-fail.rs+16-16
......@@ -1,25 +1,25 @@
11#[derive(
2 core::RustcDecodable, //~ ERROR could not find `RustcDecodable` in `core`
3 //~| ERROR could not find `RustcDecodable` in `core`
4 core::RustcDecodable, //~ ERROR could not find `RustcDecodable` in `core`
5 //~| ERROR could not find `RustcDecodable` in `core`
2 core::RustcDecodable, //~ ERROR cannot find `RustcDecodable` in `core`
3 //~| ERROR cannot find `RustcDecodable` in `core`
4 core::RustcDecodable, //~ ERROR cannot find `RustcDecodable` in `core`
5 //~| ERROR cannot find `RustcDecodable` in `core`
66)]
7#[core::bench] //~ ERROR could not find `bench` in `core`
8#[core::global_allocator] //~ ERROR could not find `global_allocator` in `core`
9#[core::test_case] //~ ERROR could not find `test_case` in `core`
10#[core::test] //~ ERROR could not find `test` in `core`
7#[core::bench] //~ ERROR cannot find `bench` in `core`
8#[core::global_allocator] //~ ERROR cannot find `global_allocator` in `core`
9#[core::test_case] //~ ERROR cannot find `test_case` in `core`
10#[core::test] //~ ERROR cannot find `test` in `core`
1111struct Core;
1212
1313#[derive(
14 std::RustcDecodable, //~ ERROR could not find `RustcDecodable` in `std`
15 //~| ERROR could not find `RustcDecodable` in `std`
16 std::RustcDecodable, //~ ERROR could not find `RustcDecodable` in `std`
17 //~| ERROR could not find `RustcDecodable` in `std`
14 std::RustcDecodable, //~ ERROR cannot find `RustcDecodable` in `std`
15 //~| ERROR cannot find `RustcDecodable` in `std`
16 std::RustcDecodable, //~ ERROR cannot find `RustcDecodable` in `std`
17 //~| ERROR cannot find `RustcDecodable` in `std`
1818)]
19#[std::bench] //~ ERROR could not find `bench` in `std`
20#[std::global_allocator] //~ ERROR could not find `global_allocator` in `std`
21#[std::test_case] //~ ERROR could not find `test_case` in `std`
22#[std::test] //~ ERROR could not find `test` in `std`
19#[std::bench] //~ ERROR cannot find `bench` in `std`
20#[std::global_allocator] //~ ERROR cannot find `global_allocator` in `std`
21#[std::test_case] //~ ERROR cannot find `test_case` in `std`
22#[std::test] //~ ERROR cannot find `test` in `std`
2323struct Std;
2424
2525fn main() {}
tests/ui/macros/builtin-std-paths-fail.stderr+16-16
......@@ -1,16 +1,16 @@
1error[E0433]: failed to resolve: could not find `RustcDecodable` in `core`
1error[E0433]: cannot find `RustcDecodable` in `core`
22 --> $DIR/builtin-std-paths-fail.rs:2:11
33 |
44LL | core::RustcDecodable,
55 | ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `core`
66
7error[E0433]: failed to resolve: could not find `RustcDecodable` in `core`
7error[E0433]: cannot find `RustcDecodable` in `core`
88 --> $DIR/builtin-std-paths-fail.rs:4:11
99 |
1010LL | core::RustcDecodable,
1111 | ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `core`
1212
13error[E0433]: failed to resolve: could not find `RustcDecodable` in `core`
13error[E0433]: cannot find `RustcDecodable` in `core`
1414 --> $DIR/builtin-std-paths-fail.rs:2:11
1515 |
1616LL | core::RustcDecodable,
......@@ -18,7 +18,7 @@ LL | core::RustcDecodable,
1818 |
1919 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
2020
21error[E0433]: failed to resolve: could not find `RustcDecodable` in `core`
21error[E0433]: cannot find `RustcDecodable` in `core`
2222 --> $DIR/builtin-std-paths-fail.rs:4:11
2323 |
2424LL | core::RustcDecodable,
......@@ -26,43 +26,43 @@ LL | core::RustcDecodable,
2626 |
2727 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
2828
29error[E0433]: failed to resolve: could not find `bench` in `core`
29error[E0433]: cannot find `bench` in `core`
3030 --> $DIR/builtin-std-paths-fail.rs:7:9
3131 |
3232LL | #[core::bench]
3333 | ^^^^^ could not find `bench` in `core`
3434
35error[E0433]: failed to resolve: could not find `global_allocator` in `core`
35error[E0433]: cannot find `global_allocator` in `core`
3636 --> $DIR/builtin-std-paths-fail.rs:8:9
3737 |
3838LL | #[core::global_allocator]
3939 | ^^^^^^^^^^^^^^^^ could not find `global_allocator` in `core`
4040
41error[E0433]: failed to resolve: could not find `test_case` in `core`
41error[E0433]: cannot find `test_case` in `core`
4242 --> $DIR/builtin-std-paths-fail.rs:9:9
4343 |
4444LL | #[core::test_case]
4545 | ^^^^^^^^^ could not find `test_case` in `core`
4646
47error[E0433]: failed to resolve: could not find `test` in `core`
47error[E0433]: cannot find `test` in `core`
4848 --> $DIR/builtin-std-paths-fail.rs:10:9
4949 |
5050LL | #[core::test]
5151 | ^^^^ could not find `test` in `core`
5252
53error[E0433]: failed to resolve: could not find `RustcDecodable` in `std`
53error[E0433]: cannot find `RustcDecodable` in `std`
5454 --> $DIR/builtin-std-paths-fail.rs:14:10
5555 |
5656LL | std::RustcDecodable,
5757 | ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `std`
5858
59error[E0433]: failed to resolve: could not find `RustcDecodable` in `std`
59error[E0433]: cannot find `RustcDecodable` in `std`
6060 --> $DIR/builtin-std-paths-fail.rs:16:10
6161 |
6262LL | std::RustcDecodable,
6363 | ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `std`
6464
65error[E0433]: failed to resolve: could not find `RustcDecodable` in `std`
65error[E0433]: cannot find `RustcDecodable` in `std`
6666 --> $DIR/builtin-std-paths-fail.rs:14:10
6767 |
6868LL | std::RustcDecodable,
......@@ -70,7 +70,7 @@ LL | std::RustcDecodable,
7070 |
7171 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
7272
73error[E0433]: failed to resolve: could not find `RustcDecodable` in `std`
73error[E0433]: cannot find `RustcDecodable` in `std`
7474 --> $DIR/builtin-std-paths-fail.rs:16:10
7575 |
7676LL | std::RustcDecodable,
......@@ -78,25 +78,25 @@ LL | std::RustcDecodable,
7878 |
7979 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
8080
81error[E0433]: failed to resolve: could not find `bench` in `std`
81error[E0433]: cannot find `bench` in `std`
8282 --> $DIR/builtin-std-paths-fail.rs:19:8
8383 |
8484LL | #[std::bench]
8585 | ^^^^^ could not find `bench` in `std`
8686
87error[E0433]: failed to resolve: could not find `global_allocator` in `std`
87error[E0433]: cannot find `global_allocator` in `std`
8888 --> $DIR/builtin-std-paths-fail.rs:20:8
8989 |
9090LL | #[std::global_allocator]
9191 | ^^^^^^^^^^^^^^^^ could not find `global_allocator` in `std`
9292
93error[E0433]: failed to resolve: could not find `test_case` in `std`
93error[E0433]: cannot find `test_case` in `std`
9494 --> $DIR/builtin-std-paths-fail.rs:21:8
9595 |
9696LL | #[std::test_case]
9797 | ^^^^^^^^^ could not find `test_case` in `std`
9898
99error[E0433]: failed to resolve: could not find `test` in `std`
99error[E0433]: cannot find `test` in `std`
100100 --> $DIR/builtin-std-paths-fail.rs:22:8
101101 |
102102LL | #[std::test]
tests/ui/macros/compile_error_macro-suppress-errors.rs+1-1
......@@ -36,5 +36,5 @@ fn main() {
3636 //~^ ERROR: cannot find function `some_function` in module `another_module`
3737 let _: another_module::SomeType = another_module::Hello::new();
3838 //~^ ERROR: cannot find type `SomeType` in module `another_module`
39 //~^^ ERROR: failed to resolve: could not find `Hello` in `another_module`
39 //~| ERROR: cannot find `Hello` in `another_module`
4040}
tests/ui/macros/compile_error_macro-suppress-errors.stderr+1-1
......@@ -16,7 +16,7 @@ error[E0432]: unresolved import `crate::another_module::NotExist`
1616LL | use crate::another_module::NotExist;
1717 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `NotExist` in `another_module`
1818
19error[E0433]: failed to resolve: could not find `Hello` in `another_module`
19error[E0433]: cannot find `Hello` in `another_module`
2020 --> $DIR/compile_error_macro-suppress-errors.rs:37:55
2121 |
2222LL | let _: another_module::SomeType = another_module::Hello::new();
tests/ui/macros/macro-inner-attributes.rs+4-4
......@@ -4,8 +4,8 @@ macro_rules! test { ($nm:ident,
44 #[$a:meta],
55 $i:item) => (mod $nm { #![$a] $i }); }
66
7test!(a,
8 #[cfg(false)],
7test!(a, //~ NOTE: found an item that was configured out
8 #[cfg(false)], //~ NOTE: the item is gated here
99 pub fn bar() { });
1010
1111test!(b,
......@@ -14,7 +14,7 @@ test!(b,
1414
1515#[rustc_dummy]
1616fn main() {
17 a::bar();
18 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `a`
17 a::bar(); //~ ERROR: cannot find module or crate `a`
18 //~^ NOTE: use of unresolved module or unlinked crate `a`
1919 b::bar();
2020}
tests/ui/macros/macro-inner-attributes.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `a`
1error[E0433]: cannot find module or crate `a` in this scope
22 --> $DIR/macro-inner-attributes.rs:17:5
33 |
44LL | a::bar();
tests/ui/macros/macro-path-prelude-fail-1.rs+4-2
......@@ -1,7 +1,9 @@
11mod m {
22 fn check() {
3 Vec::clone!(); //~ ERROR failed to resolve: `Vec` is a struct, not a module
4 u8::clone!(); //~ ERROR failed to resolve: `u8` is a builtin type, not a module
3 Vec::clone!(); //~ ERROR cannot find
4 //~^ NOTE `Vec` is a struct, not a module
5 u8::clone!(); //~ ERROR cannot find
6 //~^ NOTE `u8` is a builtin type, not a module
57 }
68}
79
tests/ui/macros/macro-path-prelude-fail-1.stderr+3-3
......@@ -1,11 +1,11 @@
1error[E0433]: failed to resolve: `Vec` is a struct, not a module
1error[E0433]: cannot find module `Vec` in this scope
22 --> $DIR/macro-path-prelude-fail-1.rs:3:9
33 |
44LL | Vec::clone!();
55 | ^^^ `Vec` is a struct, not a module
66
7error[E0433]: failed to resolve: `u8` is a builtin type, not a module
8 --> $DIR/macro-path-prelude-fail-1.rs:4:9
7error[E0433]: cannot find module `u8` in this scope
8 --> $DIR/macro-path-prelude-fail-1.rs:5:9
99 |
1010LL | u8::clone!();
1111 | ^^ `u8` is a builtin type, not a module
tests/ui/macros/macro-path-prelude-fail-2.rs+1-1
......@@ -1,6 +1,6 @@
11mod m {
22 fn check() {
3 Result::Ok!(); //~ ERROR failed to resolve: partially resolved path in a macro
3 Result::Ok!(); //~ ERROR cannot find
44 }
55}
66
tests/ui/macros/macro-path-prelude-fail-2.stderr+2-2
......@@ -1,8 +1,8 @@
1error[E0433]: failed to resolve: partially resolved path in a macro
1error[E0433]: cannot find macro `Ok` in enum `Result`
22 --> $DIR/macro-path-prelude-fail-2.rs:3:9
33 |
44LL | Result::Ok!();
5 | ^^^^^^^^^^ partially resolved path in a macro
5 | ^^^^^^^^^^ a macro can't exist within an enum
66
77error: aborting due to 1 previous error
88
tests/ui/macros/macro_path_as_generic_bound.rs+1-1
......@@ -4,6 +4,6 @@ macro_rules! foo(($t:path) => {
44 impl<T: $t> Foo for T {}
55});
66
7foo!(m::m2::A); //~ ERROR failed to resolve
7foo!(m::m2::A); //~ ERROR cannot find
88
99fn main() {}
tests/ui/macros/macro_path_as_generic_bound.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `m`
1error[E0433]: cannot find module or crate `m` in this scope
22 --> $DIR/macro_path_as_generic_bound.rs:7:6
33 |
44LL | foo!(m::m2::A);
tests/ui/macros/meta-item-absolute-path.rs+2-2
......@@ -1,6 +1,6 @@
11//@ edition:2015
2#[derive(::Absolute)] //~ ERROR failed to resolve
3 //~| ERROR failed to resolve
2#[derive(::Absolute)] //~ ERROR cannot find
3 //~| ERROR cannot find
44struct S;
55
66fn main() {}
tests/ui/macros/meta-item-absolute-path.stderr+2-2
......@@ -1,10 +1,10 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `Absolute`
1error[E0433]: cannot find module or crate `Absolute` in the crate root
22 --> $DIR/meta-item-absolute-path.rs:2:12
33 |
44LL | #[derive(::Absolute)]
55 | ^^^^^^^^ use of unresolved module or unlinked crate `Absolute`
66
7error[E0433]: failed to resolve: use of unresolved module or unlinked crate `Absolute`
7error[E0433]: cannot find module or crate `Absolute` in the crate root
88 --> $DIR/meta-item-absolute-path.rs:2:12
99 |
1010LL | #[derive(::Absolute)]
tests/ui/mir/issue-121103.rs+4-2
......@@ -1,3 +1,5 @@
11fn main(_: <lib2::GenericType<42> as lib2::TypeFn>::Output) {}
2//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `lib2`
3//~| ERROR failed to resolve: use of unresolved module or unlinked crate `lib2`
2//~^ ERROR: cannot find
3//~| ERROR: cannot find
4//~| NOTE: use of unresolved module or unlinked crate `lib2`
5//~| NOTE: use of unresolved module or unlinked crate `lib2`
tests/ui/mir/issue-121103.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `lib2`
1error[E0433]: cannot find module or crate `lib2` in this scope
22 --> $DIR/issue-121103.rs:1:38
33 |
44LL | fn main(_: <lib2::GenericType<42> as lib2::TypeFn>::Output) {}
......@@ -6,7 +6,7 @@ LL | fn main(_: <lib2::GenericType<42> as lib2::TypeFn>::Output) {}
66 |
77 = help: you might be missing a crate named `lib2`
88
9error[E0433]: failed to resolve: use of unresolved module or unlinked crate `lib2`
9error[E0433]: cannot find module or crate `lib2` in this scope
1010 --> $DIR/issue-121103.rs:1:13
1111 |
1212LL | fn main(_: <lib2::GenericType<42> as lib2::TypeFn>::Output) {}
tests/ui/modules/super-at-crate-root.rs+1-1
......@@ -1,6 +1,6 @@
11//! Check that `super` keyword used at the crate root (top-level) results in a compilation error
22//! as there is no parent module to resolve.
33
4use super::f; //~ ERROR there are too many leading `super` keywords
4use super::f; //~ ERROR too many leading `super` keywords
55
66fn main() {}
tests/ui/modules/super-at-crate-root.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: there are too many leading `super` keywords
1error[E0433]: too many leading `super` keywords
22 --> $DIR/super-at-crate-root.rs:4:5
33 |
44LL | use super::f;
tests/ui/parser/const-param-decl-on-type-instead-of-impl.rs+1-1
......@@ -11,5 +11,5 @@ fn banana(a: <T<const N: usize>>::BAR) {}
1111fn chaenomeles() {
1212 path::path::Struct::<const N: usize>()
1313 //~^ ERROR unexpected `const` parameter declaration
14 //~| ERROR failed to resolve: use of unresolved module or unlinked crate `path`
14 //~| ERROR cannot find module or crate `path`
1515}
tests/ui/parser/const-param-decl-on-type-instead-of-impl.stderr+1-1
......@@ -22,7 +22,7 @@ error: unexpected `const` parameter declaration
2222LL | path::path::Struct::<const N: usize>()
2323 | ^^^^^^^^^^^^^^ expected a `const` expression, not a parameter declaration
2424
25error[E0433]: failed to resolve: use of unresolved module or unlinked crate `path`
25error[E0433]: cannot find module or crate `path` in this scope
2626 --> $DIR/const-param-decl-on-type-instead-of-impl.rs:12:5
2727 |
2828LL | path::path::Struct::<const N: usize>()
tests/ui/parser/dyn-trait-compatibility.rs+1-1
......@@ -3,7 +3,7 @@
33type A0 = dyn;
44//~^ ERROR cannot find type `dyn` in this scope
55type A1 = dyn::dyn;
6//~^ ERROR use of unresolved module or unlinked crate `dyn`
6//~^ ERROR cannot find module or crate `dyn` in this scope
77type A2 = dyn<dyn, dyn>;
88//~^ ERROR cannot find type `dyn` in this scope
99//~| ERROR cannot find type `dyn` in this scope
tests/ui/parser/dyn-trait-compatibility.stderr+1-1
......@@ -40,7 +40,7 @@ error[E0425]: cannot find type `dyn` in this scope
4040LL | type A3 = dyn<<dyn as dyn>::dyn>;
4141 | ^^^ not found in this scope
4242
43error[E0433]: failed to resolve: use of unresolved module or unlinked crate `dyn`
43error[E0433]: cannot find module or crate `dyn` in this scope
4444 --> $DIR/dyn-trait-compatibility.rs:5:11
4545 |
4646LL | type A1 = dyn::dyn;
tests/ui/parser/mod_file_not_exist.rs+5-4
......@@ -1,8 +1,9 @@
1mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file`
2//~^ HELP to create the module `not_a_real_file`, create file
1mod not_a_real_file;
2//~^ ERROR: file not found for module `not_a_real_file`
3//~| HELP: to create the module `not_a_real_file`, create file
34
45fn main() {
56 assert_eq!(mod_file_aux::bar(), 10);
6 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `mod_file_aux`
7 //~| HELP you might be missing a crate named `mod_file_aux`
7 //~^ ERROR: cannot find module or crate `mod_file_aux`
8 //~| HELP: you might be missing a crate named `mod_file_aux`
89}
tests/ui/parser/mod_file_not_exist.stderr+2-2
......@@ -7,8 +7,8 @@ LL | mod not_a_real_file;
77 = 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"
88 = note: if there is a `mod not_a_real_file` elsewhere in the crate already, import it with `use crate::...` instead
99
10error[E0433]: failed to resolve: use of unresolved module or unlinked crate `mod_file_aux`
11 --> $DIR/mod_file_not_exist.rs:5:16
10error[E0433]: cannot find module or crate `mod_file_aux` in this scope
11 --> $DIR/mod_file_not_exist.rs:6:16
1212 |
1313LL | assert_eq!(mod_file_aux::bar(), 10);
1414 | ^^^^^^^^^^^^ use of unresolved module or unlinked crate `mod_file_aux`
tests/ui/parser/mod_file_not_exist_windows.rs+1-1
......@@ -5,6 +5,6 @@ mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file`
55
66fn main() {
77 assert_eq!(mod_file_aux::bar(), 10);
8 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `mod_file_aux`
8 //~^ ERROR cannot find module or crate `mod_file_aux` in this scope
99 //~| HELP you might be missing a crate named `mod_file_aux`
1010}
tests/ui/parser/mod_file_not_exist_windows.stderr+1-1
......@@ -7,7 +7,7 @@ LL | mod not_a_real_file;
77 = 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"
88 = note: if there is a `mod not_a_real_file` elsewhere in the crate already, import it with `use crate::...` instead
99
10error[E0433]: failed to resolve: use of unresolved module or unlinked crate `mod_file_aux`
10error[E0433]: cannot find module or crate `mod_file_aux` in this scope
1111 --> $DIR/mod_file_not_exist_windows.rs:7:16
1212 |
1313LL | assert_eq!(mod_file_aux::bar(), 10);
tests/ui/pattern/pattern-error-continue.rs+1-1
......@@ -32,6 +32,6 @@ fn main() {
3232 //~| NOTE expected `char`, found `bool`
3333
3434 match () {
35 E::V => {} //~ ERROR failed to resolve: use of undeclared type `E`
35 E::V => {} //~ ERROR cannot find type `E`
3636 }
3737}
tests/ui/pattern/pattern-error-continue.stderr+1-1
......@@ -52,7 +52,7 @@ note: function defined here
5252LL | fn f(_c: char) {}
5353 | ^ --------
5454
55error[E0433]: failed to resolve: use of undeclared type `E`
55error[E0433]: cannot find type `E` in this scope
5656 --> $DIR/pattern-error-continue.rs:35:9
5757 |
5858LL | E::V => {}
tests/ui/privacy/restricted/test.rs+1-1
......@@ -48,6 +48,6 @@ fn main() {
4848}
4949
5050mod pathological {
51 pub(in bad::path) mod m1 {} //~ ERROR failed to resolve: use of unresolved module or unlinked crate `bad`
51 pub(in bad::path) mod m1 {} //~ ERROR: cannot find module or crate `bad`
5252 pub(in foo) mod m2 {} //~ ERROR visibilities can only be restricted to ancestor modules
5353}
tests/ui/privacy/restricted/test.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `bad`
1error[E0433]: cannot find module or crate `bad` in the crate root
22 --> $DIR/test.rs:51:12
33 |
44LL | pub(in bad::path) mod m1 {}
tests/ui/privacy/unreachable-issue-121455.rs+2-1
......@@ -1,5 +1,6 @@
11fn test(s: &Self::Id) {
2//~^ ERROR failed to resolve: `Self` is only available in impls, traits, and type definitions
2//~^ ERROR: cannot find `Self`
3//~| NOTE: `Self` is only available in impls, traits, and type definitions
34 match &s[0..3] {}
45}
56
tests/ui/privacy/unreachable-issue-121455.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
1error[E0433]: cannot find `Self` in this scope
22 --> $DIR/unreachable-issue-121455.rs:1:13
33 |
44LL | fn test(s: &Self::Id) {
tests/ui/proc-macro/amputate-span.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of undeclared type `Command`
1error[E0433]: cannot find type `Command` in this scope
22 --> $DIR/amputate-span.rs:49:5
33 |
44LL | Command::new("git");
......@@ -9,7 +9,7 @@ help: consider importing this struct
99LL + use std::process::Command;
1010 |
1111
12error[E0433]: failed to resolve: use of undeclared type `Command`
12error[E0433]: cannot find type `Command` in this scope
1313 --> $DIR/amputate-span.rs:63:9
1414 |
1515LL | Command::new("git");
tests/ui/proc-macro/pretty-print-hack-hide.rs deleted-12
......@@ -1,12 +0,0 @@
1//@ proc-macro: test-macros.rs
2//@ compile-flags: -Z span-debug
3//@ check-pass
4
5#![no_std] // Don't load unnecessary hygiene information from std
6extern crate std;
7
8#[macro_use] extern crate test_macros;
9
10include!("pretty-print-hack/rental-0.5.6/src/lib.rs");
11
12fn main() {}
tests/ui/proc-macro/pretty-print-hack-hide.stdout deleted-21
......@@ -1,21 +0,0 @@
1PRINT-DERIVE INPUT (DISPLAY): enum ProceduralMasqueradeDummyType { Input }
2PRINT-DERIVE INPUT (DEBUG): TokenStream [
3 Ident {
4 ident: "enum",
5 span: $DIR/pretty-print-hack/rental-0.5.6/src/lib.rs:4:1: 4:5 (#0),
6 },
7 Ident {
8 ident: "ProceduralMasqueradeDummyType",
9 span: $DIR/pretty-print-hack/rental-0.5.6/src/lib.rs:4:6: 4:35 (#0),
10 },
11 Group {
12 delimiter: Brace,
13 stream: TokenStream [
14 Ident {
15 ident: "Input",
16 span: $DIR/pretty-print-hack/rental-0.5.6/src/lib.rs:13:5: 13:10 (#0),
17 },
18 ],
19 span: $DIR/pretty-print-hack/rental-0.5.6/src/lib.rs:4:36: 14:2 (#0),
20 },
21]
tests/ui/proc-macro/pretty-print-hack-show.local.stderr deleted-6
......@@ -1,6 +0,0 @@
1error: using an old version of `rental`
2 |
3 = 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
4
5error: aborting due to 1 previous error
6
tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr deleted-6
......@@ -1,6 +0,0 @@
1error: using an old version of `rental`
2 |
3 = 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
4
5error: aborting due to 1 previous error
6
tests/ui/proc-macro/pretty-print-hack-show.rs deleted-21
......@@ -1,21 +0,0 @@
1//@ proc-macro: test-macros.rs
2//@ compile-flags: -Z span-debug
3//@ revisions: local remapped
4//@ [remapped] remap-src-base
5
6#![no_std] // Don't load unnecessary hygiene information from std
7extern crate std;
8
9#[macro_use] extern crate test_macros;
10
11mod first {
12 include!("pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs");
13}
14
15mod second {
16 include!("pretty-print-hack/rental-0.5.5/src/lib.rs");
17}
18
19fn main() {}
20
21//~? ERROR using an old version of `rental`
tests/ui/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs deleted-14
......@@ -1,14 +0,0 @@
1//@ ignore-auxiliary (used by `../../../pretty-print-hack-show.rs`)
2
3#[derive(Print)]
4enum ProceduralMasqueradeDummyType {
5//~^ ERROR using
6//~| WARN this was previously
7//~| ERROR using
8//~| WARN this was previously
9//~| ERROR using
10//~| WARN this was previously
11//~| ERROR using
12//~| WARN this was previously
13 Input
14}
tests/ui/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs deleted-14
......@@ -1,14 +0,0 @@
1//@ ignore-auxiliary (used by `../../../pretty-print-hack-show.rs`)
2
3#[derive(Print)]
4enum ProceduralMasqueradeDummyType {
5//~^ ERROR using
6//~| WARN this was previously
7//~| ERROR using
8//~| WARN this was previously
9//~| ERROR using
10//~| WARN this was previously
11//~| ERROR using
12//~| WARN this was previously
13 Input
14}
tests/ui/proc-macro/pretty-print-hack/rental-0.5.6/src/lib.rs deleted-14
......@@ -1,14 +0,0 @@
1//@ ignore-auxiliary (used by `../../../pretty-print-hack/hide.rs`)
2
3#[derive(Print)]
4enum ProceduralMasqueradeDummyType {
5//~^ ERROR using
6//~| WARN this was previously
7//~| ERROR using
8//~| WARN this was previously
9//~| ERROR using
10//~| WARN this was previously
11//~| ERROR using
12//~| WARN this was previously
13 Input
14}
tests/ui/resolve/112590-2.fixed+5-5
......@@ -16,7 +16,7 @@ mod u {
1616 use foo::bar::baz::MyVec;
1717
1818fn _a() {
19 let _: Vec<i32> = MyVec::new(); //~ ERROR failed to resolve
19 let _: Vec<i32> = MyVec::new(); //~ ERROR cannot find
2020 }
2121}
2222
......@@ -24,12 +24,12 @@ mod v {
2424 use foo::bar::baz::MyVec;
2525
2626fn _b() {
27 let _: Vec<i32> = MyVec::new(); //~ ERROR failed to resolve
27 let _: Vec<i32> = MyVec::new(); //~ ERROR cannot find
2828 }
2929}
3030
3131fn main() {
32 let _t: Vec<i32> = Vec::new(); //~ ERROR failed to resolve
33 type _B = vec::Vec::<u8>; //~ ERROR failed to resolve
34 let _t = AtomicBool::new(true); //~ ERROR failed to resolve
32 let _t: Vec<i32> = Vec::new(); //~ ERROR cannot find
33 type _B = vec::Vec::<u8>; //~ ERROR cannot find
34 let _t = AtomicBool::new(true); //~ ERROR cannot find
3535}
tests/ui/resolve/112590-2.rs+5-5
......@@ -10,18 +10,18 @@ mod foo {
1010
1111mod u {
1212 fn _a() {
13 let _: Vec<i32> = super::foo::baf::baz::MyVec::new(); //~ ERROR failed to resolve
13 let _: Vec<i32> = super::foo::baf::baz::MyVec::new(); //~ ERROR cannot find
1414 }
1515}
1616
1717mod v {
1818 fn _b() {
19 let _: Vec<i32> = fox::bar::baz::MyVec::new(); //~ ERROR failed to resolve
19 let _: Vec<i32> = fox::bar::baz::MyVec::new(); //~ ERROR cannot find
2020 }
2121}
2222
2323fn main() {
24 let _t: Vec<i32> = vec::new(); //~ ERROR failed to resolve
25 type _B = vec::Vec::<u8>; //~ ERROR failed to resolve
26 let _t = std::sync_error::atomic::AtomicBool::new(true); //~ ERROR failed to resolve
24 let _t: Vec<i32> = vec::new(); //~ ERROR cannot find
25 type _B = vec::Vec::<u8>; //~ ERROR cannot find
26 let _t = std::sync_error::atomic::AtomicBool::new(true); //~ ERROR cannot find
2727}
tests/ui/resolve/112590-2.stderr+5-5
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: could not find `baf` in `foo`
1error[E0433]: cannot find `baf` in `foo`
22 --> $DIR/112590-2.rs:13:39
33 |
44LL | let _: Vec<i32> = super::foo::baf::baz::MyVec::new();
......@@ -14,7 +14,7 @@ LL - let _: Vec<i32> = super::foo::baf::baz::MyVec::new();
1414LL + let _: Vec<i32> = MyVec::new();
1515 |
1616
17error[E0433]: failed to resolve: use of unresolved module or unlinked crate `fox`
17error[E0433]: cannot find module or crate `fox` in this scope
1818 --> $DIR/112590-2.rs:19:27
1919 |
2020LL | let _: Vec<i32> = fox::bar::baz::MyVec::new();
......@@ -31,7 +31,7 @@ LL - let _: Vec<i32> = fox::bar::baz::MyVec::new();
3131LL + let _: Vec<i32> = MyVec::new();
3232 |
3333
34error[E0433]: failed to resolve: use of unresolved module or unlinked crate `vec`
34error[E0433]: cannot find module or crate `vec` in this scope
3535 --> $DIR/112590-2.rs:25:15
3636 |
3737LL | type _B = vec::Vec::<u8>;
......@@ -43,7 +43,7 @@ help: consider importing this module
4343LL + use std::vec;
4444 |
4545
46error[E0433]: failed to resolve: could not find `sync_error` in `std`
46error[E0433]: cannot find `sync_error` in `std`
4747 --> $DIR/112590-2.rs:26:19
4848 |
4949LL | let _t = std::sync_error::atomic::AtomicBool::new(true);
......@@ -59,7 +59,7 @@ LL - let _t = std::sync_error::atomic::AtomicBool::new(true);
5959LL + let _t = AtomicBool::new(true);
6060 |
6161
62error[E0433]: failed to resolve: use of unresolved module or unlinked crate `vec`
62error[E0433]: cannot find module or crate `vec` in this scope
6363 --> $DIR/112590-2.rs:24:24
6464 |
6565LL | let _t: Vec<i32> = vec::new();
tests/ui/resolve/bad-module.rs+2-2
......@@ -1,7 +1,7 @@
11fn main() {
22 let foo = thing::len(Vec::new());
3 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `thing`
3 //~^ ERROR cannot find module or crate `thing`
44
55 let foo = foo::bar::baz();
6 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `foo`
6 //~^ ERROR cannot find module or crate `foo`
77}
tests/ui/resolve/bad-module.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `foo`
1error[E0433]: cannot find module or crate `foo` in this scope
22 --> $DIR/bad-module.rs:5:15
33 |
44LL | let foo = foo::bar::baz();
......@@ -6,7 +6,7 @@ LL | let foo = foo::bar::baz();
66 |
77 = help: you might be missing a crate named `foo`
88
9error[E0433]: failed to resolve: use of unresolved module or unlinked crate `thing`
9error[E0433]: cannot find module or crate `thing` in this scope
1010 --> $DIR/bad-module.rs:2:15
1111 |
1212LL | let foo = thing::len(Vec::new());
tests/ui/resolve/editions-crate-root-2015.rs+4-4
......@@ -2,17 +2,17 @@
22
33mod inner {
44 fn global_inner(_: ::nonexistant::Foo) {
5 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `nonexistant`
5 //~^ ERROR: cannot find module or crate `nonexistant`
66 }
77 fn crate_inner(_: crate::nonexistant::Foo) {
8 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `nonexistant`
8 //~^ ERROR: cannot find module or crate `nonexistant`
99 }
1010
1111 fn bare_global(_: ::nonexistant) {
12 //~^ ERROR cannot find type `nonexistant` in the crate root
12 //~^ ERROR: cannot find type `nonexistant` in the crate root
1313 }
1414 fn bare_crate(_: crate::nonexistant) {
15 //~^ ERROR cannot find type `nonexistant` in the crate root
15 //~^ ERROR: cannot find type `nonexistant` in the crate root
1616 }
1717}
1818
tests/ui/resolve/editions-crate-root-2015.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistant`
1error[E0433]: cannot find module or crate `nonexistant` in the crate root
22 --> $DIR/editions-crate-root-2015.rs:4:26
33 |
44LL | fn global_inner(_: ::nonexistant::Foo) {
......@@ -9,7 +9,7 @@ help: you might be missing a crate named `nonexistant`, add it to your project a
99LL + extern crate nonexistant;
1010 |
1111
12error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistant`
12error[E0433]: cannot find module or crate `nonexistant` in `crate`
1313 --> $DIR/editions-crate-root-2015.rs:7:30
1414 |
1515LL | fn crate_inner(_: crate::nonexistant::Foo) {
tests/ui/resolve/editions-crate-root-2018.rs+4-4
......@@ -2,17 +2,17 @@
22
33mod inner {
44 fn global_inner(_: ::nonexistant::Foo) {
5 //~^ ERROR failed to resolve: could not find `nonexistant` in the list of imported crates
5 //~^ ERROR: cannot find `nonexistant`
66 }
77 fn crate_inner(_: crate::nonexistant::Foo) {
8 //~^ ERROR failed to resolve: could not find `nonexistant` in the crate root
8 //~^ ERROR: cannot find `nonexistant`
99 }
1010
1111 fn bare_global(_: ::nonexistant) {
12 //~^ ERROR cannot find crate `nonexistant` in the list of imported crates
12 //~^ ERROR: cannot find crate `nonexistant`
1313 }
1414 fn bare_crate(_: crate::nonexistant) {
15 //~^ ERROR cannot find type `nonexistant` in the crate root
15 //~^ ERROR: cannot find type `nonexistant` in the crate root
1616 }
1717}
1818
tests/ui/resolve/editions-crate-root-2018.stderr+2-2
......@@ -1,10 +1,10 @@
1error[E0433]: failed to resolve: could not find `nonexistant` in the list of imported crates
1error[E0433]: cannot find `nonexistant` in the crate root
22 --> $DIR/editions-crate-root-2018.rs:4:26
33 |
44LL | fn global_inner(_: ::nonexistant::Foo) {
55 | ^^^^^^^^^^^ could not find `nonexistant` in the list of imported crates
66
7error[E0433]: failed to resolve: could not find `nonexistant` in the crate root
7error[E0433]: cannot find `nonexistant` in `crate`
88 --> $DIR/editions-crate-root-2018.rs:7:30
99 |
1010LL | fn crate_inner(_: crate::nonexistant::Foo) {
tests/ui/resolve/export-fully-qualified-2018.rs+2-1
......@@ -5,7 +5,8 @@
55// want to change eventually.
66
77mod foo {
8 pub fn bar() { foo::baz(); } //~ ERROR failed to resolve: use of unresolved module or unlinked crate `foo`
8 pub fn bar() { foo::baz(); } //~ ERROR: cannot find
9 //~^ NOTE: use of unresolved module or unlinked crate `foo`
910
1011 fn baz() { }
1112}
tests/ui/resolve/export-fully-qualified-2018.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `foo`
1error[E0433]: cannot find module or crate `foo` in this scope
22 --> $DIR/export-fully-qualified-2018.rs:8:20
33 |
44LL | pub fn bar() { foo::baz(); }
tests/ui/resolve/export-fully-qualified.rs+1-1
......@@ -5,7 +5,7 @@
55// want to change eventually.
66
77mod foo {
8 pub fn bar() { foo::baz(); } //~ ERROR failed to resolve: use of unresolved module or unlinked crate `foo`
8 pub fn bar() { foo::baz(); } //~ ERROR cannot find module or crate `foo`
99
1010 fn baz() { }
1111}
tests/ui/resolve/export-fully-qualified.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `foo`
1error[E0433]: cannot find module or crate `foo` in this scope
22 --> $DIR/export-fully-qualified.rs:8:20
33 |
44LL | pub fn bar() { foo::baz(); }
tests/ui/resolve/exported-macro-in-mod-147958.rs created+21
......@@ -0,0 +1,21 @@
1//! Regression test for <https://github.com/rust-lang/rust/issues/147958>
2
3//@ check-pass
4
5#![feature(decl_macro)]
6
7macro_rules! exported {
8 () => {
9 #[macro_export]
10 macro_rules! exported {
11 () => {};
12 }
13 };
14}
15use inner1::*;
16exported!();
17mod inner1 {
18 pub macro exported() {}
19}
20
21fn main() {}
tests/ui/resolve/extern-prelude-fail.rs+1-1
......@@ -6,5 +6,5 @@
66
77fn main() {
88 use extern_prelude::S; //~ ERROR unresolved import `extern_prelude`
9 let s = ::extern_prelude::S; //~ ERROR failed to resolve
9 let s = ::extern_prelude::S; //~ ERROR cannot find module or crate `extern_prelude`
1010}
tests/ui/resolve/extern-prelude-fail.stderr+1-1
......@@ -9,7 +9,7 @@ help: you might be missing a crate named `extern_prelude`, add it to your projec
99LL + extern crate extern_prelude;
1010 |
1111
12error[E0433]: failed to resolve: use of unresolved module or unlinked crate `extern_prelude`
12error[E0433]: cannot find module or crate `extern_prelude` in the crate root
1313 --> $DIR/extern-prelude-fail.rs:9:15
1414 |
1515LL | let s = ::extern_prelude::S;
tests/ui/resolve/function-module-ambiguity-error-71406.rs+2-1
......@@ -3,5 +3,6 @@ use std::sync::mpsc;
33
44fn main() {
55 let (tx, rx) = mpsc::channel::new(1);
6 //~^ ERROR expected type, found function `channel` in `mpsc`
6 //~^ ERROR: cannot find `channel`
7 //~| NOTE: expected type, found function `channel` in `mpsc`
78}
tests/ui/resolve/function-module-ambiguity-error-71406.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: expected type, found function `channel` in `mpsc`
1error[E0433]: cannot find `channel` in `mpsc`
22 --> $DIR/function-module-ambiguity-error-71406.rs:5:26
33 |
44LL | let (tx, rx) = mpsc::channel::new(1);
tests/ui/resolve/impl-items-vis-unresolved.rs+1-1
......@@ -19,7 +19,7 @@ pub struct RawFloatState;
1919impl RawFloatState {
2020 perftools_inline! {
2121 pub(super) fn new() {}
22 //~^ ERROR failed to resolve: there are too many leading `super` keywords
22 //~^ ERROR: too many leading `super` keywords
2323 }
2424}
2525
tests/ui/resolve/impl-items-vis-unresolved.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: there are too many leading `super` keywords
1error[E0433]: too many leading `super` keywords
22 --> $DIR/impl-items-vis-unresolved.rs:21:13
33 |
44LL | pub(super) fn new() {}
tests/ui/resolve/issue-101749-2.rs+1-1
......@@ -12,5 +12,5 @@ fn main() {
1212 let rect = Rectangle::new(3, 4);
1313 // `area` is not implemented for `Rectangle`, so this should not suggest
1414 let _ = rect::area();
15 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `rect`
15 //~^ ERROR: cannot find module or crate `rect`
1616}
tests/ui/resolve/issue-101749-2.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `rect`
1error[E0433]: cannot find module or crate `rect` in this scope
22 --> $DIR/issue-101749-2.rs:14:13
33 |
44LL | let _ = rect::area();
tests/ui/resolve/issue-101749.fixed+1-1
......@@ -15,5 +15,5 @@ impl Rectangle {
1515fn main() {
1616 let rect = Rectangle::new(3, 4);
1717 let _ = rect.area();
18 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `rect`
18 //~^ ERROR: cannot find module or crate `rect`
1919}
tests/ui/resolve/issue-101749.rs+1-1
......@@ -15,5 +15,5 @@ impl Rectangle {
1515fn main() {
1616 let rect = Rectangle::new(3, 4);
1717 let _ = rect::area();
18 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `rect`
18 //~^ ERROR: cannot find module or crate `rect`
1919}
tests/ui/resolve/issue-101749.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `rect`
1error[E0433]: cannot find module or crate `rect` in this scope
22 --> $DIR/issue-101749.rs:17:13
33 |
44LL | let _ = rect::area();
tests/ui/resolve/issue-109250.rs+1-1
......@@ -1,3 +1,3 @@
11fn main() { //~ HELP consider importing
2 HashMap::new; //~ ERROR failed to resolve: use of undeclared type `HashMap`
2 HashMap::new; //~ ERROR cannot find type `HashMap`
33}
tests/ui/resolve/issue-109250.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of undeclared type `HashMap`
1error[E0433]: cannot find type `HashMap` in this scope
22 --> $DIR/issue-109250.rs:2:5
33 |
44LL | HashMap::new;
tests/ui/resolve/issue-117920.rs+1-1
......@@ -1,6 +1,6 @@
11#![crate_type = "lib"]
22
3use super::A; //~ ERROR failed to resolve
3use super::A; //~ ERROR too many leading `super` keywords
44
55mod b {
66 pub trait A {}
tests/ui/resolve/issue-117920.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: there are too many leading `super` keywords
1error[E0433]: too many leading `super` keywords
22 --> $DIR/issue-117920.rs:3:5
33 |
44LL | use super::A;
tests/ui/resolve/issue-24968.rs+2-2
......@@ -19,12 +19,12 @@ const FOO: Self = 0;
1919//~^ ERROR cannot find type `Self`
2020
2121const FOO2: u32 = Self::bar();
22//~^ ERROR failed to resolve: `Self`
22//~^ ERROR cannot find `Self`
2323
2424static FOO_S: Self = 0;
2525//~^ ERROR cannot find type `Self`
2626
2727static FOO_S2: u32 = Self::bar();
28//~^ ERROR failed to resolve: `Self`
28//~^ ERROR cannot find `Self`
2929
3030fn main() {}
tests/ui/resolve/issue-24968.stderr+2-2
......@@ -39,13 +39,13 @@ LL | static FOO_S: Self = 0;
3939 | |
4040 | `Self` not allowed in a static item
4141
42error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
42error[E0433]: cannot find `Self` in this scope
4343 --> $DIR/issue-24968.rs:21:19
4444 |
4545LL | const FOO2: u32 = Self::bar();
4646 | ^^^^ `Self` is only available in impls, traits, and type definitions
4747
48error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
48error[E0433]: cannot find `Self` in this scope
4949 --> $DIR/issue-24968.rs:27:22
5050 |
5151LL | static FOO_S2: u32 = Self::bar();
tests/ui/resolve/issue-81508.rs+2-2
......@@ -8,7 +8,7 @@
88fn main() {
99 let Baz: &str = "";
1010
11 println!("{}", Baz::Bar); //~ ERROR: failed to resolve: use of undeclared type `Baz`
11 println!("{}", Baz::Bar); //~ ERROR: cannot find type `Baz`
1212}
1313
1414#[allow(non_upper_case_globals)]
......@@ -17,6 +17,6 @@ pub const Foo: &str = "";
1717mod submod {
1818 use super::Foo;
1919 fn function() {
20 println!("{}", Foo::Bar); //~ ERROR: failed to resolve: use of undeclared type `Foo`
20 println!("{}", Foo::Bar); //~ ERROR: cannot find type `Foo`
2121 }
2222}
tests/ui/resolve/issue-81508.stderr+4-10
......@@ -1,20 +1,14 @@
1error[E0433]: failed to resolve: use of undeclared type `Baz`
1error[E0433]: cannot find type `Baz` in this scope
22 --> $DIR/issue-81508.rs:11:20
33 |
4LL | let Baz: &str = "";
5 | --- help: `Baz` is defined here, but is not a type
6LL |
74LL | println!("{}", Baz::Bar);
8 | ^^^ use of undeclared type `Baz`
5 | ^^^ `Baz` is declared as a local binding at `issue-81508.rs:9:9`, not a type
96
10error[E0433]: failed to resolve: use of undeclared type `Foo`
7error[E0433]: cannot find type `Foo` in this scope
118 --> $DIR/issue-81508.rs:20:24
129 |
13LL | use super::Foo;
14 | ---------- help: `Foo` is defined here, but is not a type
15LL | fn function() {
1610LL | println!("{}", Foo::Bar);
17 | ^^^ use of undeclared type `Foo`
11 | ^^^ `Foo` is declared as a constant at `issue-81508.rs:18:9`, not a type
1812
1913error: aborting due to 2 previous errors
2014
tests/ui/resolve/issue-82156.rs+1-1
......@@ -1,3 +1,3 @@
11fn main() {
2 super(); //~ ERROR failed to resolve: there are too many leading `super` keywords
2 super(); //~ ERROR: too many leading `super` keywords
33}
tests/ui/resolve/issue-82156.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: there are too many leading `super` keywords
1error[E0433]: too many leading `super` keywords
22 --> $DIR/issue-82156.rs:2:5
33 |
44LL | super();
tests/ui/resolve/issue-82865.rs+1-1
......@@ -3,7 +3,7 @@
33
44#![feature(decl_macro)]
55
6use x::y::z; //~ ERROR: failed to resolve: use of unresolved module or unlinked crate `x`
6use x::y::z; //~ ERROR: cannot find module or crate `x`
77
88macro mac () {
99 Box::z //~ ERROR: no function or associated item
tests/ui/resolve/issue-82865.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `x`
1error[E0433]: cannot find module or crate `x` in the crate root
22 --> $DIR/issue-82865.rs:6:5
33 |
44LL | use x::y::z;
tests/ui/resolve/missing-in-namespace.rs+1-1
......@@ -1,4 +1,4 @@
11fn main() {
22 let _map = std::hahmap::HashMap::new();
3 //~^ ERROR failed to resolve: could not find `hahmap` in `std
3 //~^ ERROR: cannot find `hahmap` in `std
44}
tests/ui/resolve/missing-in-namespace.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: could not find `hahmap` in `std`
1error[E0433]: cannot find `hahmap` in `std`
22 --> $DIR/missing-in-namespace.rs:2:21
33 |
44LL | let _map = std::hahmap::HashMap::new();
tests/ui/resolve/prelude-order.rs+2-2
......@@ -59,7 +59,7 @@ extern crate macro_helpers as _;
5959/* lang and libs implicitly in scope */
6060
6161// tool/extern -> extern
62#[type_ns::inner] //~ ERROR could not find `inner` in `type_ns`
62#[type_ns::inner] //~ ERROR cannot find `inner` in `type_ns`
6363fn t1() {}
6464
6565// tool/lang -> tool
......@@ -71,7 +71,7 @@ fn t2() {}
7171fn t3() {}
7272
7373// extern/lang -> extern
74#[usize::inner] //~ ERROR could not find `inner` in `usize`
74#[usize::inner] //~ ERROR cannot find `inner` in `usize`
7575fn e1() {} // NOTE: testing with `-> usize` isn't valid, crates aren't considered in that scope
7676 // (unless they have generic arguments, for some reason.)
7777
tests/ui/resolve/prelude-order.stderr+2-2
......@@ -1,10 +1,10 @@
1error[E0433]: failed to resolve: could not find `inner` in `type_ns`
1error[E0433]: cannot find `inner` in `type_ns`
22 --> $DIR/prelude-order.rs:62:12
33 |
44LL | #[type_ns::inner]
55 | ^^^^^ could not find `inner` in `type_ns`
66
7error[E0433]: failed to resolve: could not find `inner` in `usize`
7error[E0433]: cannot find `inner` in `usize`
88 --> $DIR/prelude-order.rs:74:10
99 |
1010LL | #[usize::inner]
tests/ui/resolve/resolve-bad-visibility.rs+2-2
......@@ -5,8 +5,8 @@ trait Tr {}
55pub(in E) struct S; //~ ERROR expected module, found enum `E`
66pub(in Tr) struct Z; //~ ERROR expected module, found trait `Tr`
77pub(in std::vec) struct F; //~ ERROR visibilities can only be restricted to ancestor modules
8pub(in nonexistent) struct G; //~ ERROR failed to resolve
9pub(in too_soon) struct H; //~ ERROR failed to resolve
8pub(in nonexistent) struct G; //~ ERROR cannot find
9pub(in too_soon) struct H; //~ ERROR cannot find
1010
1111// Visibilities are resolved eagerly without waiting for modules becoming fully populated.
1212// Visibilities can only use ancestor modules legally which are always available in time,
tests/ui/resolve/resolve-bad-visibility.stderr+2-2
......@@ -16,7 +16,7 @@ error[E0742]: visibilities can only be restricted to ancestor modules
1616LL | pub(in std::vec) struct F;
1717 | ^^^^^^^^
1818
19error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistent`
19error[E0433]: cannot find module or crate `nonexistent` in the crate root
2020 --> $DIR/resolve-bad-visibility.rs:8:8
2121 |
2222LL | pub(in nonexistent) struct G;
......@@ -27,7 +27,7 @@ help: you might be missing a crate named `nonexistent`, add it to your project a
2727LL + extern crate nonexistent;
2828 |
2929
30error[E0433]: failed to resolve: use of unresolved module or unlinked crate `too_soon`
30error[E0433]: cannot find module or crate `too_soon` in the crate root
3131 --> $DIR/resolve-bad-visibility.rs:9:8
3232 |
3333LL | pub(in too_soon) struct H;
tests/ui/resolve/resolve-variant-assoc-item.rs+2-2
......@@ -3,6 +3,6 @@ enum E { V }
33use E::V;
44
55fn main() {
6 E::V::associated_item; //~ ERROR failed to resolve: `V` is a variant, not a module
7 V::associated_item; //~ ERROR failed to resolve: `V` is a variant, not a module
6 E::V::associated_item; //~ ERROR: cannot find
7 V::associated_item; //~ ERROR: cannot find
88}
tests/ui/resolve/resolve-variant-assoc-item.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: `V` is a variant, not a module
1error[E0433]: cannot find module `V` in `E`
22 --> $DIR/resolve-variant-assoc-item.rs:6:8
33 |
44LL | E::V::associated_item;
......@@ -10,7 +10,7 @@ LL - E::V::associated_item;
1010LL + E::associated_item;
1111 |
1212
13error[E0433]: failed to resolve: `V` is a variant, not a module
13error[E0433]: cannot find module `V` in this scope
1414 --> $DIR/resolve-variant-assoc-item.rs:7:5
1515 |
1616LL | V::associated_item;
tests/ui/resolve/tool-import.rs+2-1
......@@ -1,7 +1,8 @@
11//@ edition: 2018
22
33use clippy::time::Instant;
4//~^ ERROR `clippy` is a tool module
4//~^ ERROR: cannot find module `clippy`
5//~| NOTE: `clippy` is a tool module
56
67fn main() {
78 Instant::now();
tests/ui/resolve/tool-import.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: `clippy` is a tool module, not a module
1error[E0433]: cannot find module `clippy` in this scope
22 --> $DIR/tool-import.rs:3:5
33 |
44LL | use clippy::time::Instant;
tests/ui/resolve/typo-suggestion-mistyped-in-path.rs+4-4
......@@ -25,18 +25,18 @@ fn main() {
2525 //~| NOTE function or associated item not found in `Struct`
2626
2727 Struc::foo();
28 //~^ ERROR failed to resolve: use of undeclared type `Struc`
28 //~^ ERROR cannot find type `Struc`
2929 //~| NOTE use of undeclared type `Struc`
3030
3131 modul::foo();
32 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `modul`
32 //~^ ERROR cannot find module or crate `modul`
3333 //~| NOTE use of unresolved module or unlinked crate `modul`
3434
3535 module::Struc::foo();
36 //~^ ERROR failed to resolve: could not find `Struc` in `module`
36 //~^ ERROR cannot find `Struc` in `module`
3737 //~| NOTE could not find `Struc` in `module`
3838
3939 Trai::foo();
40 //~^ ERROR failed to resolve: use of undeclared type `Trai`
40 //~^ ERROR cannot find type `Trai`
4141 //~| NOTE use of undeclared type `Trai`
4242}
tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr+4-4
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: could not find `Struc` in `module`
1error[E0433]: cannot find `Struc` in `module`
22 --> $DIR/typo-suggestion-mistyped-in-path.rs:35:13
33 |
44LL | module::Struc::foo();
......@@ -24,7 +24,7 @@ LL - Struct::fob();
2424LL + Struct::foo();
2525 |
2626
27error[E0433]: failed to resolve: use of undeclared type `Struc`
27error[E0433]: cannot find type `Struc` in this scope
2828 --> $DIR/typo-suggestion-mistyped-in-path.rs:27:5
2929 |
3030LL | Struc::foo();
......@@ -35,7 +35,7 @@ help: a struct with a similar name exists
3535LL | Struct::foo();
3636 | +
3737
38error[E0433]: failed to resolve: use of unresolved module or unlinked crate `modul`
38error[E0433]: cannot find module or crate `modul` in this scope
3939 --> $DIR/typo-suggestion-mistyped-in-path.rs:31:5
4040 |
4141LL | modul::foo();
......@@ -46,7 +46,7 @@ help: there is a crate or module with a similar name
4646LL | module::foo();
4747 | +
4848
49error[E0433]: failed to resolve: use of undeclared type `Trai`
49error[E0433]: cannot find type `Trai` in this scope
5050 --> $DIR/typo-suggestion-mistyped-in-path.rs:39:5
5151 |
5252LL | Trai::foo();
tests/ui/resolve/unresolved-module-error-33293.rs+1-1
......@@ -2,6 +2,6 @@
22fn main() {
33 match 0 {
44 aaa::bbb(_) => ()
5 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `aaa`
5 //~^ ERROR: cannot find module or crate `aaa`
66 };
77}
tests/ui/resolve/unresolved-module-error-33293.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `aaa`
1error[E0433]: cannot find module or crate `aaa` in this scope
22 --> $DIR/unresolved-module-error-33293.rs:4:9
33 |
44LL | aaa::bbb(_) => ()
tests/ui/resolve/unresolved-segments-visibility.rs+2-1
......@@ -6,6 +6,7 @@ extern crate alloc as b;
66mod foo {
77 mod bar {
88 pub(in crate::b::string::String::newy) extern crate alloc as e;
9 //~^ ERROR failed to resolve: `String` is a struct, not a module [E0433]
9 //~^ ERROR: cannot find module `String` in `string` [E0433]
10 //~| NOTE: `String` is a struct, not a module
1011 }
1112}
tests/ui/resolve/unresolved-segments-visibility.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: `String` is a struct, not a module
1error[E0433]: cannot find module `String` in `string`
22 --> $DIR/unresolved-segments-visibility.rs:8:34
33 |
44LL | pub(in crate::b::string::String::newy) extern crate alloc as e;
tests/ui/resolve/use_suggestion.rs+2-2
......@@ -1,6 +1,6 @@
11fn main() {
2 let x1 = HashMap::new(); //~ ERROR failed to resolve
3 let x2 = GooMap::new(); //~ ERROR failed to resolve
2 let x1 = HashMap::new(); //~ ERROR cannot find
3 let x2 = GooMap::new(); //~ ERROR cannot find
44
55 let y1: HashMap; //~ ERROR cannot find type
66 let y2: GooMap; //~ ERROR cannot find type
tests/ui/resolve/use_suggestion.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of undeclared type `HashMap`
1error[E0433]: cannot find type `HashMap` in this scope
22 --> $DIR/use_suggestion.rs:2:14
33 |
44LL | let x1 = HashMap::new();
......@@ -26,7 +26,7 @@ error[E0425]: cannot find type `GooMap` in this scope
2626LL | let y2: GooMap;
2727 | ^^^^^^ not found in this scope
2828
29error[E0433]: failed to resolve: use of undeclared type `GooMap`
29error[E0433]: cannot find type `GooMap` in this scope
3030 --> $DIR/use_suggestion.rs:3:14
3131 |
3232LL | let x2 = GooMap::new();
tests/ui/resolve/visibility-indeterminate.rs+1-1
......@@ -2,6 +2,6 @@
22
33foo!(); //~ ERROR cannot find macro `foo` in this scope
44
5pub(in ::bar) struct Baz {} //~ ERROR failed to resolve: could not find `bar` in the list of imported crates
5pub(in ::bar) struct Baz {} //~ ERROR cannot find `bar`
66
77fn main() {}
tests/ui/resolve/visibility-indeterminate.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: could not find `bar` in the list of imported crates
1error[E0433]: cannot find `bar` in the crate root
22 --> $DIR/visibility-indeterminate.rs:5:10
33 |
44LL | pub(in ::bar) struct Baz {}
tests/ui/rfcs/rfc-2126-crate-paths/crate-path-non-absolute.rs+2-2
......@@ -3,8 +3,8 @@ struct S;
33
44pub mod m {
55 fn f() {
6 let s = ::m::crate::S; //~ ERROR failed to resolve
7 let s1 = ::crate::S; //~ ERROR failed to resolve
6 let s = ::m::crate::S; //~ ERROR: `crate` in paths can only be used in start position
7 let s1 = ::crate::S; //~ ERROR: global paths cannot start with `crate`
88 let s2 = crate::S; // no error
99 }
1010}
tests/ui/rfcs/rfc-2126-crate-paths/crate-path-non-absolute.stderr+4-4
......@@ -1,14 +1,14 @@
1error[E0433]: failed to resolve: `crate` in paths can only be used in start position
1error[E0433]: `crate` in paths can only be used in start position
22 --> $DIR/crate-path-non-absolute.rs:6:22
33 |
44LL | let s = ::m::crate::S;
5 | ^^^^^ `crate` in paths can only be used in start position
5 | ^^^^^ can only be used in path start position
66
7error[E0433]: failed to resolve: global paths cannot start with `crate`
7error[E0433]: global paths cannot start with `crate`
88 --> $DIR/crate-path-non-absolute.rs:7:20
99 |
1010LL | let s1 = ::crate::S;
11 | ^^^^^ global paths cannot start with `crate`
11 | ^^^^^ cannot start with this
1212
1313error: aborting due to 2 previous errors
1414
tests/ui/rfcs/rfc-2126-extern-absolute-paths/non-existent-2.rs+1-1
......@@ -2,5 +2,5 @@
22
33fn main() {
44 let s = ::xcrate::S;
5 //~^ ERROR failed to resolve: could not find `xcrate` in the list of imported crates
5 //~^ ERROR cannot find `xcrate`
66}
tests/ui/rfcs/rfc-2126-extern-absolute-paths/non-existent-2.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: could not find `xcrate` in the list of imported crates
1error[E0433]: cannot find `xcrate` in the crate root
22 --> $DIR/non-existent-2.rs:4:15
33 |
44LL | let s = ::xcrate::S;
tests/ui/simd/portable-intrinsics-arent-exposed.stderr+8-5
......@@ -1,11 +1,14 @@
1error[E0433]: failed to resolve: you might be missing crate `core`
1error[E0433]: cannot find `core` in the crate root
22 --> $DIR/portable-intrinsics-arent-exposed.rs:5:5
33 |
44LL | use core::simd::intrinsics;
5 | ^^^^
6 | |
7 | you might be missing crate `core`
8 | help: try using `std` instead of `core`: `std`
5 | ^^^^ you might be missing crate `core`
6 |
7help: try using `std` instead of `core`
8 |
9LL - use core::simd::intrinsics;
10LL + use std::simd::intrinsics;
11 |
912
1013error[E0432]: unresolved import `std::simd::intrinsics`
1114 --> $DIR/portable-intrinsics-arent-exposed.rs:6:5
tests/ui/span/visibility-ty-params.rs+1-1
......@@ -4,7 +4,7 @@ macro_rules! m {
44
55struct S<T>(T);
66m!{ crate::S<u8> } //~ ERROR unexpected generic arguments in path
7 //~| ERROR failed to resolve: `S` is a struct, not a module [E0433]
7 //~| ERROR cannot find
88
99mod m {
1010 m!{ crate::m<> } //~ ERROR unexpected generic arguments in path
tests/ui/span/visibility-ty-params.stderr+1-1
......@@ -4,7 +4,7 @@ error: unexpected generic arguments in path
44LL | m!{ crate::S<u8> }
55 | ^^^^
66
7error[E0433]: failed to resolve: `S` is a struct, not a module
7error[E0433]: cannot find module `S` in `crate`
88 --> $DIR/visibility-ty-params.rs:6:12
99 |
1010LL | m!{ crate::S<u8> }
tests/ui/suggestions/core-std-import-order-issue-83564.no_std.fixed+1-1
......@@ -12,7 +12,7 @@ use core::num::NonZero;
1212fn main() {
1313 //~^ HELP consider importing this struct
1414 let _x = NonZero::new(5u32).unwrap();
15 //~^ ERROR failed to resolve: use of undeclared type `NonZero`
15 //~^ ERROR cannot find type `NonZero`
1616}
1717
1818#[allow(dead_code)]
tests/ui/suggestions/core-std-import-order-issue-83564.no_std.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of undeclared type `NonZero`
1error[E0433]: cannot find type `NonZero` in this scope
22 --> $DIR/core-std-import-order-issue-83564.rs:12:14
33 |
44LL | let _x = NonZero::new(5u32).unwrap();
tests/ui/suggestions/core-std-import-order-issue-83564.rs+1-1
......@@ -10,7 +10,7 @@
1010fn main() {
1111 //~^ HELP consider importing this struct
1212 let _x = NonZero::new(5u32).unwrap();
13 //~^ ERROR failed to resolve: use of undeclared type `NonZero`
13 //~^ ERROR cannot find type `NonZero`
1414}
1515
1616#[allow(dead_code)]
tests/ui/suggestions/core-std-import-order-issue-83564.std.fixed+1-1
......@@ -12,7 +12,7 @@ use std::num::NonZero;
1212fn main() {
1313 //~^ HELP consider importing this struct
1414 let _x = NonZero::new(5u32).unwrap();
15 //~^ ERROR failed to resolve: use of undeclared type `NonZero`
15 //~^ ERROR cannot find type `NonZero`
1616}
1717
1818#[allow(dead_code)]
tests/ui/suggestions/core-std-import-order-issue-83564.std.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of undeclared type `NonZero`
1error[E0433]: cannot find type `NonZero` in this scope
22 --> $DIR/core-std-import-order-issue-83564.rs:12:14
33 |
44LL | let _x = NonZero::new(5u32).unwrap();
tests/ui/suggestions/crate-or-module-typo.rs+3-3
......@@ -1,9 +1,9 @@
11//@ edition:2018
22
3use st::cell::Cell; //~ ERROR failed to resolve: use of unresolved module or unlinked crate `st`
3use st::cell::Cell; //~ ERROR cannot find module or crate `st`
44
55mod bar {
6 pub fn bar() { bar::baz(); } //~ ERROR failed to resolve: function `bar` is not a crate or module
6 pub fn bar() { bar::baz(); } //~ ERROR cannot find module or crate `bar`
77
88 fn baz() {}
99}
......@@ -11,7 +11,7 @@ mod bar {
1111use bas::bar; //~ ERROR unresolved import `bas`
1212
1313struct Foo {
14 bar: st::cell::Cell<bool> //~ ERROR failed to resolve: use of unresolved module or unlinked crate `st`
14 bar: st::cell::Cell<bool> //~ ERROR cannot find module or crate `st`
1515}
1616
1717fn main() {}
tests/ui/suggestions/crate-or-module-typo.stderr+3-3
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `st`
1error[E0433]: cannot find module or crate `st` in this scope
22 --> $DIR/crate-or-module-typo.rs:3:5
33 |
44LL | use st::cell::Cell;
......@@ -21,7 +21,7 @@ LL - use bas::bar;
2121LL + use bar::bar;
2222 |
2323
24error[E0433]: failed to resolve: use of unresolved module or unlinked crate `st`
24error[E0433]: cannot find module or crate `st` in this scope
2525 --> $DIR/crate-or-module-typo.rs:14:10
2626 |
2727LL | bar: st::cell::Cell<bool>
......@@ -41,7 +41,7 @@ LL - bar: st::cell::Cell<bool>
4141LL + bar: cell::Cell<bool>
4242 |
4343
44error[E0433]: failed to resolve: function `bar` is not a crate or module
44error[E0433]: cannot find module or crate `bar` in this scope
4545 --> $DIR/crate-or-module-typo.rs:6:20
4646 |
4747LL | pub fn bar() { bar::baz(); }
tests/ui/suggestions/issue-103112.rs+1-1
......@@ -1,4 +1,4 @@
11fn main() {
22 std::process::abort!();
3 //~^ ERROR: failed to resolve
3 //~^ ERROR: cannot find
44}
tests/ui/suggestions/issue-103112.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: could not find `abort` in `process`
1error[E0433]: cannot find `abort` in `process`
22 --> $DIR/issue-103112.rs:2:19
33 |
44LL | std::process::abort!();
tests/ui/suggestions/issue-112590-suggest-import.rs+4-3
......@@ -1,8 +1,9 @@
11pub struct S;
22
3impl fmt::Debug for S { //~ ERROR failed to resolve: use of unresolved module or unlinked crate `fmt`
4 fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { //~ ERROR failed to resolve: use of unresolved module or unlinked crate `fmt`
5 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `fmt`
3impl fmt::Debug for S { //~ ERROR: cannot find module or crate `fmt`
4 fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
5 //~^ ERROR: cannot find module or crate `fmt`
6 //~| ERROR: cannot find module or crate `fmt`
67 Ok(())
78 }
89}
tests/ui/suggestions/issue-112590-suggest-import.stderr+3-3
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `fmt`
1error[E0433]: cannot find module or crate `fmt` in this scope
22 --> $DIR/issue-112590-suggest-import.rs:3:6
33 |
44LL | impl fmt::Debug for S {
......@@ -10,7 +10,7 @@ help: consider importing this module
1010LL + use std::fmt;
1111 |
1212
13error[E0433]: failed to resolve: use of unresolved module or unlinked crate `fmt`
13error[E0433]: cannot find module or crate `fmt` in this scope
1414 --> $DIR/issue-112590-suggest-import.rs:4:28
1515 |
1616LL | fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
......@@ -22,7 +22,7 @@ help: consider importing this module
2222LL + use std::fmt;
2323 |
2424
25error[E0433]: failed to resolve: use of unresolved module or unlinked crate `fmt`
25error[E0433]: cannot find module or crate `fmt` in this scope
2626 --> $DIR/issue-112590-suggest-import.rs:4:51
2727 |
2828LL | fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
tests/ui/suggestions/suggest-tryinto-edition-change.rs+3-3
......@@ -8,17 +8,17 @@ fn test() {
88 //~| NOTE 'std::convert::TryInto' is included in the prelude starting in Edition 2021
99
1010 let _i: i16 = TryFrom::try_from(0_i32).unwrap();
11 //~^ ERROR failed to resolve: use of undeclared type
11 //~^ ERROR cannot find
1212 //~| NOTE use of undeclared type
1313 //~| NOTE 'std::convert::TryFrom' is included in the prelude starting in Edition 2021
1414
1515 let _i: i16 = TryInto::try_into(0_i32).unwrap();
16 //~^ ERROR failed to resolve: use of undeclared type
16 //~^ ERROR cannot find
1717 //~| NOTE use of undeclared type
1818 //~| NOTE 'std::convert::TryInto' is included in the prelude starting in Edition 2021
1919
2020 let _v: Vec<_> = FromIterator::from_iter(&[1]);
21 //~^ ERROR failed to resolve: use of undeclared type
21 //~^ ERROR cannot find
2222 //~| NOTE use of undeclared type
2323 //~| NOTE 'std::iter::FromIterator' is included in the prelude starting in Edition 2021
2424}
tests/ui/suggestions/suggest-tryinto-edition-change.stderr+3-3
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of undeclared type `TryFrom`
1error[E0433]: cannot find type `TryFrom` in this scope
22 --> $DIR/suggest-tryinto-edition-change.rs:10:19
33 |
44LL | let _i: i16 = TryFrom::try_from(0_i32).unwrap();
......@@ -10,7 +10,7 @@ help: consider importing this trait
1010LL + use std::convert::TryFrom;
1111 |
1212
13error[E0433]: failed to resolve: use of undeclared type `TryInto`
13error[E0433]: cannot find type `TryInto` in this scope
1414 --> $DIR/suggest-tryinto-edition-change.rs:15:19
1515 |
1616LL | let _i: i16 = TryInto::try_into(0_i32).unwrap();
......@@ -22,7 +22,7 @@ help: consider importing this trait
2222LL + use std::convert::TryInto;
2323 |
2424
25error[E0433]: failed to resolve: use of undeclared type `FromIterator`
25error[E0433]: cannot find type `FromIterator` in this scope
2626 --> $DIR/suggest-tryinto-edition-change.rs:20:22
2727 |
2828LL | let _v: Vec<_> = FromIterator::from_iter(&[1]);
tests/ui/suggestions/undeclared-module-alloc.rs+1-1
......@@ -1,5 +1,5 @@
11//@ edition:2018
22
3use alloc::rc::Rc; //~ ERROR failed to resolve: use of unresolved module or unlinked crate `alloc`
3use alloc::rc::Rc; //~ ERROR cannot find module or crate `alloc`
44
55fn main() {}
tests/ui/suggestions/undeclared-module-alloc.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `alloc`
1error[E0433]: cannot find module or crate `alloc` in this scope
22 --> $DIR/undeclared-module-alloc.rs:3:5
33 |
44LL | use alloc::rc::Rc;
tests/ui/test-attrs/issue-109816.rs+1
......@@ -1,4 +1,5 @@
11//@ compile-flags: --test
2//@ reference: attributes.testing.test.allowed-positions
23
34fn align_offset_weird_strides() {
45 #[test]
tests/ui/test-attrs/issue-109816.stderr+1-1
......@@ -1,5 +1,5 @@
11error: the `#[test]` attribute may only be used on a free function
2 --> $DIR/issue-109816.rs:4:5
2 --> $DIR/issue-109816.rs:5:5
33 |
44LL | #[test]
55 | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
tests/ui/test-attrs/test-attr-non-associated-functions.rs+1
......@@ -1,4 +1,5 @@
11//@ compile-flags:--test
2//@ reference: attributes.testing.test.allowed-positions
23
34struct A {}
45
tests/ui/test-attrs/test-attr-non-associated-functions.stderr+2-2
......@@ -1,5 +1,5 @@
11error: the `#[test]` attribute may only be used on a free function
2 --> $DIR/test-attr-non-associated-functions.rs:6:5
2 --> $DIR/test-attr-non-associated-functions.rs:7:5
33 |
44LL | #[test]
55 | ^^^^^^^ 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)]
1111 |
1212
1313error: the `#[test]` attribute may only be used on a free function
14 --> $DIR/test-attr-non-associated-functions.rs:11:5
14 --> $DIR/test-attr-non-associated-functions.rs:12:5
1515 |
1616LL | #[test]
1717 | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
tests/ui/test-attrs/test-function-signature.rs+1
......@@ -1,4 +1,5 @@
11//@ compile-flags: --test
2//@ reference: attributes.testing.test.allowed-positions
23
34#[test]
45fn foo() -> Result<(), ()> {
tests/ui/test-attrs/test-function-signature.stderr+5-5
......@@ -1,29 +1,29 @@
11error: functions used as tests can not have any arguments
2 --> $DIR/test-function-signature.rs:14:1
2 --> $DIR/test-function-signature.rs:15:1
33 |
44LL | fn baz(val: i32) {}
55 | ^^^^^^^^^^^^^^^^^^^
66
77error: functions used as tests can not have any non-lifetime generic parameters
8 --> $DIR/test-function-signature.rs:22:1
8 --> $DIR/test-function-signature.rs:23:1
99 |
1010LL | fn type_generic<T>() {}
1111 | ^^^^^^^^^^^^^^^^^^^^^^^
1212
1313error: functions used as tests can not have any non-lifetime generic parameters
14 --> $DIR/test-function-signature.rs:25:1
14 --> $DIR/test-function-signature.rs:26:1
1515 |
1616LL | fn const_generic<const N: usize>() {}
1717 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1818
1919error: functions used as tests can not have any arguments
20 --> $DIR/test-function-signature.rs:30:5
20 --> $DIR/test-function-signature.rs:31:5
2121 |
2222LL | fn foo(arg: ()) {}
2323 | ^^^^^^^^^^^^^^^^^^
2424
2525error[E0277]: the trait bound `i32: Termination` is not satisfied
26 --> $DIR/test-function-signature.rs:9:13
26 --> $DIR/test-function-signature.rs:10:13
2727 |
2828LL | #[test]
2929 | ------- in this attribute macro expansion
tests/ui/test-attrs/test-on-not-fn.rs+1
......@@ -1,4 +1,5 @@
11//@ compile-flags: --test
2//@ reference: attributes.testing.test.allowed-positions
23
34#[test] //~ ERROR: the `#[test]` attribute may only be used on a free function
45mod test {}
tests/ui/test-attrs/test-on-not-fn.stderr+12-12
......@@ -1,5 +1,5 @@
11error: the `#[test]` attribute may only be used on a free function
2 --> $DIR/test-on-not-fn.rs:3:1
2 --> $DIR/test-on-not-fn.rs:4:1
33 |
44LL | #[test]
55 | ^^^^^^^ 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)]
1313 |
1414
1515error: the `#[test]` attribute may only be used on a free function
16 --> $DIR/test-on-not-fn.rs:6:1
16 --> $DIR/test-on-not-fn.rs:7:1
1717 |
1818LL | #[test]
1919 | ^^^^^^^ 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)]
3333 |
3434
3535error: the `#[test]` attribute may only be used on a free function
36 --> $DIR/test-on-not-fn.rs:20:1
36 --> $DIR/test-on-not-fn.rs:21:1
3737 |
3838LL | #[test]
3939 | ^^^^^^^ 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)]
4747 |
4848
4949error: the `#[test]` attribute may only be used on a free function
50 --> $DIR/test-on-not-fn.rs:23:1
50 --> $DIR/test-on-not-fn.rs:24:1
5151 |
5252LL | #[test]
5353 | ^^^^^^^ 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)]
6161 |
6262
6363error: the `#[test]` attribute may only be used on a free function
64 --> $DIR/test-on-not-fn.rs:26:1
64 --> $DIR/test-on-not-fn.rs:27:1
6565 |
6666LL | #[test]
6767 | ^^^^^^^ 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)]
7575 |
7676
7777error: the `#[test]` attribute may only be used on a free function
78 --> $DIR/test-on-not-fn.rs:29:1
78 --> $DIR/test-on-not-fn.rs:30:1
7979 |
8080LL | #[test]
8181 | ^^^^^^^ 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)]
8989 |
9090
9191error: the `#[test]` attribute may only be used on a free function
92 --> $DIR/test-on-not-fn.rs:32:1
92 --> $DIR/test-on-not-fn.rs:33:1
9393 |
9494LL | #[test]
9595 | ^^^^^^^ 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)]
103103 |
104104
105105error: the `#[test]` attribute may only be used on a free function
106 --> $DIR/test-on-not-fn.rs:35:1
106 --> $DIR/test-on-not-fn.rs:36:1
107107 |
108108LL | #[test]
109109 | ^^^^^^^ 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)]
119119 |
120120
121121error: the `#[test]` attribute may only be used on a free function
122 --> $DIR/test-on-not-fn.rs:40:1
122 --> $DIR/test-on-not-fn.rs:41:1
123123 |
124124LL | #[test]
125125 | ^^^^^^^ 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)]
133133 |
134134
135135error: the `#[test]` attribute may only be used on a free function
136 --> $DIR/test-on-not-fn.rs:43:1
136 --> $DIR/test-on-not-fn.rs:44:1
137137 |
138138LL | #[test]
139139 | ^^^^^^^ 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)]
150150 |
151151
152152error: the `#[test]` attribute may only be used on a free function
153 --> $DIR/test-on-not-fn.rs:50:1
153 --> $DIR/test-on-not-fn.rs:51:1
154154 |
155155LL | #[test]
156156 | ^^^^^^^ 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)]
168168 |
169169
170170warning: the `#[test]` attribute may only be used on a free function
171 --> $DIR/test-on-not-fn.rs:61:1
171 --> $DIR/test-on-not-fn.rs:62:1
172172 |
173173LL | #[test]
174174 | ^^^^^^^ the `#[test]` macro causes a function to be run as a test and has no effect on non-functions
tests/ui/test-attrs/test-passed.rs+1
......@@ -4,6 +4,7 @@
44//@ run-pass
55//@ check-run-results
66//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
7//@ reference: attributes.testing.test.success
78
89// Tests the output of the test harness with only passed tests.
910
tests/ui/test-attrs/test-should-panic-attr.rs+1
......@@ -1,4 +1,5 @@
11//@ compile-flags: --test
2//@ reference: attributes.testing.should_panic.syntax
23
34#[test]
45#[should_panic = "foo"]
tests/ui/test-attrs/test-should-panic-attr.stderr+4-4
......@@ -1,5 +1,5 @@
11error[E0539]: malformed `should_panic` attribute input
2 --> $DIR/test-should-panic-attr.rs:10:1
2 --> $DIR/test-should-panic-attr.rs:11:1
33 |
44LL | #[should_panic(expected)]
55 | ^^^^^^^^^^^^^^^--------^^
......@@ -19,7 +19,7 @@ LL + #[should_panic]
1919 |
2020
2121error[E0539]: malformed `should_panic` attribute input
22 --> $DIR/test-should-panic-attr.rs:19:1
22 --> $DIR/test-should-panic-attr.rs:20:1
2323 |
2424LL | #[should_panic(expect)]
2525 | ^^^^^^^^^^^^^^--------^
......@@ -39,7 +39,7 @@ LL + #[should_panic]
3939 |
4040
4141error[E0539]: malformed `should_panic` attribute input
42 --> $DIR/test-should-panic-attr.rs:28:1
42 --> $DIR/test-should-panic-attr.rs:29:1
4343 |
4444LL | #[should_panic(expected(foo, bar))]
4545 | ^^^^^^^^^^^^^^^------------------^^
......@@ -60,7 +60,7 @@ LL + #[should_panic]
6060 |
6161
6262error[E0805]: malformed `should_panic` attribute input
63 --> $DIR/test-should-panic-attr.rs:37:1
63 --> $DIR/test-should-panic-attr.rs:38:1
6464 |
6565LL | #[should_panic(expected = "foo", bar)]
6666 | ^^^^^^^^^^^^^^-----------------------^
tests/ui/test-attrs/test-should-panic-failed-show-span.rs+1
......@@ -8,6 +8,7 @@
88//@ normalize-stdout: "TypeId\(0x[0-9a-f]+\)" -> "TypeId($$HEX)"
99//@ needs-threads
1010//@ needs-unwind (panic)
11//@ reference: attributes.testing.should_panic.expected
1112
1213#[test]
1314#[should_panic]
tests/ui/test-attrs/test-should-panic-failed-show-span.run.stderr+4-4
......@@ -1,13 +1,13 @@
11
2thread 'should_panic_with_any_message' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:15:5:
2thread 'should_panic_with_any_message' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:16:5:
33Panic!
44note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
55
6thread 'should_panic_with_message' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:21:5:
6thread 'should_panic_with_message' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:22:5:
77message
88
9thread 'should_panic_with_substring_panics_with_incorrect_string' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:39:5:
9thread 'should_panic_with_substring_panics_with_incorrect_string' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:40:5:
1010ZOMGWTFBBQ
1111
12thread 'should_panic_with_substring_panics_with_non_string_value' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:46:5:
12thread 'should_panic_with_substring_panics_with_non_string_value' ($TID) panicked at $DIR/test-should-panic-failed-show-span.rs:47:5:
1313Box<dyn Any>
tests/ui/test-attrs/test-should-panic-failed-show-span.run.stdout+2-2
......@@ -10,9 +10,9 @@ test should_panic_with_substring_panics_with_non_string_value - should panic ...
1010failures:
1111
1212---- should_panic_with_any_message_does_not_panic stdout ----
13note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:26:4
13note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:27:4
1414---- should_panic_with_message_does_not_panic stdout ----
15note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:32:4
15note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:33:4
1616---- should_panic_with_substring_panics_with_incorrect_string stdout ----
1717note: panic did not contain expected string
1818 panic message: "ZOMGWTFBBQ"
tests/ui/test-attrs/test-vs-cfg-test.rs+1
......@@ -1,5 +1,6 @@
11//@ run-pass
22//@ compile-flags: --cfg test
3//@ reference: cfg.test
34
45// Make sure `--cfg test` does not inject test harness
56
tests/ui/tool-attributes/tool-attributes-shadowing.rs+1-1
......@@ -1,4 +1,4 @@
11mod rustfmt {}
22
3#[rustfmt::skip] //~ ERROR failed to resolve: could not find `skip` in `rustfmt`
3#[rustfmt::skip] //~ ERROR: cannot find `skip` in `rustfmt`
44fn main() {}
tests/ui/tool-attributes/tool-attributes-shadowing.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: could not find `skip` in `rustfmt`
1error[E0433]: cannot find `skip` in `rustfmt`
22 --> $DIR/tool-attributes-shadowing.rs:3:12
33 |
44LL | #[rustfmt::skip]
tests/ui/tool-attributes/unknown-tool-name.rs+2-1
......@@ -1,2 +1,3 @@
1#[foo::bar] //~ ERROR failed to resolve: use of unresolved module or unlinked crate `foo`
1#[foo::bar] //~ ERROR: cannot find module or crate `foo`
2//~^ NOTE: use of unresolved module or unlinked crate `foo`
23fn main() {}
tests/ui/tool-attributes/unknown-tool-name.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `foo`
1error[E0433]: cannot find module or crate `foo` in this scope
22 --> $DIR/unknown-tool-name.rs:1:3
33 |
44LL | #[foo::bar]
tests/ui/traits/bound/unknown-assoc-with-const-arg.rs+1-1
......@@ -7,7 +7,7 @@ trait X {
77
88trait Y {
99 fn a() -> NOT_EXIST::unknown<{}> {}
10 //~^ ERROR: failed to resolve: use of undeclared type `NOT_EXIST`
10 //~^ ERROR: cannot find type `NOT_EXIST`
1111}
1212
1313trait Z<T> {
tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr+1-1
......@@ -10,7 +10,7 @@ error[E0220]: associated type `unknown` not found for `T`
1010LL | fn a() -> T::unknown<{}> {}
1111 | ^^^^^^^ associated type `unknown` not found
1212
13error[E0433]: failed to resolve: use of undeclared type `NOT_EXIST`
13error[E0433]: cannot find type `NOT_EXIST` in this scope
1414 --> $DIR/unknown-assoc-with-const-arg.rs:9:15
1515 |
1616LL | fn a() -> NOT_EXIST::unknown<{}> {}
tests/ui/traits/const-traits/issue-102156.stderr+15-10
......@@ -1,22 +1,27 @@
1error[E0433]: failed to resolve: you might be missing crate `core`
1error[E0433]: cannot find `core` in the crate root
22 --> $DIR/issue-102156.rs:5:5
33 |
44LL | use core::convert::{From, TryFrom};
5 | ^^^^
6 | |
7 | you might be missing crate `core`
8 | help: try using `std` instead of `core`: `std`
5 | ^^^^ you might be missing crate `core`
6 |
7help: try using `std` instead of `core`
8 |
9LL - use core::convert::{From, TryFrom};
10LL + use std::convert::{From, TryFrom};
11 |
912
10error[E0433]: failed to resolve: you might be missing crate `core`
13error[E0433]: cannot find `core` in the crate root
1114 --> $DIR/issue-102156.rs:5:5
1215 |
1316LL | use core::convert::{From, TryFrom};
14 | ^^^^
15 | |
16 | you might be missing crate `core`
17 | help: try using `std` instead of `core`: `std`
17 | ^^^^ you might be missing crate `core`
1818 |
1919 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
20help: try using `std` instead of `core`
21 |
22LL - use core::convert::{From, TryFrom};
23LL + use std::convert::{From, TryFrom};
24 |
2025
2126error: aborting due to 2 previous errors
2227
tests/ui/traits/const-traits/staged-api.rs+1-1
......@@ -5,7 +5,7 @@
55#![feature(local_feature)]
66#![feature(const_trait_impl)]
77#![feature(staged_api)]
8#![feature(rustc_allow_const_fn_unstable)]
8#![feature(rustc_attrs)]
99#![stable(feature = "rust1", since = "1.0.0")]
1010
1111//@ aux-build: staged-api.rs
tests/ui/traits/final/final-kw.gated.stderr+1-1
......@@ -4,7 +4,7 @@ error[E0658]: `final` on trait functions is experimental
44LL | final fn foo() {}
55 | ^^^^^
66 |
7 = note: see issue #1 <https://github.com/rust-lang/rust/issues/1> for more information
7 = note: see issue #131179 <https://github.com/rust-lang/rust/issues/131179> for more information
88 = help: add `#![feature(final_associated_functions)]` to the crate attributes to enable
99 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010
tests/ui/traits/final/final-kw.ungated.stderr+1-1
......@@ -4,7 +4,7 @@ error[E0658]: `final` on trait functions is experimental
44LL | final fn foo() {}
55 | ^^^^^
66 |
7 = note: see issue #1 <https://github.com/rust-lang/rust/issues/1> for more information
7 = note: see issue #131179 <https://github.com/rust-lang/rust/issues/131179> for more information
88 = help: add `#![feature(final_associated_functions)]` to the crate attributes to enable
99 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010
tests/ui/type-alias/issue-62263-self-in-atb.rs+1-1
......@@ -3,6 +3,6 @@ pub trait Trait {
33}
44
55pub type Alias = dyn Trait<A = Self::A>;
6//~^ ERROR failed to resolve: `Self`
6//~^ ERROR cannot find `Self`
77
88fn main() {}
tests/ui/type-alias/issue-62263-self-in-atb.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
1error[E0433]: cannot find `Self` in this scope
22 --> $DIR/issue-62263-self-in-atb.rs:5:32
33 |
44LL | pub type Alias = dyn Trait<A = Self::A>;
tests/ui/type-alias/issue-62305-self-assoc-ty.rs+1-1
......@@ -1,4 +1,4 @@
11type Alias = Self::Target;
2//~^ ERROR failed to resolve: `Self`
2//~^ ERROR cannot find `Self`
33
44fn main() {}
tests/ui/type-alias/issue-62305-self-assoc-ty.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
1error[E0433]: cannot find `Self` in this scope
22 --> $DIR/issue-62305-self-assoc-ty.rs:1:14
33 |
44LL | type Alias = Self::Target;
tests/ui/type/type-path-err-node-types.rs+1-1
......@@ -12,7 +12,7 @@ fn ufcs_trait() {
1212}
1313
1414fn ufcs_item() {
15 NonExistent::Assoc::<u8>; //~ ERROR undeclared type `NonExistent`
15 NonExistent::Assoc::<u8>; //~ ERROR cannot find type `NonExistent`
1616}
1717
1818fn method() {
tests/ui/type/type-path-err-node-types.stderr+1-1
......@@ -16,7 +16,7 @@ error[E0425]: cannot find value `nonexistent` in this scope
1616LL | nonexistent.nonexistent::<u8>();
1717 | ^^^^^^^^^^^ not found in this scope
1818
19error[E0433]: failed to resolve: use of undeclared type `NonExistent`
19error[E0433]: cannot find type `NonExistent` in this scope
2020 --> $DIR/type-path-err-node-types.rs:15:5
2121 |
2222LL | NonExistent::Assoc::<u8>;
tests/ui/typeck/issue-120856.rs+4-2
......@@ -1,5 +1,7 @@
11pub type Archived<T> = <m::Alias as n::Trait>::Archived;
2//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `m`
3//~| ERROR failed to resolve: use of unresolved module or unlinked crate `n`
2//~^ ERROR: cannot find module or crate `m` in this scope
3//~| ERROR: cannot find module or crate `n` in this scope
4//~| NOTE: use of unresolved module or unlinked crate `m`
5//~| NOTE: use of unresolved module or unlinked crate `n`
46
57fn main() {}
tests/ui/typeck/issue-120856.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `n`
1error[E0433]: cannot find module or crate `n` in this scope
22 --> $DIR/issue-120856.rs:1:37
33 |
44LL | pub type Archived<T> = <m::Alias as n::Trait>::Archived;
......@@ -10,7 +10,7 @@ help: a trait with a similar name exists
1010LL | pub type Archived<T> = <m::Alias as Fn::Trait>::Archived;
1111 | +
1212
13error[E0433]: failed to resolve: use of unresolved module or unlinked crate `m`
13error[E0433]: cannot find module or crate `m` in this scope
1414 --> $DIR/issue-120856.rs:1:25
1515 |
1616LL | pub type Archived<T> = <m::Alias as n::Trait>::Archived;
tests/ui/typeck/path-to-method-sugg-unresolved-expr.cargo-invoked.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `page_size`
1error[E0433]: cannot find module or crate `page_size` in this scope
22 --> $DIR/path-to-method-sugg-unresolved-expr.rs:5:21
33 |
44LL | let page_size = page_size::get();
tests/ui/typeck/path-to-method-sugg-unresolved-expr.only-rustc.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: use of unresolved module or unlinked crate `page_size`
1error[E0433]: cannot find module or crate `page_size` in this scope
22 --> $DIR/path-to-method-sugg-unresolved-expr.rs:5:21
33 |
44LL | let page_size = page_size::get();
tests/ui/typeck/path-to-method-sugg-unresolved-expr.rs+1-1
......@@ -3,7 +3,7 @@
33//@[cargo-invoked] rustc-env:CARGO_CRATE_NAME=foo
44fn main() {
55 let page_size = page_size::get();
6 //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `page_size`
6 //~^ ERROR cannot find module or crate `page_size`
77 //~| NOTE use of unresolved module or unlinked crate `page_size`
88 //[cargo-invoked]~^^^ HELP if you wanted to use a crate named `page_size`, use `cargo add
99 //[only-rustc]~^^^^ HELP you might be missing a crate named `page_size`
tests/ui/use/use-path-segment-kw.rs+22-22
......@@ -9,43 +9,43 @@ macro_rules! macro_dollar_crate {
99 use $crate; //~ ERROR `$crate` may not be imported
1010 pub use $crate as _dollar_crate; //~ ERROR `$crate` may not be imported
1111
12 type A2 = ::$crate; //~ ERROR failed to resolve: global paths cannot start with `$crate`
12 type A2 = ::$crate; //~ ERROR global paths cannot start with `$crate`
1313 use ::$crate; //~ ERROR unresolved import `$crate`
1414 use ::$crate as _dollar_crate2; //~ ERROR unresolved import `$crate`
1515 use ::{$crate}; //~ ERROR unresolved import `$crate`
1616 use ::{$crate as _nested_dollar_crate2}; //~ ERROR unresolved import `$crate`
1717
18 type A3 = foobar::$crate; //~ ERROR failed to resolve: `$crate` in paths can only be used in start position
18 type A3 = foobar::$crate; //~ ERROR `$crate` in paths can only be used in start position
1919 use foobar::$crate; //~ ERROR unresolved import `foobar::$crate`
2020 use foobar::$crate as _dollar_crate3; //~ ERROR unresolved import `foobar::$crate`
2121 use foobar::{$crate}; //~ ERROR unresolved import `foobar::$crate`
2222 use foobar::{$crate as _nested_dollar_crate3}; //~ ERROR unresolved import `foobar::$crate`
2323
24 type A4 = crate::$crate; //~ ERROR failed to resolve: `$crate` in paths can only be used in start position
24 type A4 = crate::$crate; //~ ERROR `$crate` in paths can only be used in start position
2525 use crate::$crate; //~ ERROR unresolved import `crate::$crate`
2626 use crate::$crate as _dollar_crate4; //~ ERROR unresolved import `crate::$crate`
2727 use crate::{$crate}; //~ ERROR unresolved import `crate::$crate`
2828 use crate::{$crate as _nested_dollar_crate4}; //~ ERROR unresolved import `crate::$crate`
2929
30 type A5 = super::$crate; //~ ERROR failed to resolve: `$crate` in paths can only be used in start position
30 type A5 = super::$crate; //~ ERROR `$crate` in paths can only be used in start position
3131 use super::$crate; //~ ERROR unresolved import `super::$crate`
3232 use super::$crate as _dollar_crate5; //~ ERROR unresolved import `super::$crate`
3333 use super::{$crate}; //~ ERROR unresolved import `super::$crate`
3434 use super::{$crate as _nested_dollar_crate5}; //~ ERROR unresolved import `super::$crate`
3535
36 type A6 = self::$crate; //~ ERROR failed to resolve: `$crate` in paths can only be used in start position
36 type A6 = self::$crate; //~ ERROR `$crate` in paths can only be used in start position
3737 use self::$crate;
3838 use self::$crate as _dollar_crate6;
3939 use self::{$crate};
4040 use self::{$crate as _nested_dollar_crate6};
4141
42 type A7 = $crate::$crate; //~ ERROR failed to resolve: `$crate` in paths can only be used in start position
42 type A7 = $crate::$crate; //~ ERROR `$crate` in paths can only be used in start position
4343 use $crate::$crate; //~ ERROR unresolved import `$crate::$crate`
4444 use $crate::$crate as _dollar_crate7; //~ ERROR unresolved import `$crate::$crate`
4545 use $crate::{$crate}; //~ ERROR unresolved import `$crate::$crate`
4646 use $crate::{$crate as _nested_dollar_crate7}; //~ ERROR unresolved import `$crate::$crate`
4747
48 type A8 = $crate::crate; //~ ERROR failed to resolve: `crate` in paths can only be used in start position
48 type A8 = $crate::crate; //~ ERROR `crate` in paths can only be used in start position
4949 use $crate::crate; //~ ERROR unresolved import `$crate::crate`
5050 //~^ ERROR crate root imports need to be explicitly named: `use crate as name;`
5151 use $crate::crate as _m_crate8; //~ ERROR unresolved import `$crate::crate`
......@@ -53,13 +53,13 @@ macro_rules! macro_dollar_crate {
5353 //~^ ERROR crate root imports need to be explicitly named: `use crate as name;`
5454 use $crate::{crate as _m_nested_crate8}; //~ ERROR unresolved import `$crate::crate`
5555
56 type A9 = $crate::super; //~ ERROR failed to resolve: `super` in paths can only be used in start position
56 type A9 = $crate::super; //~ ERROR `super` in paths can only be used in start position
5757 use $crate::super; //~ ERROR unresolved import `$crate::super`
5858 use $crate::super as _m_super8; //~ ERROR unresolved import `$crate::super`
5959 use $crate::{super}; //~ ERROR unresolved import `$crate::super`
6060 use $crate::{super as _m_nested_super8}; //~ ERROR unresolved import `$crate::super`
6161
62 type A10 = $crate::self; //~ ERROR failed to resolve: `self` in paths can only be used in start position
62 type A10 = $crate::self; //~ ERROR `self` in paths can only be used in start position
6363 use $crate::self; //~ ERROR `$crate` may not be imported
6464 //~^ ERROR `self` imports are only allowed within a { } list
6565 //~^^ ERROR the name `<!dummy!>` is defined multiple times
......@@ -98,7 +98,7 @@ mod foo {
9898 use crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;`
9999 pub use crate as _crate; // Good
100100
101 type B2 = ::crate; //~ ERROR failed to resolve: global paths cannot start with `crate`
101 type B2 = ::crate; //~ ERROR `crate`
102102 use ::crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;`
103103 //~^ ERROR unresolved import `crate`
104104 use ::crate as _crate2; //~ ERROR unresolved import `crate`
......@@ -106,7 +106,7 @@ mod foo {
106106 //~^ ERROR unresolved import `crate`
107107 use ::{crate as _nested_crate2}; //~ ERROR unresolved import `crate`
108108
109 type B3 = foobar::crate; //~ ERROR failed to resolve: `crate` in paths can only be used in start position
109 type B3 = foobar::crate; //~ ERROR `crate` in paths can only be used in start position
110110 use foobar::crate; //~ ERROR unresolved import `foobar::crate`
111111 //~^ ERROR crate root imports need to be explicitly named: `use crate as name;`
112112 use foobar::crate as _crate3; //~ ERROR unresolved import `foobar::crate`
......@@ -114,7 +114,7 @@ mod foo {
114114 //~^ ERROR crate root imports need to be explicitly named: `use crate as name;`
115115 use foobar::{crate as _nested_crate3}; //~ ERROR unresolved import `foobar::crate`
116116
117 type B4 = crate::crate; //~ ERROR failed to resolve: `crate` in paths can only be used in start position
117 type B4 = crate::crate; //~ ERROR `crate` in paths can only be used in start position
118118 use crate::crate; //~ ERROR unresolved import `crate::crate`
119119 //~^ ERROR crate root imports need to be explicitly named: `use crate as name;`
120120 use crate::crate as _crate4; //~ ERROR unresolved import `crate::crate`
......@@ -122,7 +122,7 @@ mod foo {
122122 //~^ ERROR crate root imports need to be explicitly named: `use crate as name;`
123123 use crate::{crate as _nested_crate4}; //~ ERROR unresolved import `crate::crate`
124124
125 type B5 = super::crate; //~ ERROR failed to resolve: `crate` in paths can only be used in start position
125 type B5 = super::crate; //~ ERROR `crate` in paths can only be used in start position
126126 use super::crate; //~ ERROR unresolved import `super::crate`
127127 //~^ ERROR crate root imports need to be explicitly named: `use crate as name;`
128128 use super::crate as _crate5; //~ ERROR unresolved import `super::crate`
......@@ -130,7 +130,7 @@ mod foo {
130130 //~^ ERROR crate root imports need to be explicitly named: `use crate as name;`
131131 use super::{crate as _nested_crate5}; //~ ERROR unresolved import `super::crate`
132132
133 type B6 = self::crate; //~ ERROR failed to resolve: `crate` in paths can only be used in start position
133 type B6 = self::crate; //~ ERROR `crate` in paths can only be used in start position
134134 use self::crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;`
135135 //~^ ERROR the name `crate` is defined multiple times
136136 use self::crate as _crate6;
......@@ -146,19 +146,19 @@ mod foo {
146146 use super; //~ ERROR unresolved import `super`
147147 pub use super as _super; //~ ERROR unresolved import `super`
148148
149 type C2 = ::super; //~ ERROR failed to resolve: global paths cannot start with `super`
149 type C2 = ::super; //~ ERROR global paths cannot start with `super`
150150 use ::super; //~ ERROR unresolved import `super`
151151 use ::super as _super2; //~ ERROR unresolved import `super`
152152 use ::{super}; //~ ERROR unresolved import `super`
153153 use ::{super as _nested_super2}; //~ ERROR unresolved import `super`
154154
155 type C3 = foobar::super; //~ ERROR failed to resolve: `super` in paths can only be used in start position
155 type C3 = foobar::super; //~ ERROR `super` in paths can only be used in start position
156156 use foobar::super; //~ ERROR unresolved import `foobar::super`
157157 use foobar::super as _super3; //~ ERROR unresolved import `foobar::super`
158158 use foobar::{super}; //~ ERROR unresolved import `foobar::super`
159159 use foobar::{super as _nested_super3}; //~ ERROR unresolved import `foobar::super`
160160
161 type C4 = crate::super; //~ ERROR failed to resolve: `super` in paths can only be used in start position
161 type C4 = crate::super; //~ ERROR `super` in paths can only be used in start position
162162 use crate::super; //~ ERROR unresolved import `crate::super`
163163 use crate::super as _super4; //~ ERROR unresolved import `crate::super`
164164 use crate::{super}; //~ ERROR unresolved import `crate::super`
......@@ -184,7 +184,7 @@ mod foo {
184184 use self; //~ ERROR `self` imports are only allowed within a { } list
185185 pub use self as _self; //~ ERROR `self` imports are only allowed within a { } list
186186
187 type D2 = ::self; //~ ERROR failed to resolve: global paths cannot start with `self`
187 type D2 = ::self; //~ ERROR global paths cannot start with `self`
188188 use ::self; //~ ERROR `self` imports are only allowed within a { } list
189189 //~^ ERROR unresolved import `{{root}}`
190190 use ::self as _self2; //~ ERROR `self` imports are only allowed within a { } list
......@@ -192,13 +192,13 @@ mod foo {
192192 use ::{self}; //~ ERROR `self` import can only appear in an import list with a non-empty prefix
193193 use ::{self as _nested_self2}; //~ ERROR `self` import can only appear in an import list with a non-empty prefix
194194
195 type D3 = foobar::self; //~ ERROR failed to resolve: `self` in paths can only be used in start position
195 type D3 = foobar::self; //~ ERROR `self` in paths can only be used in start position
196196 pub use foobar::qux::self; //~ ERROR `self` imports are only allowed within a { } list
197197 pub use foobar::self as _self3; //~ ERROR `self` imports are only allowed within a { } list
198198 pub use foobar::baz::{self}; // Good
199199 pub use foobar::{self as _nested_self3}; // Good
200200
201 type D4 = crate::self; //~ ERROR failed to resolve: `self` in paths can only be used in start position
201 type D4 = crate::self; //~ ERROR `self` in paths can only be used in start position
202202 use crate::self; //~ ERROR crate root imports need to be explicitly named: `use crate as name;`
203203 //~^ ERROR `self` imports are only allowed within a { } list
204204 //~^^ ERROR the name `crate` is defined multiple times
......@@ -207,7 +207,7 @@ mod foo {
207207 //~^ ERROR the name `crate` is defined multiple times
208208 pub use crate::{self as _nested_self4}; // Good
209209
210 type D5 = super::self; //~ ERROR failed to resolve: `self` in paths can only be used in start position
210 type D5 = super::self; //~ ERROR `self` in paths can only be used in start position
211211 use super::self; //~ ERROR unresolved import `super`
212212 //~^ ERROR `self` imports are only allowed within a { } list
213213 pub use super::self as _self5; //~ ERROR `self` imports are only allowed within a { } list
......@@ -215,7 +215,7 @@ mod foo {
215215 use super::{self}; //~ ERROR unresolved import `super`
216216 pub use super::{self as _nested_self5}; //~ ERROR unresolved import `super`
217217
218 type D6 = self::self; //~ ERROR failed to resolve: `self` in paths can only be used in start position
218 type D6 = self::self; //~ ERROR `self` in paths can only be used in start position
219219 use self::self; //~ ERROR `self` imports are only allowed within a { } list
220220 pub use self::self as _self6; //~ ERROR `self` imports are only allowed within a { } list
221221 use self::{self}; //~ ERROR unresolved import `self`
tests/ui/use/use-path-segment-kw.stderr+44-44
......@@ -1062,182 +1062,182 @@ error[E0573]: expected type, found module `self`
10621062LL | type D1 = self;
10631063 | ^^^^ not a type
10641064
1065error[E0433]: failed to resolve: global paths cannot start with `$crate`
1065error[E0433]: global paths cannot start with `$crate`
10661066 --> $DIR/use-path-segment-kw.rs:12:21
10671067 |
10681068LL | type A2 = ::$crate;
1069 | ^^^^^^ global paths cannot start with `$crate`
1069 | ^^^^^^ cannot start with this
10701070...
10711071LL | macro_dollar_crate!();
10721072 | --------------------- in this macro invocation
10731073 |
10741074 = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
10751075
1076error[E0433]: failed to resolve: `$crate` in paths can only be used in start position
1076error[E0433]: `$crate` in paths can only be used in start position
10771077 --> $DIR/use-path-segment-kw.rs:18:27
10781078 |
10791079LL | type A3 = foobar::$crate;
1080 | ^^^^^^ `$crate` in paths can only be used in start position
1080 | ^^^^^^ can only be used in path start position
10811081...
10821082LL | macro_dollar_crate!();
10831083 | --------------------- in this macro invocation
10841084 |
10851085 = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
10861086
1087error[E0433]: failed to resolve: `$crate` in paths can only be used in start position
1087error[E0433]: `$crate` in paths can only be used in start position
10881088 --> $DIR/use-path-segment-kw.rs:24:26
10891089 |
10901090LL | type A4 = crate::$crate;
1091 | ^^^^^^ `$crate` in paths can only be used in start position
1091 | ^^^^^^ can only be used in path start position
10921092...
10931093LL | macro_dollar_crate!();
10941094 | --------------------- in this macro invocation
10951095 |
10961096 = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
10971097
1098error[E0433]: failed to resolve: `$crate` in paths can only be used in start position
1098error[E0433]: `$crate` in paths can only be used in start position
10991099 --> $DIR/use-path-segment-kw.rs:30:26
11001100 |
11011101LL | type A5 = super::$crate;
1102 | ^^^^^^ `$crate` in paths can only be used in start position
1102 | ^^^^^^ can only be used in path start position
11031103...
11041104LL | macro_dollar_crate!();
11051105 | --------------------- in this macro invocation
11061106 |
11071107 = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
11081108
1109error[E0433]: failed to resolve: `$crate` in paths can only be used in start position
1109error[E0433]: `$crate` in paths can only be used in start position
11101110 --> $DIR/use-path-segment-kw.rs:36:25
11111111 |
11121112LL | type A6 = self::$crate;
1113 | ^^^^^^ `$crate` in paths can only be used in start position
1113 | ^^^^^^ can only be used in path start position
11141114...
11151115LL | macro_dollar_crate!();
11161116 | --------------------- in this macro invocation
11171117 |
11181118 = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
11191119
1120error[E0433]: failed to resolve: `$crate` in paths can only be used in start position
1120error[E0433]: `$crate` in paths can only be used in start position
11211121 --> $DIR/use-path-segment-kw.rs:42:27
11221122 |
11231123LL | type A7 = $crate::$crate;
1124 | ^^^^^^ `$crate` in paths can only be used in start position
1124 | ^^^^^^ can only be used in path start position
11251125...
11261126LL | macro_dollar_crate!();
11271127 | --------------------- in this macro invocation
11281128 |
11291129 = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
11301130
1131error[E0433]: failed to resolve: `crate` in paths can only be used in start position
1131error[E0433]: `crate` in paths can only be used in start position
11321132 --> $DIR/use-path-segment-kw.rs:48:27
11331133 |
11341134LL | type A8 = $crate::crate;
1135 | ^^^^^ `crate` in paths can only be used in start position
1135 | ^^^^^ can only be used in path start position
11361136...
11371137LL | macro_dollar_crate!();
11381138 | --------------------- in this macro invocation
11391139 |
11401140 = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
11411141
1142error[E0433]: failed to resolve: `super` in paths can only be used in start position
1142error[E0433]: `super` in paths can only be used in start position
11431143 --> $DIR/use-path-segment-kw.rs:56:27
11441144 |
11451145LL | type A9 = $crate::super;
1146 | ^^^^^ `super` in paths can only be used in start position
1146 | ^^^^^ can only be used in path start position
11471147...
11481148LL | macro_dollar_crate!();
11491149 | --------------------- in this macro invocation
11501150 |
11511151 = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
11521152
1153error[E0433]: failed to resolve: `self` in paths can only be used in start position
1153error[E0433]: `self` in paths can only be used in start position
11541154 --> $DIR/use-path-segment-kw.rs:62:28
11551155 |
11561156LL | type A10 = $crate::self;
1157 | ^^^^ `self` in paths can only be used in start position
1157 | ^^^^ can only be used in path start position
11581158...
11591159LL | macro_dollar_crate!();
11601160 | --------------------- in this macro invocation
11611161 |
11621162 = note: this error originates in the macro `macro_dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info)
11631163
1164error[E0433]: failed to resolve: global paths cannot start with `crate`
1164error[E0433]: global paths cannot start with `crate`
11651165 --> $DIR/use-path-segment-kw.rs:101:21
11661166 |
11671167LL | type B2 = ::crate;
1168 | ^^^^^ global paths cannot start with `crate`
1168 | ^^^^^ cannot start with this
11691169
1170error[E0433]: failed to resolve: `crate` in paths can only be used in start position
1170error[E0433]: `crate` in paths can only be used in start position
11711171 --> $DIR/use-path-segment-kw.rs:109:27
11721172 |
11731173LL | type B3 = foobar::crate;
1174 | ^^^^^ `crate` in paths can only be used in start position
1174 | ^^^^^ can only be used in path start position
11751175
1176error[E0433]: failed to resolve: `crate` in paths can only be used in start position
1176error[E0433]: `crate` in paths can only be used in start position
11771177 --> $DIR/use-path-segment-kw.rs:117:26
11781178 |
11791179LL | type B4 = crate::crate;
1180 | ^^^^^ `crate` in paths can only be used in start position
1180 | ^^^^^ can only be used in path start position
11811181
1182error[E0433]: failed to resolve: `crate` in paths can only be used in start position
1182error[E0433]: `crate` in paths can only be used in start position
11831183 --> $DIR/use-path-segment-kw.rs:125:26
11841184 |
11851185LL | type B5 = super::crate;
1186 | ^^^^^ `crate` in paths can only be used in start position
1186 | ^^^^^ can only be used in path start position
11871187
1188error[E0433]: failed to resolve: `crate` in paths can only be used in start position
1188error[E0433]: `crate` in paths can only be used in start position
11891189 --> $DIR/use-path-segment-kw.rs:133:25
11901190 |
11911191LL | type B6 = self::crate;
1192 | ^^^^^ `crate` in paths can only be used in start position
1192 | ^^^^^ can only be used in path start position
11931193
1194error[E0433]: failed to resolve: global paths cannot start with `super`
1194error[E0433]: global paths cannot start with `super`
11951195 --> $DIR/use-path-segment-kw.rs:149:21
11961196 |
11971197LL | type C2 = ::super;
1198 | ^^^^^ global paths cannot start with `super`
1198 | ^^^^^ cannot start with this
11991199
1200error[E0433]: failed to resolve: `super` in paths can only be used in start position
1200error[E0433]: `super` in paths can only be used in start position
12011201 --> $DIR/use-path-segment-kw.rs:155:27
12021202 |
12031203LL | type C3 = foobar::super;
1204 | ^^^^^ `super` in paths can only be used in start position
1204 | ^^^^^ can only be used in path start position
12051205
1206error[E0433]: failed to resolve: `super` in paths can only be used in start position
1206error[E0433]: `super` in paths can only be used in start position
12071207 --> $DIR/use-path-segment-kw.rs:161:26
12081208 |
12091209LL | type C4 = crate::super;
1210 | ^^^^^ `super` in paths can only be used in start position
1210 | ^^^^^ can only be used in path start position
12111211
1212error[E0433]: failed to resolve: global paths cannot start with `self`
1212error[E0433]: global paths cannot start with `self`
12131213 --> $DIR/use-path-segment-kw.rs:187:21
12141214 |
12151215LL | type D2 = ::self;
1216 | ^^^^ global paths cannot start with `self`
1216 | ^^^^ cannot start with this
12171217
1218error[E0433]: failed to resolve: `self` in paths can only be used in start position
1218error[E0433]: `self` in paths can only be used in start position
12191219 --> $DIR/use-path-segment-kw.rs:195:27
12201220 |
12211221LL | type D3 = foobar::self;
1222 | ^^^^ `self` in paths can only be used in start position
1222 | ^^^^ can only be used in path start position
12231223
1224error[E0433]: failed to resolve: `self` in paths can only be used in start position
1224error[E0433]: `self` in paths can only be used in start position
12251225 --> $DIR/use-path-segment-kw.rs:201:26
12261226 |
12271227LL | type D4 = crate::self;
1228 | ^^^^ `self` in paths can only be used in start position
1228 | ^^^^ can only be used in path start position
12291229
1230error[E0433]: failed to resolve: `self` in paths can only be used in start position
1230error[E0433]: `self` in paths can only be used in start position
12311231 --> $DIR/use-path-segment-kw.rs:210:26
12321232 |
12331233LL | type D5 = super::self;
1234 | ^^^^ `self` in paths can only be used in start position
1234 | ^^^^ can only be used in path start position
12351235
1236error[E0433]: failed to resolve: `self` in paths can only be used in start position
1236error[E0433]: `self` in paths can only be used in start position
12371237 --> $DIR/use-path-segment-kw.rs:218:25
12381238 |
12391239LL | type D6 = self::self;
1240 | ^^^^ `self` in paths can only be used in start position
1240 | ^^^^ can only be used in path start position
12411241
12421242error: aborting due to 141 previous errors
12431243
tests/ui/use/use-self-type.rs+1-1
......@@ -4,7 +4,7 @@ impl S {
44 fn f() {}
55 fn g() {
66 use Self::f; //~ ERROR unresolved import
7 pub(in Self::f) struct Z; //~ ERROR failed to resolve: `Self`
7 pub(in Self::f) struct Z; //~ ERROR cannot find `Self`
88 }
99}
1010
tests/ui/use/use-self-type.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0433]: failed to resolve: `Self` cannot be used in imports
1error[E0433]: cannot find `Self` in this scope
22 --> $DIR/use-self-type.rs:7:16
33 |
44LL | pub(in Self::f) struct Z;
tests/ui/use/use-super-global-path.rs+4-3
......@@ -4,11 +4,12 @@ struct S;
44struct Z;
55
66mod foo {
7 use ::super::{S, Z}; //~ ERROR global paths cannot start with `super`
8 //~| ERROR global paths cannot start with `super`
7 use ::super::{S, Z};
8 //~^ ERROR: global paths cannot start with `super`
9 //~| ERROR: global paths cannot start with `super`
910
1011 pub fn g() {
11 use ::super::main; //~ ERROR global paths cannot start with `super`
12 use ::super::main; //~ ERROR: global paths cannot start with `super`
1213 main();
1314 }
1415}
tests/ui/use/use-super-global-path.stderr+7-7
......@@ -1,22 +1,22 @@
1error[E0433]: failed to resolve: global paths cannot start with `super`
1error[E0433]: global paths cannot start with `super`
22 --> $DIR/use-super-global-path.rs:7:11
33 |
44LL | use ::super::{S, Z};
5 | ^^^^^ global paths cannot start with `super`
5 | ^^^^^ cannot start with this
66
7error[E0433]: failed to resolve: global paths cannot start with `super`
7error[E0433]: global paths cannot start with `super`
88 --> $DIR/use-super-global-path.rs:7:11
99 |
1010LL | use ::super::{S, Z};
11 | ^^^^^ global paths cannot start with `super`
11 | ^^^^^ cannot start with this
1212 |
1313 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
1414
15error[E0433]: failed to resolve: global paths cannot start with `super`
16 --> $DIR/use-super-global-path.rs:11:15
15error[E0433]: global paths cannot start with `super`
16 --> $DIR/use-super-global-path.rs:12:15
1717 |
1818LL | use ::super::main;
19 | ^^^^^ global paths cannot start with `super`
19 | ^^^^^ cannot start with this
2020
2121error: aborting due to 3 previous errors
2222
typos.toml+1
......@@ -46,6 +46,7 @@ unstalled = "unstalled" # short for un-stalled
4646#
4747# tidy-alphabetical-start
4848definitinon = "definition"
49dependy = ""
4950similarlty = "similarity"
5051# tidy-alphabetical-end
5152