diff --git a/compiler/rustc_borrowck/src/diagnostics/region_name.rs b/compiler/rustc_borrowck/src/diagnostics/region_name.rs index 0e07de31c2baa..57fd18107a414 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_name.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_name.rs @@ -147,7 +147,7 @@ impl RegionName { )) => { diag.span_label( *span, - format!("lifetime `{self}` appears in the type {type_name}"), + format!("lifetime `{self}` appears in the type `{type_name}`"), ); } RegionNameSource::AnonRegionFromOutput( diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 69def782bb67b..21ba71333ec36 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -190,6 +190,10 @@ pub struct RegionHighlightMode<'tcx> { /// instead of the ordinary behavior. highlight_regions: [Option<(ty::Region<'tcx>, usize)>; 3], + /// If set to `true`, types that include regions will always be included in the output, while + /// other types will be free to be trimmed. + pub keep_regions: bool, + /// If enabled, when printing a "free region" that originated from /// the given `ty::BoundRegionKind`, print it as "`'1`". Free regions that would ordinarily /// have names print as normal. @@ -208,6 +212,7 @@ impl<'tcx> RegionHighlightMode<'tcx> { region: Option>, number: Option, ) { + self.keep_regions = true; if let Some(k) = region && let Some(n) = number { @@ -223,6 +228,7 @@ impl<'tcx> RegionHighlightMode<'tcx> { bug!("can only highlight {} placeholders at a time", num_slots,) }); *first_avail_slot = Some((region, number)); + self.keep_regions = true; } /// Convenience wrapper for `highlighting_region`. @@ -2330,12 +2336,70 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> { } fn print_type(&mut self, ty: Ty<'tcx>) -> Result<(), PrintError> { + let has_regions = self.region_highlight_mode.keep_regions + && ty.has_type_flags(ty::TypeFlags::HAS_REGIONS); match ty.kind() { - ty::Tuple(tys) if tys.len() == 0 && self.should_truncate() => { + ty::Tuple(tys) if tys.len() == 0 => { // Don't truncate `()`. + self.pretty_print_type(ty) + } + + ty::Adt(def, args) + if self.should_truncate() + && args.consts().count() < 2 + && args.types().count() < 2 + && { + // We ensure that if there's at most a single type parameter and that type + // *doesn't* have any parameters, to avoid printing all the names in cases + // like `Foo>>`, instead truncating those always to + // `Foo<...>`. + if let Some(arg) = args.types().next() { + if let ty::Adt(_, arg_args) = arg.kind() { + if arg_args.consts().next().is_none() + && arg_args.types().next().is_none() + { + // Single param type with no type or const parameters: + // `Foo>`. + true + } else { + // Single param type with multiple type or const parameters: + // `Foo>`. We don't want to recurse into those, + // we'll replace the whole thing with `...`. + false + } + } else { + // Single type param that *isn't* a type with parameters, like a + // primitive: `Foo`. + true + } + } else { + // No type param: `Foo`. + true + } + } + && self.tcx.item_name(def.did()).as_str().len() < 7 => + { + // Don't fully truncate types that have "short names" and at most one type or const + // param. We do use the short path for them (only item name instead of full path). + with_forced_trimmed_paths!(self.pretty_print_type(ty)) + } + + ty::Alias(_, alias) + if self.should_truncate() + && let ty::AliasTyKind::Opaque { def_id } = alias.kind + && self.region_highlight_mode.keep_regions + && self + .tcx + .explicit_item_bounds(def_id) + .iter_instantiated_copied(self.tcx, alias.args) + .map(Unnormalized::skip_norm_wip) + .any(|(value, _)| value.has_bound_vars()) => + { + // ` Trait as Trait>` self.printed_type_count += 1; self.pretty_print_type(ty) } + ty::Adt(..) | ty::Foreign(_) | ty::Pat(..) @@ -2345,23 +2409,23 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> { | ty::FnPtr(..) | ty::UnsafeBinder(..) | ty::Dynamic(..) - | ty::Closure(..) | ty::CoroutineClosure(..) | ty::Coroutine(..) | ty::CoroutineWitness(..) | ty::Tuple(_) | ty::Alias(..) - | ty::Param(_) | ty::Bound(..) | ty::Placeholder(_) | ty::Error(_) - if self.should_truncate() => + if self.should_truncate() && !has_regions => { // We only truncate types that we know are likely to be much longer than 3 chars. // There's no point in replacing `i32` or `!`. write!(self, "_")?; Ok(()) } + ty::Ref(..) if self.should_truncate() && has_regions => self.pretty_print_type(ty), + ty::Closure(..) => self.pretty_print_type(ty), _ => { self.printed_type_count += 1; self.pretty_print_type(ty) diff --git a/compiler/rustc_trait_selection/src/diagnostics.rs b/compiler/rustc_trait_selection/src/diagnostics.rs index bb2614992adf2..44b5e669d5251 100644 --- a/compiler/rustc_trait_selection/src/diagnostics.rs +++ b/compiler/rustc_trait_selection/src/diagnostics.rs @@ -1203,9 +1203,9 @@ impl Subdiagnostic for ConsiderBorrowingParamHelp { #[diag("`impl` item signature doesn't match `trait` item signature")] pub(crate) struct TraitImplDiff { #[primary_span] - #[label("found `{$found}`")] + #[label("found `{$found_short}`")] pub sp: Span, - #[label("expected `{$expected}`")] + #[label("expected `{$expected_short}`")] pub trait_sp: Span, #[note( "expected signature `{$expected}` @@ -1218,6 +1218,8 @@ pub(crate) struct TraitImplDiff { "verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output" )] pub rel_help: bool, + pub expected_short: String, + pub found_short: String, pub expected: String, pub found: String, } diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs index f6887c18075a4..7f452a578778d 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs @@ -5,6 +5,7 @@ use rustc_errors::{Applicability, Diag, IntoDiagArg}; use rustc_hir as hir; use rustc_hir::def::Namespace; use rustc_hir::def_id::{CRATE_DEF_ID, DefId}; +use rustc_hir::limit::Limit; use rustc_middle::bug; use rustc_middle::ty::error::ExpectedFound; use rustc_middle::ty::print::{FmtPrinter, Print, PrintTraitRefExt as _, RegionHighlightMode}; @@ -29,7 +30,7 @@ pub(crate) struct Highlighted<'tcx, T> { impl<'tcx, T> IntoDiagArg for Highlighted<'tcx, T> where - T: for<'a> Print>, + T: for<'a> Print> + Copy, { fn into_diag_arg(self, _: &mut Option) -> rustc_errors::DiagArgValue { rustc_errors::DiagArgValue::Str(self.to_string().into()) @@ -44,14 +45,28 @@ impl<'tcx, T> Highlighted<'tcx, T> { impl<'tcx, T> fmt::Display for Highlighted<'tcx, T> where - T: for<'a> Print>, + T: for<'a> Print> + Copy, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let mut p = ty::print::FmtPrinter::new(self.tcx, self.ns); p.region_highlight_mode = self.highlight; self.value.print(&mut p)?; - f.write_str(&p.into_buffer()) + let b = p.into_buffer(); + if b.len() <= 40 || !self.highlight.keep_regions || self.tcx.sess.opts.verbose { + // This is a short enough type that can be safely be printed to the user, or we aren't + // showing the type with a particular interest in its lifetimes. + f.write_str(&b)?; + } else { + // We are highlighting lifetimes in the output, we will print out the smallest possible + // portion of the type while keeping the lifetimes visible. + let mut p = FmtPrinter::new_with_limit(self.tcx, self.ns, Limit(0)); + p.region_highlight_mode = self.highlight; + self.value.print(&mut p).expect("could not print type"); + let x = p.into_buffer(); + f.write_str(&x)?; + } + Ok(()) } } diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs index eb0b9a0234275..f1be118896b01 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs @@ -84,7 +84,15 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { } let tcx = self.cx.tcx; - let expected_highlight = HighlightBuilder::build(tcx, expected); + let mut expected_highlight = HighlightBuilder::build(tcx, expected); + let expected_short = Highlighted { + highlight: expected_highlight, + ns: Namespace::TypeNS, + tcx, + value: expected, + } + .to_string(); + expected_highlight.keep_regions = false; let expected = Highlighted { highlight: expected_highlight, ns: Namespace::TypeNS, @@ -92,7 +100,11 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { value: expected, } .to_string(); - let found_highlight = HighlightBuilder::build(tcx, found); + let mut found_highlight = HighlightBuilder::build(tcx, found); + let found_short = + Highlighted { highlight: found_highlight, ns: Namespace::TypeNS, tcx, value: found } + .to_string(); + found_highlight.keep_regions = false; let found = Highlighted { highlight: found_highlight, ns: Namespace::TypeNS, tcx, value: found } .to_string(); @@ -121,6 +133,8 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { rel_help: visitor.types.is_empty(), expected, found, + expected_short, + found_short, }; let mut diag = self.tcx().dcx().create_err(diag); diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs index 7e706a9838306..5e906c17c0756 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs @@ -4,13 +4,14 @@ use rustc_data_structures::fx::FxIndexSet; use rustc_errors::{ Applicability, Diag, E0309, E0310, E0311, E0803, Subdiagnostic, msg, struct_span_code_err, }; -use rustc_hir::def::DefKind; +use rustc_hir::def::{DefKind, Namespace}; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::intravisit::Visitor; use rustc_hir::{self as hir, ParamName}; use rustc_middle::bug; use rustc_middle::traits::ObligationCauseCode; use rustc_middle::ty::error::TypeError; +use rustc_middle::ty::print::RegionHighlightMode; use rustc_middle::ty::{ self, IsSuggestable, Region, Ty, TyCtxt, TypeVisitableExt as _, Upcast as _, }; @@ -25,6 +26,7 @@ use crate::diagnostics::{ }; use crate::error_reporting::TypeErrCtxt; use crate::error_reporting::infer::ObligationCauseExt; +use crate::error_reporting::infer::nice_region_error::placeholder_error::Highlighted; use crate::infer::region_constraints::GenericKind; use crate::infer::{ BoundRegionConversionTime, InferCtxt, RegionResolutionError, RegionVariableOrigin, @@ -1286,6 +1288,9 @@ pub fn unexpected_hidden_region_diagnostic<'a, 'tcx>( ), opaque_ty_span: tcx.def_span(opaque_ty_key.def_id), }); + let mut highlight = RegionHighlightMode::default(); + highlight.keep_regions = true; + let hidden_ty = Highlighted { highlight, ns: Namespace::TypeNS, tcx, value: hidden_ty }; // Explain the region we are capturing. match hidden_region.kind() { diff --git a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr index d5560bf892032..5a5bba352c69b 100644 --- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr +++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr @@ -6,7 +6,7 @@ LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrde LL | | }); | |______^ implementation of `FnOnce` is not general enough | - = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... + = note: `fn(&'0 ()) -> Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&(),)>` error: implementation of `FnOnce` is not general enough @@ -17,7 +17,7 @@ LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrde LL | | }); | |______^ implementation of `FnOnce` is not general enough | - = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... + = note: `fn(&'0 ()) -> Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&(),)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr index 461b065d55ad3..e8d1f585f0256 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr @@ -4,7 +4,7 @@ error: implementation of `FnOnce` is not general enough LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | - = note: closure with signature `fn(&'0 Vec) -> std::slice::Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... + = note: closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&Vec,)>` help: consider adding an explicit type annotation to the closure's argument | @@ -17,7 +17,7 @@ error: implementation of `FnOnce` is not general enough LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | - = note: closure with signature `fn(&'0 Vec) -> std::slice::Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... + = note: closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&Vec,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument diff --git a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr index d7762621cc5c7..c43a983cbf365 100644 --- a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr +++ b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr @@ -24,7 +24,7 @@ error: lifetime may not live long enough LL | move |()| s.chars().map(|c| format!("{}{}", c, s)) | --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | - | | return type of closure `Map, {closure@$DIR/issue-95079-missing-move-in-nested-closure.rs:11:29: 11:32}>` contains a lifetime `'2` + | | return type of closure `Map, {closure@...}>` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure diff --git a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr index eaa0d32e75dff..cdaa16ac9e807 100644 --- a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr +++ b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr @@ -8,7 +8,7 @@ LL | | x.to_string(); LL | | }); | |______^ implementation of `Foo` is not general enough | - = note: `Wrap<{closure@$DIR/obligation-with-leaking-placeholders.rs:18:15: 18:18}>` must implement `Foo<'0>`, for any lifetime `'0`... + = note: `Wrap<{closure@...}>` must implement `Foo<'0>`, for any lifetime `'0`... = note: ...but it actually implements `Foo<'1>`, for some specific lifetime `'1` error: aborting due to 1 previous error diff --git a/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr b/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr index 80da4e7145f95..1b94d59901d22 100644 --- a/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr +++ b/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr @@ -43,7 +43,7 @@ error: lifetime may not live long enough LL | take(|_| to_fn(|_| self.counter += 1)); | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | - | | return type of closure `aux::Map<{closure@$DIR/wrong-closure-arg-suggestion-125325.rs:46:24: 46:27}>` contains a lifetime `'2` + | | return type of closure `aux::Map<{closure@...}>` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure @@ -77,7 +77,7 @@ error: lifetime may not live long enough LL | P.flat_map(|_| P.map(|_| self.counter += 1)); | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | - | | return type of closure `aux::Map<{closure@$DIR/wrong-closure-arg-suggestion-125325.rs:54:30: 54:33}>` contains a lifetime `'2` + | | return type of closure `aux::Map<{closure@...}>` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure diff --git a/tests/ui/codegen/overflow-during-mono.stderr b/tests/ui/codegen/overflow-during-mono.stderr index 4d631e255afe5..a5f5aafb7c7c2 100644 --- a/tests/ui/codegen/overflow-during-mono.stderr +++ b/tests/ui/codegen/overflow-during-mono.stderr @@ -3,8 +3,8 @@ error[E0275]: overflow evaluating the requirement `for<'a> {closure@$DIR/overflo = help: consider increasing the recursion limit by adding a `#![recursion_limit = "64"]` attribute to your crate (`overflow_during_mono`) = note: required for `Filter, {closure@overflow-during-mono.rs:14:41}>` to implement `Iterator` = note: 31 redundant requirements hidden - = note: required for `Filter, _>, _>, _>, _>, _>` to implement `Iterator` - = note: required for `Filter, _>, _>, _>, _>, _>` to implement `IntoIterator` + = note: required for `Filter, {closure@...}>, {closure@...}>` to implement `Iterator` + = note: required for `Filter, {closure@...}>, {closure@...}>` to implement `IntoIterator` = note: the full name for the type has been written to '$TEST_BUILD_DIR/overflow-during-mono.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console diff --git a/tests/ui/impl-trait/static-return-lifetime-infered.stderr b/tests/ui/impl-trait/static-return-lifetime-infered.stderr index 21e3187d01912..093bd3d227527 100644 --- a/tests/ui/impl-trait/static-return-lifetime-infered.stderr +++ b/tests/ui/impl-trait/static-return-lifetime-infered.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values_anon(&self) -> impl Iterator { | ----- ----------------------- opaque type defined here | | - | hidden type `Map, {closure@$DIR/static-return-lifetime-infered.rs:7:27: 7:30}>` captures the anonymous lifetime defined here + | hidden type `Map, {closure@...}>` captures the anonymous lifetime defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -19,7 +19,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values<'a>(&'a self) -> impl Iterator { | -- ----------------------- opaque type defined here | | - | hidden type `Map, {closure@$DIR/static-return-lifetime-infered.rs:11:27: 11:30}>` captures the lifetime `'a` as defined here + | hidden type `Map, {closure@...}>` captures the lifetime `'a` as defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr b/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr index db69b4f3656e6..4c4f6032b0f7b 100644 --- a/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr +++ b/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr @@ -2,10 +2,10 @@ error: `impl` item signature doesn't match `trait` item signature --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:17:9 | LL | fn bar(&self, r: &mut Re); - | -------------------------- expected `fn(&'1 plain::Foo, &'2 mut plain::Re<'3>)` + | -------------------------- expected `fn(&'1 Foo, &'2 mut Re<'3>)` ... LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 plain::Foo, &'2 mut plain::Re<'1>)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Foo, &'2 mut Re<'1>)` | = note: expected signature `fn(&'1 plain::Foo, &'2 mut plain::Re<'3>)` found signature `fn(&'1 plain::Foo, &'2 mut plain::Re<'1>)` @@ -21,10 +21,10 @@ error: `impl` item signature doesn't match `trait` item signature --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:40:9 | LL | fn bar(&self, r: &mut Re); - | ------------------------------ expected `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'3, u8>)` + | ------------------------------ expected `fn(&'1 Foo, &'2 mut Re<'3, u8>)` ... LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a, u8>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'1, u8>)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Foo, &'2 mut Re<'1, u8>)` | = note: expected signature `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'3, u8>)` found signature `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'1, u8>)` diff --git a/tests/ui/limits/type-length-limit-enforcement.stderr b/tests/ui/limits/type-length-limit-enforcement.stderr index 0313f212d3f7e..637a626fc4e7e 100644 --- a/tests/ui/limits/type-length-limit-enforcement.stderr +++ b/tests/ui/limits/type-length-limit-enforcement.stderr @@ -8,7 +8,7 @@ LL | drop::>(None); = note: the full name for the type has been written to '$TEST_BUILD_DIR/type-length-limit-enforcement.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console -error: reached the type-length limit while instantiating `<{closure@...} as FnMut<()>>::call_mut` +error: reached the type-length limit while instantiating `<{closure@lang_start<()>::{closure#0}} as FnMut<()>>::call_mut` | = help: consider adding a `#![type_length_limit="10"]` attribute to your crate = note: the full name for the type has been written to '$TEST_BUILD_DIR/type-length-limit-enforcement.long-type-$LONG_TYPE_HASH.txt' diff --git a/tests/ui/recursion/issue-83150.stderr b/tests/ui/recursion/issue-83150.stderr index 9ec187f055018..a01f14b66794c 100644 --- a/tests/ui/recursion/issue-83150.stderr +++ b/tests/ui/recursion/issue-83150.stderr @@ -15,7 +15,7 @@ error[E0275]: overflow evaluating the requirement `Map<&mut std::ops::Range, = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`) = note: required for `&mut Map<&mut Range, {closure@issue-83150.rs:12:24}>` to implement `Iterator` = note: 65 redundant requirements hidden - = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<_, _>, _>, _>, _>, _>` to implement `Iterator` + = note: required for `&mut Map<&mut Map<&mut _, {closure@...}>, {closure@...}>` to implement `Iterator` = note: the full name for the type has been written to '$TEST_BUILD_DIR/issue-83150.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console diff --git a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr index a9b0931499d95..e7751de6f51ab 100644 --- a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr +++ b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr @@ -8,7 +8,7 @@ LL | | LL | | .filter_map(|_| foo(src)) | |_________________________________^ | - = note: hidden type `FilterMap, {closure@$DIR/explicit-lifetime-suggestion-in-proper-span-issue-121267.rs:10:21: 10:24}>` captures lifetime `'_` + = note: hidden type `FilterMap, {closure@...}>` captures lifetime `'_` error: aborting due to 1 previous error diff --git a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr index 3eff2944b472f..de16865629f89 100644 --- a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr +++ b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr @@ -24,7 +24,7 @@ LL | impl> Iterator for IteratorOfWrapped { | | | unsatisfied trait bound introduced here = note: 256 redundant requirements hidden - = note: required for `IteratorOfWrapped<(), Map>, _>>` to implement `Iterator` + = note: required for `IteratorOfWrapped<(), Map, {closure@...}>>` to implement `Iterator` = note: the full name for the type has been written to '$TEST_BUILD_DIR/issue-91949-hangs-on-recursion.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console diff --git a/tests/ui/traits/self-without-lifetime-constraint.stderr b/tests/ui/traits/self-without-lifetime-constraint.stderr index 8997d2a98b323..a82ff8eb0c269 100644 --- a/tests/ui/traits/self-without-lifetime-constraint.stderr +++ b/tests/ui/traits/self-without-lifetime-constraint.stderr @@ -2,10 +2,10 @@ error: `impl` item signature doesn't match `trait` item signature --> $DIR/self-without-lifetime-constraint.rs:46:5 | LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult; - | -------------------------------------------------------------------- expected `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), FromSqlError>` + | -------------------------------------------------------------------- expected `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), _>` ... LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<&str, &&str> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), FromSqlError>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), _>` | = note: expected signature `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), FromSqlError>` found signature `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), FromSqlError>`