1
Fork 0

Use Term in ProjectionPredicate

ProjectionPredicate should be able to handle both associated types and consts so this adds the
first step of that. It mainly just pipes types all the way down, not entirely sure how to handle
consts, but hopefully that'll come with time.
This commit is contained in:
kadmin 2022-01-08 09:28:12 +00:00
parent fb57b7518d
commit 67f56671d0
51 changed files with 274 additions and 259 deletions

View file

@ -997,10 +997,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
};
let kind = match constraint.kind {
AssocConstraintKind::Equality { ref term } => match term {
Term::Ty(ref ty) => hir::TypeBindingKind::Equality { ty: self.lower_ty(ty, itctx) },
Term::Const(ref c) => hir::TypeBindingKind::Const { c: self.lower_anon_const(c) },
},
AssocConstraintKind::Equality { ref term } => {
let term = match term {
Term::Ty(ref ty) => self.lower_ty(ty, itctx).into(),
Term::Const(ref c) => self.lower_anon_const(c).into(),
};
hir::TypeBindingKind::Equality { term }
}
AssocConstraintKind::Bound { ref bounds } => {
let mut capturable_lifetimes;
let mut parent_def_id = self.current_hir_id_owner;
@ -1079,7 +1082,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
itctx,
);
hir::TypeBindingKind::Equality { ty }
hir::TypeBindingKind::Equality { term: ty.into() }
})
} else {
// Desugar `AssocTy: Bounds` into a type binding where the

View file

@ -420,7 +420,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
ty: &'hir hir::Ty<'hir>,
) -> hir::TypeBinding<'hir> {
let ident = Ident::with_dummy_span(hir::FN_OUTPUT_NAME);
let kind = hir::TypeBindingKind::Equality { ty };
let kind = hir::TypeBindingKind::Equality { term: ty.into() };
let args = arena_vec![self;];
let bindings = arena_vec![self;];
let gen_args = self.arena.alloc(hir::GenericArgs {