diff --git a/compiler/rustc_mir/src/borrow_check/type_check/input_output.rs b/compiler/rustc_mir/src/borrow_check/type_check/input_output.rs index 1e0a2b0c42177af61fadb59b3979f3797048fe39..c815ed0d1cb49c18585b71a1bc461e70e7202223 100644 --- a/compiler/rustc_mir/src/borrow_check/type_check/input_output.rs +++ b/compiler/rustc_mir/src/borrow_check/type_check/input_output.rs @@ -182,6 +182,7 @@ fn equate_normalized_input_or_output(&mut self, a: Ty<'tcx>, b: Ty<'tcx>, span: matches!( o.predicate.kind().skip_binder(), ty::PredicateKind::RegionOutlives(_) + | ty::PredicateKind::TypeOutlives(_) ) }) { n.value diff --git a/src/test/ui/associated-types/normalization-generality-2.rs b/src/test/ui/associated-types/normalization-generality-2.rs new file mode 100644 index 0000000000000000000000000000000000000000..d8790bb2d12fc1c3b162f5e8fcaa94bce353d3ae --- /dev/null +++ b/src/test/ui/associated-types/normalization-generality-2.rs @@ -0,0 +1,30 @@ +// build-pass + +// Ensures that we don't regress on "implementation is not general enough" when +// normalizating under binders. Unlike `normalization-generality.rs`, this also produces +// type outlives predicates that we must ignore. + +pub unsafe trait Yokeable<'a> { + type Output: 'a; +} +pub struct Yoke Yokeable<'a>> { + _marker: std::marker::PhantomData, +} +impl Yokeable<'a>> Yoke { + pub fn project

( + &self, + _f: for<'a> fn(&>::Output, &'a ()) ->

>::Output, + ) -> Yoke

+ where + P: for<'a> Yokeable<'a>, + { + unimplemented!() + } +} +pub fn slice(y: Yoke<&'static str>) -> Yoke<&'static [u8]> { + y.project(move |yk, _| yk.as_bytes()) +} +unsafe impl<'a, T: 'static + ?Sized> Yokeable<'a> for &'static T { + type Output = &'a T; +} +fn main() {}