Normalize generic_ty before checking if bound is met

This commit is contained in:
jackh726 2021-07-19 10:25:20 -04:00
parent 59216858a3
commit 3d464947d4
2 changed files with 20 additions and 0 deletions

View file

@ -638,6 +638,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
let sub = var_data.normalize(self.tcx(), verify.region);
let verify_kind_ty = verify.kind.to_ty(self.tcx());
let verify_kind_ty = var_data.normalize(self.tcx(), verify_kind_ty);
if self.bound_is_met(&verify.bound, var_data, verify_kind_ty, sub) {
continue;
}

View file

@ -0,0 +1,19 @@
// build-pass
#![feature(generic_associated_types)]
trait Trait {
type Ref<'a>;
}
impl Trait for () {
type Ref<'a> = &'a i8;
}
struct RefRef<'a, T: Trait>(&'a <T as Trait>::Ref<'a>);
fn wrap<'a, T: Trait>(reff: &'a <T as Trait>::Ref<'a>) -> RefRef<'a, T> {
RefRef(reff)
}
fn main() {}