diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index dff46ece65430..19e826cf18f31 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1670,7 +1670,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let output = match coro { Some(coro) => { let fn_def_id = self.local_def_id(fn_node_id); - self.lower_coroutine_fn_ret_ty(&decl.output, fn_def_id, coro, kind, fn_span) + self.lower_coroutine_fn_ret_ty(&decl.output, fn_def_id, coro, kind) } None => match &decl.output { FnRetTy::Ty(ty) => { @@ -1755,9 +1755,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { fn_def_id: LocalDefId, coro: CoroutineKind, fn_kind: FnDeclKind, - fn_span: Span, ) -> hir::FnRetTy<'hir> { - let span = self.lower_span(fn_span); + let span = self.lower_span(output.span()); let (opaque_ty_node_id, allowed_features) = match coro { CoroutineKind::Async { return_impl_trait_id, .. } => (return_impl_trait_id, None), diff --git a/compiler/rustc_codegen_cranelift/src/allocator.rs b/compiler/rustc_codegen_cranelift/src/allocator.rs index 67b89114356b5..4a9b0c0952ff3 100644 --- a/compiler/rustc_codegen_cranelift/src/allocator.rs +++ b/compiler/rustc_codegen_cranelift/src/allocator.rs @@ -6,7 +6,6 @@ use rustc_ast::expand::allocator::{ AllocatorMethod, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE, default_fn_name, global_fn_name, }; use rustc_codegen_ssa::base::{allocator_kind_for_codegen, allocator_shim_contents}; -use rustc_session::config::OomStrategy; use rustc_symbol_mangling::mangle_internal_symbol; use crate::prelude::*; @@ -15,16 +14,11 @@ use crate::prelude::*; pub(crate) fn codegen(tcx: TyCtxt<'_>, module: &mut dyn Module) -> bool { let Some(kind) = allocator_kind_for_codegen(tcx) else { return false }; let methods = allocator_shim_contents(tcx, kind); - codegen_inner(tcx, module, &methods, tcx.sess.opts.unstable_opts.oom); + codegen_inner(tcx, module, &methods); true } -fn codegen_inner( - tcx: TyCtxt<'_>, - module: &mut dyn Module, - methods: &[AllocatorMethod], - oom_strategy: OomStrategy, -) { +fn codegen_inner(tcx: TyCtxt<'_>, module: &mut dyn Module, methods: &[AllocatorMethod]) { let usize_ty = module.target_config().pointer_type(); for method in methods { @@ -65,35 +59,6 @@ fn codegen_inner( ); } - { - let sig = Signature { - call_conv: module.target_config().default_call_conv, - params: vec![], - returns: vec![AbiParam::new(types::I8)], - }; - let func_id = module - .declare_function( - &mangle_internal_symbol(tcx, OomStrategy::SYMBOL), - Linkage::Export, - &sig, - ) - .unwrap(); - let mut ctx = Context::new(); - ctx.func.signature = sig; - { - let mut func_ctx = FunctionBuilderContext::new(); - let mut bcx = FunctionBuilder::new(&mut ctx.func, &mut func_ctx); - - let block = bcx.create_block(); - bcx.switch_to_block(block); - let value = bcx.ins().iconst(types::I8, oom_strategy.should_panic() as i64); - bcx.ins().return_(&[value]); - bcx.seal_all_blocks(); - bcx.finalize(); - } - module.define_function(func_id, &mut ctx).unwrap(); - } - { let sig = Signature { call_conv: module.target_config().default_call_conv, diff --git a/compiler/rustc_codegen_gcc/src/allocator.rs b/compiler/rustc_codegen_gcc/src/allocator.rs index 647569694b04d..1f464d7e1226f 100644 --- a/compiler/rustc_codegen_gcc/src/allocator.rs +++ b/compiler/rustc_codegen_gcc/src/allocator.rs @@ -1,12 +1,11 @@ #[cfg(feature = "master")] use gccjit::FnAttribute; -use gccjit::{Context, FunctionType, RValue, ToRValue, Type}; +use gccjit::{Context, FunctionType, ToRValue, Type}; use rustc_ast::expand::allocator::{ AllocatorMethod, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE, default_fn_name, global_fn_name, }; use rustc_middle::bug; use rustc_middle::ty::TyCtxt; -use rustc_session::config::OomStrategy; use rustc_symbol_mangling::mangle_internal_symbol; use crate::GccContext; @@ -59,14 +58,6 @@ pub(crate) unsafe fn codegen( create_wrapper_function(tcx, context, &from_name, Some(&to_name), &types, output); } - create_const_value_function( - tcx, - context, - &mangle_internal_symbol(tcx, OomStrategy::SYMBOL), - i8, - context.new_rvalue_from_int(i8, tcx.sess.opts.unstable_opts.oom.should_panic() as i32), - ); - create_wrapper_function( tcx, context, @@ -77,34 +68,6 @@ pub(crate) unsafe fn codegen( ); } -fn create_const_value_function( - tcx: TyCtxt<'_>, - context: &Context<'_>, - name: &str, - output: Type<'_>, - value: RValue<'_>, -) { - let func = context.new_function(None, FunctionType::Exported, output, &[], name, false); - - #[cfg(feature = "master")] - { - func.add_attribute(FnAttribute::Visibility(symbol_visibility_to_gcc( - tcx.sess.default_visibility(), - ))); - - // FIXME(antoyo): cg_llvm sets AlwaysInline, but AlwaysInline is different in GCC and using - // it here will causes linking errors when using LTO. - func.add_attribute(FnAttribute::Inline); - } - - if tcx.sess.must_emit_unwind_tables() { - // TODO(antoyo): emit unwind tables. - } - - let block = func.new_block("entry"); - block.end_with_return(None, value); -} - fn create_wrapper_function( tcx: TyCtxt<'_>, context: &Context<'_>, diff --git a/compiler/rustc_codegen_gcc/src/builder.rs b/compiler/rustc_codegen_gcc/src/builder.rs index 1787415b72e6d..df1e64c75b963 100644 --- a/compiler/rustc_codegen_gcc/src/builder.rs +++ b/compiler/rustc_codegen_gcc/src/builder.rs @@ -500,11 +500,11 @@ impl<'gcc, 'tcx> BackendTypes for Builder<'_, 'gcc, 'tcx> { } fn set_rvalue_location<'a, 'gcc, 'tcx>( - bx: &mut Builder<'a, 'gcc, 'tcx>, + _bx: &mut Builder<'a, 'gcc, 'tcx>, rvalue: RValue<'gcc>, ) -> RValue<'gcc> { - if let Some(location) = bx.location { - #[cfg(feature = "master")] + #[cfg(feature = "master")] + if let Some(location) = _bx.location { rvalue.set_location(location); } rvalue diff --git a/compiler/rustc_codegen_llvm/src/allocator.rs b/compiler/rustc_codegen_llvm/src/allocator.rs index de0b85ebb63b8..24b2bd37aa46c 100644 --- a/compiler/rustc_codegen_llvm/src/allocator.rs +++ b/compiler/rustc_codegen_llvm/src/allocator.rs @@ -7,13 +7,13 @@ use rustc_codegen_ssa::traits::BaseTypeCodegenMethods as _; use rustc_middle::bug; use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs}; use rustc_middle::ty::TyCtxt; -use rustc_session::config::{DebugInfo, OomStrategy}; +use rustc_session::config::DebugInfo; use rustc_symbol_mangling::mangle_internal_symbol; use crate::attributes::llfn_attrs_from_instance; use crate::builder::SBuilder; use crate::declare::declare_simple_fn; -use crate::llvm::{self, FALSE, FromGeneric, TRUE, Type, Value}; +use crate::llvm::{self, FromGeneric, TRUE, Type}; use crate::{SimpleCx, attributes, debuginfo}; pub(crate) unsafe fn codegen( @@ -28,7 +28,6 @@ pub(crate) unsafe fn codegen( 64 => cx.type_i64(), tws => bug!("Unsupported target word size for int: {}", tws), }; - let i8 = cx.type_i8(); let i8p = cx.type_ptr(); for method in methods { @@ -87,17 +86,6 @@ pub(crate) unsafe fn codegen( ); } - // __rust_alloc_error_handler_should_panic_v2 - create_const_value_function( - tcx, - &cx, - &mangle_internal_symbol(tcx, OomStrategy::SYMBOL), - &i8, - unsafe { - llvm::LLVMConstInt(i8, tcx.sess.opts.unstable_opts.oom.should_panic() as u64, FALSE) - }, - ); - // __rust_no_alloc_shim_is_unstable_v2 create_wrapper_function( tcx, @@ -117,34 +105,6 @@ pub(crate) unsafe fn codegen( } } -fn create_const_value_function( - tcx: TyCtxt<'_>, - cx: &SimpleCx<'_>, - name: &str, - output: &Type, - value: &Value, -) { - let ty = cx.type_func(&[], output); - let llfn = declare_simple_fn( - &cx, - name, - llvm::CallConv::CCallConv, - llvm::UnnamedAddr::Global, - llvm::Visibility::from_generic(tcx.sess.default_visibility()), - ty, - ); - - attributes::apply_to_llfn( - llfn, - llvm::AttributePlace::Function, - &[llvm::AttributeKind::AlwaysInline.create_attr(cx.llcx)], - ); - - let llbb = unsafe { llvm::LLVMAppendBasicBlockInContext(cx.llcx, llfn, c"entry".as_ptr()) }; - let mut bx = SBuilder::build(&cx, llbb); - bx.ret(value); -} - fn create_wrapper_function( tcx: TyCtxt<'_>, cx: &SimpleCx<'_>, diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs index a80976fad02a4..9d06de2b35c23 100644 --- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs @@ -15,7 +15,7 @@ use rustc_middle::middle::exported_symbols::{ use rustc_middle::query::LocalCrate; use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, Instance, SymbolName, Ty, TyCtxt}; use rustc_middle::util::Providers; -use rustc_session::config::{CrateType, OomStrategy}; +use rustc_session::config::CrateType; use rustc_symbol_mangling::mangle_internal_symbol; use rustc_target::spec::{Arch, Os, TlsModel}; use tracing::debug; @@ -493,7 +493,6 @@ pub(crate) fn allocator_shim_symbols( .map(move |method| mangle_internal_symbol(tcx, global_fn_name(method.name).as_str())) .chain([ mangle_internal_symbol(tcx, global_fn_name(ALLOC_ERROR_HANDLER).as_str()), - mangle_internal_symbol(tcx, OomStrategy::SYMBOL), mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE), ]) .map(move |symbol_name| { diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index d08d5a5a1ea29..78feb60261bd8 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -474,9 +474,12 @@ pub trait Emitter { .chain(span.span_labels().iter().map(|sp_label| sp_label.span)) .filter_map(|sp| { if !sp.is_dummy() && source_map.is_imported(sp) { - let maybe_callsite = sp.source_callsite(); - if sp != maybe_callsite { - return Some((sp, maybe_callsite)); + let mut span = sp; + while let Some(callsite) = span.parent_callsite() { + span = callsite; + if !source_map.is_imported(span) { + return Some((sp, span)); + } } } None diff --git a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs index 14e48594c006c..02443b577d385 100644 --- a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs +++ b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs @@ -66,6 +66,13 @@ struct BoundVarContext<'a, 'tcx> { rbv: &'a mut ResolveBoundVars, disambiguator: &'a mut DisambiguatorState, scope: ScopeRef<'a>, + opaque_capture_errors: RefCell>, +} + +struct OpaqueHigherRankedLifetimeCaptureErrors { + bad_place: &'static str, + capture_spans: Vec, + decl_spans: Vec, } #[derive(Debug)] @@ -253,6 +260,7 @@ fn resolve_bound_vars(tcx: TyCtxt<'_>, local_def_id: hir::OwnerId) -> ResolveBou rbv: &mut rbv, scope: &Scope::Root { opt_parent_item: None }, disambiguator: &mut DisambiguatorState::new(), + opaque_capture_errors: RefCell::new(None), }; match tcx.hir_owner_node(local_def_id) { hir::OwnerNode::Item(item) => visitor.visit_item(item), @@ -597,6 +605,8 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> { }) }); + self.emit_opaque_capture_errors(); + let captures = captures.into_inner().into_iter().collect(); debug!(?captures); self.rbv.opaque_captured_lifetimes.insert(opaque.def_id, captures); @@ -1089,12 +1099,20 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> { F: for<'b> FnOnce(&mut BoundVarContext<'b, 'tcx>), { let BoundVarContext { tcx, rbv, disambiguator, .. } = self; - let mut this = BoundVarContext { tcx: *tcx, rbv, disambiguator, scope: &wrap_scope }; + let nested_errors = RefCell::new(self.opaque_capture_errors.borrow_mut().take()); + let mut this = BoundVarContext { + tcx: *tcx, + rbv, + disambiguator, + scope: &wrap_scope, + opaque_capture_errors: nested_errors, + }; let span = debug_span!("scope", scope = ?this.scope.debug_truncated()); { let _enter = span.enter(); f(&mut this); } + *self.opaque_capture_errors.borrow_mut() = this.opaque_capture_errors.into_inner(); } fn record_late_bound_vars(&mut self, hir_id: HirId, binder: Vec) { @@ -1424,21 +1442,52 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> { }; let decl_span = self.tcx.def_span(lifetime_def_id); - let (span, label) = if capture_span != decl_span { - (capture_span, None) - } else { - let opaque_span = self.tcx.def_span(opaque_def_id); - (opaque_span, Some(opaque_span)) - }; + let opaque_span = self.tcx.def_span(opaque_def_id); + + let mut errors = self.opaque_capture_errors.borrow_mut(); + let error_info = errors.get_or_insert_with(|| OpaqueHigherRankedLifetimeCaptureErrors { + bad_place, + capture_spans: Vec::new(), + decl_spans: Vec::new(), + }); + + if error_info.capture_spans.is_empty() { + error_info.capture_spans.push(opaque_span); + } + + if capture_span != decl_span && capture_span != opaque_span { + error_info.capture_spans.push(capture_span); + } + + if !error_info.decl_spans.contains(&decl_span) { + error_info.decl_spans.push(decl_span); + } + + // Errors should be emitted by `emit_opaque_capture_errors`. + Err(self.tcx.dcx().span_delayed_bug(capture_span, "opaque capture error not emitted")) + } + + fn emit_opaque_capture_errors(&self) -> Option { + let errors = self.opaque_capture_errors.borrow_mut().take()?; + if errors.capture_spans.is_empty() { + return None; + } + + let mut span = rustc_errors::MultiSpan::from_span(errors.capture_spans[0]); + for &capture_span in &errors.capture_spans[1..] { + span.push_span_label(capture_span, ""); + } + let decl_span = rustc_errors::MultiSpan::from_spans(errors.decl_spans); // Ensure that the parent of the def is an item, not HRTB let guar = self.tcx.dcx().emit_err(errors::OpaqueCapturesHigherRankedLifetime { span, - label, + label: Some(errors.capture_spans[0]), decl_span, - bad_place, + bad_place: errors.bad_place, }); - Err(guar) + + Some(guar) } #[instrument(level = "trace", skip(self, opaque_capture_scopes), ret)] diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index f8809e051b600..34ad4e720eb51 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -1551,11 +1551,11 @@ pub(crate) struct UnconstrainedGenericParameter { #[diag(hir_analysis_opaque_captures_higher_ranked_lifetime, code = E0657)] pub(crate) struct OpaqueCapturesHigherRankedLifetime { #[primary_span] - pub span: Span, + pub span: MultiSpan, #[label] pub label: Option, #[note] - pub decl_span: Span, + pub decl_span: MultiSpan, pub bad_place: &'static str, } diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index 0e9ff962435fc..06fd89837d516 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -2296,7 +2296,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let suggested_name = find_best_match_for_name(&[field.name], pat_field.ident.name, None); if let Some(suggested_name) = suggested_name { - err.span_suggestion( + err.span_suggestion_verbose( pat_field.ident.span, "a field with a similar name exists", suggested_name, diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 6752ddbc5706e..89b8a5fddb89e 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -14,10 +14,10 @@ use rustc_session::config::{ CoverageOptions, DebugInfo, DumpMonoStatsFormat, ErrorOutputType, ExternEntry, ExternLocation, Externs, FmtDebug, FunctionReturn, InliningThreshold, Input, InstrumentCoverage, InstrumentXRay, LinkSelfContained, LinkerPluginLto, LocationDetail, LtoCli, MirIncludeSpans, - NextSolverConfig, Offload, OomStrategy, Options, OutFileName, OutputType, OutputTypes, - PAuthKey, PacRet, Passes, PatchableFunctionEntry, Polonius, ProcMacroExecutionStrategy, Strip, - SwitchWithOptPath, SymbolManglingVersion, WasiExecModel, build_configuration, - build_session_options, rustc_optgroups, + NextSolverConfig, Offload, Options, OutFileName, OutputType, OutputTypes, PAuthKey, PacRet, + Passes, PatchableFunctionEntry, Polonius, ProcMacroExecutionStrategy, Strip, SwitchWithOptPath, + SymbolManglingVersion, WasiExecModel, build_configuration, build_session_options, + rustc_optgroups, }; use rustc_session::lint::Level; use rustc_session::search_paths::SearchPath; @@ -839,7 +839,6 @@ fn test_unstable_options_tracking_hash() { tracked!(no_unique_section_names, true); tracked!(offload, vec![Offload::Enable]); tracked!(on_broken_pipe, OnBrokenPipe::Kill); - tracked!(oom, OomStrategy::Panic); tracked!(osx_rpath_install_name, true); tracked!(packed_bundled_libs, true); tracked!(panic_abort_tests, true); diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index a675c62ddf705..406da40d6123b 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -1963,7 +1963,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { }; (span, msg, suggestion.candidate.to_ident_string()) }; - err.span_suggestion(span, msg, sugg, Applicability::MaybeIncorrect); + err.span_suggestion_verbose(span, msg, sugg, Applicability::MaybeIncorrect); true } diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 9b19961fcee4e..35d9b77f2ea81 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -3127,8 +3127,8 @@ pub(crate) mod dep_tracking { AnnotateMoves, AutoDiff, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions, CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FmtDebug, FunctionReturn, InliningThreshold, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, - LocationDetail, LtoCli, MirStripDebugInfo, NextSolverConfig, Offload, OomStrategy, - OptLevel, OutFileName, OutputType, OutputTypes, PatchableFunctionEntry, Polonius, + LocationDetail, LtoCli, MirStripDebugInfo, NextSolverConfig, Offload, OptLevel, + OutFileName, OutputType, OutputTypes, PatchableFunctionEntry, Polonius, RemapPathScopeComponents, ResolveDocLinks, SourceFileHashAlgorithm, SplitDwarfKind, SwitchWithOptPath, SymbolManglingVersion, WasiExecModel, }; @@ -3227,7 +3227,6 @@ pub(crate) mod dep_tracking { LocationDetail, FmtDebug, BranchProtection, - OomStrategy, LanguageIdentifier, NextSolverConfig, PatchableFunctionEntry, @@ -3340,27 +3339,6 @@ pub(crate) mod dep_tracking { } } -/// Default behavior to use in out-of-memory situations. -#[derive(Clone, Copy, PartialEq, Hash, Debug, Encodable, Decodable, HashStable_Generic)] -pub enum OomStrategy { - /// Generate a panic that can be caught by `catch_unwind`. - Panic, - - /// Abort the process immediately. - Abort, -} - -impl OomStrategy { - pub const SYMBOL: &'static str = "__rust_alloc_error_handler_should_panic_v2"; - - pub fn should_panic(self) -> u8 { - match self { - OomStrategy::Panic => 1, - OomStrategy::Abort => 0, - } - } -} - /// How to run proc-macro code when building this crate #[derive(Clone, Copy, PartialEq, Hash, Debug)] pub enum ProcMacroExecutionStrategy { diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index d9792142a884d..92dd4a23125cc 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -806,7 +806,6 @@ mod desc { pub(crate) const parse_on_broken_pipe: &str = "either `kill`, `error`, or `inherit`"; pub(crate) const parse_patchable_function_entry: &str = "either two comma separated integers (total_nops,prefix_nops), with prefix_nops <= total_nops, or one integer (total_nops)"; pub(crate) const parse_opt_panic_strategy: &str = parse_panic_strategy; - pub(crate) const parse_oom_strategy: &str = "either `panic` or `abort`"; pub(crate) const parse_relro_level: &str = "one of: `full`, `partial`, or `off`"; pub(crate) const parse_sanitizers: &str = "comma separated list of sanitizers: `address`, `cfi`, `dataflow`, `hwaddress`, `kcfi`, `kernel-address`, `leak`, `memory`, `memtag`, `safestack`, `shadow-call-stack`, `thread`, or 'realtime'"; pub(crate) const parse_sanitizer_memory_track_origins: &str = "0, 1, or 2"; @@ -1242,15 +1241,6 @@ pub mod parse { false } - pub(crate) fn parse_oom_strategy(slot: &mut OomStrategy, v: Option<&str>) -> bool { - match v { - Some("panic") => *slot = OomStrategy::Panic, - Some("abort") => *slot = OomStrategy::Abort, - _ => return false, - } - true - } - pub(crate) fn parse_relro_level(slot: &mut Option, v: Option<&str>) -> bool { match v { Some(s) => match s.parse::() { @@ -2529,8 +2519,6 @@ options! { Currently the only option available"), on_broken_pipe: OnBrokenPipe = (OnBrokenPipe::Default, parse_on_broken_pipe, [TRACKED], "behavior of std::io::ErrorKind::BrokenPipe (SIGPIPE)"), - oom: OomStrategy = (OomStrategy::Abort, parse_oom_strategy, [TRACKED], - "panic strategy for out-of-memory handling"), osx_rpath_install_name: bool = (false, parse_bool, [TRACKED], "pass `-install_name @rpath/...` to the macOS linker (default: no)"), packed_bundled_libs: bool = (false, parse_bool, [TRACKED], diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs index 1094f00e42f29..fd845e31c9093 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs @@ -1886,12 +1886,56 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { let ty::Dynamic(_, _) = trait_pred.self_ty().skip_binder().kind() else { return false; }; + if let Node::Item(hir::Item { kind: hir::ItemKind::Fn { sig: fn_sig, .. }, .. }) + | Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Fn(fn_sig, _), .. }) + | Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Fn(fn_sig, _), .. }) = + self.tcx.hir_node_by_def_id(obligation.cause.body_id) + && let hir::FnRetTy::Return(ty) = fn_sig.decl.output + && let hir::TyKind::Path(qpath) = ty.kind + && let hir::QPath::Resolved(None, path) = qpath + && let Res::Def(DefKind::TyAlias, def_id) = path.res + { + // Do not suggest + // type T = dyn Trait; + // fn foo() -> impl T { .. } + err.span_note(self.tcx.def_span(def_id), "this type alias is unsized"); + err.multipart_suggestion( + format!( + "consider boxing the return type, and wrapping all of the returned values in \ + `Box::new`", + ), + vec![ + (ty.span.shrink_to_lo(), "Box<".to_string()), + (ty.span.shrink_to_hi(), ">".to_string()), + ], + Applicability::MaybeIncorrect, + ); + return false; + } err.code(E0746); err.primary_message("return type cannot be a trait object without pointer indirection"); err.children.clear(); - let span = obligation.cause.span; + let mut span = obligation.cause.span; + if let DefKind::Closure = self.tcx.def_kind(obligation.cause.body_id) + && let parent = self.tcx.parent(obligation.cause.body_id.into()) + && let DefKind::Fn | DefKind::AssocFn = self.tcx.def_kind(parent) + && self.tcx.asyncness(parent).is_async() + && let Some(parent) = parent.as_local() + && let Node::Item(hir::Item { kind: hir::ItemKind::Fn { sig: fn_sig, .. }, .. }) + | Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Fn(fn_sig, _), .. }) + | Node::TraitItem(hir::TraitItem { + kind: hir::TraitItemKind::Fn(fn_sig, _), .. + }) = self.tcx.hir_node_by_def_id(parent) + { + // Do not suggest (#147894) + // async fn foo() -> dyn Display impl { .. } + // and + // async fn foo() -> dyn Display Box + span = fn_sig.decl.output.span(); + err.span(span); + } let body = self.tcx.hir_body_owned_by(obligation.cause.body_id); let mut visitor = ReturnsVisitor::default(); diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs index 39450f69ce30a..c5f16f3708d74 100644 --- a/library/alloc/src/alloc.rs +++ b/library/alloc/src/alloc.rs @@ -426,20 +426,9 @@ pub mod __alloc_error_handler { // `#[alloc_error_handler]`. #[rustc_std_internal_symbol] pub unsafe fn __rdl_alloc_error_handler(size: usize, _align: usize) -> ! { - unsafe extern "Rust" { - // This symbol is emitted by rustc next to __rust_alloc_error_handler. - // Its value depends on the -Zoom={panic,abort} compiler option. - #[rustc_std_internal_symbol] - fn __rust_alloc_error_handler_should_panic_v2() -> u8; - } - - if unsafe { __rust_alloc_error_handler_should_panic_v2() != 0 } { - panic!("memory allocation of {size} bytes failed") - } else { - core::panicking::panic_nounwind_fmt( - format_args!("memory allocation of {size} bytes failed"), - /* force_no_backtrace */ false, - ) - } + core::panicking::panic_nounwind_fmt( + format_args!("memory allocation of {size} bytes failed"), + /* force_no_backtrace */ false, + ) } } diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs index 9254aa55507e7..f0d2b913bbbb9 100644 --- a/library/std/src/alloc.rs +++ b/library/std/src/alloc.rs @@ -357,17 +357,6 @@ fn default_alloc_error_hook(layout: Layout) { return; } - unsafe extern "Rust" { - // This symbol is emitted by rustc next to __rust_alloc_error_handler. - // Its value depends on the -Zoom={panic,abort} compiler option. - #[rustc_std_internal_symbol] - fn __rust_alloc_error_handler_should_panic_v2() -> u8; - } - - if unsafe { __rust_alloc_error_handler_should_panic_v2() != 0 } { - panic!("memory allocation of {} bytes failed", layout.size()); - } - // This is the default path taken on OOM, and the only path taken on stable with std. // Crucially, it does *not* call any user-defined code, and therefore users do not have to // worry about allocation failure causing reentrancy issues. That makes it different from diff --git a/src/bootstrap/src/core/build_steps/clippy.rs b/src/bootstrap/src/core/build_steps/clippy.rs index d8b74b43cfab8..085c2d952e304 100644 --- a/src/bootstrap/src/core/build_steps/clippy.rs +++ b/src/bootstrap/src/core/build_steps/clippy.rs @@ -379,15 +379,24 @@ impl Step for CodegenGcc { let stamp = BuildStamp::new(&builder.cargo_out(build_compiler, Mode::Codegen, target)) .with_prefix("rustc_codegen_gcc-check"); - run_cargo( + let args = lint_args(builder, &self.config, &[]); + run_cargo(builder, cargo, args.clone(), &stamp, vec![], true, false); + + // Same but we disable the features enabled by default. + let mut cargo = prepare_tool_cargo( builder, - cargo, - lint_args(builder, &self.config, &[]), - &stamp, - vec![], - true, - false, + build_compiler, + Mode::Codegen, + target, + Kind::Clippy, + "compiler/rustc_codegen_gcc", + SourceType::InTree, + &[], ); + self.build_compiler.configure_cargo(&mut cargo); + println!("Now running clippy on `rustc_codegen_gcc` with `--no-default-features`"); + cargo.arg("--no-default-features"); + run_cargo(builder, cargo, args, &stamp, vec![], true, false); } fn metadata(&self) -> Option { diff --git a/src/tools/clippy/tests/ui/future_not_send.stderr b/src/tools/clippy/tests/ui/future_not_send.stderr index e366dc2d21958..8b8af1ebaed39 100644 --- a/src/tools/clippy/tests/ui/future_not_send.stderr +++ b/src/tools/clippy/tests/ui/future_not_send.stderr @@ -1,8 +1,8 @@ error: future cannot be sent between threads safely - --> tests/ui/future_not_send.rs:8:1 + --> tests/ui/future_not_send.rs:8:62 | LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell) -> bool { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `private_future` is not `Send` + | ^^^^ future returned by `private_future` is not `Send` | note: future is not `Send` as this value is used across an await --> tests/ui/future_not_send.rs:11:20 @@ -23,10 +23,10 @@ LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell) -> bool { = help: to override `-D warnings` add `#[allow(clippy::future_not_send)]` error: future cannot be sent between threads safely - --> tests/ui/future_not_send.rs:14:1 + --> tests/ui/future_not_send.rs:14:41 | LL | pub async fn public_future(rc: Rc<[u8]>) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `public_future` is not `Send` + | ^ future returned by `public_future` is not `Send` | note: future is not `Send` as this value is used across an await --> tests/ui/future_not_send.rs:17:20 @@ -39,10 +39,10 @@ LL | async { true }.await; = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send` error: future cannot be sent between threads safely - --> tests/ui/future_not_send.rs:24:1 + --> tests/ui/future_not_send.rs:24:63 | LL | async fn private_future2(rc: Rc<[u8]>, cell: &Cell) -> bool { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `private_future2` is not `Send` + | ^^^^ future returned by `private_future2` is not `Send` | note: captured value is not `Send` --> tests/ui/future_not_send.rs:24:26 @@ -58,10 +58,10 @@ LL | async fn private_future2(rc: Rc<[u8]>, cell: &Cell) -> bool { = note: `std::cell::Cell` doesn't implement `std::marker::Sync` error: future cannot be sent between threads safely - --> tests/ui/future_not_send.rs:30:1 + --> tests/ui/future_not_send.rs:30:42 | LL | pub async fn public_future2(rc: Rc<[u8]>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `public_future2` is not `Send` + | ^ future returned by `public_future2` is not `Send` | note: captured value is not `Send` --> tests/ui/future_not_send.rs:30:29 @@ -71,10 +71,10 @@ LL | pub async fn public_future2(rc: Rc<[u8]>) {} = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send` error: future cannot be sent between threads safely - --> tests/ui/future_not_send.rs:42:5 + --> tests/ui/future_not_send.rs:42:39 | LL | async fn private_future(&self) -> usize { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `private_future` is not `Send` + | ^^^^^ future returned by `private_future` is not `Send` | note: future is not `Send` as this value is used across an await --> tests/ui/future_not_send.rs:45:24 @@ -87,10 +87,10 @@ LL | async { true }.await; = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync` error: future cannot be sent between threads safely - --> tests/ui/future_not_send.rs:49:5 + --> tests/ui/future_not_send.rs:49:38 | LL | pub async fn public_future(&self) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `public_future` is not `Send` + | ^ future returned by `public_future` is not `Send` | note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` --> tests/ui/future_not_send.rs:49:32 @@ -100,13 +100,10 @@ LL | pub async fn public_future(&self) { = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync` error: future cannot be sent between threads safely - --> tests/ui/future_not_send.rs:61:1 + --> tests/ui/future_not_send.rs:61:37 | -LL | / async fn generic_future(t: T) -> T -LL | | -LL | | where -LL | | T: Send, - | |____________^ future returned by `generic_future` is not `Send` +LL | async fn generic_future(t: T) -> T + | ^ future returned by `generic_future` is not `Send` | note: future is not `Send` as this value is used across an await --> tests/ui/future_not_send.rs:67:20 @@ -118,10 +115,10 @@ LL | async { true }.await; = note: `T` doesn't implement `std::marker::Sync` error: future cannot be sent between threads safely - --> tests/ui/future_not_send.rs:83:1 + --> tests/ui/future_not_send.rs:83:51 | LL | async fn generic_future_always_unsend(_: Rc) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `generic_future_always_unsend` is not `Send` + | ^ future returned by `generic_future_always_unsend` is not `Send` | note: future is not `Send` as this value is used across an await --> tests/ui/future_not_send.rs:86:20 diff --git a/src/tools/miri/src/shims/foreign_items.rs b/src/tools/miri/src/shims/foreign_items.rs index 440388673e7d4..8a959d06bf9ca 100644 --- a/src/tools/miri/src/shims/foreign_items.rs +++ b/src/tools/miri/src/shims/foreign_items.rs @@ -12,7 +12,6 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc_middle::mir::interpret::AllocInit; use rustc_middle::ty::{Instance, Ty}; use rustc_middle::{mir, ty}; -use rustc_session::config::OomStrategy; use rustc_span::Symbol; use rustc_target::callconv::FnAbi; use rustc_target::spec::{Arch, Os}; @@ -305,18 +304,12 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { // Here we dispatch all the shims for foreign functions. If you have a platform specific // shim, add it to the corresponding submodule. match link_name.as_str() { - // Magic functions Rust emits (and not as part of the allocator shim). + // Magic function Rust emits (and not as part of the allocator shim). name if name == this.mangle_internal_symbol(NO_ALLOC_SHIM_IS_UNSTABLE) => { // This is a no-op shim that only exists to prevent making the allocator shims // instantly stable. let [] = this.check_shim_sig_lenient(abi, CanonAbi::Rust, link_name, args)?; } - name if name == this.mangle_internal_symbol(OomStrategy::SYMBOL) => { - // Gets the value of the `oom` option. - let [] = this.check_shim_sig_lenient(abi, CanonAbi::Rust, link_name, args)?; - let val = this.tcx.sess.opts.unstable_opts.oom.should_panic(); - this.write_int(val, dest)?; - } // Miri-specific extern functions "miri_alloc" => { diff --git a/src/tools/miri/tests/fail/panic/tls_macro_drop_panic.rs b/src/tools/miri/tests/fail/panic/tls_macro_drop_panic.rs index 107d70a3b3c7f..a207d3923124a 100644 --- a/src/tools/miri/tests/fail/panic/tls_macro_drop_panic.rs +++ b/src/tools/miri/tests/fail/panic/tls_macro_drop_panic.rs @@ -1,7 +1,7 @@ //@error-in-other-file: aborted execution // Backtraces vary wildly between platforms, we have to normalize away almost the entire thing //@normalize-stderr-test: "'main'|''" -> "$$NAME" -//@normalize-stderr-test: ".*(note|-->|\|).*\n" -> "" +//@normalize-stderr-test: ".*(note|-->|:::|\|).*\n" -> "" pub struct NoisyDrop {} diff --git a/src/tools/miri/tests/panic/alloc_error_handler_panic.rs b/src/tools/miri/tests/panic/alloc_error_handler_panic.rs deleted file mode 100644 index c434e8d3227a2..0000000000000 --- a/src/tools/miri/tests/panic/alloc_error_handler_panic.rs +++ /dev/null @@ -1,18 +0,0 @@ -//@compile-flags: -Zoom=panic -#![feature(allocator_api)] - -use std::alloc::*; - -struct Bomb; -impl Drop for Bomb { - fn drop(&mut self) { - eprintln!("yes we are unwinding!"); - } -} - -#[allow(unreachable_code, unused_variables)] -fn main() { - let bomb = Bomb; - handle_alloc_error(Layout::for_value(&0)); - std::mem::forget(bomb); // defuse unwinding bomb -} diff --git a/src/tools/miri/tests/panic/alloc_error_handler_panic.stderr b/src/tools/miri/tests/panic/alloc_error_handler_panic.stderr deleted file mode 100644 index 7c2d089f952ef..0000000000000 --- a/src/tools/miri/tests/panic/alloc_error_handler_panic.stderr +++ /dev/null @@ -1,6 +0,0 @@ - -thread 'main' ($TID) panicked at RUSTLIB/std/src/alloc.rs:LL:CC: -memory allocation of 4 bytes failed -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect -yes we are unwinding! diff --git a/tests/ui-fulldeps/rustc-dev-remap.only-remap.stderr b/tests/ui-fulldeps/rustc-dev-remap.only-remap.stderr index 15e2cf66f8f86..d2303ef4bbb56 100644 --- a/tests/ui-fulldeps/rustc-dev-remap.only-remap.stderr +++ b/tests/ui-fulldeps/rustc-dev-remap.only-remap.stderr @@ -18,6 +18,9 @@ help: the following other types implement trait `VisitorResult` = note: `ControlFlow` note: required by a bound in `rustc_ast::visit::Visitor::Result` --> /rustc-dev/xyz/compiler/rustc_ast/src/visit.rs:LL:COL + ::: /rustc-dev/xyz/compiler/rustc_ast/src/visit.rs:LL:COL + | + = note: in this macro invocation = note: this error originates in the macro `common_visitor_and_walkers` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui-fulldeps/rustc-dev-remap.remap-unremap.stderr b/tests/ui-fulldeps/rustc-dev-remap.remap-unremap.stderr index b9276974c465e..50bb60e78d680 100644 --- a/tests/ui-fulldeps/rustc-dev-remap.remap-unremap.stderr +++ b/tests/ui-fulldeps/rustc-dev-remap.remap-unremap.stderr @@ -20,8 +20,11 @@ LL | impl VisitorResult for ControlFlow { note: required by a bound in `rustc_ast::visit::Visitor::Result` --> $COMPILER_DIR_REAL/rustc_ast/src/visit.rs:LL:COL | +LL | type Result: VisitorResult = (); + | ^^^^^^^^^^^^^ required by this bound in `Visitor::Result` +... LL | common_visitor_and_walkers!(Visitor<'a>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Visitor::Result` + | ---------------------------------------- in this macro invocation = note: this error originates in the macro `common_visitor_and_walkers` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr index 8b6c4b181c0fe..72e150dd5178d 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr @@ -15,6 +15,9 @@ LL | struct NotIntoDiagArg; = help: normalized in stderr note: required by a bound in `Diag::<'a, G>::arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC + ::: $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC + | + = note: in this macro invocation = note: this error originates in the macro `with_fn` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotIntoDiagArg: IntoDiagArg` is not satisfied @@ -34,6 +37,9 @@ LL | struct NotIntoDiagArg; = help: normalized in stderr note: required by a bound in `Diag::<'a, G>::arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC + ::: $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC + | + = note: in this macro invocation = note: this error originates in the macro `with_fn` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index 59b48e9f0ecc2..f2244a9687698 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -570,19 +570,37 @@ error: cannot find attribute `warn_` in this scope --> $DIR/diagnostic-derive.rs:590:3 | LL | #[warn_(no_crate_example, code = E0123)] - | ^^^^^ help: a built-in attribute with a similar name exists: `warn` + | ^^^^^ + | +help: a built-in attribute with a similar name exists + | +LL - #[warn_(no_crate_example, code = E0123)] +LL + #[warn(no_crate_example, code = E0123)] + | error: cannot find attribute `lint` in this scope --> $DIR/diagnostic-derive.rs:597:3 | LL | #[lint(no_crate_example, code = E0123)] - | ^^^^ help: a built-in attribute with a similar name exists: `link` + | ^^^^ + | +help: a built-in attribute with a similar name exists + | +LL - #[lint(no_crate_example, code = E0123)] +LL + #[link(no_crate_example, code = E0123)] + | error: cannot find attribute `lint` in this scope --> $DIR/diagnostic-derive.rs:604:3 | LL | #[lint(no_crate_example, code = E0123)] - | ^^^^ help: a built-in attribute with a similar name exists: `link` + | ^^^^ + | +help: a built-in attribute with a similar name exists + | +LL - #[lint(no_crate_example, code = E0123)] +LL + #[link(no_crate_example, code = E0123)] + | error: cannot find attribute `multipart_suggestion` in this scope --> $DIR/diagnostic-derive.rs:644:3 @@ -647,6 +665,9 @@ LL | struct Hello {} = help: normalized in stderr note: required by a bound in `Diag::<'a, G>::arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC + ::: $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC + | + = note: in this macro invocation = note: this error originates in the macro `with_fn` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 85 previous errors diff --git a/tests/ui/argument-suggestions/issue-109831.stderr b/tests/ui/argument-suggestions/issue-109831.stderr index 6c25236ebb1b0..852016c983f72 100644 --- a/tests/ui/argument-suggestions/issue-109831.stderr +++ b/tests/ui/argument-suggestions/issue-109831.stderr @@ -24,7 +24,13 @@ LL | struct A; | --------- similarly named unit struct `A` defined here ... LL | f(A, A, B, C); - | ^ help: a unit struct with a similar name exists: `A` + | ^ + | +help: a unit struct with a similar name exists + | +LL - f(A, A, B, C); +LL + f(A, A, B, A); + | error[E0061]: this function takes 3 arguments but 4 arguments were supplied --> $DIR/issue-109831.rs:7:5 diff --git a/tests/ui/associated-item/issue-87638.stderr b/tests/ui/associated-item/issue-87638.stderr index cf6083444b0e6..cce20318a23ba 100644 --- a/tests/ui/associated-item/issue-87638.stderr +++ b/tests/ui/associated-item/issue-87638.stderr @@ -5,10 +5,13 @@ LL | type Target; | ------------ associated type `Target` defined here ... LL | let _: ::Output; - | ^^^^^^ - | | - | not found in `Trait` - | help: maybe you meant this associated type: `Target` + | ^^^^^^ not found in `Trait` + | +help: maybe you meant this associated type + | +LL - let _: ::Output; +LL + let _: ::Target; + | error[E0576]: cannot find method or associated constant `BAR` in trait `Trait` --> $DIR/issue-87638.rs:20:27 @@ -17,10 +20,13 @@ LL | const FOO: usize; | ----------------- associated constant `FOO` defined here ... LL | let _ = ::BAR; - | ^^^ - | | - | not found in `Trait` - | help: maybe you meant this associated constant: `FOO` + | ^^^ not found in `Trait` + | +help: maybe you meant this associated constant + | +LL - let _ = ::BAR; +LL + let _ = ::FOO; + | error: aborting due to 2 previous errors diff --git a/tests/ui/associated-types/issue-19883.stderr b/tests/ui/associated-types/issue-19883.stderr index 35184e852cfe1..435c2933e3616 100644 --- a/tests/ui/associated-types/issue-19883.stderr +++ b/tests/ui/associated-types/issue-19883.stderr @@ -5,10 +5,13 @@ LL | type Output; | ------------ associated type `Output` defined here ... LL | >::Dst - | ^^^ - | | - | not found in `From` - | help: maybe you meant this associated type: `Output` + | ^^^ not found in `From` + | +help: maybe you meant this associated type + | +LL - >::Dst +LL + >::Output + | error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/issue-22037.stderr b/tests/ui/associated-types/issue-22037.stderr index b02dad97d354e..0b5f18f81c0bf 100644 --- a/tests/ui/associated-types/issue-22037.stderr +++ b/tests/ui/associated-types/issue-22037.stderr @@ -4,10 +4,13 @@ error[E0576]: cannot find associated type `X` in trait `A` LL | type Output; | ------------ associated type `Output` defined here LL | fn a(&self) -> ::X; - | ^ - | | - | not found in `A` - | help: maybe you meant this associated type: `Output` + | ^ not found in `A` + | +help: maybe you meant this associated type + | +LL - fn a(&self) -> ::X; +LL + fn a(&self) -> ::Output; + | error: aborting due to 1 previous error diff --git a/tests/ui/async-await/async-await-let-else.stderr b/tests/ui/async-await/async-await-let-else.stderr index 5883f34f87de6..b5b56d3242f4d 100644 --- a/tests/ui/async-await/async-await-let-else.stderr +++ b/tests/ui/async-await/async-await-let-else.stderr @@ -22,7 +22,7 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely --> $DIR/async-await-let-else.rs:47:13 | LL | async fn foo2(x: Option) { - | ------------------------------ within this `impl Future` + | - within this `impl Future` ... LL | is_send(foo2(Some(true))); | ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely diff --git a/tests/ui/async-await/async-fn/dyn-in-return-type.fixed b/tests/ui/async-await/async-fn/dyn-in-return-type.fixed new file mode 100644 index 0000000000000..6a717f628460e --- /dev/null +++ b/tests/ui/async-await/async-fn/dyn-in-return-type.fixed @@ -0,0 +1,30 @@ +//@ edition:2024 +//@ run-rustfix + +async fn f() -> Box { +//~^ ERROR return type cannot be a trait object without pointer indirection +//~| HELP consider returning an `impl Trait` instead of a `dyn Trait` +//~| HELP alternatively, box the return type, and wrap all of the returned values in `Box::new` + Box::new("") +} +trait T { + async fn f(&self) -> Box { + //~^ ERROR return type cannot be a trait object without pointer indirection + //~| HELP consider returning an `impl Trait` instead of a `dyn Trait` + //~| HELP alternatively, box the return type, and wrap all of the returned values in `Box::new` + Box::new("") + } +} +impl T for () { + async fn f(&self) -> Box { + //~^ ERROR return type cannot be a trait object without pointer indirection + //~| HELP consider returning an `impl Trait` instead of a `dyn Trait` + //~| HELP alternatively, box the return type, and wrap all of the returned values in `Box::new` + Box::new("") + } +} + +fn main() { + let _ = f(); + let _ = ().f(); +} diff --git a/tests/ui/async-await/async-fn/dyn-in-return-type.rs b/tests/ui/async-await/async-fn/dyn-in-return-type.rs new file mode 100644 index 0000000000000..47d5e371f55f6 --- /dev/null +++ b/tests/ui/async-await/async-fn/dyn-in-return-type.rs @@ -0,0 +1,30 @@ +//@ edition:2024 +//@ run-rustfix + +async fn f() -> dyn core::fmt::Debug { +//~^ ERROR return type cannot be a trait object without pointer indirection +//~| HELP consider returning an `impl Trait` instead of a `dyn Trait` +//~| HELP alternatively, box the return type, and wrap all of the returned values in `Box::new` + Box::new("") +} +trait T { + async fn f(&self) -> dyn core::fmt::Debug { + //~^ ERROR return type cannot be a trait object without pointer indirection + //~| HELP consider returning an `impl Trait` instead of a `dyn Trait` + //~| HELP alternatively, box the return type, and wrap all of the returned values in `Box::new` + Box::new("") + } +} +impl T for () { + async fn f(&self) -> dyn core::fmt::Debug { + //~^ ERROR return type cannot be a trait object without pointer indirection + //~| HELP consider returning an `impl Trait` instead of a `dyn Trait` + //~| HELP alternatively, box the return type, and wrap all of the returned values in `Box::new` + Box::new("") + } +} + +fn main() { + let _ = f(); + let _ = ().f(); +} diff --git a/tests/ui/async-await/async-fn/dyn-in-return-type.stderr b/tests/ui/async-await/async-fn/dyn-in-return-type.stderr new file mode 100644 index 0000000000000..0d8a92d33cf9a --- /dev/null +++ b/tests/ui/async-await/async-fn/dyn-in-return-type.stderr @@ -0,0 +1,51 @@ +error[E0746]: return type cannot be a trait object without pointer indirection + --> $DIR/dyn-in-return-type.rs:4:17 + | +LL | async fn f() -> dyn core::fmt::Debug { + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider returning an `impl Trait` instead of a `dyn Trait` + | +LL - async fn f() -> dyn core::fmt::Debug { +LL + async fn f() -> impl core::fmt::Debug { + | +help: alternatively, box the return type, and wrap all of the returned values in `Box::new` + | +LL | async fn f() -> Box { + | ++++ + + +error[E0746]: return type cannot be a trait object without pointer indirection + --> $DIR/dyn-in-return-type.rs:11:26 + | +LL | async fn f(&self) -> dyn core::fmt::Debug { + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider returning an `impl Trait` instead of a `dyn Trait` + | +LL - async fn f(&self) -> dyn core::fmt::Debug { +LL + async fn f(&self) -> impl core::fmt::Debug { + | +help: alternatively, box the return type, and wrap all of the returned values in `Box::new` + | +LL | async fn f(&self) -> Box { + | ++++ + + +error[E0746]: return type cannot be a trait object without pointer indirection + --> $DIR/dyn-in-return-type.rs:19:26 + | +LL | async fn f(&self) -> dyn core::fmt::Debug { + | ^^^^^^^^^^^^^^^^^^^^ + | +help: consider returning an `impl Trait` instead of a `dyn Trait` + | +LL - async fn f(&self) -> dyn core::fmt::Debug { +LL + async fn f(&self) -> impl core::fmt::Debug { + | +help: alternatively, box the return type, and wrap all of the returned values in `Box::new` + | +LL | async fn f(&self) -> Box { + | ++++ + + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0746`. diff --git a/tests/ui/async-await/async-fn/recurse-ice-129215.stderr b/tests/ui/async-await/async-fn/recurse-ice-129215.stderr index 98c7be2a5a3f2..232246590cf10 100644 --- a/tests/ui/async-await/async-fn/recurse-ice-129215.stderr +++ b/tests/ui/async-await/async-fn/recurse-ice-129215.stderr @@ -7,10 +7,10 @@ LL | a() = help: the trait `Future` is not implemented for `()` error[E0277]: `()` is not a future - --> $DIR/recurse-ice-129215.rs:3:1 + --> $DIR/recurse-ice-129215.rs:3:13 | LL | async fn a() { - | ^^^^^^^^^^^^ `()` is not a future + | ^ `()` is not a future | = help: the trait `Future` is not implemented for `()` diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr index 54df0edf5a8e4..c98df134072eb 100644 --- a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr +++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr @@ -1,8 +1,8 @@ error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/async-example-desugared-boxed-in-trait.rs:11:5 + --> $DIR/async-example-desugared-boxed-in-trait.rs:11:28 | LL | async fn foo(&self) -> i32 { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Pin>>`, found future + | ^^^ expected `Pin>>`, found future | note: type in trait --> $DIR/async-example-desugared-boxed-in-trait.rs:7:22 diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr index b7f2879727f24..d3765a7e6e6fd 100644 --- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr +++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr @@ -2,7 +2,7 @@ warning: impl trait in impl method signature does not match trait method signatu --> $DIR/async-example-desugared-boxed.rs:14:22 | LL | async fn foo(&self) -> i32; - | --------------------------- return type from trait method defined here + | --- return type from trait method defined here ... LL | fn foo(&self) -> Pin + '_>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr b/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr index 86546df88c175..3328dea37fe4d 100644 --- a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr +++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr @@ -2,7 +2,7 @@ warning: impl trait in impl method signature does not match trait method signatu --> $DIR/async-example-desugared-manual.rs:22:22 | LL | async fn foo(&self) -> i32; - | --------------------------- return type from trait method defined here + | --- return type from trait method defined here ... LL | fn foo(&self) -> MyFuture { | ^^^^^^^^ diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr index 183b0fa152aa3..52fd887b296f4 100644 --- a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr +++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr @@ -1,11 +1,10 @@ error[E0311]: the parameter type `T` may not live long enough - --> $DIR/async-generics-and-bounds.rs:8:5 + --> $DIR/async-generics-and-bounds.rs:8:28 | LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | the parameter type `T` must be valid for the anonymous lifetime as defined here... - | ...so that the reference type `&(T, U)` does not outlive the data it points at + | - ^^^^^^^ ...so that the reference type `&(T, U)` does not outlive the data it points at + | | + | the parameter type `T` must be valid for the anonymous lifetime as defined here... | help: consider adding an explicit lifetime bound | @@ -13,13 +12,12 @@ LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: Debug + Sized, U: Has | ++++ ++ ++ +++++++ error[E0311]: the parameter type `U` may not live long enough - --> $DIR/async-generics-and-bounds.rs:8:5 + --> $DIR/async-generics-and-bounds.rs:8:28 | LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | the parameter type `U` must be valid for the anonymous lifetime as defined here... - | ...so that the reference type `&(T, U)` does not outlive the data it points at + | - ^^^^^^^ ...so that the reference type `&(T, U)` does not outlive the data it points at + | | + | the parameter type `U` must be valid for the anonymous lifetime as defined here... | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/async-await/in-trait/async-generics.stderr b/tests/ui/async-await/in-trait/async-generics.stderr index 8916ef5ab6830..3f44e4cdb6778 100644 --- a/tests/ui/async-await/in-trait/async-generics.stderr +++ b/tests/ui/async-await/in-trait/async-generics.stderr @@ -1,11 +1,10 @@ error[E0311]: the parameter type `T` may not live long enough - --> $DIR/async-generics.rs:5:5 + --> $DIR/async-generics.rs:5:28 | LL | async fn foo(&self) -> &(T, U); - | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^ - | | | - | | the parameter type `T` must be valid for the anonymous lifetime as defined here... - | ...so that the reference type `&(T, U)` does not outlive the data it points at + | - ^^^^^^^ ...so that the reference type `&(T, U)` does not outlive the data it points at + | | + | the parameter type `T` must be valid for the anonymous lifetime as defined here... | help: consider adding an explicit lifetime bound | @@ -13,13 +12,12 @@ LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: 'a; | ++++ ++ ++ +++++++++++ error[E0311]: the parameter type `U` may not live long enough - --> $DIR/async-generics.rs:5:5 + --> $DIR/async-generics.rs:5:28 | LL | async fn foo(&self) -> &(T, U); - | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^ - | | | - | | the parameter type `U` must be valid for the anonymous lifetime as defined here... - | ...so that the reference type `&(T, U)` does not outlive the data it points at + | - ^^^^^^^ ...so that the reference type `&(T, U)` does not outlive the data it points at + | | + | the parameter type `U` must be valid for the anonymous lifetime as defined here... | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr index 823d8d5b92fce..d0c11565f4e90 100644 --- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr @@ -1,14 +1,14 @@ error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/dont-project-to-specializable-projection.rs:14:5 + --> $DIR/dont-project-to-specializable-projection.rs:14:35 | LL | default async fn foo(_: T) -> &'static str { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found future + | ^^^^^^^^^^^^ expected associated type, found future | note: type in trait - --> $DIR/dont-project-to-specializable-projection.rs:10:5 + --> $DIR/dont-project-to-specializable-projection.rs:10:27 | LL | async fn foo(_: T) -> &'static str; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ = note: expected signature `fn(_) -> impl Future` found signature `fn(_) -> impl Future` diff --git a/tests/ui/async-await/inference_var_self_argument.stderr b/tests/ui/async-await/inference_var_self_argument.stderr index 1fccc32470ff6..c4240a095e685 100644 --- a/tests/ui/async-await/inference_var_self_argument.stderr +++ b/tests/ui/async-await/inference_var_self_argument.stderr @@ -8,10 +8,10 @@ LL | async fn foo(self: &dyn Foo) { = help: consider changing to `self`, `&self`, `&mut self`, `self: Box`, `self: Rc`, `self: Arc`, or `self: Pin

` (where P is one of the previous types except `Self`) error[E0038]: the trait `Foo` is not dyn compatible - --> $DIR/inference_var_self_argument.rs:5:5 + --> $DIR/inference_var_self_argument.rs:5:33 | LL | async fn foo(self: &dyn Foo) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo` is not dyn compatible + | ^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit diff --git a/tests/ui/async-await/issue-64130-3-other.stderr b/tests/ui/async-await/issue-64130-3-other.stderr index d683366ed4737..531a7028f7e0e 100644 --- a/tests/ui/async-await/issue-64130-3-other.stderr +++ b/tests/ui/async-await/issue-64130-3-other.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future $DIR/issue-64130-3-other.rs:25:12 | LL | async fn bar() { - | -------------- within this `impl Future` + | - within this `impl Future` ... LL | is_qux(bar()); | ^^^^^ unsatisfied trait bound diff --git a/tests/ui/async-await/issues/issue-67893.stderr b/tests/ui/async-await/issues/issue-67893.stderr index 34f28dd53c7b9..610ed60bc8fda 100644 --- a/tests/ui/async-await/issues/issue-67893.stderr +++ b/tests/ui/async-await/issues/issue-67893.stderr @@ -6,10 +6,10 @@ LL | g(issue_67893::run()) | | | required by a bound introduced by this call | - ::: $DIR/auxiliary/issue_67893.rs:9:1 + ::: $DIR/auxiliary/issue_67893.rs:9:19 | LL | pub async fn run() { - | ------------------ within this `impl Future` + | - within this `impl Future` | = help: within `impl Future`, the trait `Send` is not implemented for `std::sync::MutexGuard<'_, ()>` note: required because it's used within this `async` fn body diff --git a/tests/ui/async-await/partial-drop-partial-reinit.stderr b/tests/ui/async-await/partial-drop-partial-reinit.stderr index cef835f7aed8b..cf4b408ad12b8 100644 --- a/tests/ui/async-await/partial-drop-partial-reinit.stderr +++ b/tests/ui/async-await/partial-drop-partial-reinit.stderr @@ -7,7 +7,7 @@ LL | gimme_send(foo()); | required by a bound introduced by this call ... LL | async fn foo() { - | -------------- within this `impl Future` + | - within this `impl Future` | help: within `impl Future`, the trait `Send` is not implemented for `NotSend` --> $DIR/partial-drop-partial-reinit.rs:19:1 diff --git a/tests/ui/attributes/align-on-fields-143987.stderr b/tests/ui/attributes/align-on-fields-143987.stderr index c95543a74c1a1..1ffbf4a37cb93 100644 --- a/tests/ui/attributes/align-on-fields-143987.stderr +++ b/tests/ui/attributes/align-on-fields-143987.stderr @@ -2,7 +2,13 @@ error[E0425]: cannot find type `usize8` in this scope --> $DIR/align-on-fields-143987.rs:17:8 | LL | x: usize8, - | ^^^^^^ help: a builtin type with a similar name exists: `usize` + | ^^^^^^ + | +help: a builtin type with a similar name exists + | +LL - x: usize8, +LL + x: usize, + | error: `#[rustc_align]` attribute cannot be used on struct fields --> $DIR/align-on-fields-143987.rs:10:5 diff --git a/tests/ui/binop/binary-op-suggest-deref.stderr b/tests/ui/binop/binary-op-suggest-deref.stderr index 0c9b1d9bd938c..eb17c6cbbc66b 100644 --- a/tests/ui/binop/binary-op-suggest-deref.stderr +++ b/tests/ui/binop/binary-op-suggest-deref.stderr @@ -305,13 +305,19 @@ LL | let _ = FOO & (*"Sized".to_string().into_boxed_str()); help: the following other types implement trait `BitAnd` --> $SRC_DIR/core/src/ops/bit.rs:LL:COL | - = note: `&i32` implements `BitAnd` + = note: `i32` implements `BitAnd` + ::: $SRC_DIR/core/src/ops/bit.rs:LL:COL | - = note: `&i32` implements `BitAnd` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&i32` implements `BitAnd` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `i32` implements `BitAnd<&i32>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `i32` implements `BitAnd` + = note: `&i32` implements `BitAnd` = note: this error originates in the macro `bitand_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `str` cannot be known at compilation time diff --git a/tests/ui/binop/binop-mul-i32-f32.stderr b/tests/ui/binop/binop-mul-i32-f32.stderr index dc4e7fdf6c144..a8893700b1be5 100644 --- a/tests/ui/binop/binop-mul-i32-f32.stderr +++ b/tests/ui/binop/binop-mul-i32-f32.stderr @@ -8,13 +8,19 @@ LL | x * y help: the following other types implement trait `Mul` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&i32` implements `Mul` + = note: `i32` implements `Mul` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&i32` implements `Mul` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&i32` implements `Mul` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `i32` implements `Mul<&i32>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `i32` implements `Mul` + = note: `&i32` implements `Mul` = note: this error originates in the macro `mul_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.stderr b/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.stderr index 349546606a57e..ae5c67eae9a6c 100644 --- a/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.stderr +++ b/tests/ui/borrowck/non-ADT-struct-pattern-box-pattern-ice-121463.stderr @@ -2,19 +2,23 @@ error[E0433]: failed to resolve: use of undeclared type `E` --> $DIR/non-ADT-struct-pattern-box-pattern-ice-121463.rs:6:17 | LL | let mut a = E::StructVar { boxed: Box::new(5_i32) }; - | ^ - | | - | use of undeclared type `E` - | help: a trait with a similar name exists: `Eq` + | ^ use of undeclared type `E` + | +help: a trait with a similar name exists + | +LL | let mut a = Eq::StructVar { boxed: Box::new(5_i32) }; + | + error[E0433]: failed to resolve: use of undeclared type `E` --> $DIR/non-ADT-struct-pattern-box-pattern-ice-121463.rs:9:9 | LL | E::StructVar { box boxed } => { } - | ^ - | | - | use of undeclared type `E` - | help: a trait with a similar name exists: `Eq` + | ^ use of undeclared type `E` + | +help: a trait with a similar name exists + | +LL | Eq::StructVar { box boxed } => { } + | + error: aborting due to 2 previous errors diff --git a/tests/ui/c-variadic/not-async.stderr b/tests/ui/c-variadic/not-async.stderr index fc5eb10bec4f7..bb8cc64e15fa4 100644 --- a/tests/ui/c-variadic/not-async.stderr +++ b/tests/ui/c-variadic/not-async.stderr @@ -14,9 +14,9 @@ error[E0700]: hidden type for `impl Future` captures lifetime that --> $DIR/not-async.rs:5:65 | LL | async unsafe extern "C" fn fn_cannot_be_async(x: isize, _: ...) {} - | --------------------------------------------------------------- ^^ - | | - | opaque type defined here + | -^^ + | | + | opaque type defined here | = note: hidden type `{async fn body of fn_cannot_be_async()}` captures lifetime `'_` @@ -24,9 +24,9 @@ error[E0700]: hidden type for `impl Future` captures lifetime that --> $DIR/not-async.rs:12:73 | LL | async unsafe extern "C" fn method_cannot_be_async(x: isize, _: ...) {} - | ------------------------------------------------------------------- ^^ - | | - | opaque type defined here + | -^^ + | | + | opaque type defined here | = note: hidden type `{async fn body of S::method_cannot_be_async()}` captures lifetime `'_` diff --git a/tests/ui/closures/issue-90871.stderr b/tests/ui/closures/issue-90871.stderr index 071694def4135..140f249821404 100644 --- a/tests/ui/closures/issue-90871.stderr +++ b/tests/ui/closures/issue-90871.stderr @@ -2,11 +2,15 @@ error[E0425]: cannot find type `n` in this scope --> $DIR/issue-90871.rs:4:22 | LL | type_ascribe!(2, n([u8; || 1])) - | ^ help: a trait with a similar name exists: `Fn` + | ^ | --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here +help: a trait with a similar name exists + | +LL | type_ascribe!(2, Fn([u8; || 1])) + | + error[E0308]: mismatched types --> $DIR/issue-90871.rs:4:29 diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.stderr index c8f4ef98c124e..2a2d769c7cf89 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.stderr @@ -25,10 +25,10 @@ LL | async unsafe extern "cmse-nonsecure-entry" fn async_and_c_variadic(_: ...) = help: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list error[E0798]: `impl Trait` is not allowed in `extern "cmse-nonsecure-entry"` signatures - --> $DIR/c-variadic.rs:26:1 + --> $DIR/c-variadic.rs:26:69 | LL | async unsafe extern "cmse-nonsecure-entry" fn async_is_not_allowed() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: aborting due to 4 previous errors diff --git a/tests/ui/compiletest-self-test/ui-testing-optout.stderr b/tests/ui/compiletest-self-test/ui-testing-optout.stderr index b0d495edfb62a..6a4950c55afd8 100644 --- a/tests/ui/compiletest-self-test/ui-testing-optout.stderr +++ b/tests/ui/compiletest-self-test/ui-testing-optout.stderr @@ -11,7 +11,13 @@ error[E0425]: cannot find type `D` in this scope | ----------- similarly named type alias `A` defined here ... 7 | type C = D; - | ^ help: a type alias with a similar name exists: `A` + | ^ + | +help: a type alias with a similar name exists + | +7 - type C = D; +7 + type C = A; + | error[E0425]: cannot find type `F` in this scope --> $DIR/ui-testing-optout.rs:92:10 @@ -20,7 +26,13 @@ error[E0425]: cannot find type `F` in this scope | ----------- similarly named type alias `A` defined here ... 92 | type E = F; - | ^ help: a type alias with a similar name exists: `A` + | ^ + | +help: a type alias with a similar name exists + | +92 - type E = F; +92 + type E = A; + | error: aborting due to 3 previous errors diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr index 75718fbbba0a3..5109dccd96a1d 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr @@ -84,6 +84,9 @@ LL | check(&mut () as *mut ()); | help: the trait `ConstParamTy_` is implemented for `()` --> $SRC_DIR/core/src/marker.rs:LL:COL + ::: $SRC_DIR/core/src/marker.rs:LL:COL + | + = note: in this macro invocation note: required by a bound in `check` --> $DIR/const_param_ty_bad.rs:4:18 | @@ -101,6 +104,9 @@ LL | check(&() as *const ()); | help: the trait `ConstParamTy_` is implemented for `()` --> $SRC_DIR/core/src/marker.rs:LL:COL + ::: $SRC_DIR/core/src/marker.rs:LL:COL + | + = note: in this macro invocation note: required by a bound in `check` --> $DIR/const_param_ty_bad.rs:4:18 | diff --git a/tests/ui/const-generics/generic_const_exprs/error_in_ty.stderr b/tests/ui/const-generics/generic_const_exprs/error_in_ty.stderr index d822fa5894a5b..58f0d31b09601 100644 --- a/tests/ui/const-generics/generic_const_exprs/error_in_ty.stderr +++ b/tests/ui/const-generics/generic_const_exprs/error_in_ty.stderr @@ -2,9 +2,15 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/error_in_ty.rs:6:31 | LL | pub struct A {} - | - ^ help: a const parameter with a similar name exists: `z` + | - ^ | | | similarly named const parameter `z` defined here + | +help: a const parameter with a similar name exists + | +LL - pub struct A {} +LL + pub struct A {} + | error: `[usize; x]` is forbidden as the type of a const generic parameter --> $DIR/error_in_ty.rs:6:23 diff --git a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr index d3a7e286fdd60..b547bdd7d07a4 100644 --- a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr +++ b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr @@ -20,7 +20,13 @@ LL | pub type v11 = [[usize; v4]; v4]; | --------------------------------- similarly named type alias `v11` defined here ... LL | pub const fn v21() -> v18 {} - | ^^^ help: a type alias with a similar name exists: `v11` + | ^^^ + | +help: a type alias with a similar name exists + | +LL - pub const fn v21() -> v18 {} +LL + pub const fn v21() -> v11 {} + | error[E0425]: cannot find type `v18` in this scope --> $DIR/unevaluated-const-ice-119731.rs:35:31 @@ -29,7 +35,13 @@ LL | pub type v11 = [[usize; v4]; v4]; | --------------------------------- similarly named type alias `v11` defined here ... LL | pub const fn v21() -> v18 { - | ^^^ help: a type alias with a similar name exists: `v11` + | ^^^ + | +help: a type alias with a similar name exists + | +LL - pub const fn v21() -> v18 { +LL + pub const fn v21() -> v11 { + | error[E0422]: cannot find struct, variant or union type `v18` in this scope --> $DIR/unevaluated-const-ice-119731.rs:37:13 @@ -38,7 +50,13 @@ LL | pub type v11 = [[usize; v4]; v4]; | --------------------------------- similarly named type alias `v11` defined here ... LL | v18 { _p: () } - | ^^^ help: a type alias with a similar name exists: `v11` + | ^^^ + | +help: a type alias with a similar name exists + | +LL - v18 { _p: () } +LL + v11 { _p: () } + | warning: type `v11` should have an upper camel case name --> $DIR/unevaluated-const-ice-119731.rs:9:14 diff --git a/tests/ui/const-generics/parent_generics_of_nested_in_default.stderr b/tests/ui/const-generics/parent_generics_of_nested_in_default.stderr index 00eeecb9595f3..9452e747a7553 100644 --- a/tests/ui/const-generics/parent_generics_of_nested_in_default.stderr +++ b/tests/ui/const-generics/parent_generics_of_nested_in_default.stderr @@ -8,9 +8,15 @@ error[E0425]: cannot find value `B` in this scope --> $DIR/parent_generics_of_nested_in_default.rs:1:30 | LL | impl Tr {} - | - ^ help: a const parameter with a similar name exists: `A` + | - ^ | | | similarly named const parameter `A` defined here + | +help: a const parameter with a similar name exists + | +LL - impl Tr {} +LL + impl Tr {} + | error: defaults for generic parameters are not allowed here --> $DIR/parent_generics_of_nested_in_default.rs:1:6 diff --git a/tests/ui/consts/const-eval/const-eval-overflow-3b.stderr b/tests/ui/consts/const-eval/const-eval-overflow-3b.stderr index 4209e4bcee522..54d77b1bf3e94 100644 --- a/tests/ui/consts/const-eval/const-eval-overflow-3b.stderr +++ b/tests/ui/consts/const-eval/const-eval-overflow-3b.stderr @@ -14,13 +14,19 @@ LL | = [0; (i8::MAX + 1u8) as usize]; help: the following other types implement trait `Add` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&i8` implements `Add` + = note: `i8` implements `Add` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&i8` implements `Add` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&i8` implements `Add` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `i8` implements `Add<&i8>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `i8` implements `Add` + = note: `&i8` implements `Add` = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-eval/const-eval-overflow-4b.stderr b/tests/ui/consts/const-eval/const-eval-overflow-4b.stderr index 2677d7956cc98..6c6472610b724 100644 --- a/tests/ui/consts/const-eval/const-eval-overflow-4b.stderr +++ b/tests/ui/consts/const-eval/const-eval-overflow-4b.stderr @@ -14,13 +14,19 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize] help: the following other types implement trait `Add` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&i8` implements `Add` + = note: `i8` implements `Add` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&i8` implements `Add` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&i8` implements `Add` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `i8` implements `Add<&i8>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `i8` implements `Add` + = note: `&i8` implements `Add` = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0604]: only `u8` can be cast as `char`, not `i8` diff --git a/tests/ui/consts/const-eval/ice-unhandled-type-122191.stderr b/tests/ui/consts/const-eval/ice-unhandled-type-122191.stderr index bcb6a80a8f2b2..5e2e3524ae9ea 100644 --- a/tests/ui/consts/const-eval/ice-unhandled-type-122191.stderr +++ b/tests/ui/consts/const-eval/ice-unhandled-type-122191.stderr @@ -22,10 +22,16 @@ error[E0425]: cannot find function `value` in this scope --> $DIR/ice-unhandled-type-122191.rs:9:5 | LL | value() - | ^^^^^ help: a constant with a similar name exists: `VALUE` + | ^^^^^ ... LL | const VALUE: Foo = foo(); | ------------------------- similarly named constant `VALUE` defined here + | +help: a constant with a similar name exists + | +LL - value() +LL + VALUE() + | error[E0308]: mismatched types --> $DIR/ice-unhandled-type-122191.rs:17:9 diff --git a/tests/ui/consts/const-eval/issue-85155.stderr b/tests/ui/consts/const-eval/issue-85155.stderr index 486d2adaf8cde..dfc784bc7a4f3 100644 --- a/tests/ui/consts/const-eval/issue-85155.stderr +++ b/tests/ui/consts/const-eval/issue-85155.stderr @@ -5,10 +5,13 @@ LL | let _ = 1 / ((IMM >= MIN && IMM <= MAX) as usize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `post_monomorphization_error::ValidateConstImm::<2, 0, 1>::VALID` failed here note: erroneous constant encountered - --> $DIR/auxiliary/post_monomorphization_error.rs:19:5 + --> $DIR/auxiliary/post_monomorphization_error.rs:13:17 | +LL | let _ = $crate::ValidateConstImm::<$imm, 0, { (1 << 1) - 1 }>::VALID; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... LL | static_assert_imm1!(IMM1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ------------------------- in this macro invocation | = note: this note originates in the macro `static_assert_imm1` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/const-eval/parse_ints.stderr b/tests/ui/consts/const-eval/parse_ints.stderr index 9c9d083e7ca23..7f42e20cf8e83 100644 --- a/tests/ui/consts/const-eval/parse_ints.stderr +++ b/tests/ui/consts/const-eval/parse_ints.stderr @@ -6,8 +6,14 @@ LL | const _TOO_LOW: () = { u64::from_str_radix("12345ABCD", 1); }; | note: inside `core::num::::from_str_radix` --> $SRC_DIR/core/src/num/mod.rs:LL:COL + ::: $SRC_DIR/core/src/num/mod.rs:LL:COL + | + = note: in this macro invocation note: inside `core::num::::from_ascii_radix` --> $SRC_DIR/core/src/num/mod.rs:LL:COL + ::: $SRC_DIR/core/src/num/mod.rs:LL:COL + | + = note: in this macro invocation = note: this error originates in the macro `from_str_int_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation panicked: from_ascii_radix: radix must lie in the range `[2, 36]` @@ -18,8 +24,14 @@ LL | const _TOO_HIGH: () = { u64::from_str_radix("12345ABCD", 37); }; | note: inside `core::num::::from_str_radix` --> $SRC_DIR/core/src/num/mod.rs:LL:COL + ::: $SRC_DIR/core/src/num/mod.rs:LL:COL + | + = note: in this macro invocation note: inside `core::num::::from_ascii_radix` --> $SRC_DIR/core/src/num/mod.rs:LL:COL + ::: $SRC_DIR/core/src/num/mod.rs:LL:COL + | + = note: in this macro invocation = note: this error originates in the macro `from_str_int_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-pattern-rewrite-error-32086.stderr b/tests/ui/consts/const-pattern-rewrite-error-32086.stderr index 47616b0663214..9c8ac70087098 100644 --- a/tests/ui/consts/const-pattern-rewrite-error-32086.stderr +++ b/tests/ui/consts/const-pattern-rewrite-error-32086.stderr @@ -5,7 +5,13 @@ LL | struct S(u8); | ------------- similarly named tuple struct `S` defined here ... LL | let C(a) = S(11); - | ^ help: a tuple struct with a similar name exists: `S` + | ^ + | +help: a tuple struct with a similar name exists + | +LL - let C(a) = S(11); +LL + let S(a) = S(11); + | error[E0532]: expected tuple struct or tuple variant, found constant `C` --> $DIR/const-pattern-rewrite-error-32086.rs:7:9 @@ -14,7 +20,13 @@ LL | struct S(u8); | ------------- similarly named tuple struct `S` defined here ... LL | let C(..) = S(11); - | ^ help: a tuple struct with a similar name exists: `S` + | ^ + | +help: a tuple struct with a similar name exists + | +LL - let C(..) = S(11); +LL + let S(..) = S(11); + | error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-ptr-is-null.stderr b/tests/ui/consts/const-ptr-is-null.stderr index be0a1346c6475..b532ed9d4c5fa 100644 --- a/tests/ui/consts/const-ptr-is-null.stderr +++ b/tests/ui/consts/const-ptr-is-null.stderr @@ -5,9 +5,16 @@ LL | assert!(!ptr.wrapping_sub(512).is_null()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `MAYBE_NULL` failed inside this call | note: inside `std::ptr::const_ptr::::is_null` + --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + ::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + | + = note: in this macro invocation note: inside `std::ptr::const_ptr::::is_null::compiletime` + --> $SRC_DIR/core/src/panic.rs:LL:COL --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + | + = note: in this macro invocation error: aborting due to 1 previous error diff --git a/tests/ui/consts/const_transmute_type_id2.stderr b/tests/ui/consts/const_transmute_type_id2.stderr index 5646eb1257d1e..b420deaa49ce9 100644 --- a/tests/ui/consts/const_transmute_type_id2.stderr +++ b/tests/ui/consts/const_transmute_type_id2.stderr @@ -5,7 +5,11 @@ LL | assert!(a == b); | ^^^^^^ evaluation of `_` failed inside this call | note: inside `::eq` + --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL --> $SRC_DIR/core/src/any.rs:LL:COL + ::: $SRC_DIR/core/src/any.rs:LL:COL + | + = note: in this macro invocation note: inside `::eq::compiletime` --> $SRC_DIR/core/src/any.rs:LL:COL = note: this error originates in the macro `$crate::intrinsics::const_eval_select` which comes from the expansion of the macro `crate::intrinsics::const_eval_select` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/const_transmute_type_id3.stderr b/tests/ui/consts/const_transmute_type_id3.stderr index e731f496652e5..9f796cda61454 100644 --- a/tests/ui/consts/const_transmute_type_id3.stderr +++ b/tests/ui/consts/const_transmute_type_id3.stderr @@ -5,7 +5,11 @@ LL | assert!(a == b); | ^^^^^^ evaluation of `_` failed inside this call | note: inside `::eq` + --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL --> $SRC_DIR/core/src/any.rs:LL:COL + ::: $SRC_DIR/core/src/any.rs:LL:COL + | + = note: in this macro invocation note: inside `::eq::compiletime` --> $SRC_DIR/core/src/any.rs:LL:COL = note: this error originates in the macro `$crate::intrinsics::const_eval_select` which comes from the expansion of the macro `crate::intrinsics::const_eval_select` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/const_transmute_type_id4.stderr b/tests/ui/consts/const_transmute_type_id4.stderr index b224227cf3526..c844b10d78cfb 100644 --- a/tests/ui/consts/const_transmute_type_id4.stderr +++ b/tests/ui/consts/const_transmute_type_id4.stderr @@ -5,7 +5,11 @@ LL | assert!(a == b); | ^^^^^^ evaluation of `_` failed inside this call | note: inside `::eq` + --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL --> $SRC_DIR/core/src/any.rs:LL:COL + ::: $SRC_DIR/core/src/any.rs:LL:COL + | + = note: in this macro invocation note: inside `::eq::compiletime` --> $SRC_DIR/core/src/any.rs:LL:COL = note: this error originates in the macro `$crate::intrinsics::const_eval_select` which comes from the expansion of the macro `crate::intrinsics::const_eval_select` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/const_transmute_type_id5.stderr b/tests/ui/consts/const_transmute_type_id5.stderr index 6205679ebb641..9a7384eb95b42 100644 --- a/tests/ui/consts/const_transmute_type_id5.stderr +++ b/tests/ui/consts/const_transmute_type_id5.stderr @@ -5,7 +5,11 @@ LL | assert!(b == b); | ^^^^^^ evaluation of `_` failed inside this call | note: inside `::eq` + --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL --> $SRC_DIR/core/src/any.rs:LL:COL + ::: $SRC_DIR/core/src/any.rs:LL:COL + | + = note: in this macro invocation note: inside `::eq::compiletime` --> $SRC_DIR/core/src/any.rs:LL:COL = note: this error originates in the macro `$crate::intrinsics::const_eval_select` which comes from the expansion of the macro `crate::intrinsics::const_eval_select` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/const_transmute_type_id6.stderr b/tests/ui/consts/const_transmute_type_id6.stderr index f5d90256e7c6a..c0b35f3d1081d 100644 --- a/tests/ui/consts/const_transmute_type_id6.stderr +++ b/tests/ui/consts/const_transmute_type_id6.stderr @@ -5,7 +5,11 @@ LL | id == id | ^^^^^^^^ evaluation of `X` failed inside this call | note: inside `::eq` + --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL --> $SRC_DIR/core/src/any.rs:LL:COL + ::: $SRC_DIR/core/src/any.rs:LL:COL + | + = note: in this macro invocation note: inside `::eq::compiletime` --> $SRC_DIR/core/src/any.rs:LL:COL = note: this error originates in the macro `$crate::intrinsics::const_eval_select` which comes from the expansion of the macro `crate::intrinsics::const_eval_select` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/timeout.stderr b/tests/ui/consts/timeout.stderr index ecefeff76e967..6afb317c3affa 100644 --- a/tests/ui/consts/timeout.stderr +++ b/tests/ui/consts/timeout.stderr @@ -1,5 +1,10 @@ error: constant evaluation is taking a long time + --> $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + | --> $SRC_DIR/core/src/num/mod.rs:LL:COL + ::: $SRC_DIR/core/src/num/mod.rs:LL:COL + | + = note: in this macro invocation | = note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval. If your compilation actually takes a long time, you can safely allow the lint. diff --git a/tests/ui/delegation/bad-resolve.stderr b/tests/ui/delegation/bad-resolve.stderr index fc6811292a6ff..4c015c226b18f 100644 --- a/tests/ui/delegation/bad-resolve.stderr +++ b/tests/ui/delegation/bad-resolve.stderr @@ -53,7 +53,13 @@ LL | fn bar() {} | -------- similarly named associated function `bar` defined here ... LL | reuse ::baz; - | ^^^ help: an associated function with a similar name exists: `bar` + | ^^^ + | +help: an associated function with a similar name exists + | +LL - reuse ::baz; +LL + reuse ::bar; + | error[E0425]: cannot find function `foo` in this scope --> $DIR/bad-resolve.rs:35:11 @@ -68,7 +74,13 @@ LL | fn foo(&self, x: i32) -> i32 { x } | ---------------------------- similarly named associated function `foo` defined here ... LL | reuse Trait::foo2 { self.0 } - | ^^^^ help: an associated function with a similar name exists: `foo` + | ^^^^ + | +help: an associated function with a similar name exists + | +LL - reuse Trait::foo2 { self.0 } +LL + reuse Trait::foo { self.0 } + | error[E0046]: not all trait items implemented, missing: `Type` --> $DIR/bad-resolve.rs:22:1 diff --git a/tests/ui/derives/deriving-meta-unknown-trait.stderr b/tests/ui/derives/deriving-meta-unknown-trait.stderr index 7ee90ae9eb0c3..1cf31502dfb8b 100644 --- a/tests/ui/derives/deriving-meta-unknown-trait.stderr +++ b/tests/ui/derives/deriving-meta-unknown-trait.stderr @@ -2,23 +2,33 @@ error: cannot find derive macro `Eqr` in this scope --> $DIR/deriving-meta-unknown-trait.rs:1:10 | LL | #[derive(Eqr)] - | ^^^ help: a derive macro with a similar name exists: `Eq` + | ^^^ | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named derive macro `Eq` defined here +help: a derive macro with a similar name exists + | +LL - #[derive(Eqr)] +LL + #[derive(Eq)] + | error: cannot find derive macro `Eqr` in this scope --> $DIR/deriving-meta-unknown-trait.rs:1:10 | LL | #[derive(Eqr)] - | ^^^ help: a derive macro with a similar name exists: `Eq` + | ^^^ | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named derive macro `Eq` defined here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: a derive macro with a similar name exists + | +LL - #[derive(Eqr)] +LL + #[derive(Eq)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/did_you_mean/println-typo.stderr b/tests/ui/did_you_mean/println-typo.stderr index 7dd6fbba620b0..471d49b6ee2e6 100644 --- a/tests/ui/did_you_mean/println-typo.stderr +++ b/tests/ui/did_you_mean/println-typo.stderr @@ -2,11 +2,16 @@ error: cannot find macro `prinltn` in this scope --> $DIR/println-typo.rs:4:5 | LL | prinltn!(); - | ^^^^^^^ help: a macro with a similar name exists: `println` + | ^^^^^^^ | --> $SRC_DIR/std/src/macros.rs:LL:COL | = note: similarly named macro `println` defined here +help: a macro with a similar name exists + | +LL - prinltn!(); +LL + println!(); + | error: aborting due to 1 previous error diff --git a/tests/ui/did_you_mean/typo-suggestion-improvement-46332.stderr b/tests/ui/did_you_mean/typo-suggestion-improvement-46332.stderr index 502f81518785c..d677152314dc6 100644 --- a/tests/ui/did_you_mean/typo-suggestion-improvement-46332.stderr +++ b/tests/ui/did_you_mean/typo-suggestion-improvement-46332.stderr @@ -5,7 +5,13 @@ LL | struct TyUint {} | ------------- similarly named struct `TyUint` defined here ... LL | TyUInt {}; - | ^^^^^^ help: a struct with a similar name exists (notice the capitalization): `TyUint` + | ^^^^^^ + | +help: a struct with a similar name exists (notice the capitalization) + | +LL - TyUInt {}; +LL + TyUint {}; + | error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0657.stderr b/tests/ui/error-codes/E0657.stderr index c9dfc9eb9069d..1d69af5d9654a 100644 --- a/tests/ui/error-codes/E0657.stderr +++ b/tests/ui/error-codes/E0657.stderr @@ -1,8 +1,8 @@ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from `dyn` type - --> $DIR/E0657.rs:10:35 + --> $DIR/E0657.rs:10:27 | LL | -> Box Id>> - | ^^ + | ^^^^^^^^--^ `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/E0657.rs:10:20 @@ -11,10 +11,10 @@ LL | -> Box Id>> | ^^ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from `dyn` type - --> $DIR/E0657.rs:19:39 + --> $DIR/E0657.rs:19:31 | LL | -> Box Id>> - | ^^ + | ^^^^^^^^--^ `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/E0657.rs:19:24 diff --git a/tests/ui/expr/if/bad-if-let-suggestion.stderr b/tests/ui/expr/if/bad-if-let-suggestion.stderr index 0d1f895bd82bf..4244a3bb06eea 100644 --- a/tests/ui/expr/if/bad-if-let-suggestion.stderr +++ b/tests/ui/expr/if/bad-if-let-suggestion.stderr @@ -27,7 +27,13 @@ LL | fn a() { | ------ similarly named function `a` defined here ... LL | if (i + j) = i {} - | ^ help: a function with a similar name exists: `a` + | ^ + | +help: a function with a similar name exists + | +LL - if (i + j) = i {} +LL + if (a + j) = i {} + | error[E0425]: cannot find value `j` in this scope --> $DIR/bad-if-let-suggestion.rs:9:13 @@ -36,7 +42,13 @@ LL | fn a() { | ------ similarly named function `a` defined here ... LL | if (i + j) = i {} - | ^ help: a function with a similar name exists: `a` + | ^ + | +help: a function with a similar name exists + | +LL - if (i + j) = i {} +LL + if (i + a) = i {} + | error[E0425]: cannot find value `i` in this scope --> $DIR/bad-if-let-suggestion.rs:9:18 @@ -45,7 +57,13 @@ LL | fn a() { | ------ similarly named function `a` defined here ... LL | if (i + j) = i {} - | ^ help: a function with a similar name exists: `a` + | ^ + | +help: a function with a similar name exists + | +LL - if (i + j) = i {} +LL + if (i + j) = a {} + | error[E0425]: cannot find value `x` in this scope --> $DIR/bad-if-let-suggestion.rs:16:8 @@ -54,7 +72,13 @@ LL | fn a() { | ------ similarly named function `a` defined here ... LL | if x[0] = 1 {} - | ^ help: a function with a similar name exists: `a` + | ^ + | +help: a function with a similar name exists + | +LL - if x[0] = 1 {} +LL + if a[0] = 1 {} + | error[E0308]: mismatched types --> $DIR/bad-if-let-suggestion.rs:2:8 diff --git a/tests/ui/fmt/format-args-capture-issue-102057.stderr b/tests/ui/fmt/format-args-capture-issue-102057.stderr index f2d625e7f8dc8..9a5bc5365df74 100644 --- a/tests/ui/fmt/format-args-capture-issue-102057.stderr +++ b/tests/ui/fmt/format-args-capture-issue-102057.stderr @@ -14,31 +14,61 @@ error[E0425]: cannot find value `b` in this scope --> $DIR/format-args-capture-issue-102057.rs:9:22 | LL | format!("\x7Ba} {b}"); - | ^ help: a local variable with a similar name exists: `a` + | ^ + | +help: a local variable with a similar name exists + | +LL - format!("\x7Ba} {b}"); +LL + format!("\x7Ba} {a}"); + | error[E0425]: cannot find value `b` in this scope --> $DIR/format-args-capture-issue-102057.rs:11:25 | LL | format!("\x7Ba\x7D {b}"); - | ^ help: a local variable with a similar name exists: `a` + | ^ + | +help: a local variable with a similar name exists + | +LL - format!("\x7Ba\x7D {b}"); +LL + format!("\x7Ba\x7D {a}"); + | error[E0425]: cannot find value `b` in this scope --> $DIR/format-args-capture-issue-102057.rs:13:25 | LL | format!("\x7Ba} \x7Bb}"); - | ^ help: a local variable with a similar name exists: `a` + | ^ + | +help: a local variable with a similar name exists + | +LL - format!("\x7Ba} \x7Bb}"); +LL + format!("\x7Ba} \x7Ba}"); + | error[E0425]: cannot find value `b` in this scope --> $DIR/format-args-capture-issue-102057.rs:15:28 | LL | format!("\x7Ba\x7D \x7Bb}"); - | ^ help: a local variable with a similar name exists: `a` + | ^ + | +help: a local variable with a similar name exists + | +LL - format!("\x7Ba\x7D \x7Bb}"); +LL + format!("\x7Ba\x7D \x7Ba}"); + | error[E0425]: cannot find value `b` in this scope --> $DIR/format-args-capture-issue-102057.rs:17:28 | LL | format!("\x7Ba\x7D \x7Bb\x7D"); - | ^ help: a local variable with a similar name exists: `a` + | ^ + | +help: a local variable with a similar name exists + | +LL - format!("\x7Ba\x7D \x7Bb\x7D"); +LL + format!("\x7Ba\x7D \x7Ba\x7D"); + | error: aborting due to 7 previous errors diff --git a/tests/ui/fmt/format-args-capture-issue-94010.stderr b/tests/ui/fmt/format-args-capture-issue-94010.stderr index ed90dc855360a..ccdaf0c67b2ba 100644 --- a/tests/ui/fmt/format-args-capture-issue-94010.stderr +++ b/tests/ui/fmt/format-args-capture-issue-94010.stderr @@ -4,7 +4,13 @@ error[E0425]: cannot find value `foo` in this scope LL | const FOO: i32 = 123; | --------------------- similarly named constant `FOO` defined here LL | println!("{foo:X}"); - | ^^^ help: a constant with a similar name exists (notice the capitalization): `FOO` + | ^^^ + | +help: a constant with a similar name exists (notice the capitalization) + | +LL - println!("{foo:X}"); +LL + println!("{FOO:X}"); + | error[E0425]: cannot find value `foo` in this scope --> $DIR/format-args-capture-issue-94010.rs:5:18 @@ -13,7 +19,13 @@ LL | const FOO: i32 = 123; | --------------------- similarly named constant `FOO` defined here ... LL | println!("{:.foo$}", 0); - | ^^^ help: a constant with a similar name exists (notice the capitalization): `FOO` + | ^^^ + | +help: a constant with a similar name exists (notice the capitalization) + | +LL - println!("{:.foo$}", 0); +LL + println!("{:.FOO$}", 0); + | error: aborting due to 2 previous errors diff --git a/tests/ui/generic-associated-types/equality-bound.stderr b/tests/ui/generic-associated-types/equality-bound.stderr index 03fafe3e21c1d..265c86ac5bb61 100644 --- a/tests/ui/generic-associated-types/equality-bound.stderr +++ b/tests/ui/generic-associated-types/equality-bound.stderr @@ -114,28 +114,46 @@ error[E0425]: cannot find type `A` in this scope --> $DIR/equality-bound.rs:20:79 | LL | fn from_iter(_: T) -> Self where T: IntoIterator, IntoIterator::Item = A, - | ^ help: a struct with a similar name exists: `K` + | ^ ... LL | struct K {} | -------- similarly named struct `K` defined here + | +help: a struct with a similar name exists + | +LL - fn from_iter(_: T) -> Self where T: IntoIterator, IntoIterator::Item = A, +LL + fn from_iter(_: T) -> Self where T: IntoIterator, IntoIterator::Item = K, + | error[E0425]: cannot find type `A` in this scope --> $DIR/equality-bound.rs:31:68 | LL | fn from_iter(_: T) -> Self where T: IntoIterator, T::Item = A, - | ^ help: a struct with a similar name exists: `K` + | ^ ... LL | struct K {} | -------- similarly named struct `K` defined here + | +help: a struct with a similar name exists + | +LL - fn from_iter(_: T) -> Self where T: IntoIterator, T::Item = A, +LL + fn from_iter(_: T) -> Self where T: IntoIterator, T::Item = K, + | error[E0425]: cannot find type `A` in this scope --> $DIR/equality-bound.rs:42:76 | LL | fn from_iter(_: T) -> Self where IntoIterator::Item = A, - | ^ help: a struct with a similar name exists: `K` + | ^ ... LL | struct K {} | -------- similarly named struct `K` defined here + | +help: a struct with a similar name exists + | +LL - fn from_iter(_: T) -> Self where IntoIterator::Item = A, +LL + fn from_iter(_: T) -> Self where IntoIterator::Item = K, + | error[E0425]: cannot find type `A` in this scope --> $DIR/equality-bound.rs:53:65 @@ -144,7 +162,13 @@ LL | struct K {} | -------- similarly named struct `K` defined here ... LL | fn from_iter(_: T) -> Self where T::Item = A, - | ^ help: a struct with a similar name exists: `K` + | ^ + | +help: a struct with a similar name exists + | +LL - fn from_iter(_: T) -> Self where T::Item = A, +LL + fn from_iter(_: T) -> Self where T::Item = K, + | error[E0425]: cannot find type `A` in this scope --> $DIR/equality-bound.rs:64:62 @@ -153,7 +177,13 @@ LL | struct K {} | -------- similarly named struct `K` defined here ... LL | fn from_iter(_: T) -> Self where IntoIterator::Item = A, T: IntoIterator, - | ^ help: a struct with a similar name exists: `K` + | ^ + | +help: a struct with a similar name exists + | +LL - fn from_iter(_: T) -> Self where IntoIterator::Item = A, T: IntoIterator, +LL + fn from_iter(_: T) -> Self where IntoIterator::Item = K, T: IntoIterator, + | error[E0425]: cannot find type `A` in this scope --> $DIR/equality-bound.rs:75:51 @@ -162,16 +192,25 @@ LL | struct K {} | -------- similarly named struct `K` defined here ... LL | fn from_iter(_: T) -> Self where T::Item = A, T: IntoIterator, - | ^ help: a struct with a similar name exists: `K` + | ^ + | +help: a struct with a similar name exists + | +LL - fn from_iter(_: T) -> Self where T::Item = A, T: IntoIterator, +LL + fn from_iter(_: T) -> Self where T::Item = K, T: IntoIterator, + | error[E0433]: failed to resolve: use of undeclared type `I` --> $DIR/equality-bound.rs:9:41 | LL | fn sum3(i: J) -> i32 where I::Item = i32 { - | ^ - | | - | use of undeclared type `I` - | help: a type parameter with a similar name exists: `J` + | ^ use of undeclared type `I` + | +help: a type parameter with a similar name exists + | +LL - fn sum3(i: J) -> i32 where I::Item = i32 { +LL + fn sum3(i: J) -> i32 where J::Item = i32 { + | error: aborting due to 16 previous errors diff --git a/tests/ui/hygiene/cross-crate-name-hiding-2.stderr b/tests/ui/hygiene/cross-crate-name-hiding-2.stderr index fe3a12e93a7e7..336d35099c806 100644 --- a/tests/ui/hygiene/cross-crate-name-hiding-2.stderr +++ b/tests/ui/hygiene/cross-crate-name-hiding-2.stderr @@ -4,10 +4,10 @@ error[E0422]: cannot find struct, variant or union type `MyStruct` in this scope LL | let x = MyStruct {}; | ^^^^^^^^ not found in this scope | - ::: $DIR/auxiliary/use_by_macro.rs:15:1 + ::: $DIR/auxiliary/use_by_macro.rs:7:24 | -LL | x!(my_struct); - | ------------- you might have meant to refer to this struct +LL | pub struct MyStruct; + | -------- you might have meant to refer to this struct error: aborting due to 1 previous error diff --git a/tests/ui/hygiene/rustc-macro-transparency.stderr b/tests/ui/hygiene/rustc-macro-transparency.stderr index 1bea8a0ee4f31..af67bfe66cc84 100644 --- a/tests/ui/hygiene/rustc-macro-transparency.stderr +++ b/tests/ui/hygiene/rustc-macro-transparency.stderr @@ -11,10 +11,13 @@ LL | struct SemiOpaque; | ------------------ similarly named unit struct `SemiOpaque` defined here ... LL | semiopaque; - | ^^^^^^^^^^ - | | - | not a value - | help: a unit struct with a similar name exists (notice the capitalization): `SemiOpaque` + | ^^^^^^^^^^ not a value + | +help: a unit struct with a similar name exists (notice the capitalization) + | +LL - semiopaque; +LL + SemiOpaque; + | error[E0423]: expected value, found macro `opaque` --> $DIR/rustc-macro-transparency.rs:30:5 diff --git a/tests/ui/impl-trait/equality.stderr b/tests/ui/impl-trait/equality.stderr index c2b889138c893..7f965b9609a9d 100644 --- a/tests/ui/impl-trait/equality.stderr +++ b/tests/ui/impl-trait/equality.stderr @@ -33,13 +33,19 @@ LL | n + sum_to(n - 1) help: the following other types implement trait `Add` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&u32` implements `Add` + = note: `u32` implements `Add` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&u32` implements `Add` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&u32` implements `Add` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `u32` implements `Add<&u32>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `u32` implements `Add` + = note: `&u32` implements `Add` = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors; 1 warning emitted diff --git a/tests/ui/impl-trait/higher-ranked-lifetime-capture-deduplication.edition2015.stderr b/tests/ui/impl-trait/higher-ranked-lifetime-capture-deduplication.edition2015.stderr new file mode 100644 index 0000000000000..8954a802ab952 --- /dev/null +++ b/tests/ui/impl-trait/higher-ranked-lifetime-capture-deduplication.edition2015.stderr @@ -0,0 +1,17 @@ +error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` + --> $DIR/higher-ranked-lifetime-capture-deduplication.rs:19:44 + | +LL | fn f() -> impl for<'a, 'b> Trait<'a, Out = impl Sized + 'a + 'b> { + | ^^^^^^^^^^^^^--^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope + | +note: lifetime declared here + --> $DIR/higher-ranked-lifetime-capture-deduplication.rs:19:20 + | +LL | fn f() -> impl for<'a, 'b> Trait<'a, Out = impl Sized + 'a + 'b> { + | ^^ ^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0657`. diff --git a/tests/ui/impl-trait/higher-ranked-lifetime-capture-deduplication.edition2024.stderr b/tests/ui/impl-trait/higher-ranked-lifetime-capture-deduplication.edition2024.stderr new file mode 100644 index 0000000000000..8954a802ab952 --- /dev/null +++ b/tests/ui/impl-trait/higher-ranked-lifetime-capture-deduplication.edition2024.stderr @@ -0,0 +1,17 @@ +error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` + --> $DIR/higher-ranked-lifetime-capture-deduplication.rs:19:44 + | +LL | fn f() -> impl for<'a, 'b> Trait<'a, Out = impl Sized + 'a + 'b> { + | ^^^^^^^^^^^^^--^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope + | +note: lifetime declared here + --> $DIR/higher-ranked-lifetime-capture-deduplication.rs:19:20 + | +LL | fn f() -> impl for<'a, 'b> Trait<'a, Out = impl Sized + 'a + 'b> { + | ^^ ^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0657`. diff --git a/tests/ui/impl-trait/higher-ranked-lifetime-capture-deduplication.rs b/tests/ui/impl-trait/higher-ranked-lifetime-capture-deduplication.rs new file mode 100644 index 0000000000000..d8da93e5560d7 --- /dev/null +++ b/tests/ui/impl-trait/higher-ranked-lifetime-capture-deduplication.rs @@ -0,0 +1,26 @@ +//@revisions: edition2015 edition2024 +//@[edition2015] edition:2015 +//@[edition2024] edition:2024 + +trait Trait<'a> { + type Out; + fn call(&'a self) -> Self::Out; +} + +struct X(()); + +impl<'a> Trait<'a> for X { + type Out = (); + fn call(&'a self) -> Self::Out { + () + } +} + +fn f() -> impl for<'a, 'b> Trait<'a, Out = impl Sized + 'a + 'b> { + //~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` + X(()) +} + +fn main() { + let _ = f(); +} diff --git a/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr b/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr index 40cb6b647d1e9..36f52e8103a33 100644 --- a/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr +++ b/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr @@ -12,10 +12,12 @@ LL + fn d() -> impl Fn() -> (impl Debug + 'static) { | error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/impl-fn-hrtb-bounds.rs:4:41 + --> $DIR/impl-fn-hrtb-bounds.rs:4:28 | LL | fn a() -> impl Fn(&u8) -> (impl Debug + '_) { - | ^^ + | ^^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/impl-fn-hrtb-bounds.rs:4:19 @@ -24,10 +26,12 @@ LL | fn a() -> impl Fn(&u8) -> (impl Debug + '_) { | ^ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/impl-fn-hrtb-bounds.rs:9:52 + --> $DIR/impl-fn-hrtb-bounds.rs:9:39 | LL | fn b() -> impl for<'a> Fn(&'a u8) -> (impl Debug + 'a) { - | ^^ + | ^^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/impl-fn-hrtb-bounds.rs:9:20 @@ -36,10 +40,12 @@ LL | fn b() -> impl for<'a> Fn(&'a u8) -> (impl Debug + 'a) { | ^^ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/impl-fn-hrtb-bounds.rs:14:52 + --> $DIR/impl-fn-hrtb-bounds.rs:14:39 | LL | fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) { - | ^^ + | ^^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/impl-fn-hrtb-bounds.rs:14:20 diff --git a/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr b/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr index 94b6ffdd91230..5ba9567e14e37 100644 --- a/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr +++ b/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr @@ -21,10 +21,12 @@ LL | fn b() -> impl Fn() -> (impl Debug + Send) { | + + error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/impl-fn-parsing-ambiguities.rs:4:40 + --> $DIR/impl-fn-parsing-ambiguities.rs:4:27 | LL | fn a() -> impl Fn(&u8) -> impl Debug + '_ { - | ^^ + | ^^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/impl-fn-parsing-ambiguities.rs:4:19 diff --git a/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr index 19ffff9d3f2bd..75d7224020969 100644 --- a/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr +++ b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr @@ -1,11 +1,11 @@ error[E0310]: the associated type `impl T` may not live long enough - --> $DIR/async-and-ret-ref.rs:7:5 + --> $DIR/async-and-ret-ref.rs:7:23 | LL | async fn foo() -> &'static impl T; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the associated type `impl T` must be valid for the static lifetime... - | ...so that the reference type `&'static impl T` does not outlive the data it points at + | ^^^^^^^^^^^^^^^ + | | + | the associated type `impl T` must be valid for the static lifetime... + | ...so that the reference type `&'static impl T` does not outlive the data it points at error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/issues/issue-54895.edition2015.stderr b/tests/ui/impl-trait/issues/issue-54895.edition2015.stderr index 27a3c6c8b7ce0..8348a1d5e87b1 100644 --- a/tests/ui/impl-trait/issues/issue-54895.edition2015.stderr +++ b/tests/ui/impl-trait/issues/issue-54895.edition2015.stderr @@ -1,8 +1,10 @@ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/issue-54895.rs:18:53 + --> $DIR/issue-54895.rs:18:40 | LL | fn f() -> impl for<'a> Trait<'a, Out = impl Sized + 'a> { - | ^^ + | ^^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/issue-54895.rs:18:20 diff --git a/tests/ui/impl-trait/issues/issue-54895.edition2024.stderr b/tests/ui/impl-trait/issues/issue-54895.edition2024.stderr index 54aa29e62d880..8348a1d5e87b1 100644 --- a/tests/ui/impl-trait/issues/issue-54895.edition2024.stderr +++ b/tests/ui/impl-trait/issues/issue-54895.edition2024.stderr @@ -2,7 +2,9 @@ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `imp --> $DIR/issue-54895.rs:18:40 | LL | fn f() -> impl for<'a> Trait<'a, Out = impl Sized + 'a> { - | ^^^^^^^^^^^^^^^ `impl Trait` implicitly captures all lifetimes in scope + | ^^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/issue-54895.rs:18:20 @@ -10,18 +12,6 @@ note: lifetime declared here LL | fn f() -> impl for<'a> Trait<'a, Out = impl Sized + 'a> { | ^^ -error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/issue-54895.rs:18:53 - | -LL | fn f() -> impl for<'a> Trait<'a, Out = impl Sized + 'a> { - | ^^ - | -note: lifetime declared here - --> $DIR/issue-54895.rs:18:20 - | -LL | fn f() -> impl for<'a> Trait<'a, Out = impl Sized + 'a> { - | ^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0657`. diff --git a/tests/ui/impl-trait/issues/issue-54895.rs b/tests/ui/impl-trait/issues/issue-54895.rs index bc1841209e170..ccdb0ce20f9a0 100644 --- a/tests/ui/impl-trait/issues/issue-54895.rs +++ b/tests/ui/impl-trait/issues/issue-54895.rs @@ -17,7 +17,6 @@ impl<'a> Trait<'a> for X { fn f() -> impl for<'a> Trait<'a, Out = impl Sized + 'a> { //~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - //[edition2024]~^^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` X(()) } diff --git a/tests/ui/impl-trait/issues/issue-67830.stderr b/tests/ui/impl-trait/issues/issue-67830.stderr index a7633c7f20b65..7254955ed0bde 100644 --- a/tests/ui/impl-trait/issues/issue-67830.stderr +++ b/tests/ui/impl-trait/issues/issue-67830.stderr @@ -1,8 +1,10 @@ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/issue-67830.rs:20:64 + --> $DIR/issue-67830.rs:20:48 | LL | fn test() -> impl for<'a> MyFn<&'a A, Output = impl Iterator + 'a> { - | ^^ + | ^^^^^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/issue-67830.rs:20:23 diff --git a/tests/ui/impl-trait/issues/issue-88236-2.stderr b/tests/ui/impl-trait/issues/issue-88236-2.stderr index 4ded9ed386fa6..3943c41218454 100644 --- a/tests/ui/impl-trait/issues/issue-88236-2.stderr +++ b/tests/ui/impl-trait/issues/issue-88236-2.stderr @@ -1,8 +1,10 @@ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/issue-88236-2.rs:15:61 + --> $DIR/issue-88236-2.rs:15:49 | LL | fn make_impl() -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {} - | ^^ + | ^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/issue-88236-2.rs:15:28 @@ -11,10 +13,12 @@ LL | fn make_impl() -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {} | ^^ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/issue-88236-2.rs:18:80 + --> $DIR/issue-88236-2.rs:18:68 | LL | fn make_weird_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> { - | ^^ + | ^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/issue-88236-2.rs:18:47 @@ -23,10 +27,12 @@ LL | fn make_weird_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Sen | ^^ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/issue-88236-2.rs:23:78 + --> $DIR/issue-88236-2.rs:23:66 | LL | fn make_bad_impl<'b>(x: &'b ()) -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> { - | ^^ + | ^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/issue-88236-2.rs:23:45 diff --git a/tests/ui/impl-trait/issues/issue-88236.stderr b/tests/ui/impl-trait/issues/issue-88236.stderr index 5dee5f88c89f2..6303379288b7f 100644 --- a/tests/ui/impl-trait/issues/issue-88236.stderr +++ b/tests/ui/impl-trait/issues/issue-88236.stderr @@ -1,8 +1,10 @@ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/issue-88236.rs:15:61 + --> $DIR/issue-88236.rs:15:49 | LL | fn make_impl() -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {} - | ^^ + | ^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/issue-88236.rs:15:28 diff --git a/tests/ui/impl-trait/nested-rpit-hrtb.stderr b/tests/ui/impl-trait/nested-rpit-hrtb.stderr index a15f400fc2a76..6c1253678e991 100644 --- a/tests/ui/impl-trait/nested-rpit-hrtb.stderr +++ b/tests/ui/impl-trait/nested-rpit-hrtb.stderr @@ -30,10 +30,12 @@ LL | fn two_htrb_outlives_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl for<'b | ++++ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/nested-rpit-hrtb.rs:25:69 + --> $DIR/nested-rpit-hrtb.rs:25:56 | LL | fn one_hrtb_outlives() -> impl for<'a> Foo<'a, Assoc = impl Sized + 'a> {} - | ^^ + | ^^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/nested-rpit-hrtb.rs:25:36 @@ -42,10 +44,10 @@ LL | fn one_hrtb_outlives() -> impl for<'a> Foo<'a, Assoc = impl Sized + 'a> {} | ^^ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/nested-rpit-hrtb.rs:29:68 + --> $DIR/nested-rpit-hrtb.rs:29:59 | LL | fn one_hrtb_trait_param() -> impl for<'a> Foo<'a, Assoc = impl Qux<'a>> {} - | ^^ + | ^^^^^^^^^--^ `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/nested-rpit-hrtb.rs:29:39 @@ -54,10 +56,12 @@ LL | fn one_hrtb_trait_param() -> impl for<'a> Foo<'a, Assoc = impl Qux<'a>> {} | ^^ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/nested-rpit-hrtb.rs:32:74 + --> $DIR/nested-rpit-hrtb.rs:32:61 | LL | fn one_hrtb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'a> {} - | ^^ + | ^^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/nested-rpit-hrtb.rs:32:41 @@ -66,10 +70,10 @@ LL | fn one_hrtb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'a | ^^ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/nested-rpit-hrtb.rs:35:73 + --> $DIR/nested-rpit-hrtb.rs:35:64 | LL | fn one_hrtb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl Qux<'a>> {} - | ^^ + | ^^^^^^^^^--^ `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/nested-rpit-hrtb.rs:35:44 diff --git a/tests/ui/imports/glob-resolve1.stderr b/tests/ui/imports/glob-resolve1.stderr index 1356255a08501..5e02c933836d1 100644 --- a/tests/ui/imports/glob-resolve1.stderr +++ b/tests/ui/imports/glob-resolve1.stderr @@ -75,13 +75,18 @@ LL | pub enum B { | ---------- similarly named enum `B` defined here ... LL | foo::(); - | ^ help: an enum with a similar name exists: `B` + | ^ | note: enum `bar::A` exists but is inaccessible --> $DIR/glob-resolve1.rs:12:5 | LL | enum A { | ^^^^^^ not accessible +help: an enum with a similar name exists + | +LL - foo::(); +LL + foo::(); + | error[E0425]: cannot find type `C` in this scope --> $DIR/glob-resolve1.rs:34:11 @@ -90,13 +95,18 @@ LL | pub enum B { | ---------- similarly named enum `B` defined here ... LL | foo::(); - | ^ help: an enum with a similar name exists: `B` + | ^ | note: struct `bar::C` exists but is inaccessible --> $DIR/glob-resolve1.rs:19:5 | LL | struct C; | ^^^^^^^^^ not accessible +help: an enum with a similar name exists + | +LL - foo::(); +LL + foo::(); + | error[E0425]: cannot find type `D` in this scope --> $DIR/glob-resolve1.rs:35:11 @@ -105,13 +115,18 @@ LL | pub enum B { | ---------- similarly named enum `B` defined here ... LL | foo::(); - | ^ help: an enum with a similar name exists: `B` + | ^ | note: type alias `bar::D` exists but is inaccessible --> $DIR/glob-resolve1.rs:21:5 | LL | type D = isize; | ^^^^^^^^^^^^^^^ not accessible +help: an enum with a similar name exists + | +LL - foo::(); +LL + foo::(); + | error: aborting due to 8 previous errors diff --git a/tests/ui/inference/note-and-explain-ReVar-124973.stderr b/tests/ui/inference/note-and-explain-ReVar-124973.stderr index bb37e6231a323..2b5e79e9a1c64 100644 --- a/tests/ui/inference/note-and-explain-ReVar-124973.stderr +++ b/tests/ui/inference/note-and-explain-ReVar-124973.stderr @@ -8,9 +8,9 @@ error[E0700]: hidden type for `impl Future` captures lifetime that --> $DIR/note-and-explain-ReVar-124973.rs:5:76 | LL | async unsafe extern "C" fn multiple_named_lifetimes<'a, 'b>(_: u8, _: ...) {} - | -------------------------------------------------------------------------- ^^ - | | - | opaque type defined here + | -^^ + | | + | opaque type defined here | = note: hidden type `{async fn body of multiple_named_lifetimes<'a, 'b>()}` captures lifetime `'_` diff --git a/tests/ui/infinite/issue-41731-infinite-macro-print.stderr b/tests/ui/infinite/issue-41731-infinite-macro-print.stderr index 84436de9aa37f..5f5d2c75525d2 100644 --- a/tests/ui/infinite/issue-41731-infinite-macro-print.stderr +++ b/tests/ui/infinite/issue-41731-infinite-macro-print.stderr @@ -1,8 +1,11 @@ error: recursion limit reached while expanding `$crate::format_args!` - --> $DIR/issue-41731-infinite-macro-print.rs:14:5 + --> $DIR/issue-41731-infinite-macro-print.rs:8:13 | +LL | print!(stack!($overflow)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +... LL | stack!("overflow"); - | ^^^^^^^^^^^^^^^^^^ + | ------------------ in this macro invocation | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "10"]` attribute to your crate (`issue_41731_infinite_macro_print`) = note: this error originates in the macro `print` which comes from the expansion of the macro `stack` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -23,10 +26,13 @@ LL | stack!("overflow"); = note: to `{ $crate :: io :: _print($crate :: format_args! (stack! ("overflow"))); }` error: format argument must be a string literal - --> $DIR/issue-41731-infinite-macro-print.rs:14:5 + --> $DIR/issue-41731-infinite-macro-print.rs:8:13 | +LL | print!(stack!($overflow)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +... LL | stack!("overflow"); - | ^^^^^^^^^^^^^^^^^^ + | ------------------ in this macro invocation | = note: this error originates in the macro `print` which comes from the expansion of the macro `stack` (in Nightly builds, run with -Z macro-backtrace for more info) help: you might be missing a string literal to format with diff --git a/tests/ui/infinite/issue-41731-infinite-macro-println.stderr b/tests/ui/infinite/issue-41731-infinite-macro-println.stderr index 6d0432abe4c58..c19039e305e20 100644 --- a/tests/ui/infinite/issue-41731-infinite-macro-println.stderr +++ b/tests/ui/infinite/issue-41731-infinite-macro-println.stderr @@ -1,8 +1,11 @@ error: recursion limit reached while expanding `$crate::format_args_nl!` - --> $DIR/issue-41731-infinite-macro-println.rs:14:5 + --> $DIR/issue-41731-infinite-macro-println.rs:8:13 | +LL | println!(stack!($overflow)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... LL | stack!("overflow"); - | ^^^^^^^^^^^^^^^^^^ + | ------------------ in this macro invocation | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "10"]` attribute to your crate (`issue_41731_infinite_macro_println`) = note: this error originates in the macro `println` which comes from the expansion of the macro `stack` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -23,10 +26,13 @@ LL | stack!("overflow"); = note: to `{ $crate :: io :: _print($crate :: format_args_nl! (stack! ("overflow"))); }` error: format argument must be a string literal - --> $DIR/issue-41731-infinite-macro-println.rs:14:5 + --> $DIR/issue-41731-infinite-macro-println.rs:8:13 | +LL | println!(stack!($overflow)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... LL | stack!("overflow"); - | ^^^^^^^^^^^^^^^^^^ + | ------------------ in this macro invocation | = note: this error originates in the macro `println` which comes from the expansion of the macro `stack` (in Nightly builds, run with -Z macro-backtrace for more info) help: you might be missing a string literal to format with diff --git a/tests/ui/iterators/invalid-iterator-chain-fixable.stderr b/tests/ui/iterators/invalid-iterator-chain-fixable.stderr index bef4cb6b0a1b6..99bff6b450b56 100644 --- a/tests/ui/iterators/invalid-iterator-chain-fixable.stderr +++ b/tests/ui/iterators/invalid-iterator-chain-fixable.stderr @@ -35,10 +35,14 @@ LL | println!("{}", scores.sum::()); = help: the trait `Sum<()>` is not implemented for `i32` help: the following other types implement trait `Sum` --> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL + | + = note: `i32` implements `Sum` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: `i32` implements `Sum<&i32>` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | - = note: `i32` implements `Sum` + = note: in this macro invocation note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain-fixable.rs:14:10 | @@ -72,10 +76,14 @@ LL | .sum::(), = help: the trait `Sum<()>` is not implemented for `i32` help: the following other types implement trait `Sum` --> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL + | + = note: `i32` implements `Sum` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: `i32` implements `Sum<&i32>` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | - = note: `i32` implements `Sum` + = note: in this macro invocation note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain-fixable.rs:23:14 | @@ -109,10 +117,14 @@ LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::()); = help: the trait `Sum<()>` is not implemented for `i32` help: the following other types implement trait `Sum` --> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL + | + = note: `i32` implements `Sum` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: `i32` implements `Sum<&i32>` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | - = note: `i32` implements `Sum` + = note: in this macro invocation note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain-fixable.rs:27:38 | diff --git a/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr b/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr index 638287ed1c644..c94b716e3131f 100644 --- a/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr +++ b/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr @@ -9,10 +9,14 @@ LL | let x = Some(()).iter().map(|()| 1).sum::(); = help: the trait `Sum<{integer}>` is not implemented for `f32` help: the following other types implement trait `Sum` --> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL + | + = note: `f32` implements `Sum` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: `f32` implements `Sum<&f32>` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | - = note: `f32` implements `Sum` + = note: in this macro invocation note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain-with-int-infer.rs:2:29 | diff --git a/tests/ui/iterators/invalid-iterator-chain.stderr b/tests/ui/iterators/invalid-iterator-chain.stderr index 0fd9d3999966c..7f0c154e255ad 100644 --- a/tests/ui/iterators/invalid-iterator-chain.stderr +++ b/tests/ui/iterators/invalid-iterator-chain.stderr @@ -35,10 +35,14 @@ LL | println!("{}", scores.sum::()); = help: the trait `Sum<()>` is not implemented for `i32` help: the following other types implement trait `Sum` --> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL + | + = note: `i32` implements `Sum` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: `i32` implements `Sum<&i32>` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | - = note: `i32` implements `Sum` + = note: in this macro invocation note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain.rs:12:10 | @@ -71,10 +75,14 @@ LL | .sum::(), = help: the trait `Sum<()>` is not implemented for `i32` help: the following other types implement trait `Sum` --> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL + | + = note: `i32` implements `Sum` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: `i32` implements `Sum<&i32>` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | - = note: `i32` implements `Sum` + = note: in this macro invocation note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain.rs:25:14 | @@ -114,10 +122,14 @@ LL | .sum::(), = help: the trait `Sum` is not implemented for `i32` help: the following other types implement trait `Sum` --> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL + | + = note: `i32` implements `Sum` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: `i32` implements `Sum<&i32>` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | - = note: `i32` implements `Sum` + = note: in this macro invocation note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain.rs:33:14 | @@ -148,10 +160,14 @@ LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::()); = help: the trait `Sum<()>` is not implemented for `i32` help: the following other types implement trait `Sum` --> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL + | + = note: `i32` implements `Sum` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: `i32` implements `Sum<&i32>` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | - = note: `i32` implements `Sum` + = note: in this macro invocation note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain.rs:38:38 | @@ -180,10 +196,14 @@ LL | println!("{}", vec![(), ()].iter().sum::()); = help: the trait `Sum<&()>` is not implemented for `i32` help: the following other types implement trait `Sum` --> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL + | + = note: `i32` implements `Sum` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: `i32` implements `Sum<&i32>` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | - = note: `i32` implements `Sum` + = note: in this macro invocation note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain.rs:39:33 | diff --git a/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr b/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr index 945d38d17f63d..bb8e847242571 100644 --- a/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr +++ b/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr @@ -34,24 +34,18 @@ LL | for<'a> >::Output: Future + 'a, = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32` error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32` - --> $DIR/issue-76168-hr-outlives-3.rs:6:1 + --> $DIR/issue-76168-hr-outlives-3.rs:6:26 | -LL | / async fn wrapper(f: F) -... | -LL | | F:, -LL | | for<'a> >::Output: Future + 'a, - | |__________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32` +LL | async fn wrapper(f: F) + | ^ expected an `FnOnce(&'a mut i32)` closure, found `i32` | = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32` error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32` - --> $DIR/issue-76168-hr-outlives-3.rs:6:1 + --> $DIR/issue-76168-hr-outlives-3.rs:6:26 | -LL | / async fn wrapper(f: F) -... | -LL | | F:, -LL | | for<'a> >::Output: Future + 'a, - | |__________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32` +LL | async fn wrapper(f: F) + | ^ expected an `FnOnce(&'a mut i32)` closure, found `i32` | = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/macros/macro-context.stderr b/tests/ui/macros/macro-context.stderr index edddfef9de3b2..3ec1af3a82f82 100644 --- a/tests/ui/macros/macro-context.stderr +++ b/tests/ui/macros/macro-context.stderr @@ -46,12 +46,16 @@ error[E0425]: cannot find type `i` in this scope --> $DIR/macro-context.rs:3:13 | LL | () => ( i ; typeof ); - | ^ help: a builtin type with a similar name exists: `i8` + | ^ ... LL | let a: m!(); | ---- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a builtin type with a similar name exists + | +LL | () => ( i8 ; typeof ); + | + error[E0425]: cannot find value `i` in this scope --> $DIR/macro-context.rs:3:13 diff --git a/tests/ui/macros/macro-name-typo.stderr b/tests/ui/macros/macro-name-typo.stderr index 1cc7ea6ec1b60..bca7dbe9369cb 100644 --- a/tests/ui/macros/macro-name-typo.stderr +++ b/tests/ui/macros/macro-name-typo.stderr @@ -2,11 +2,16 @@ error: cannot find macro `printlx` in this scope --> $DIR/macro-name-typo.rs:2:5 | LL | printlx!("oh noes!"); - | ^^^^^^^ help: a macro with a similar name exists: `println` + | ^^^^^^^ | --> $SRC_DIR/std/src/macros.rs:LL:COL | = note: similarly named macro `println` defined here +help: a macro with a similar name exists + | +LL - printlx!("oh noes!"); +LL + println!("oh noes!"); + | error: aborting due to 1 previous error diff --git a/tests/ui/macros/macro-path-prelude-fail-3.stderr b/tests/ui/macros/macro-path-prelude-fail-3.stderr index 3d0a074deeb05..7bf166d0e56f6 100644 --- a/tests/ui/macros/macro-path-prelude-fail-3.stderr +++ b/tests/ui/macros/macro-path-prelude-fail-3.stderr @@ -2,13 +2,18 @@ error: cannot find macro `inline` in this scope --> $DIR/macro-path-prelude-fail-3.rs:2:5 | LL | inline!(); - | ^^^^^^ help: a macro with a similar name exists: `line` + | ^^^^^^ | --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | = note: similarly named macro `line` defined here | = note: `inline` is in scope, but it is an attribute: `#[inline]` +help: a macro with a similar name exists + | +LL - inline!(); +LL + line!(); + | error: aborting due to 1 previous error diff --git a/tests/ui/macros/macro-reexport-removed.stderr b/tests/ui/macros/macro-reexport-removed.stderr index 8130fe0c4bdaa..752133162214e 100644 --- a/tests/ui/macros/macro-reexport-removed.stderr +++ b/tests/ui/macros/macro-reexport-removed.stderr @@ -11,7 +11,13 @@ error: cannot find attribute `macro_reexport` in this scope --> $DIR/macro-reexport-removed.rs:5:3 | LL | #[macro_reexport(macro_one)] - | ^^^^^^^^^^^^^^ help: a built-in attribute with a similar name exists: `macro_export` + | ^^^^^^^^^^^^^^ + | +help: a built-in attribute with a similar name exists + | +LL - #[macro_reexport(macro_one)] +LL + #[macro_export(macro_one)] + | error: aborting due to 2 previous errors diff --git a/tests/ui/macros/macro_undefined.stderr b/tests/ui/macros/macro_undefined.stderr index cc3efacbc5415..ed58be8808b2f 100644 --- a/tests/ui/macros/macro_undefined.stderr +++ b/tests/ui/macros/macro_undefined.stderr @@ -5,7 +5,12 @@ LL | macro_rules! kl { | --------------- similarly named macro `kl` defined here ... LL | k!(); - | ^ help: a macro with a similar name exists: `kl` + | ^ + | +help: a macro with a similar name exists + | +LL | kl!(); + | + error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/binops.stderr b/tests/ui/mismatched_types/binops.stderr index 504b44dfb7f69..ec2a951aac9a4 100644 --- a/tests/ui/mismatched_types/binops.stderr +++ b/tests/ui/mismatched_types/binops.stderr @@ -26,13 +26,19 @@ LL | 2 as usize - Some(1); help: the following other types implement trait `Sub` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&usize` implements `Sub` + = note: `usize` implements `Sub` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&usize` implements `Sub` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&usize` implements `Sub` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `usize` implements `Sub<&usize>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `usize` implements `Sub` + = note: `&usize` implements `Sub` = note: this error originates in the macro `sub_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: cannot multiply `{integer}` by `()` diff --git a/tests/ui/mismatched_types/float-integer-subtraction-error-24352.stderr b/tests/ui/mismatched_types/float-integer-subtraction-error-24352.stderr index b2d0ffc4710e2..54b536744f757 100644 --- a/tests/ui/mismatched_types/float-integer-subtraction-error-24352.stderr +++ b/tests/ui/mismatched_types/float-integer-subtraction-error-24352.stderr @@ -8,13 +8,19 @@ LL | 1.0f64 - 1 help: the following other types implement trait `Sub` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Sub` + = note: `f64` implements `Sub` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Sub` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f64` implements `Sub` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f64` implements `Sub<&f64>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f64` implements `Sub` + = note: `&f64` implements `Sub` = note: this error originates in the macro `sub_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider using a floating-point literal by writing it with `.0` | diff --git a/tests/ui/never_type/issue-13352.stderr b/tests/ui/never_type/issue-13352.stderr index 344625af683ae..5fcbb4aab9937 100644 --- a/tests/ui/never_type/issue-13352.stderr +++ b/tests/ui/never_type/issue-13352.stderr @@ -8,13 +8,19 @@ LL | 2_usize + (loop {}); help: the following other types implement trait `Add` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&usize` implements `Add` + = note: `usize` implements `Add` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&usize` implements `Add` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&usize` implements `Add` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `usize` implements `Add<&usize>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `usize` implements `Add` + = note: `&usize` implements `Add` = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/numbers-arithmetic/not-suggest-float-literal.stderr b/tests/ui/numbers-arithmetic/not-suggest-float-literal.stderr index 3f5297be3719c..a62bf5b6a04de 100644 --- a/tests/ui/numbers-arithmetic/not-suggest-float-literal.stderr +++ b/tests/ui/numbers-arithmetic/not-suggest-float-literal.stderr @@ -8,13 +8,19 @@ LL | x + 100.0 help: the following other types implement trait `Add` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&u8` implements `Add` + = note: `u8` implements `Add` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&u8` implements `Add` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&u8` implements `Add` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `u8` implements `Add<&u8>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `u8` implements `Add` + = note: `&u8` implements `Add` = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: cannot add `&str` to `f64` @@ -27,13 +33,19 @@ LL | x + "foo" help: the following other types implement trait `Add` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Add` + = note: `f64` implements `Add` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Add` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f64` implements `Add` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f64` implements `Add<&f64>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f64` implements `Add` + = note: `&f64` implements `Add` = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: cannot add `{integer}` to `f64` @@ -46,13 +58,19 @@ LL | x + y help: the following other types implement trait `Add` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Add` + = note: `f64` implements `Add` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Add` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f64` implements `Add` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f64` implements `Add<&f64>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f64` implements `Add` + = note: `&f64` implements `Add` = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: cannot subtract `{float}` from `u8` @@ -65,13 +83,19 @@ LL | x - 100.0 help: the following other types implement trait `Sub` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&u8` implements `Sub` + = note: `u8` implements `Sub` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&u8` implements `Sub` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&u8` implements `Sub` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `u8` implements `Sub<&u8>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `u8` implements `Sub` + = note: `&u8` implements `Sub` = note: this error originates in the macro `sub_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: cannot subtract `&str` from `f64` @@ -84,13 +108,19 @@ LL | x - "foo" help: the following other types implement trait `Sub` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Sub` + = note: `f64` implements `Sub` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Sub` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f64` implements `Sub` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f64` implements `Sub<&f64>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f64` implements `Sub` + = note: `&f64` implements `Sub` = note: this error originates in the macro `sub_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: cannot subtract `{integer}` from `f64` @@ -103,13 +133,19 @@ LL | x - y help: the following other types implement trait `Sub` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Sub` + = note: `f64` implements `Sub` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Sub` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f64` implements `Sub` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f64` implements `Sub<&f64>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f64` implements `Sub` + = note: `&f64` implements `Sub` = note: this error originates in the macro `sub_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: cannot multiply `u8` by `{float}` @@ -122,13 +158,19 @@ LL | x * 100.0 help: the following other types implement trait `Mul` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&u8` implements `Mul` + = note: `u8` implements `Mul` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&u8` implements `Mul` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&u8` implements `Mul` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `u8` implements `Mul<&u8>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `u8` implements `Mul` + = note: `&u8` implements `Mul` = note: this error originates in the macro `mul_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: cannot multiply `f64` by `&str` @@ -141,13 +183,19 @@ LL | x * "foo" help: the following other types implement trait `Mul` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Mul` + = note: `f64` implements `Mul` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Mul` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f64` implements `Mul` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f64` implements `Mul<&f64>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f64` implements `Mul` + = note: `&f64` implements `Mul` = note: this error originates in the macro `mul_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: cannot multiply `f64` by `{integer}` @@ -160,13 +208,19 @@ LL | x * y help: the following other types implement trait `Mul` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Mul` + = note: `f64` implements `Mul` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Mul` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f64` implements `Mul` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f64` implements `Mul<&f64>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f64` implements `Mul` + = note: `&f64` implements `Mul` = note: this error originates in the macro `mul_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: cannot divide `u8` by `{float}` @@ -193,13 +247,19 @@ LL | x / "foo" help: the following other types implement trait `Div` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Div` + = note: `f64` implements `Div` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Div` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f64` implements `Div` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f64` implements `Div<&f64>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f64` implements `Div` + = note: `&f64` implements `Div` = note: this error originates in the macro `div_impl_float` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: cannot divide `f64` by `{integer}` @@ -212,13 +272,19 @@ LL | x / y help: the following other types implement trait `Div` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Div` + = note: `f64` implements `Div` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Div` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f64` implements `Div` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f64` implements `Div<&f64>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f64` implements `Div` + = note: `&f64` implements `Div` = note: this error originates in the macro `div_impl_float` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 12 previous errors diff --git a/tests/ui/numbers-arithmetic/suggest-float-literal.stderr b/tests/ui/numbers-arithmetic/suggest-float-literal.stderr index a31ed61547465..65881ca7a82f1 100644 --- a/tests/ui/numbers-arithmetic/suggest-float-literal.stderr +++ b/tests/ui/numbers-arithmetic/suggest-float-literal.stderr @@ -8,13 +8,19 @@ LL | x + 100 help: the following other types implement trait `Add` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f32` implements `Add` + = note: `f32` implements `Add` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f32` implements `Add` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f32` implements `Add` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f32` implements `Add<&f32>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f32` implements `Add` + = note: `&f32` implements `Add` = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider using a floating-point literal by writing it with `.0` | @@ -31,13 +37,19 @@ LL | x + 100 help: the following other types implement trait `Add` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Add` + = note: `f64` implements `Add` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Add` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f64` implements `Add` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f64` implements `Add<&f64>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f64` implements `Add` + = note: `&f64` implements `Add` = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider using a floating-point literal by writing it with `.0` | @@ -54,13 +66,19 @@ LL | x - 100 help: the following other types implement trait `Sub` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f32` implements `Sub` + = note: `f32` implements `Sub` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f32` implements `Sub` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f32` implements `Sub` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f32` implements `Sub<&f32>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f32` implements `Sub` + = note: `&f32` implements `Sub` = note: this error originates in the macro `sub_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider using a floating-point literal by writing it with `.0` | @@ -77,13 +95,19 @@ LL | x - 100 help: the following other types implement trait `Sub` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Sub` + = note: `f64` implements `Sub` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Sub` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f64` implements `Sub` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f64` implements `Sub<&f64>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f64` implements `Sub` + = note: `&f64` implements `Sub` = note: this error originates in the macro `sub_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider using a floating-point literal by writing it with `.0` | @@ -100,13 +124,19 @@ LL | x * 100 help: the following other types implement trait `Mul` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f32` implements `Mul` + = note: `f32` implements `Mul` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f32` implements `Mul` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f32` implements `Mul` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f32` implements `Mul<&f32>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f32` implements `Mul` + = note: `&f32` implements `Mul` = note: this error originates in the macro `mul_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider using a floating-point literal by writing it with `.0` | @@ -123,13 +153,19 @@ LL | x * 100 help: the following other types implement trait `Mul` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Mul` + = note: `f64` implements `Mul` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Mul` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f64` implements `Mul` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f64` implements `Mul<&f64>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f64` implements `Mul` + = note: `&f64` implements `Mul` = note: this error originates in the macro `mul_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider using a floating-point literal by writing it with `.0` | @@ -146,13 +182,19 @@ LL | x / 100 help: the following other types implement trait `Div` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f32` implements `Div` + = note: `f32` implements `Div` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f32` implements `Div` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f32` implements `Div` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f32` implements `Div<&f32>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f32` implements `Div` + = note: `&f32` implements `Div` = note: this error originates in the macro `div_impl_float` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider using a floating-point literal by writing it with `.0` | @@ -169,13 +211,19 @@ LL | x / 100 help: the following other types implement trait `Div` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Div` + = note: `f64` implements `Div` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&f64` implements `Div` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&f64` implements `Div` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `f64` implements `Div<&f64>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `f64` implements `Div` + = note: `&f64` implements `Div` = note: this error originates in the macro `div_impl_float` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider using a floating-point literal by writing it with `.0` | diff --git a/tests/ui/on-unimplemented/slice-index.stderr b/tests/ui/on-unimplemented/slice-index.stderr index baf821c45c5e8..67b72bd038d80 100644 --- a/tests/ui/on-unimplemented/slice-index.stderr +++ b/tests/ui/on-unimplemented/slice-index.stderr @@ -28,6 +28,9 @@ help: the following other types implement trait `SliceIndex` --> $SRC_DIR/core/src/bstr/traits.rs:LL:COL | = note: `RangeTo` implements `SliceIndex` + ::: $SRC_DIR/core/src/bstr/traits.rs:LL:COL + | + = note: in this macro invocation --> $SRC_DIR/core/src/str/traits.rs:LL:COL | = note: `RangeTo` implements `SliceIndex` diff --git a/tests/ui/on-unimplemented/sum.stderr b/tests/ui/on-unimplemented/sum.stderr index c4650e9f52786..5e82948352f75 100644 --- a/tests/ui/on-unimplemented/sum.stderr +++ b/tests/ui/on-unimplemented/sum.stderr @@ -9,10 +9,14 @@ LL | vec![(), ()].iter().sum::(); = help: the trait `Sum<&()>` is not implemented for `i32` help: the following other types implement trait `Sum` --> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL + | + = note: `i32` implements `Sum` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: `i32` implements `Sum<&i32>` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | - = note: `i32` implements `Sum` + = note: in this macro invocation note: the method call chain might not have had the expected associated types --> $DIR/sum.rs:4:18 | @@ -35,10 +39,14 @@ LL | vec![(), ()].iter().product::(); = help: the trait `Product<&()>` is not implemented for `i32` help: the following other types implement trait `Product` --> $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL + | + = note: `i32` implements `Product` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | = note: `i32` implements `Product<&i32>` + ::: $SRC_DIR/core/src/iter/traits/accum.rs:LL:COL | - = note: `i32` implements `Product` + = note: in this macro invocation note: the method call chain might not have had the expected associated types --> $DIR/sum.rs:7:18 | diff --git a/tests/ui/panics/oom-panic-unwind.rs b/tests/ui/panics/alloc_error_hook-unwind.rs similarity index 84% rename from tests/ui/panics/oom-panic-unwind.rs rename to tests/ui/panics/alloc_error_hook-unwind.rs index 4f7939ce60b20..8a107bc390d4a 100644 --- a/tests/ui/panics/oom-panic-unwind.rs +++ b/tests/ui/panics/alloc_error_hook-unwind.rs @@ -1,17 +1,19 @@ -//! Test that out-of-memory conditions trigger catchable panics with `-Z oom=panic`. +//! Test that out-of-memory conditions trigger catchable panics with `set_alloc_error_hook`. -//@ compile-flags: -Z oom=panic //@ run-pass -//@ no-prefer-dynamic //@ needs-unwind //@ only-linux //@ ignore-backends: gcc +#![feature(alloc_error_hook)] + use std::hint::black_box; use std::mem::forget; use std::panic::catch_unwind; fn main() { + std::alloc::set_alloc_error_hook(|_| panic!()); + let panic = catch_unwind(|| { // This is guaranteed to exceed even the size of the address space for _ in 0..16 { diff --git a/tests/ui/parser/emoji-identifiers.stderr b/tests/ui/parser/emoji-identifiers.stderr index ef4e647b9f506..016ed0401caf8 100644 --- a/tests/ui/parser/emoji-identifiers.stderr +++ b/tests/ui/parser/emoji-identifiers.stderr @@ -91,7 +91,13 @@ LL | fn i_like_to_😅_a_lot() -> 👀 { | ----------------------------- similarly named function `i_like_to_😅_a_lot` defined here ... LL | let _ = i_like_to_😄_a_lot() ➖ 4; - | ^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `i_like_to_😅_a_lot` + | ^^^^^^^^^^^^^^^^^^ + | +help: a function with a similar name exists + | +LL - let _ = i_like_to_😄_a_lot() ➖ 4; +LL + let _ = i_like_to_😅_a_lot() ➖ 4; + | error: aborting due to 10 previous errors diff --git a/tests/ui/parser/kw-in-trait-bounds.stderr b/tests/ui/parser/kw-in-trait-bounds.stderr index 5a4adf3e37b4c..5f86b1430616b 100644 --- a/tests/ui/parser/kw-in-trait-bounds.stderr +++ b/tests/ui/parser/kw-in-trait-bounds.stderr @@ -94,37 +94,61 @@ error[E0405]: cannot find trait `r#struct` in this scope --> $DIR/kw-in-trait-bounds.rs:16:10 | LL | fn _g(_: impl struct, _: &dyn struct) - | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct` + | ^^^^^^ ... LL | trait Struct {} | ------------ similarly named trait `Struct` defined here + | +help: a trait with a similar name exists (notice the capitalization) + | +LL - fn _g(_: impl struct, _: &dyn struct) +LL + fn _g(_: impl struct, _: &dyn struct) + | error[E0405]: cannot find trait `r#struct` in this scope --> $DIR/kw-in-trait-bounds.rs:30:8 | LL | B: struct, - | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct` + | ^^^^^^ ... LL | trait Struct {} | ------------ similarly named trait `Struct` defined here + | +help: a trait with a similar name exists (notice the capitalization) + | +LL - B: struct, +LL + B: Struct, + | error[E0405]: cannot find trait `r#struct` in this scope --> $DIR/kw-in-trait-bounds.rs:16:29 | LL | fn _g(_: impl struct, _: &dyn struct) - | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct` + | ^^^^^^ ... LL | trait Struct {} | ------------ similarly named trait `Struct` defined here + | +help: a trait with a similar name exists (notice the capitalization) + | +LL - fn _g(_: impl struct, _: &dyn struct) +LL + fn _g(_: impl Struct, _: &dyn struct) + | error[E0405]: cannot find trait `r#struct` in this scope --> $DIR/kw-in-trait-bounds.rs:16:45 | LL | fn _g(_: impl struct, _: &dyn struct) - | ^^^^^^ help: a trait with a similar name exists (notice the capitalization): `Struct` + | ^^^^^^ ... LL | trait Struct {} | ------------ similarly named trait `Struct` defined here + | +help: a trait with a similar name exists (notice the capitalization) + | +LL - fn _g(_: impl struct, _: &dyn struct) +LL + fn _g(_: impl struct, _: &dyn Struct) + | error: aborting due to 12 previous errors diff --git a/tests/ui/parser/recover/raw-no-const-mut.stderr b/tests/ui/parser/recover/raw-no-const-mut.stderr index 65032c807953d..3007134f7f5c0 100644 --- a/tests/ui/parser/recover/raw-no-const-mut.stderr +++ b/tests/ui/parser/recover/raw-no-const-mut.stderr @@ -101,7 +101,13 @@ LL | fn a() { | ------ similarly named function `a` defined here ... LL | f(&raw 2); - | ^ help: a function with a similar name exists: `a` + | ^ + | +help: a function with a similar name exists + | +LL - f(&raw 2); +LL + a(&raw 2); + | error: aborting due to 9 previous errors diff --git a/tests/ui/pattern/match-enum-struct-variant-field-missing.stderr b/tests/ui/pattern/match-enum-struct-variant-field-missing.stderr index 326595a7cb706..f449f00a6982d 100644 --- a/tests/ui/pattern/match-enum-struct-variant-field-missing.stderr +++ b/tests/ui/pattern/match-enum-struct-variant-field-missing.stderr @@ -2,10 +2,13 @@ error[E0026]: variant `A::A` does not have a field named `fob` --> $DIR/match-enum-struct-variant-field-missing.rs:12:16 | LL | A::A { fob } => { - | ^^^ - | | - | variant `A::A` does not have this field - | help: a field with a similar name exists: `foo` + | ^^^ variant `A::A` does not have this field + | +help: a field with a similar name exists + | +LL - A::A { fob } => { +LL + A::A { foo } => { + | error: aborting due to 1 previous error diff --git a/tests/ui/pattern/pattern-error-continue.stderr b/tests/ui/pattern/pattern-error-continue.stderr index a9ac96e3eaffb..de90d99a0ff1c 100644 --- a/tests/ui/pattern/pattern-error-continue.stderr +++ b/tests/ui/pattern/pattern-error-continue.stderr @@ -56,10 +56,13 @@ error[E0433]: failed to resolve: use of undeclared type `E` --> $DIR/pattern-error-continue.rs:35:9 | LL | E::V => {} - | ^ - | | - | use of undeclared type `E` - | help: an enum with a similar name exists: `A` + | ^ use of undeclared type `E` + | +help: an enum with a similar name exists + | +LL - E::V => {} +LL + A::V => {} + | error: aborting due to 5 previous errors diff --git a/tests/ui/pattern/rfc-3637-guard-patterns/name-resolution.stderr b/tests/ui/pattern/rfc-3637-guard-patterns/name-resolution.stderr index a5d9fd2b1a6ec..44e42f1427074 100644 --- a/tests/ui/pattern/rfc-3637-guard-patterns/name-resolution.stderr +++ b/tests/ui/pattern/rfc-3637-guard-patterns/name-resolution.stderr @@ -38,43 +38,85 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/name-resolution.rs:10:34 | LL | fn bad_fn_item_1(x: bool, ((y if x) | y): bool) {} - | ^ help: a local variable with a similar name exists: `y` + | ^ + | +help: a local variable with a similar name exists + | +LL - fn bad_fn_item_1(x: bool, ((y if x) | y): bool) {} +LL + fn bad_fn_item_1(x: bool, ((y if y) | y): bool) {} + | error[E0425]: cannot find value `y` in this scope --> $DIR/name-resolution.rs:12:25 | LL | fn bad_fn_item_2(((x if y) | x): bool, y: bool) {} - | ^ help: a local variable with a similar name exists: `x` + | ^ + | +help: a local variable with a similar name exists + | +LL - fn bad_fn_item_2(((x if y) | x): bool, y: bool) {} +LL + fn bad_fn_item_2(((x if x) | x): bool, y: bool) {} + | error[E0425]: cannot find value `x` in this scope --> $DIR/name-resolution.rs:20:18 | LL | (x, y if x) => x && y, - | ^ help: a local variable with a similar name exists: `y` + | ^ + | +help: a local variable with a similar name exists + | +LL - (x, y if x) => x && y, +LL + (x, y if y) => x && y, + | error[E0425]: cannot find value `y` in this scope --> $DIR/name-resolution.rs:22:15 | LL | (x if y, y) => x && y, - | ^ help: a local variable with a similar name exists: `x` + | ^ + | +help: a local variable with a similar name exists + | +LL - (x if y, y) => x && y, +LL + (x if x, y) => x && y, + | error[E0425]: cannot find value `x` in this scope --> $DIR/name-resolution.rs:29:20 | LL | (x @ (y if x),) => x && y, - | ^ help: a local variable with a similar name exists: `y` + | ^ + | +help: a local variable with a similar name exists + | +LL - (x @ (y if x),) => x && y, +LL + (x @ (y if y),) => x && y, + | error[E0425]: cannot find value `y` in this scope --> $DIR/name-resolution.rs:37:20 | LL | ((Ok(x) if y) | (Err(y) if x),) => x && y, - | ^ help: a local variable with a similar name exists: `x` + | ^ + | +help: a local variable with a similar name exists + | +LL - ((Ok(x) if y) | (Err(y) if x),) => x && y, +LL + ((Ok(x) if x) | (Err(y) if x),) => x && y, + | error[E0425]: cannot find value `x` in this scope --> $DIR/name-resolution.rs:37:36 | LL | ((Ok(x) if y) | (Err(y) if x),) => x && y, - | ^ help: a local variable with a similar name exists: `y` + | ^ + | +help: a local variable with a similar name exists + | +LL - ((Ok(x) if y) | (Err(y) if x),) => x && y, +LL + ((Ok(x) if y) | (Err(y) if y),) => x && y, + | error[E0425]: cannot find value `nonexistent` in this scope --> $DIR/name-resolution.rs:44:15 @@ -86,49 +128,97 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/name-resolution.rs:46:22 | LL | if let ((x, y if x) | (x if y, y)) = (true, true) { x && y; } - | ^ help: a local variable with a similar name exists: `y` + | ^ + | +help: a local variable with a similar name exists + | +LL - if let ((x, y if x) | (x if y, y)) = (true, true) { x && y; } +LL + if let ((x, y if y) | (x if y, y)) = (true, true) { x && y; } + | error[E0425]: cannot find value `y` in this scope --> $DIR/name-resolution.rs:46:33 | LL | if let ((x, y if x) | (x if y, y)) = (true, true) { x && y; } - | ^ help: a local variable with a similar name exists: `x` + | ^ + | +help: a local variable with a similar name exists + | +LL - if let ((x, y if x) | (x if y, y)) = (true, true) { x && y; } +LL + if let ((x, y if x) | (x if x, y)) = (true, true) { x && y; } + | error[E0425]: cannot find value `x` in this scope --> $DIR/name-resolution.rs:49:25 | LL | while let ((x, y if x) | (x if y, y)) = (true, true) { x && y; } - | ^ help: a local variable with a similar name exists: `y` + | ^ + | +help: a local variable with a similar name exists + | +LL - while let ((x, y if x) | (x if y, y)) = (true, true) { x && y; } +LL + while let ((x, y if y) | (x if y, y)) = (true, true) { x && y; } + | error[E0425]: cannot find value `y` in this scope --> $DIR/name-resolution.rs:49:36 | LL | while let ((x, y if x) | (x if y, y)) = (true, true) { x && y; } - | ^ help: a local variable with a similar name exists: `x` + | ^ + | +help: a local variable with a similar name exists + | +LL - while let ((x, y if x) | (x if y, y)) = (true, true) { x && y; } +LL + while let ((x, y if x) | (x if x, y)) = (true, true) { x && y; } + | error[E0425]: cannot find value `x` in this scope --> $DIR/name-resolution.rs:52:19 | LL | for ((x, y if x) | (x if y, y)) in [(true, true)] { x && y; } - | ^ help: a local variable with a similar name exists: `y` + | ^ + | +help: a local variable with a similar name exists + | +LL - for ((x, y if x) | (x if y, y)) in [(true, true)] { x && y; } +LL + for ((x, y if y) | (x if y, y)) in [(true, true)] { x && y; } + | error[E0425]: cannot find value `y` in this scope --> $DIR/name-resolution.rs:52:30 | LL | for ((x, y if x) | (x if y, y)) in [(true, true)] { x && y; } - | ^ help: a local variable with a similar name exists: `x` + | ^ + | +help: a local variable with a similar name exists + | +LL - for ((x, y if x) | (x if y, y)) in [(true, true)] { x && y; } +LL + for ((x, y if x) | (x if x, y)) in [(true, true)] { x && y; } + | error[E0425]: cannot find value `y` in this scope --> $DIR/name-resolution.rs:57:13 | LL | (|(x if y), (y if x)| x && y)(true, true); - | ^ help: a local variable with a similar name exists: `x` + | ^ + | +help: a local variable with a similar name exists + | +LL - (|(x if y), (y if x)| x && y)(true, true); +LL + (|(x if x), (y if x)| x && y)(true, true); + | error[E0425]: cannot find value `x` in this scope --> $DIR/name-resolution.rs:57:23 | LL | (|(x if y), (y if x)| x && y)(true, true); - | ^ help: a local variable with a similar name exists: `y` + | ^ + | +help: a local variable with a similar name exists + | +LL - (|(x if y), (y if x)| x && y)(true, true); +LL + (|(x if y), (y if y)| x && y)(true, true); + | error[E0308]: mismatched types --> $DIR/name-resolution.rs:75:18 diff --git a/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr b/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr index b985b771754ee..b8c6f1d867a19 100644 --- a/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr +++ b/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr @@ -20,7 +20,13 @@ error[E0425]: cannot find value `a` in this scope LL | if let Foo::Bar { .. } = x { | --------------- this pattern doesn't include `a`, which is available in `Bar` LL | println!("{a}"); - | ^ help: a local variable with a similar name exists: `x` + | ^ + | +help: a local variable with a similar name exists + | +LL - println!("{a}"); +LL + println!("{x}"); + | error: aborting due to 3 previous errors diff --git a/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr b/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr index ed8ee4dc52cba..46cdbaccaeb6c 100644 --- a/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr +++ b/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr @@ -13,7 +13,7 @@ error[E0425]: cannot find value `local_use` in this scope --> $DIR/gen-macro-rules-hygiene.rs:13:1 | LL | gen_macro_rules!(); - | ^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `local_def` + | ^^^^^^^^^^^^^^^^^^ ... LL | generated!(); | ------------ in this macro invocation @@ -24,12 +24,17 @@ help: an identifier with the same name exists, but is not accessible due to macr LL | let local_use = 1; | ^^^^^^^^^ = note: this error originates in the macro `generated` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a local variable with a similar name exists + | +LL - gen_macro_rules!(); +LL + local_def; + | error[E0425]: cannot find value `local_def` in this scope --> $DIR/gen-macro-rules-hygiene.rs:22:9 | LL | local_def; - | ^^^^^^^^^ help: a local variable with a similar name exists: `local_use` + | ^^^^^^^^^ | help: an identifier with the same name is defined here, but is not accessible due to macro hygiene --> $DIR/gen-macro-rules-hygiene.rs:13:1 @@ -40,6 +45,11 @@ LL | gen_macro_rules!(); LL | generated!(); | ------------ in this macro invocation = note: this error originates in the macro `generated` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a local variable with a similar name exists + | +LL - local_def; +LL + local_use; + | error: aborting due to 3 previous errors diff --git a/tests/ui/proc-macro/lints_in_proc_macros.stderr b/tests/ui/proc-macro/lints_in_proc_macros.stderr index 016b236bda881..0b8df1b348d7e 100644 --- a/tests/ui/proc-macro/lints_in_proc_macros.stderr +++ b/tests/ui/proc-macro/lints_in_proc_macros.stderr @@ -2,9 +2,14 @@ error[E0425]: cannot find value `foobar2` in this scope --> $DIR/lints_in_proc_macros.rs:10:5 | LL | bang_proc_macro2!(); - | ^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `foobar` + | ^^^^^^^^^^^^^^^^^^^ | = note: this error originates in the macro `bang_proc_macro2` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a local variable with a similar name exists + | +LL - bang_proc_macro2!(); +LL + foobar; + | error: aborting due to 1 previous error diff --git a/tests/ui/proc-macro/mixed-site-span.stderr b/tests/ui/proc-macro/mixed-site-span.stderr index 97e3f3e3dea8c..fd941f65b788c 100644 --- a/tests/ui/proc-macro/mixed-site-span.stderr +++ b/tests/ui/proc-macro/mixed-site-span.stderr @@ -112,10 +112,13 @@ LL | test!(); = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:69:5 + --> $DIR/mixed-site-span.rs:67:9 | +LL | invoke_with_ident!{$crate call proc_macro_item} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `proc_macro_item` in the root +LL | }} LL | test!(); - | ^^^^^^^ no `proc_macro_item` in the root + | ------- in this macro invocation | = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -262,10 +265,13 @@ LL + token_site_span::TokenItem as _ | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:110:5 + --> $DIR/mixed-site-span.rs:106:9 | +LL | invoke_with_ident!{$crate mixed TokenItem} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `TokenItem` in the root +... LL | test!(); - | ^^^^^^^ no `TokenItem` in the root + | ------- in this macro invocation | = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider importing this struct instead @@ -417,10 +423,13 @@ LL + ($m:ident $s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:150:5 + --> $DIR/mixed-site-span.rs:145:9 | +LL | invoke_with_ident!{$crate mixed ItemUse} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root +... LL | test!(); - | ^^^^^^^ no `ItemUse` in the root + | ------- in this macro invocation | = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider importing this struct instead @@ -447,10 +456,13 @@ LL + ItemUse as _ | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:150:5 + --> $DIR/mixed-site-span.rs:148:9 | +LL | invoke_with_ident!{$crate call ItemUse} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ItemUse` in the root +LL | }} LL | test!(); - | ^^^^^^^ no `ItemUse` in the root + | ------- in this macro invocation | = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider importing this struct instead @@ -592,7 +604,7 @@ error[E0425]: cannot find value `local_use` in this scope --> $DIR/mixed-site-span.rs:23:9 | LL | proc_macro_rules!(); - | ^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `local_def` + | ^^^^^^^^^^^^^^^^^^^ | help: an identifier with the same name exists, but is not accessible due to macro hygiene --> $DIR/mixed-site-span.rs:22:13 @@ -600,12 +612,17 @@ help: an identifier with the same name exists, but is not accessible due to macr LL | let local_use = 1; | ^^^^^^^^^ = note: this error originates in the macro `proc_macro_rules` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a local variable with a similar name exists + | +LL - proc_macro_rules!(); +LL + local_def; + | error[E0425]: cannot find value `local_def` in this scope --> $DIR/mixed-site-span.rs:28:9 | LL | local_def; - | ^^^^^^^^^ help: a local variable with a similar name exists: `local_use` + | ^^^^^^^^^ | help: an identifier with the same name is defined here, but is not accessible due to macro hygiene --> $DIR/mixed-site-span.rs:23:9 @@ -613,6 +630,11 @@ help: an identifier with the same name is defined here, but is not accessible du LL | proc_macro_rules!(); | ^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `proc_macro_rules` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a local variable with a similar name exists + | +LL - local_def; +LL + local_use; + | error: aborting due to 52 previous errors diff --git a/tests/ui/proc-macro/parent-source-spans.stderr b/tests/ui/proc-macro/parent-source-spans.stderr index 28a70eea873d1..87b8dae74f489 100644 --- a/tests/ui/proc-macro/parent-source-spans.stderr +++ b/tests/ui/proc-macro/parent-source-spans.stderr @@ -140,7 +140,7 @@ error[E0425]: cannot find value `ok` in this scope --> $DIR/parent-source-spans.rs:30:5 | LL | parent_source_spans!($($tokens)*); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | one!("hello", "world"); | ---------------------- in this macro invocation @@ -150,12 +150,17 @@ LL | one!("hello", "world"); = note: similarly named tuple variant `Ok` defined here | = note: this error originates in the macro `parent_source_spans` which comes from the expansion of the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a tuple variant with a similar name exists + | +LL - parent_source_spans!($($tokens)*); +LL + Ok; + | error[E0425]: cannot find value `ok` in this scope --> $DIR/parent-source-spans.rs:30:5 | LL | parent_source_spans!($($tokens)*); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | two!("yay", "rust"); | ------------------- in this macro invocation @@ -165,12 +170,17 @@ LL | two!("yay", "rust"); = note: similarly named tuple variant `Ok` defined here | = note: this error originates in the macro `parent_source_spans` which comes from the expansion of the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a tuple variant with a similar name exists + | +LL - parent_source_spans!($($tokens)*); +LL + Ok; + | error[E0425]: cannot find value `ok` in this scope --> $DIR/parent-source-spans.rs:30:5 | LL | parent_source_spans!($($tokens)*); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | three!("hip", "hop"); | -------------------- in this macro invocation @@ -180,6 +190,11 @@ LL | three!("hip", "hop"); = note: similarly named tuple variant `Ok` defined here | = note: this error originates in the macro `parent_source_spans` which comes from the expansion of the macro `three` (in Nightly builds, run with -Z macro-backtrace for more info) +help: a tuple variant with a similar name exists + | +LL - parent_source_spans!($($tokens)*); +LL + Ok; + | error: aborting due to 21 previous errors diff --git a/tests/ui/proc-macro/resolve-error.stderr b/tests/ui/proc-macro/resolve-error.stderr index 45b71a3e7b3af..7efb751caaec3 100644 --- a/tests/ui/proc-macro/resolve-error.stderr +++ b/tests/ui/proc-macro/resolve-error.stderr @@ -2,12 +2,18 @@ error: cannot find macro `bang_proc_macrp` in this scope --> $DIR/resolve-error.rs:60:5 | LL | bang_proc_macrp!(); - | ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `bang_proc_macro` + | ^^^^^^^^^^^^^^^ | ::: $DIR/auxiliary/test-macros.rs:10:1 | LL | pub fn empty(_: TokenStream) -> TokenStream { | ------------------------------------------- similarly named macro `bang_proc_macro` defined here + | +help: a macro with a similar name exists + | +LL - bang_proc_macrp!(); +LL + bang_proc_macro!(); + | error: cannot find macro `Dlona` in this scope --> $DIR/resolve-error.rs:57:5 @@ -22,7 +28,13 @@ LL | macro_rules! attr_proc_mac { | -------------------------- similarly named macro `attr_proc_mac` defined here ... LL | attr_proc_macra!(); - | ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `attr_proc_mac` + | ^^^^^^^^^^^^^^^ + | +help: a macro with a similar name exists + | +LL - attr_proc_macra!(); +LL + attr_proc_mac!(); + | error: cannot find macro `FooWithLongNama` in this scope --> $DIR/resolve-error.rs:51:5 @@ -31,7 +43,13 @@ LL | macro_rules! FooWithLongNam { | --------------------------- similarly named macro `FooWithLongNam` defined here ... LL | FooWithLongNama!(); - | ^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `FooWithLongNam` + | ^^^^^^^^^^^^^^^ + | +help: a macro with a similar name exists + | +LL - FooWithLongNama!(); +LL + FooWithLongNam!(); + | error: cannot find derive macro `attr_proc_macra` in this scope --> $DIR/resolve-error.rs:45:10 @@ -51,18 +69,24 @@ error: cannot find derive macro `Dlona` in this scope --> $DIR/resolve-error.rs:40:10 | LL | #[derive(Dlona)] - | ^^^^^ help: a derive macro with a similar name exists: `Clona` + | ^^^^^ | ::: $DIR/auxiliary/derive-clona.rs:6:1 | LL | pub fn derive_clonea(input: TokenStream) -> TokenStream { | ------------------------------------------------------- similarly named derive macro `Clona` defined here + | +help: a derive macro with a similar name exists + | +LL - #[derive(Dlona)] +LL + #[derive(Clona)] + | error: cannot find derive macro `Dlona` in this scope --> $DIR/resolve-error.rs:40:10 | LL | #[derive(Dlona)] - | ^^^^^ help: a derive macro with a similar name exists: `Clona` + | ^^^^^ | ::: $DIR/auxiliary/derive-clona.rs:6:1 | @@ -70,28 +94,43 @@ LL | pub fn derive_clonea(input: TokenStream) -> TokenStream { | ------------------------------------------------------- similarly named derive macro `Clona` defined here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: a derive macro with a similar name exists + | +LL - #[derive(Dlona)] +LL + #[derive(Clona)] + | error: cannot find derive macro `Dlone` in this scope --> $DIR/resolve-error.rs:35:10 | LL | #[derive(Dlone)] - | ^^^^^ help: a derive macro with a similar name exists: `Clone` + | ^^^^^ | --> $SRC_DIR/core/src/clone.rs:LL:COL | = note: similarly named derive macro `Clone` defined here +help: a derive macro with a similar name exists + | +LL - #[derive(Dlone)] +LL + #[derive(Clone)] + | error: cannot find derive macro `Dlone` in this scope --> $DIR/resolve-error.rs:35:10 | LL | #[derive(Dlone)] - | ^^^^^ help: a derive macro with a similar name exists: `Clone` + | ^^^^^ | --> $SRC_DIR/core/src/clone.rs:LL:COL | = note: similarly named derive macro `Clone` defined here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: a derive macro with a similar name exists + | +LL - #[derive(Dlone)] +LL + #[derive(Clone)] + | error: cannot find attribute `FooWithLongNan` in this scope --> $DIR/resolve-error.rs:32:3 @@ -103,29 +142,41 @@ error: cannot find attribute `attr_proc_macra` in this scope --> $DIR/resolve-error.rs:28:3 | LL | #[attr_proc_macra] - | ^^^^^^^^^^^^^^^ help: an attribute macro with a similar name exists: `attr_proc_macro` + | ^^^^^^^^^^^^^^^ | ::: $DIR/auxiliary/test-macros.rs:15:1 | LL | pub fn empty_attr(_: TokenStream, _: TokenStream) -> TokenStream { | ---------------------------------------------------------------- similarly named attribute macro `attr_proc_macro` defined here + | +help: an attribute macro with a similar name exists + | +LL - #[attr_proc_macra] +LL + #[attr_proc_macro] + | error: cannot find derive macro `FooWithLongNan` in this scope --> $DIR/resolve-error.rs:22:10 | LL | #[derive(FooWithLongNan)] - | ^^^^^^^^^^^^^^ help: a derive macro with a similar name exists: `FooWithLongName` + | ^^^^^^^^^^^^^^ | ::: $DIR/auxiliary/derive-foo.rs:6:1 | LL | pub fn derive_foo(input: TokenStream) -> TokenStream { | ---------------------------------------------------- similarly named derive macro `FooWithLongName` defined here + | +help: a derive macro with a similar name exists + | +LL - #[derive(FooWithLongNan)] +LL + #[derive(FooWithLongName)] + | error: cannot find derive macro `FooWithLongNan` in this scope --> $DIR/resolve-error.rs:22:10 | LL | #[derive(FooWithLongNan)] - | ^^^^^^^^^^^^^^ help: a derive macro with a similar name exists: `FooWithLongName` + | ^^^^^^^^^^^^^^ | ::: $DIR/auxiliary/derive-foo.rs:6:1 | @@ -133,6 +184,11 @@ LL | pub fn derive_foo(input: TokenStream) -> TokenStream { | ---------------------------------------------------- similarly named derive macro `FooWithLongName` defined here | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: a derive macro with a similar name exists + | +LL - #[derive(FooWithLongNan)] +LL + #[derive(FooWithLongName)] + | error: aborting due to 14 previous errors diff --git a/tests/ui/regions/outlives-with-missing.stderr b/tests/ui/regions/outlives-with-missing.stderr index b8762e9cb8f3e..25fac19706350 100644 --- a/tests/ui/regions/outlives-with-missing.stderr +++ b/tests/ui/regions/outlives-with-missing.stderr @@ -5,7 +5,13 @@ LL | impl HandlerWrapper { | - similarly named type parameter `H` defined here ... LL | T: Send + Sync + 'static, - | ^ help: a type parameter with a similar name exists: `H` + | ^ + | +help: a type parameter with a similar name exists + | +LL - T: Send + Sync + 'static, +LL + H: Send + Sync + 'static, + | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/112590-2.stderr b/tests/ui/resolve/112590-2.stderr index 28d23ccf85375..d6f4a8f22a456 100644 --- a/tests/ui/resolve/112590-2.stderr +++ b/tests/ui/resolve/112590-2.stderr @@ -63,12 +63,14 @@ error[E0433]: failed to resolve: use of unresolved module or unlinked crate `vec --> $DIR/112590-2.rs:24:24 | LL | let _t: Vec = vec::new(); - | ^^^ - | | - | use of unresolved module or unlinked crate `vec` - | help: a struct with a similar name exists (notice the capitalization): `Vec` + | ^^^ use of unresolved module or unlinked crate `vec` | = help: you might be missing a crate named `vec` +help: a struct with a similar name exists (notice the capitalization) + | +LL - let _t: Vec = vec::new(); +LL + let _t: Vec = Vec::new(); + | error: aborting due to 5 previous errors diff --git a/tests/ui/resolve/issue-10200.stderr b/tests/ui/resolve/issue-10200.stderr index 4b6d9b6f1dfa6..62731960191ff 100644 --- a/tests/ui/resolve/issue-10200.stderr +++ b/tests/ui/resolve/issue-10200.stderr @@ -5,9 +5,14 @@ LL | struct Foo(bool); | ----------------- similarly named tuple struct `Foo` defined here ... LL | foo(x) - | ^^^ help: a tuple struct with a similar name exists (notice the capitalization): `Foo` + | ^^^ | = note: function calls are not allowed in patterns: +help: a tuple struct with a similar name exists (notice the capitalization) + | +LL - foo(x) +LL + Foo(x) + | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/issue-49074.stderr b/tests/ui/resolve/issue-49074.stderr index bbfeb4ea9483a..16a4ede0c0b54 100644 --- a/tests/ui/resolve/issue-49074.stderr +++ b/tests/ui/resolve/issue-49074.stderr @@ -10,7 +10,13 @@ error: cannot find attribute `marco_use` in this scope --> $DIR/issue-49074.rs:3:3 | LL | #[marco_use] // typo - | ^^^^^^^^^ help: a built-in attribute with a similar name exists: `macro_use` + | ^^^^^^^^^ + | +help: a built-in attribute with a similar name exists + | +LL - #[marco_use] // typo +LL + #[macro_use] // typo + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/levenshtein.stderr b/tests/ui/resolve/levenshtein.stderr index 7a1abd1343303..48515b9e6bd51 100644 --- a/tests/ui/resolve/levenshtein.stderr +++ b/tests/ui/resolve/levenshtein.stderr @@ -2,7 +2,13 @@ error[E0425]: cannot find type `esize` in this scope --> $DIR/levenshtein.rs:5:11 | LL | fn foo(c: esize) {} // Misspelled primitive type name. - | ^^^^^ help: a builtin type with a similar name exists: `isize` + | ^^^^^ + | +help: a builtin type with a similar name exists + | +LL - fn foo(c: esize) {} // Misspelled primitive type name. +LL + fn foo(c: isize) {} // Misspelled primitive type name. + | error[E0425]: cannot find type `Baz` in this scope --> $DIR/levenshtein.rs:10:10 @@ -11,17 +17,28 @@ LL | enum Bar { } | -------- similarly named enum `Bar` defined here LL | LL | type A = Baz; // Misspelled type name. - | ^^^ help: an enum with a similar name exists: `Bar` + | ^^^ + | +help: an enum with a similar name exists + | +LL - type A = Baz; // Misspelled type name. +LL + type A = Bar; // Misspelled type name. + | error[E0425]: cannot find type `Opiton` in this scope --> $DIR/levenshtein.rs:12:10 | LL | type B = Opiton; // Misspelled type name from the prelude. - | ^^^^^^ help: an enum with a similar name exists: `Option` + | ^^^^^^ | --> $SRC_DIR/core/src/option.rs:LL:COL | = note: similarly named enum `Option` defined here +help: an enum with a similar name exists + | +LL - type B = Opiton; // Misspelled type name from the prelude. +LL + type B = Option; // Misspelled type name from the prelude. + | error[E0425]: cannot find type `Baz` in this scope --> $DIR/levenshtein.rs:16:14 @@ -36,7 +53,12 @@ LL | const MAX_ITEM: usize = 10; | --------------------------- similarly named constant `MAX_ITEM` defined here ... LL | let v = [0u32; MAXITEM]; // Misspelled constant name. - | ^^^^^^^ help: a constant with a similar name exists: `MAX_ITEM` + | ^^^^^^^ + | +help: a constant with a similar name exists + | +LL | let v = [0u32; MAX_ITEM]; // Misspelled constant name. + | + error[E0425]: cannot find type `first` in module `m` --> $DIR/levenshtein.rs:28:15 @@ -45,7 +67,13 @@ LL | pub struct First; | ----------------- similarly named struct `First` defined here ... LL | let b: m::first = m::second; // Misspelled item in module. - | ^^^^^ help: a struct with a similar name exists (notice the capitalization): `First` + | ^^^^^ + | +help: a struct with a similar name exists (notice the capitalization) + | +LL - let b: m::first = m::second; // Misspelled item in module. +LL + let b: m::First = m::second; // Misspelled item in module. + | error[E0425]: cannot find value `second` in module `m` --> $DIR/levenshtein.rs:28:26 @@ -54,7 +82,13 @@ LL | pub struct Second; | ------------------ similarly named unit struct `Second` defined here ... LL | let b: m::first = m::second; // Misspelled item in module. - | ^^^^^^ help: a unit struct with a similar name exists (notice the capitalization): `Second` + | ^^^^^^ + | +help: a unit struct with a similar name exists (notice the capitalization) + | +LL - let b: m::first = m::second; // Misspelled item in module. +LL + let b: m::first = m::Second; // Misspelled item in module. + | error[E0425]: cannot find function `foobar` in this scope --> $DIR/levenshtein.rs:26:5 @@ -63,7 +97,12 @@ LL | fn foo_bar() {} | ------------ similarly named function `foo_bar` defined here ... LL | foobar(); // Misspelled function name. - | ^^^^^^ help: a function with a similar name exists: `foo_bar` + | ^^^^^^ + | +help: a function with a similar name exists + | +LL | foo_bar(); // Misspelled function name. + | + error: aborting due to 8 previous errors diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr index 81356c5040f8b..5349108065dc9 100644 --- a/tests/ui/resolve/privacy-enum-ctor.stderr +++ b/tests/ui/resolve/privacy-enum-ctor.stderr @@ -149,13 +149,18 @@ LL | pub enum E { | ---------- similarly named enum `E` defined here ... LL | let _: Z = m::n::Z; - | ^ help: an enum with a similar name exists: `E` + | ^ | note: enum `m::Z` exists but is inaccessible --> $DIR/privacy-enum-ctor.rs:12:9 | LL | pub(in crate::m) enum Z { | ^^^^^^^^^^^^^^^^^^^^^^^ not accessible +help: an enum with a similar name exists + | +LL - let _: Z = m::n::Z; +LL + let _: E = m::n::Z; + | error[E0423]: expected value, found enum `m::n::Z` --> $DIR/privacy-enum-ctor.rs:58:16 @@ -192,13 +197,18 @@ LL | pub enum E { | ---------- similarly named enum `E` defined here ... LL | let _: Z = m::n::Z::Fn; - | ^ help: an enum with a similar name exists: `E` + | ^ | note: enum `m::Z` exists but is inaccessible --> $DIR/privacy-enum-ctor.rs:12:9 | LL | pub(in crate::m) enum Z { | ^^^^^^^^^^^^^^^^^^^^^^^ not accessible +help: an enum with a similar name exists + | +LL - let _: Z = m::n::Z::Fn; +LL + let _: E = m::n::Z::Fn; + | error[E0425]: cannot find type `Z` in this scope --> $DIR/privacy-enum-ctor.rs:65:12 @@ -207,13 +217,18 @@ LL | pub enum E { | ---------- similarly named enum `E` defined here ... LL | let _: Z = m::n::Z::Struct; - | ^ help: an enum with a similar name exists: `E` + | ^ | note: enum `m::Z` exists but is inaccessible --> $DIR/privacy-enum-ctor.rs:12:9 | LL | pub(in crate::m) enum Z { | ^^^^^^^^^^^^^^^^^^^^^^^ not accessible +help: an enum with a similar name exists + | +LL - let _: Z = m::n::Z::Struct; +LL + let _: E = m::n::Z::Struct; + | error[E0425]: cannot find type `Z` in this scope --> $DIR/privacy-enum-ctor.rs:69:12 @@ -222,13 +237,18 @@ LL | pub enum E { | ---------- similarly named enum `E` defined here ... LL | let _: Z = m::n::Z::Unit {}; - | ^ help: an enum with a similar name exists: `E` + | ^ | note: enum `m::Z` exists but is inaccessible --> $DIR/privacy-enum-ctor.rs:12:9 | LL | pub(in crate::m) enum Z { | ^^^^^^^^^^^^^^^^^^^^^^^ not accessible +help: an enum with a similar name exists + | +LL - let _: Z = m::n::Z::Unit {}; +LL + let _: E = m::n::Z::Unit {}; + | error[E0603]: enum `Z` is private --> $DIR/privacy-enum-ctor.rs:58:22 diff --git a/tests/ui/resolve/privacy-struct-ctor.stderr b/tests/ui/resolve/privacy-struct-ctor.stderr index 96c3e6e5122df..5a01d51d24ffd 100644 --- a/tests/ui/resolve/privacy-struct-ctor.stderr +++ b/tests/ui/resolve/privacy-struct-ctor.stderr @@ -5,10 +5,13 @@ LL | pub struct S(u8); | ----------------- similarly named tuple struct `S` defined here ... LL | Z; - | ^ - | | - | constructor is not visible here due to private fields - | help: a tuple struct with a similar name exists: `S` + | ^ constructor is not visible here due to private fields + | +help: a tuple struct with a similar name exists + | +LL - Z; +LL + S; + | error[E0423]: expected value, found struct `S` --> $DIR/privacy-struct-ctor.rs:34:5 diff --git a/tests/ui/resolve/suggestions/suggest-path-instead-of-mod-dot-item.stderr b/tests/ui/resolve/suggestions/suggest-path-instead-of-mod-dot-item.stderr index 5db943cd10d0f..89c0cd54faeee 100644 --- a/tests/ui/resolve/suggestions/suggest-path-instead-of-mod-dot-item.stderr +++ b/tests/ui/resolve/suggestions/suggest-path-instead-of-mod-dot-item.stderr @@ -73,9 +73,13 @@ LL | pub const I: i32 = 1; | --------------------- similarly named constant `I` defined here ... LL | v.push(a::b); - | ^^^- - | | - | help: a constant with a similar name exists: `I` + | ^^^^ + | +help: a constant with a similar name exists + | +LL - v.push(a::b); +LL + v.push(a::I); + | error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:52:5 @@ -104,9 +108,13 @@ LL | pub const I: i32 = 1; | --------------------- similarly named constant `I` defined here ... LL | a::b - | ^^^- - | | - | help: a constant with a similar name exists: `I` + | ^^^^ + | +help: a constant with a similar name exists + | +LL - a::b +LL + a::I + | error[E0423]: expected function, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:65:5 @@ -115,9 +123,13 @@ LL | pub const I: i32 = 1; | --------------------- similarly named constant `I` defined here ... LL | a::b() - | ^^^- - | | - | help: a constant with a similar name exists: `I` + | ^^^^ + | +help: a constant with a similar name exists + | +LL - a::b() +LL + a::I() + | error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:72:9 diff --git a/tests/ui/resolve/tuple-struct-alias.stderr b/tests/ui/resolve/tuple-struct-alias.stderr index bf026a499b8c2..89b536708372b 100644 --- a/tests/ui/resolve/tuple-struct-alias.stderr +++ b/tests/ui/resolve/tuple-struct-alias.stderr @@ -5,7 +5,13 @@ LL | struct S(u8, u16); | ------------------ similarly named tuple struct `S` defined here ... LL | A(..) => {} - | ^ help: a tuple struct with a similar name exists: `S` + | ^ + | +help: a tuple struct with a similar name exists + | +LL - A(..) => {} +LL + S(..) => {} + | error[E0423]: expected function, tuple struct or tuple variant, found type alias `A` --> $DIR/tuple-struct-alias.rs:5:13 diff --git a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr index 039410f8795f8..9c874d980cbe1 100644 --- a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr +++ b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr @@ -5,7 +5,13 @@ LL | config: String, | ------ a field by that name exists in `Self` ... LL | Self { config } - | ^^^^^^ help: a local variable with a similar name exists: `cofig` + | ^^^^^^ + | +help: a local variable with a similar name exists + | +LL - Self { config } +LL + Self { cofig } + | error[E0425]: cannot find value `config` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:11:20 @@ -14,15 +20,26 @@ LL | config: String, | ------ a field by that name exists in `Self` ... LL | println!("{config}"); - | ^^^^^^ help: a local variable with a similar name exists: `cofig` + | ^^^^^^ + | +help: a local variable with a similar name exists + | +LL - println!("{config}"); +LL + println!("{cofig}"); + | error[E0425]: cannot find value `config` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:15:20 | LL | println!("{config}"); - | ^^^^^^ help: a local variable with a similar name exists: `cofig` + | ^^^^^^ | = help: you might have meant to use the available field in a format string: `"{}", self.config` +help: a local variable with a similar name exists + | +LL - println!("{config}"); +LL + println!("{cofig}"); + | error[E0425]: cannot find value `bah` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:33:9 diff --git a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr index 2d0d0d0f38670..fef1f52b86b7e 100644 --- a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr +++ b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr @@ -2,10 +2,12 @@ error[E0433]: failed to resolve: could not find `Struc` in `module` --> $DIR/typo-suggestion-mistyped-in-path.rs:35:13 | LL | module::Struc::foo(); - | ^^^^^ - | | - | could not find `Struc` in `module` - | help: a struct with a similar name exists: `Struct` + | ^^^^^ could not find `Struc` in `module` + | +help: a struct with a similar name exists + | +LL | module::Struct::foo(); + | + error[E0599]: no function or associated item named `fob` found for struct `Struct` in the current scope --> $DIR/typo-suggestion-mistyped-in-path.rs:23:13 @@ -26,10 +28,12 @@ error[E0433]: failed to resolve: use of undeclared type `Struc` --> $DIR/typo-suggestion-mistyped-in-path.rs:27:5 | LL | Struc::foo(); - | ^^^^^ - | | - | use of undeclared type `Struc` - | help: a struct with a similar name exists: `Struct` + | ^^^^^ use of undeclared type `Struc` + | +help: a struct with a similar name exists + | +LL | Struct::foo(); + | + error[E0433]: failed to resolve: use of unresolved module or unlinked crate `modul` --> $DIR/typo-suggestion-mistyped-in-path.rs:31:5 @@ -46,10 +50,12 @@ error[E0433]: failed to resolve: use of undeclared type `Trai` --> $DIR/typo-suggestion-mistyped-in-path.rs:39:5 | LL | Trai::foo(); - | ^^^^ - | | - | use of undeclared type `Trai` - | help: a trait with a similar name exists: `Trait` + | ^^^^ use of undeclared type `Trai` + | +help: a trait with a similar name exists + | +LL | Trait::foo(); + | + error: aborting due to 5 previous errors diff --git a/tests/ui/span/macro-span-caller-replacement.rs b/tests/ui/span/macro-span-caller-replacement.rs new file mode 100644 index 0000000000000..8e7239699cd15 --- /dev/null +++ b/tests/ui/span/macro-span-caller-replacement.rs @@ -0,0 +1,16 @@ +macro_rules! macro_with_format { () => { + fn check_5(arg : usize) -> String { + let s : &str; + if arg < 5 { + s = format!("{arg}"); //~ ERROR mismatched types + } else { + s = String::new(); //~ ERROR mismatched types + } + String::from(s) + } +}} + +fn main() { + macro_with_format!(); + println!( "{}", check_5(6) ); +} diff --git a/tests/ui/span/macro-span-caller-replacement.stderr b/tests/ui/span/macro-span-caller-replacement.stderr new file mode 100644 index 0000000000000..43be48a9e362e --- /dev/null +++ b/tests/ui/span/macro-span-caller-replacement.stderr @@ -0,0 +1,32 @@ +error[E0308]: mismatched types + --> $DIR/macro-span-caller-replacement.rs:5:17 + | +LL | s = format!("{arg}"); + | ^^^^^^^^^^^^^^^^ expected `&str`, found `String` +... +LL | macro_with_format!(); + | -------------------- in this macro invocation + | + = note: this error originates in the macro `format` which comes from the expansion of the macro `macro_with_format` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> $DIR/macro-span-caller-replacement.rs:7:17 + | +LL | let s : &str; + | ---- expected due to this type +... +LL | s = String::new(); + | ^^^^^^^^^^^^^ expected `&str`, found `String` +... +LL | macro_with_format!(); + | -------------------- in this macro invocation + | + = note: this error originates in the macro `macro_with_format` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider borrowing here + | +LL | s = &String::new(); + | + + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/span/multiline-span-simple.stderr b/tests/ui/span/multiline-span-simple.stderr index af04ceaf8097c..e013b3c06bc1b 100644 --- a/tests/ui/span/multiline-span-simple.stderr +++ b/tests/ui/span/multiline-span-simple.stderr @@ -8,13 +8,19 @@ LL | foo(1 as u32 + help: the following other types implement trait `Add` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&u32` implements `Add` + = note: `u32` implements `Add` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&u32` implements `Add` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&u32` implements `Add` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `u32` implements `Add<&u32>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `u32` implements `Add` + = note: `&u32` implements `Add` = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/span/suggestion-raw-68962.stderr b/tests/ui/span/suggestion-raw-68962.stderr index 2e25f5cbdf58d..2271acf15a802 100644 --- a/tests/ui/span/suggestion-raw-68962.stderr +++ b/tests/ui/span/suggestion-raw-68962.stderr @@ -2,7 +2,13 @@ error[E0425]: cannot find value `fina` in this scope --> $DIR/suggestion-raw-68962.rs:7:5 | LL | fina; - | ^^^^ help: a local variable with a similar name exists: `r#final` + | ^^^^ + | +help: a local variable with a similar name exists + | +LL - fina; +LL + r#final; + | error[E0425]: cannot find function `f` in this scope --> $DIR/suggestion-raw-68962.rs:10:5 @@ -11,7 +17,13 @@ LL | fn r#fn() {} | --------- similarly named function `r#fn` defined here ... LL | f(); - | ^ help: a function with a similar name exists: `r#fn` + | ^ + | +help: a function with a similar name exists + | +LL - f(); +LL + r#fn(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/span/typo-suggestion.stderr b/tests/ui/span/typo-suggestion.stderr index 61d4e06119c4f..1f679221c0026 100644 --- a/tests/ui/span/typo-suggestion.stderr +++ b/tests/ui/span/typo-suggestion.stderr @@ -8,7 +8,13 @@ error[E0425]: cannot find value `fob` in this scope --> $DIR/typo-suggestion.rs:8:26 | LL | println!("Hello {}", fob); - | ^^^ help: a local variable with a similar name exists: `foo` + | ^^^ + | +help: a local variable with a similar name exists + | +LL - println!("Hello {}", fob); +LL + println!("Hello {}", foo); + | error: aborting due to 2 previous errors diff --git a/tests/ui/stability-attribute/issue-109177.stderr b/tests/ui/stability-attribute/issue-109177.stderr index 9c2ac591ace05..6f89bde7f8945 100644 --- a/tests/ui/stability-attribute/issue-109177.stderr +++ b/tests/ui/stability-attribute/issue-109177.stderr @@ -2,12 +2,18 @@ error[E0425]: cannot find function `foo1` in crate `similar_unstable_method` --> $DIR/issue-109177.rs:7:30 | LL | similar_unstable_method::foo1(); - | ^^^^ help: a function with a similar name exists: `foo` + | ^^^^ | ::: $DIR/auxiliary/similar-unstable-method.rs:5:1 | LL | pub fn foo() {} | ------------ similarly named function `foo` defined here + | +help: a function with a similar name exists + | +LL - similar_unstable_method::foo1(); +LL + similar_unstable_method::foo(); + | error[E0599]: no method named `foo1` found for struct `Foo` in the current scope --> $DIR/issue-109177.rs:11:9 diff --git a/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr index 6a8a7b152c547..93e189ffa0d3f 100644 --- a/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr +++ b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr @@ -6,6 +6,9 @@ LL | core::sync::atomic::AtomicU64::from_mut(&mut 0u64); | note: if you're trying to build a new `AtomicU64`, consider using `AtomicU64::new` which returns `AtomicU64` --> $SRC_DIR/core/src/sync/atomic.rs:LL:COL + ::: $SRC_DIR/core/src/sync/atomic.rs:LL:COL + | + = note: in this macro invocation = note: this error originates in the macro `atomic_int` (in Nightly builds, run with -Z macro-backtrace for more info) help: there is an associated function `from` with a similar name | diff --git a/tests/ui/structs/struct-fields-shorthand-unresolved.stderr b/tests/ui/structs/struct-fields-shorthand-unresolved.stderr index b485c17c1b270..5d8321130958a 100644 --- a/tests/ui/structs/struct-fields-shorthand-unresolved.stderr +++ b/tests/ui/structs/struct-fields-shorthand-unresolved.stderr @@ -2,7 +2,13 @@ error[E0425]: cannot find value `y` in this scope --> $DIR/struct-fields-shorthand-unresolved.rs:10:9 | LL | y - | ^ help: a local variable with a similar name exists: `x` + | ^ + | +help: a local variable with a similar name exists + | +LL - y +LL + x + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/attribute-typos.stderr b/tests/ui/suggestions/attribute-typos.stderr index 1816a27dcdc8e..960e0b0f620ff 100644 --- a/tests/ui/suggestions/attribute-typos.stderr +++ b/tests/ui/suggestions/attribute-typos.stderr @@ -8,23 +8,38 @@ error: cannot find attribute `rustc_dumm` in this scope --> $DIR/attribute-typos.rs:7:3 | LL | #[rustc_dumm] - | ^^^^^^^^^^ help: a built-in attribute with a similar name exists: `rustc_dummy` + | ^^^^^^^^^^ + | +help: a built-in attribute with a similar name exists + | +LL | #[rustc_dummy] + | + error: cannot find attribute `tests` in this scope --> $DIR/attribute-typos.rs:4:3 | LL | #[tests] - | ^^^^^ help: an attribute macro with a similar name exists: `test` + | ^^^^^ | --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | = note: similarly named attribute macro `test` defined here +help: an attribute macro with a similar name exists + | +LL - #[tests] +LL + #[test] + | error: cannot find attribute `deprcated` in this scope --> $DIR/attribute-typos.rs:1:3 | LL | #[deprcated] - | ^^^^^^^^^ help: a built-in attribute with a similar name exists: `deprecated` + | ^^^^^^^^^ + | +help: a built-in attribute with a similar name exists + | +LL | #[deprecated] + | + error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/case-difference-suggestions.stderr b/tests/ui/suggestions/case-difference-suggestions.stderr index c3d2410a6eb20..198c3c7a38c91 100644 --- a/tests/ui/suggestions/case-difference-suggestions.stderr +++ b/tests/ui/suggestions/case-difference-suggestions.stderr @@ -2,97 +2,193 @@ error[E0425]: cannot find value `Hello` in this scope --> $DIR/case-difference-suggestions.rs:5:20 | LL | println!("{}", Hello); - | ^^^^^ help: a local variable with a similar name exists: `hello` + | ^^^^^ + | +help: a local variable with a similar name exists + | +LL - println!("{}", Hello); +LL + println!("{}", hello); + | error[E0425]: cannot find value `myvariable` in this scope --> $DIR/case-difference-suggestions.rs:9:20 | LL | println!("{}", myvariable); - | ^^^^^^^^^^ help: a local variable with a similar name exists (notice the capitalization): `myVariable` + | ^^^^^^^^^^ + | +help: a local variable with a similar name exists (notice the capitalization) + | +LL - println!("{}", myvariable); +LL + println!("{}", myVariable); + | error[E0425]: cannot find value `User_Name` in this scope --> $DIR/case-difference-suggestions.rs:13:20 | LL | println!("{}", User_Name); - | ^^^^^^^^^ help: a local variable with a similar name exists: `user_name` + | ^^^^^^^^^ + | +help: a local variable with a similar name exists + | +LL - println!("{}", User_Name); +LL + println!("{}", user_name); + | error[E0425]: cannot find value `foo` in this scope --> $DIR/case-difference-suggestions.rs:17:20 | LL | println!("{}", foo); - | ^^^ help: a local variable with a similar name exists (notice the capitalization): `FOO` + | ^^^ + | +help: a local variable with a similar name exists (notice the capitalization) + | +LL - println!("{}", foo); +LL + println!("{}", FOO); + | error[E0425]: cannot find value `FFOO` in this scope --> $DIR/case-difference-suggestions.rs:22:20 | LL | println!("{}", FFOO); - | ^^^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `FFO0` + | ^^^^ + | +help: a local variable with a similar name exists (notice the digit/letter confusion) + | +LL - println!("{}", FFOO); +LL + println!("{}", FFO0); + | error[E0425]: cannot find value `list` in this scope --> $DIR/case-difference-suggestions.rs:25:20 | LL | println!("{}", list); - | ^^^^ help: a local variable with a similar name exists: `l1st` + | ^^^^ + | +help: a local variable with a similar name exists + | +LL - println!("{}", list); +LL + println!("{}", l1st); + | error[E0425]: cannot find value `SS` in this scope --> $DIR/case-difference-suggestions.rs:28:20 | LL | println!("{}", SS); - | ^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `S5` + | ^^ + | +help: a local variable with a similar name exists (notice the digit/letter confusion) + | +LL - println!("{}", SS); +LL + println!("{}", S5); + | error[E0425]: cannot find value `a55` in this scope --> $DIR/case-difference-suggestions.rs:31:20 | LL | println!("{}", a55); - | ^^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `aS5` + | ^^^ + | +help: a local variable with a similar name exists (notice the digit/letter confusion) + | +LL - println!("{}", a55); +LL + println!("{}", aS5); + | error[E0425]: cannot find value `BB` in this scope --> $DIR/case-difference-suggestions.rs:34:20 | LL | println!("{}", BB); - | ^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `B8` + | ^^ + | +help: a local variable with a similar name exists (notice the digit/letter confusion) + | +LL - println!("{}", BB); +LL + println!("{}", B8); + | error[E0425]: cannot find value `gg` in this scope --> $DIR/case-difference-suggestions.rs:37:20 | LL | println!("{}", gg); - | ^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `g9` + | ^^ + | +help: a local variable with a similar name exists (notice the digit/letter confusion) + | +LL - println!("{}", gg); +LL + println!("{}", g9); + | error[E0425]: cannot find value `old` in this scope --> $DIR/case-difference-suggestions.rs:40:20 | LL | println!("{}", old); - | ^^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `o1d` + | ^^^ + | +help: a local variable with a similar name exists (notice the digit/letter confusion) + | +LL - println!("{}", old); +LL + println!("{}", o1d); + | error[E0425]: cannot find value `newl` in this scope --> $DIR/case-difference-suggestions.rs:43:20 | LL | println!("{}", newl); - | ^^^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `new1` + | ^^^^ + | +help: a local variable with a similar name exists (notice the digit/letter confusion) + | +LL - println!("{}", newl); +LL + println!("{}", new1); + | error[E0425]: cannot find value `app1e` in this scope --> $DIR/case-difference-suggestions.rs:46:20 | LL | println!("{}", app1e); - | ^^^^^ help: a local variable with a similar name exists (notice the digit/letter confusion): `apple` + | ^^^^^ + | +help: a local variable with a similar name exists (notice the digit/letter confusion) + | +LL - println!("{}", app1e); +LL + println!("{}", apple); + | error[E0425]: cannot find value `A` in this scope --> $DIR/case-difference-suggestions.rs:49:20 | LL | println!("{}", A); - | ^ help: a local variable with a similar name exists: `a` + | ^ + | +help: a local variable with a similar name exists + | +LL - println!("{}", A); +LL + println!("{}", a); + | error[E0425]: cannot find value `world1U` in this scope --> $DIR/case-difference-suggestions.rs:52:20 | LL | println!("{}", world1U); - | ^^^^^^^ help: a local variable with a similar name exists (notice the capitalization and digit/letter confusion): `worldlu` + | ^^^^^^^ + | +help: a local variable with a similar name exists (notice the capitalization and digit/letter confusion) + | +LL - println!("{}", world1U); +LL + println!("{}", worldlu); + | error[E0425]: cannot find value `myv4r1able` in this scope --> $DIR/case-difference-suggestions.rs:55:20 | LL | println!("{}", myv4r1able); - | ^^^^^^^^^^ help: a local variable with a similar name exists (notice the capitalization and digit/letter confusion): `myV4rlable` + | ^^^^^^^^^^ + | +help: a local variable with a similar name exists (notice the capitalization and digit/letter confusion) + | +LL - println!("{}", myv4r1able); +LL + println!("{}", myV4rlable); + | error: aborting due to 16 previous errors diff --git a/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr b/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr index 112ed6fffd504..e54e5acffe8f8 100644 --- a/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr +++ b/tests/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr @@ -2,11 +2,16 @@ error[E0573]: expected type, found module `result` --> $DIR/do-not-attempt-to-add-suggestions-with-no-changes.rs:3:6 | LL | impl result { - | ^^^^^^ help: an enum with a similar name exists: `Result` + | ^^^^^^ | --> $SRC_DIR/core/src/result.rs:LL:COL | = note: similarly named enum `Result` defined here +help: an enum with a similar name exists + | +LL - impl result { +LL + impl Result { + | error[E0573]: expected type, found variant `Err` --> $DIR/do-not-attempt-to-add-suggestions-with-no-changes.rs:4:25 diff --git a/tests/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr b/tests/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr index 46613e8e1b487..0ed657c7fa99b 100644 --- a/tests/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr +++ b/tests/ui/suggestions/dont-suggest-deref-inside-macro-issue-58298.stderr @@ -1,10 +1,13 @@ error[E0308]: mismatched types - --> $DIR/dont-suggest-deref-inside-macro-issue-58298.rs:11:5 + --> $DIR/dont-suggest-deref-inside-macro-issue-58298.rs:5:14 | +LL | warn(format!("unsupported intrinsic {}", $intrinsic)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&str`, found `String` +... LL | / intrinsic_match! { LL | | "abc" LL | | }; - | |_____^ expected `&str`, found `String` + | |_____- in this macro invocation | = note: this error originates in the macro `format` which comes from the expansion of the macro `intrinsic_match` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/suggestions/issue-66968-suggest-sorted-words.stderr b/tests/ui/suggestions/issue-66968-suggest-sorted-words.stderr index ce0087fbfcbab..b55353c9e6e47 100644 --- a/tests/ui/suggestions/issue-66968-suggest-sorted-words.stderr +++ b/tests/ui/suggestions/issue-66968-suggest-sorted-words.stderr @@ -2,7 +2,13 @@ error[E0425]: cannot find value `a_variable_longer_name` in this scope --> $DIR/issue-66968-suggest-sorted-words.rs:3:20 | LL | println!("{}", a_variable_longer_name); - | ^^^^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `a_longer_variable_name` + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: a local variable with a similar name exists + | +LL - println!("{}", a_variable_longer_name); +LL + println!("{}", a_longer_variable_name); + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr index 40936ce1ec34d..660bbc120d0ed 100644 --- a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr +++ b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr @@ -84,11 +84,15 @@ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:19:51 | LL | fn issue_95327() where ::Assoc: String {} - | ^^^^^^ help: a trait with a similar name exists: `ToString` + | ^^^^^^ | --> $SRC_DIR/alloc/src/string.rs:LL:COL | = note: similarly named trait `ToString` defined here +help: a trait with a similar name exists + | +LL | fn issue_95327() where ::Assoc: ToString {} + | ++ error: aborting due to 6 previous errors diff --git a/tests/ui/traits/const-traits/ice-120503-async-const-method.stderr b/tests/ui/traits/const-traits/ice-120503-async-const-method.stderr index e499451d8971b..d2eea3a805d99 100644 --- a/tests/ui/traits/const-traits/ice-120503-async-const-method.stderr +++ b/tests/ui/traits/const-traits/ice-120503-async-const-method.stderr @@ -42,10 +42,16 @@ error[E0425]: cannot find function `main8` in this scope --> $DIR/ice-120503-async-const-method.rs:11:9 | LL | main8().await; - | ^^^^^ help: a function with a similar name exists: `main` + | ^^^^^ ... LL | fn main() {} | --------- similarly named function `main` defined here + | +help: a function with a similar name exists + | +LL - main8().await; +LL + main().await; + | error: aborting due to 5 previous errors diff --git a/tests/ui/traits/const-traits/mismatched_generic_args.stderr b/tests/ui/traits/const-traits/mismatched_generic_args.stderr index 8e12b40381fd2..e8103313dc4f6 100644 --- a/tests/ui/traits/const-traits/mismatched_generic_args.stderr +++ b/tests/ui/traits/const-traits/mismatched_generic_args.stderr @@ -5,7 +5,13 @@ LL | pub fn add(x: Quantity) -> Quantity { | - similarly named const parameter `U` defined here LL | LL | x + y - | ^ help: a const parameter with a similar name exists: `U` + | ^ + | +help: a const parameter with a similar name exists + | +LL - x + y +LL + x + U + | warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/mismatched_generic_args.rs:1:12 diff --git a/tests/ui/traits/impl-for-module.stderr b/tests/ui/traits/impl-for-module.stderr index b715c699e89f1..1011a913a4ab7 100644 --- a/tests/ui/traits/impl-for-module.stderr +++ b/tests/ui/traits/impl-for-module.stderr @@ -5,7 +5,13 @@ LL | trait A { | ------- similarly named trait `A` defined here ... LL | impl A for a { - | ^ help: a trait with a similar name exists: `A` + | ^ + | +help: a trait with a similar name exists + | +LL - impl A for a { +LL + impl A for A { + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr index 15902bf16de5c..c325718b3033e 100644 --- a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr +++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr @@ -8,15 +8,12 @@ LL | #![feature(non_lifetime_binders)] = note: `#[warn(incomplete_features)]` on by default error[E0309]: the placeholder type `F` may not live long enough - --> $DIR/type-match-with-late-bound.rs:8:1 - | -LL | async fn walk2<'a, T: 'a>(_: T) - | ^ -- the placeholder type `F` must be valid for the lifetime `'a` as defined here... - | _| - | | -LL | | where -LL | | for F: 'a, - | |_________________^ ...so that the type `F` will meet its required lifetime bounds... + --> $DIR/type-match-with-late-bound.rs:8:32 + | +LL | async fn walk2<'a, T: 'a>(_: T) + | -- ^ ...so that the type `F` will meet its required lifetime bounds... + | | + | the placeholder type `F` must be valid for the lifetime `'a` as defined here... | note: ...that is required by this bound --> $DIR/type-match-with-late-bound.rs:10:15 diff --git a/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr b/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr index 07a54d574df49..3bae5798d0471 100644 --- a/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr +++ b/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr @@ -24,7 +24,11 @@ LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter()) { | = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>` help: the trait `Iterator` is implemented for `std::slice::Iter<'_, T>` + --> $SRC_DIR/core/src/slice/iter/macros.rs:LL:COL --> $SRC_DIR/core/src/slice/iter.rs:LL:COL + ::: $SRC_DIR/core/src/slice/iter.rs:LL:COL + | + = note: in this macro invocation = note: required for `Zip, &std::slice::Iter<'_, {integer}>>` to implement `Iterator` = note: required for `Zip, &std::slice::Iter<'_, {integer}>>` to implement `IntoIterator` = note: this error originates in the macro `iterator` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -55,7 +59,11 @@ LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter().clone( | = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>` help: the trait `Iterator` is implemented for `std::slice::Iter<'_, T>` + --> $SRC_DIR/core/src/slice/iter/macros.rs:LL:COL --> $SRC_DIR/core/src/slice/iter.rs:LL:COL + ::: $SRC_DIR/core/src/slice/iter.rs:LL:COL + | + = note: in this macro invocation = note: required for `Zip, &std::slice::Iter<'_, {integer}>>` to implement `Iterator` = note: required for `Zip, &std::slice::Iter<'_, {integer}>>` to implement `IntoIterator` = note: this error originates in the macro `iterator` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -68,7 +76,11 @@ LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter()) { | = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>` help: the trait `Iterator` is implemented for `std::slice::Iter<'_, T>` + --> $SRC_DIR/core/src/slice/iter/macros.rs:LL:COL --> $SRC_DIR/core/src/slice/iter.rs:LL:COL + ::: $SRC_DIR/core/src/slice/iter.rs:LL:COL + | + = note: in this macro invocation = note: required for `&std::slice::Iter<'_, {integer}>` to implement `IntoIterator` = note: this error originates in the macro `iterator` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -80,7 +92,11 @@ LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter().clone( | = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>` help: the trait `Iterator` is implemented for `std::slice::Iter<'_, T>` + --> $SRC_DIR/core/src/slice/iter/macros.rs:LL:COL --> $SRC_DIR/core/src/slice/iter.rs:LL:COL + ::: $SRC_DIR/core/src/slice/iter.rs:LL:COL + | + = note: in this macro invocation = note: required for `&std::slice::Iter<'_, {integer}>` to implement `IntoIterator` = note: this error originates in the macro `iterator` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/try-trait/bad-interconversion.stderr b/tests/ui/try-trait/bad-interconversion.stderr index da5c4d03dccbd..61fecaf89917c 100644 --- a/tests/ui/try-trait/bad-interconversion.stderr +++ b/tests/ui/try-trait/bad-interconversion.stderr @@ -13,9 +13,15 @@ help: the following other types implement trait `From` --> $SRC_DIR/core/src/convert/num.rs:LL:COL | = note: `u8` implements `From` + ::: $SRC_DIR/core/src/convert/num.rs:LL:COL + | + = note: in this macro invocation --> $SRC_DIR/core/src/ascii/ascii_char.rs:LL:COL | = note: `u8` implements `From` + ::: $SRC_DIR/core/src/ascii/ascii_char.rs:LL:COL + | + = note: in this macro invocation = note: this error originates in the macro `impl_from` which comes from the expansion of the macro `into_int_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in a function that returns `Result` diff --git a/tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.stderr b/tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.stderr index 7219fda4772a2..6f0c6bb22060a 100644 --- a/tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.stderr +++ b/tests/ui/type-alias-impl-trait/bound-lifetime-through-dyn-trait.stderr @@ -1,8 +1,8 @@ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from `dyn` type - --> $DIR/bound-lifetime-through-dyn-trait.rs:6:71 + --> $DIR/bound-lifetime-through-dyn-trait.rs:6:57 | LL | fn dyn_hoops() -> dyn for<'a> Iterator> { - | ^^ + | ^^^^^^^^^^^^^^--^ `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/bound-lifetime-through-dyn-trait.rs:6:37 diff --git a/tests/ui/type-alias-impl-trait/escaping-bound-var.rs b/tests/ui/type-alias-impl-trait/escaping-bound-var.rs index 31bdd0815ec34..4b17448080ed7 100644 --- a/tests/ui/type-alias-impl-trait/escaping-bound-var.rs +++ b/tests/ui/type-alias-impl-trait/escaping-bound-var.rs @@ -8,7 +8,6 @@ trait Test<'a> {} pub type Foo = impl for<'a> Trait<'a, Assoc = impl Test<'a>>; //~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` -//~| ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` impl Trait<'_> for () { type Assoc = (); diff --git a/tests/ui/type-alias-impl-trait/escaping-bound-var.stderr b/tests/ui/type-alias-impl-trait/escaping-bound-var.stderr index c9f0618639afb..cdbcfa6f3dc95 100644 --- a/tests/ui/type-alias-impl-trait/escaping-bound-var.stderr +++ b/tests/ui/type-alias-impl-trait/escaping-bound-var.stderr @@ -2,7 +2,7 @@ error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `imp --> $DIR/escaping-bound-var.rs:9:47 | LL | pub type Foo = impl for<'a> Trait<'a, Assoc = impl Test<'a>>; - | ^^^^^^^^^^^^^ `impl Trait` implicitly captures all lifetimes in scope + | ^^^^^^^^^^--^ `impl Trait` implicitly captures all lifetimes in scope | note: lifetime declared here --> $DIR/escaping-bound-var.rs:9:25 @@ -10,18 +10,6 @@ note: lifetime declared here LL | pub type Foo = impl for<'a> Trait<'a, Assoc = impl Test<'a>>; | ^^ -error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` - --> $DIR/escaping-bound-var.rs:9:57 - | -LL | pub type Foo = impl for<'a> Trait<'a, Assoc = impl Test<'a>>; - | ^^ - | -note: lifetime declared here - --> $DIR/escaping-bound-var.rs:9:25 - | -LL | pub type Foo = impl for<'a> Trait<'a, Assoc = impl Test<'a>>; - | ^^ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0657`. diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr index 2aacf9698379b..87313e3495249 100644 --- a/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr +++ b/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr @@ -18,10 +18,10 @@ LL | call(operation).await | ^^^^^^^^^^^^^^^ expected `{async fn body of operation()}`, got `FutNothing<'_>` | note: previous use here - --> $DIR/hkl_forbidden4.rs:12:1 + --> $DIR/hkl_forbidden4.rs:12:35 | LL | async fn operation(_: &mut ()) -> () { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^ error: aborting due to 2 previous errors diff --git a/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr b/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr index 2855c90234d21..ca26e3dd03f35 100644 --- a/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr +++ b/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr @@ -9,6 +9,9 @@ LL | 42_i32 help: the trait `PartialEq` is not implemented for `i32` but trait `PartialEq` is implemented for it --> $SRC_DIR/core/src/cmp.rs:LL:COL + ::: $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: in this macro invocation = note: this error originates in the macro `partial_eq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/self-referential-3.stderr b/tests/ui/type-alias-impl-trait/self-referential-3.stderr index 83fed16c0a17b..8592de243adac 100644 --- a/tests/ui/type-alias-impl-trait/self-referential-3.stderr +++ b/tests/ui/type-alias-impl-trait/self-referential-3.stderr @@ -10,6 +10,9 @@ LL | i = help: the trait `PartialEq>` is not implemented for `&i32` help: the trait `PartialEq` is implemented for `i32` --> $SRC_DIR/core/src/cmp.rs:LL:COL + ::: $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: in this macro invocation = note: this error originates in the macro `partial_eq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/self-referential-4.stderr b/tests/ui/type-alias-impl-trait/self-referential-4.stderr index 4176bf7802945..c6bf1973fcbb1 100644 --- a/tests/ui/type-alias-impl-trait/self-referential-4.stderr +++ b/tests/ui/type-alias-impl-trait/self-referential-4.stderr @@ -9,6 +9,9 @@ LL | i = help: the trait `PartialEq>` is not implemented for `&i32` help: the trait `PartialEq` is implemented for `i32` --> $SRC_DIR/core/src/cmp.rs:LL:COL + ::: $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: in this macro invocation = note: this error originates in the macro `partial_eq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `&i32` with `Foo<'static, 'b>` @@ -22,6 +25,9 @@ LL | i = help: the trait `PartialEq>` is not implemented for `&i32` help: the trait `PartialEq` is implemented for `i32` --> $SRC_DIR/core/src/cmp.rs:LL:COL + ::: $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: in this macro invocation = note: this error originates in the macro `partial_eq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `&i32` with `Moo<'static, 'a>` @@ -35,6 +41,9 @@ LL | i = help: the trait `PartialEq>` is not implemented for `&i32` help: the trait `PartialEq` is implemented for `i32` --> $SRC_DIR/core/src/cmp.rs:LL:COL + ::: $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: in this macro invocation = note: this error originates in the macro `partial_eq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/type-alias-impl-trait/self-referential.stderr b/tests/ui/type-alias-impl-trait/self-referential.stderr index dc5b9ba7b4426..7b4e6e9cac528 100644 --- a/tests/ui/type-alias-impl-trait/self-referential.stderr +++ b/tests/ui/type-alias-impl-trait/self-referential.stderr @@ -10,6 +10,9 @@ LL | i = help: the trait `PartialEq>` is not implemented for `&i32` help: the trait `PartialEq` is implemented for `i32` --> $SRC_DIR/core/src/cmp.rs:LL:COL + ::: $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: in this macro invocation = note: this error originates in the macro `partial_eq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `&i32` with `(i32, Foo<'a, 'b>::{opaque#0}<'a, 'b>)` @@ -24,6 +27,9 @@ LL | (42, i) = help: the trait `PartialEq<(i32, Foo<'a, 'b>::{opaque#0}<'a, 'b>)>` is not implemented for `&i32` help: the trait `PartialEq` is implemented for `i32` --> $SRC_DIR/core/src/cmp.rs:LL:COL + ::: $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: in this macro invocation = note: this error originates in the macro `partial_eq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `&i32` with `(i32, Moo<'b, 'a>::{opaque#0}<'b, 'a>)` @@ -38,6 +44,9 @@ LL | (42, i) = help: the trait `PartialEq<(i32, Moo<'b, 'a>::{opaque#0}<'b, 'a>)>` is not implemented for `&i32` help: the trait `PartialEq` is implemented for `i32` --> $SRC_DIR/core/src/cmp.rs:LL:COL + ::: $SRC_DIR/core/src/cmp.rs:LL:COL + | + = note: in this macro invocation = note: this error originates in the macro `partial_eq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/type-alias-impl-trait/type-error-drop-elaboration.stderr b/tests/ui/type-alias-impl-trait/type-error-drop-elaboration.stderr index 1cb33eabd902e..e5c35d58b72dc 100644 --- a/tests/ui/type-alias-impl-trait/type-error-drop-elaboration.stderr +++ b/tests/ui/type-alias-impl-trait/type-error-drop-elaboration.stderr @@ -2,10 +2,16 @@ error[E0425]: cannot find function `value` in this scope --> $DIR/type-error-drop-elaboration.rs:12:5 | LL | value() - | ^^^^^ help: a constant with a similar name exists: `VALUE` + | ^^^^^ ... LL | const VALUE: Foo = foo(); | ------------------------- similarly named constant `VALUE` defined here + | +help: a constant with a similar name exists + | +LL - value() +LL + VALUE() + | error: aborting due to 1 previous error diff --git a/tests/ui/type-alias/dyn-trait-type-alias-return-type.fixed b/tests/ui/type-alias/dyn-trait-type-alias-return-type.fixed new file mode 100644 index 0000000000000..ba94e1967df39 --- /dev/null +++ b/tests/ui/type-alias/dyn-trait-type-alias-return-type.fixed @@ -0,0 +1,39 @@ +//@ run-rustfix +type T = dyn core::fmt::Debug; +//~^ NOTE this type alias is unsized +//~| NOTE this type alias is unsized +//~| NOTE this type alias is unsized + +fn f() -> Box { loop {} } +//~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time +//~| HELP the trait `Sized` is not implemented for `(dyn Debug + 'static)` +//~| NOTE doesn't have a size known at compile-time +//~| NOTE the return type of a function must have a statically known size +//~| HELP consider boxing the return type + +trait X { + fn f(&self) -> Box { loop {} } + //~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time + //~| HELP the trait `Sized` is not implemented for `(dyn Debug + 'static)` + //~| NOTE doesn't have a size known at compile-time + //~| NOTE the return type of a function must have a statically known size + //~| HELP consider boxing the return type +} + +impl X for () { + fn f(&self) -> Box { loop {} } + //~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time + //~| HELP the trait `Sized` is not implemented for `(dyn Debug + 'static)` + //~| NOTE doesn't have a size known at compile-time + //~| NOTE the return type of a function must have a statically known size + //~| HELP consider boxing the return type +} + +fn main() { + f(); + //~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time + //~| HELP the trait `Sized` is not implemented for `(dyn Debug + 'static)` + //~| NOTE doesn't have a size known at compile-time + //~| NOTE the return type of a function must have a statically known size + ().f(); +} diff --git a/tests/ui/type-alias/dyn-trait-type-alias-return-type.rs b/tests/ui/type-alias/dyn-trait-type-alias-return-type.rs new file mode 100644 index 0000000000000..76f6e7c443424 --- /dev/null +++ b/tests/ui/type-alias/dyn-trait-type-alias-return-type.rs @@ -0,0 +1,39 @@ +//@ run-rustfix +type T = dyn core::fmt::Debug; +//~^ NOTE this type alias is unsized +//~| NOTE this type alias is unsized +//~| NOTE this type alias is unsized + +fn f() -> T { loop {} } +//~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time +//~| HELP the trait `Sized` is not implemented for `(dyn Debug + 'static)` +//~| NOTE doesn't have a size known at compile-time +//~| NOTE the return type of a function must have a statically known size +//~| HELP consider boxing the return type + +trait X { + fn f(&self) -> T { loop {} } + //~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time + //~| HELP the trait `Sized` is not implemented for `(dyn Debug + 'static)` + //~| NOTE doesn't have a size known at compile-time + //~| NOTE the return type of a function must have a statically known size + //~| HELP consider boxing the return type +} + +impl X for () { + fn f(&self) -> T { loop {} } + //~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time + //~| HELP the trait `Sized` is not implemented for `(dyn Debug + 'static)` + //~| NOTE doesn't have a size known at compile-time + //~| NOTE the return type of a function must have a statically known size + //~| HELP consider boxing the return type +} + +fn main() { + f(); + //~^ ERROR the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time + //~| HELP the trait `Sized` is not implemented for `(dyn Debug + 'static)` + //~| NOTE doesn't have a size known at compile-time + //~| NOTE the return type of a function must have a statically known size + ().f(); +} diff --git a/tests/ui/type-alias/dyn-trait-type-alias-return-type.stderr b/tests/ui/type-alias/dyn-trait-type-alias-return-type.stderr new file mode 100644 index 0000000000000..bb6951687048f --- /dev/null +++ b/tests/ui/type-alias/dyn-trait-type-alias-return-type.stderr @@ -0,0 +1,66 @@ +error[E0277]: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time + --> $DIR/dyn-trait-type-alias-return-type.rs:7:11 + | +LL | fn f() -> T { loop {} } + | ^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn Debug + 'static)` +note: this type alias is unsized + --> $DIR/dyn-trait-type-alias-return-type.rs:2:1 + | +LL | type T = dyn core::fmt::Debug; + | ^^^^^^ + = note: the return type of a function must have a statically known size +help: consider boxing the return type, and wrapping all of the returned values in `Box::new` + | +LL | fn f() -> Box { loop {} } + | ++++ + + +error[E0277]: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time + --> $DIR/dyn-trait-type-alias-return-type.rs:24:20 + | +LL | fn f(&self) -> T { loop {} } + | ^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn Debug + 'static)` +note: this type alias is unsized + --> $DIR/dyn-trait-type-alias-return-type.rs:2:1 + | +LL | type T = dyn core::fmt::Debug; + | ^^^^^^ + = note: the return type of a function must have a statically known size +help: consider boxing the return type, and wrapping all of the returned values in `Box::new` + | +LL | fn f(&self) -> Box { loop {} } + | ++++ + + +error[E0277]: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time + --> $DIR/dyn-trait-type-alias-return-type.rs:15:20 + | +LL | fn f(&self) -> T { loop {} } + | ^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn Debug + 'static)` +note: this type alias is unsized + --> $DIR/dyn-trait-type-alias-return-type.rs:2:1 + | +LL | type T = dyn core::fmt::Debug; + | ^^^^^^ + = note: the return type of a function must have a statically known size +help: consider boxing the return type, and wrapping all of the returned values in `Box::new` + | +LL | fn f(&self) -> Box { loop {} } + | ++++ + + +error[E0277]: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time + --> $DIR/dyn-trait-type-alias-return-type.rs:33:5 + | +LL | f(); + | ^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn Debug + 'static)` + = note: the return type of a function must have a statically known size + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/type/issue-7607-1.stderr b/tests/ui/type/issue-7607-1.stderr index ac6034da75f1b..8edd0d31d7918 100644 --- a/tests/ui/type/issue-7607-1.stderr +++ b/tests/ui/type/issue-7607-1.stderr @@ -2,11 +2,16 @@ error[E0425]: cannot find type `Fo` in this scope --> $DIR/issue-7607-1.rs:5:6 | LL | impl Fo { - | ^^ help: a trait with a similar name exists: `Fn` + | ^^ | --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here +help: a trait with a similar name exists + | +LL - impl Fo { +LL + impl Fn { + | error: aborting due to 1 previous error diff --git a/tests/ui/type/type-check-defaults.stderr b/tests/ui/type/type-check-defaults.stderr index 4eab611244a69..a3a2ed5aa725c 100644 --- a/tests/ui/type/type-check-defaults.stderr +++ b/tests/ui/type/type-check-defaults.stderr @@ -86,13 +86,19 @@ LL | trait ProjectionPred> where T::Item : Add {} help: the following other types implement trait `Add` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&i32` implements `Add` + = note: `i32` implements `Add` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&i32` implements `Add` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&i32` implements `Add` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `i32` implements `Add<&i32>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `i32` implements `Add` + = note: `&i32` implements `Add` note: required by a bound in `ProjectionPred` --> $DIR/type-check-defaults.rs:24:66 | diff --git a/tests/ui/typeck/issue-110017-format-into-help-deletes-macro.stderr b/tests/ui/typeck/issue-110017-format-into-help-deletes-macro.stderr index e4834c0308bc8..bc722cdd57a5a 100644 --- a/tests/ui/typeck/issue-110017-format-into-help-deletes-macro.stderr +++ b/tests/ui/typeck/issue-110017-format-into-help-deletes-macro.stderr @@ -13,10 +13,13 @@ LL | Err(format!("error: {x}").into()) | +++++++ error[E0308]: mismatched types - --> $DIR/issue-110017-format-into-help-deletes-macro.rs:23:10 + --> $DIR/issue-110017-format-into-help-deletes-macro.rs:17:10 | +LL | format!("error: {}", $x) + | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box`, found `String` +... LL | Err(outer!(x)) - | ^^^^^^^^^ expected `Box`, found `String` + | --------- in this macro invocation | = note: expected struct `Box` found struct `String` @@ -27,10 +30,13 @@ LL | format!("error: {}", $x).into() | +++++++ error[E0308]: mismatched types - --> $DIR/issue-110017-format-into-help-deletes-macro.rs:41:2 + --> $DIR/issue-110017-format-into-help-deletes-macro.rs:35:18 | +LL | Err(format!("error: {x}")) + | ^^^^^^^^^^^^^^^^^^^^^ expected `Box`, found `String` +... LL | entire_fn_outer!(); - | ^^^^^^^^^^^^^^^^^^ expected `Box`, found `String` + | ------------------ in this macro invocation | = note: expected struct `Box` found struct `String` @@ -41,10 +47,13 @@ LL | Err(format!("error: {x}").into()) | +++++++ error[E0308]: mismatched types - --> $DIR/issue-110017-format-into-help-deletes-macro.rs:51:5 + --> $DIR/issue-110017-format-into-help-deletes-macro.rs:45:13 | +LL | Err(format!("error: {}", $x)) + | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box`, found `String` +... LL | nontrivial!(x) - | ^^^^^^^^^^^^^^ expected `Box`, found `String` + | -------------- in this macro invocation | = note: expected struct `Box` found struct `String` diff --git a/tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.stderr b/tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.stderr index 889d2c94d0cfb..30d51420b7cb3 100644 --- a/tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.stderr +++ b/tests/ui/typeck/issue-112007-leaked-writeln-macro-internals.stderr @@ -27,13 +27,16 @@ LL | writeln!(w, "but not here")? | + error[E0308]: mismatched types - --> $DIR/issue-112007-leaked-writeln-macro-internals.rs:40:9 + --> $DIR/issue-112007-leaked-writeln-macro-internals.rs:31:9 | +LL | writeln!($w, "but not here") + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Result<(), Error>` +... LL | / if true { LL | | writeln!(w, "`;?` here ->")?; LL | | } else { LL | | baz!(w) - | | ^^^^^^^ expected `()`, found `Result<(), Error>` + | | ------- in this macro invocation LL | | } | |_____- expected this to be `()` | diff --git a/tests/ui/typeck/issue-114423-ice-regression-in-suggestion.stderr b/tests/ui/typeck/issue-114423-ice-regression-in-suggestion.stderr index 4ccfacfb00521..1d766e6e5cdb0 100644 --- a/tests/ui/typeck/issue-114423-ice-regression-in-suggestion.stderr +++ b/tests/ui/typeck/issue-114423-ice-regression-in-suggestion.stderr @@ -14,7 +14,13 @@ error[E0425]: cannot find value `g` in this scope --> $DIR/issue-114423-ice-regression-in-suggestion.rs:11:22 | LL | let _ = RGB { r, g, b }; - | ^ help: a local variable with a similar name exists: `b` + | ^ + | +help: a local variable with a similar name exists + | +LL - let _ = RGB { r, g, b }; +LL + let _ = RGB { r, b, b }; + | error[E0308]: mismatched types --> $DIR/issue-114423-ice-regression-in-suggestion.rs:7:50 diff --git a/tests/ui/typeck/issue-120856.stderr b/tests/ui/typeck/issue-120856.stderr index e366744409f4e..4ff9f345c48b0 100644 --- a/tests/ui/typeck/issue-120856.stderr +++ b/tests/ui/typeck/issue-120856.stderr @@ -2,23 +2,26 @@ error[E0433]: failed to resolve: use of unresolved module or unlinked crate `n` --> $DIR/issue-120856.rs:1:37 | LL | pub type Archived = ::Archived; - | ^ - | | - | use of unresolved module or unlinked crate `n` - | help: a trait with a similar name exists: `Fn` + | ^ use of unresolved module or unlinked crate `n` | = help: you might be missing a crate named `n` +help: a trait with a similar name exists + | +LL | pub type Archived = ::Archived; + | + error[E0433]: failed to resolve: use of unresolved module or unlinked crate `m` --> $DIR/issue-120856.rs:1:25 | LL | pub type Archived = ::Archived; - | ^ - | | - | use of unresolved module or unlinked crate `m` - | help: a type parameter with a similar name exists: `T` + | ^ use of unresolved module or unlinked crate `m` | = help: you might be missing a crate named `m` +help: a type parameter with a similar name exists + | +LL - pub type Archived = ::Archived; +LL + pub type Archived = ::Archived; + | error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/issue-81293.stderr b/tests/ui/typeck/issue-81293.stderr index 8318d31f0946f..604f3cca54866 100644 --- a/tests/ui/typeck/issue-81293.stderr +++ b/tests/ui/typeck/issue-81293.stderr @@ -23,13 +23,19 @@ LL | a = c + b * 5; help: the following other types implement trait `Add` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&usize` implements `Add` + = note: `usize` implements `Add` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&usize` implements `Add` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&usize` implements `Add` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `usize` implements `Add<&usize>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `usize` implements `Add` + = note: `&usize` implements `Add` = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/typeck/issue-83693.stderr b/tests/ui/typeck/issue-83693.stderr index 521288c434022..2f83e5daff97e 100644 --- a/tests/ui/typeck/issue-83693.stderr +++ b/tests/ui/typeck/issue-83693.stderr @@ -2,11 +2,15 @@ error[E0425]: cannot find type `F` in this scope --> $DIR/issue-83693.rs:6:6 | LL | impl F { - | ^ help: a trait with a similar name exists: `Fn` + | ^ | --> $SRC_DIR/core/src/ops/function.rs:LL:COL | = note: similarly named trait `Fn` defined here +help: a trait with a similar name exists + | +LL | impl Fn { + | + error[E0425]: cannot find type `TestResult` in this scope --> $DIR/issue-83693.rs:9:22 diff --git a/tests/ui/typeck/issue-88844.stderr b/tests/ui/typeck/issue-88844.stderr index a5f4310c34dde..6d21317dfd7f5 100644 --- a/tests/ui/typeck/issue-88844.stderr +++ b/tests/ui/typeck/issue-88844.stderr @@ -5,7 +5,12 @@ LL | struct Struct { value: i32 } | ------------- similarly named struct `Struct` defined here ... LL | impl Stuct { - | ^^^^^ help: a struct with a similar name exists: `Struct` + | ^^^^^ + | +help: a struct with a similar name exists + | +LL | impl Struct { + | + error: aborting due to 1 previous error diff --git a/tests/ui/ufcs/ufcs-partially-resolved.stderr b/tests/ui/ufcs/ufcs-partially-resolved.stderr index a854ecb062224..e1df200feccff 100644 --- a/tests/ui/ufcs/ufcs-partially-resolved.stderr +++ b/tests/ui/ufcs/ufcs-partially-resolved.stderr @@ -5,17 +5,27 @@ LL | type Y = u16; | ------------- similarly named associated type `Y` defined here ... LL | let _: ::N; - | ^ help: an associated type with a similar name exists: `Y` + | ^ + | +help: an associated type with a similar name exists + | +LL - let _: ::N; +LL + let _: ::Y; + | error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:20:19 | LL | let _: ::N; - | ^ help: a trait with a similar name exists: `Eq` + | ^ | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here +help: a trait with a similar name exists + | +LL | let _: ::N; + | + error[E0404]: expected trait, found type alias `A` --> $DIR/ufcs-partially-resolved.rs:21:19 @@ -36,17 +46,27 @@ LL | fn Y() {} | ------ similarly named associated function `Y` defined here ... LL | ::N; - | ^ help: an associated function with a similar name exists: `Y` + | ^ + | +help: an associated function with a similar name exists + | +LL - ::N; +LL + ::Y; + | error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:23:12 | LL | ::N; - | ^ help: a trait with a similar name exists: `Eq` + | ^ | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here +help: a trait with a similar name exists + | +LL | ::N; + | + error[E0404]: expected trait, found type alias `A` --> $DIR/ufcs-partially-resolved.rs:24:12 @@ -64,21 +84,29 @@ error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:26:19 | LL | let _: ::Y; - | ^ help: a trait with a similar name exists: `Eq` + | ^ | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here +help: a trait with a similar name exists + | +LL | let _: ::Y; + | + error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:28:12 | LL | ::Y; - | ^ help: a trait with a similar name exists: `Eq` + | ^ | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here +help: a trait with a similar name exists + | +LL | ::Y; + | + error[E0576]: cannot find associated type `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:30:24 @@ -87,17 +115,27 @@ LL | type Y = u16; | ------------- similarly named associated type `Y` defined here ... LL | let _: ::N::NN; - | ^ help: an associated type with a similar name exists: `Y` + | ^ + | +help: an associated type with a similar name exists + | +LL - let _: ::N::NN; +LL + let _: ::Y::NN; + | error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:31:19 | LL | let _: ::N::NN; - | ^ help: a trait with a similar name exists: `Eq` + | ^ | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here +help: a trait with a similar name exists + | +LL | let _: ::N::NN; + | + error[E0404]: expected trait, found type alias `A` --> $DIR/ufcs-partially-resolved.rs:32:19 @@ -118,17 +156,27 @@ LL | type Y = u16; | ------------- similarly named associated type `Y` defined here ... LL | ::N::NN; - | ^ help: an associated type with a similar name exists: `Y` + | ^ + | +help: an associated type with a similar name exists + | +LL - ::N::NN; +LL + ::Y::NN; + | error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:34:12 | LL | ::N::NN; - | ^ help: a trait with a similar name exists: `Eq` + | ^ | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here +help: a trait with a similar name exists + | +LL | ::N::NN; + | + error[E0404]: expected trait, found type alias `A` --> $DIR/ufcs-partially-resolved.rs:35:12 @@ -146,21 +194,29 @@ error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:37:19 | LL | let _: ::Y::NN; - | ^ help: a trait with a similar name exists: `Eq` + | ^ | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here +help: a trait with a similar name exists + | +LL | let _: ::Y::NN; + | + error[E0404]: expected trait, found enum `E` --> $DIR/ufcs-partially-resolved.rs:39:12 | LL | ::Y::NN; - | ^ help: a trait with a similar name exists: `Eq` + | ^ | --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: similarly named trait `Eq` defined here +help: a trait with a similar name exists + | +LL | ::Y::NN; + | + error[E0405]: cannot find trait `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:41:23 @@ -229,9 +285,13 @@ LL | type X = u16; | ------------- similarly named associated type `X` defined here ... LL | let _: ::Z; - | ^^^^^^^^^^^^- - | | - | help: an associated type with a similar name exists: `X` + | ^^^^^^^^^^^^^ + | +help: an associated type with a similar name exists + | +LL - let _: ::Z; +LL + let _: ::X; + | error[E0575]: expected method or associated constant, found associated type `Dr::X` --> $DIR/ufcs-partially-resolved.rs:53:5 @@ -240,9 +300,13 @@ LL | fn Z() {} | ------ similarly named associated function `Z` defined here ... LL | ::X; - | ^^^^^^^^^^^^- - | | - | help: an associated function with a similar name exists: `Z` + | ^^^^^^^^^^^^^ + | +help: an associated function with a similar name exists + | +LL - ::X; +LL + ::Z; + | error[E0575]: expected associated type, found associated function `Dr::Z` --> $DIR/ufcs-partially-resolved.rs:54:12 @@ -251,9 +315,13 @@ LL | type X = u16; | ------------- similarly named associated type `X` defined here ... LL | let _: ::Z::N; - | ^^^^^^^^^^^^-^^^ - | | - | help: an associated type with a similar name exists: `X` + | ^^^^^^^^^^^^^^^^ + | +help: an associated type with a similar name exists + | +LL - let _: ::Z::N; +LL + let _: ::X::N; + | error[E0223]: ambiguous associated type --> $DIR/ufcs-partially-resolved.rs:36:12 diff --git a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr index 352638dd0118e..dbbee54c185bf 100644 --- a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -8,13 +8,19 @@ LL | >::add(1, 2); help: the following other types implement trait `Add` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&i32` implements `Add` + = note: `i32` implements `Add` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&i32` implements `Add` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&i32` implements `Add` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `i32` implements `Add<&i32>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `i32` implements `Add` + = note: `&i32` implements `Add` = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types @@ -73,13 +79,19 @@ LL | >::add(1, 2); help: the following other types implement trait `Add` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&i32` implements `Add` + = note: `i32` implements `Add` + ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL | - = note: `&i32` implements `Add` + = note: in this macro invocation + --> $SRC_DIR/core/src/internal_macros.rs:LL:COL + | + = note: `&i32` implements `Add` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | = note: `i32` implements `Add<&i32>` + ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL | - = note: `i32` implements `Add` + = note: `&i32` implements `Add` = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 4 previous errors diff --git a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr index 5f22c781345ff..7e295c1d54f9a 100644 --- a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr +++ b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr @@ -8,7 +8,13 @@ error[E0425]: cannot find value `y` in this scope --> $DIR/unboxed-closures-type-mismatch-closure-from-another-scope.rs:9:26 | LL | closure(&mut p, &y); - | ^ help: a local variable with a similar name exists: `p` + | ^ + | +help: a local variable with a similar name exists + | +LL - closure(&mut p, &y); +LL + closure(&mut p, &p); + | error[E0308]: mismatched types --> $DIR/unboxed-closures-type-mismatch-closure-from-another-scope.rs:9:17 diff --git a/tests/ui/unsized/issue-91801.rs b/tests/ui/unsized/issue-91801.rs index d906a08a55a21..8b4a3d214d5e7 100644 --- a/tests/ui/unsized/issue-91801.rs +++ b/tests/ui/unsized/issue-91801.rs @@ -6,7 +6,7 @@ pub static ALL_VALIDATORS: &[(&'static str, &'static Validator)] = &[("validate that credits and debits balance", &validate_something)]; fn or<'a>(first: &'static Validator<'a>, second: &'static Validator<'a>) -> Validator<'a> { - //~^ ERROR return type cannot be a trait object without pointer indirection + //~^ ERROR E0277 return Box::new(move |something: &'_ Something| -> Result<(), ()> { first(something).or_else(|_| second(something)) }); diff --git a/tests/ui/unsized/issue-91801.stderr b/tests/ui/unsized/issue-91801.stderr index 28e10f9caa41a..192cdc767dd90 100644 --- a/tests/ui/unsized/issue-91801.stderr +++ b/tests/ui/unsized/issue-91801.stderr @@ -1,18 +1,21 @@ -error[E0746]: return type cannot be a trait object without pointer indirection +error[E0277]: the size for values of type `(dyn Fn(&'a Something) -> Result<(), ()> + Send + Sync + 'a)` cannot be known at compilation time --> $DIR/issue-91801.rs:8:77 | LL | fn or<'a>(first: &'static Validator<'a>, second: &'static Validator<'a>) -> Validator<'a> { | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | -help: consider returning an `impl Trait` instead of a `dyn Trait` + = help: the trait `Sized` is not implemented for `(dyn Fn(&'a Something) -> Result<(), ()> + Send + Sync + 'a)` +note: this type alias is unsized + --> $DIR/issue-91801.rs:3:1 | -LL | fn or<'a>(first: &'static Validator<'a>, second: &'static Validator<'a>) -> impl Validator<'a> { - | ++++ -help: alternatively, box the return type, and wrap all of the returned values in `Box::new` +LL | type Validator<'a> = dyn 'a + Send + Sync + Fn(&'a Something) -> Result<(), ()>; + | ^^^^^^^^^^^^^^^^^^ + = note: the return type of a function must have a statically known size +help: consider boxing the return type, and wrapping all of the returned values in `Box::new` | -LL | fn or<'a>(first: &'static Validator<'a>, second: &'static Validator<'a>) -> Box> { - | +++++++ + +LL | fn or<'a>(first: &'static Validator<'a>, second: &'static Validator<'a>) -> Box> { + | ++++ + error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0746`. +For more information about this error, try `rustc --explain E0277`.