diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index 50048534aae..0a049f83e31 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -1191,16 +1191,26 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { // | | // | elided as they were the same // not elided, they were different, but irrelevant + // + // For bound lifetimes, keep the names of the lifetimes, + // even if they are the same so that it's clear what's happening + // if we have something like + // + // for<'r, 's> fn(Inv<'r>, Inv<'s>) + // for<'r> fn(Inv<'r>, Inv<'r>) let lifetimes = sub1.regions().zip(sub2.regions()); for (i, lifetimes) in lifetimes.enumerate() { let l1 = lifetime_display(lifetimes.0); let l2 = lifetime_display(lifetimes.1); - if lifetimes.0 == lifetimes.1 { - values.0.push_normal("'_"); - values.1.push_normal("'_"); - } else { + if lifetimes.0 != lifetimes.1 { values.0.push_highlighted(l1); values.1.push_highlighted(l2); + } else if lifetimes.0.is_late_bound() { + values.0.push_normal(l1); + values.1.push_normal(l2); + } else { + values.0.push_normal("'_"); + values.1.push_normal("'_"); } self.push_comma(&mut values.0, &mut values.1, len, i); } diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index 10217a5f574..930d9e7d7c5 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -1,4 +1,5 @@ pub use self::freshen::TypeFreshener; +pub use self::lexical_region_resolve::RegionResolutionError; pub use self::LateBoundRegionConversionTime::*; pub use self::RegionVariableOrigin::*; pub use self::SubregionOrigin::*;