Auto merge of #87648 - JulianKnodt:const_eq_constrain, r=oli-obk
allow eq constraints on associated constants Updates #70256 (cc `@varkor,` `@Centril)`
This commit is contained in:
commit
7bc7be860f
83 changed files with 776 additions and 382 deletions
|
@ -960,7 +960,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
/// returns a `hir::TypeBinding` representing `Item`.
|
||||
fn lower_assoc_ty_constraint(
|
||||
&mut self,
|
||||
constraint: &AssocTyConstraint,
|
||||
constraint: &AssocConstraint,
|
||||
mut itctx: ImplTraitContext<'_, 'hir>,
|
||||
) -> hir::TypeBinding<'hir> {
|
||||
debug!("lower_assoc_ty_constraint(constraint={:?}, itctx={:?})", constraint, itctx);
|
||||
|
@ -997,10 +997,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
};
|
||||
|
||||
let kind = match constraint.kind {
|
||||
AssocTyConstraintKind::Equality { ref ty } => {
|
||||
hir::TypeBindingKind::Equality { ty: self.lower_ty(ty, itctx) }
|
||||
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 }
|
||||
}
|
||||
AssocTyConstraintKind::Bound { ref bounds } => {
|
||||
AssocConstraintKind::Bound { ref bounds } => {
|
||||
let mut capturable_lifetimes;
|
||||
let mut parent_def_id = self.current_hir_id_owner;
|
||||
// Piggy-back on the `impl Trait` context to figure out the correct behavior.
|
||||
|
@ -1078,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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue