Remove origin field from TypeAliasesOpaqueTy

This commit is contained in:
Santiago Pastorino 2021-07-15 12:43:54 -03:00
parent 5cefdbdab5
commit c34fb5167e
No known key found for this signature in database
GPG Key ID: 8131A24E0C79EFAF
2 changed files with 4 additions and 10 deletions

View File

@ -345,7 +345,6 @@ fn lower_item_kind(
ty,
ImplTraitContext::TypeAliasesOpaqueTy {
capturable_lifetimes: &mut FxHashSet::default(),
origin: hir::OpaqueTyOrigin::TyAlias,
},
);
let generics = self.lower_generics(gen, ImplTraitContext::disallowed());
@ -918,7 +917,6 @@ fn lower_impl_item(&mut self, i: &AssocItem) -> hir::ImplItem<'hir> {
ty,
ImplTraitContext::TypeAliasesOpaqueTy {
capturable_lifetimes: &mut FxHashSet::default(),
origin: hir::OpaqueTyOrigin::TyAlias,
},
);
hir::ImplItemKind::TyAlias(ty)

View File

@ -280,8 +280,6 @@ enum ImplTraitContext<'b, 'a> {
// FIXME(impl_trait): but `required_region_bounds` will ICE later
// anyway.
capturable_lifetimes: &'b mut FxHashSet<hir::LifetimeName>,
/// Origin: OpaqueTyOrigin::TyAlias
origin: hir::OpaqueTyOrigin,
},
/// `impl Trait` is not accepted in this position.
Disallowed(ImplTraitPosition),
@ -310,8 +308,8 @@ fn reborrow<'this>(&'this mut self) -> ImplTraitContext<'this, 'a> {
ReturnPositionOpaqueTy { fn_def_id, origin } => {
ReturnPositionOpaqueTy { fn_def_id: *fn_def_id, origin: *origin }
}
TypeAliasesOpaqueTy { capturable_lifetimes, origin } => {
TypeAliasesOpaqueTy { capturable_lifetimes, origin: *origin }
TypeAliasesOpaqueTy { capturable_lifetimes } => {
TypeAliasesOpaqueTy { capturable_lifetimes }
}
Disallowed(pos) => Disallowed(*pos),
}
@ -1152,7 +1150,6 @@ fn lower_assoc_ty_constraint(
true,
ImplTraitContext::TypeAliasesOpaqueTy {
capturable_lifetimes: &mut capturable_lifetimes,
origin: hir::OpaqueTyOrigin::TyAlias,
},
)
}
@ -1416,18 +1413,17 @@ fn lower_ty_direct(&mut self, t: &Ty, mut itctx: ImplTraitContext<'_, 'hir>) ->
None,
|this| this.lower_param_bounds(bounds, itctx),
),
ImplTraitContext::TypeAliasesOpaqueTy { ref capturable_lifetimes, origin } => {
ImplTraitContext::TypeAliasesOpaqueTy { ref capturable_lifetimes } => {
// Reset capturable lifetimes, any nested impl trait
// types will inherit lifetimes from this opaque type,
// so don't need to capture them again.
let nested_itctx = ImplTraitContext::TypeAliasesOpaqueTy {
capturable_lifetimes: &mut FxHashSet::default(),
origin,
};
self.lower_opaque_impl_trait(
span,
None,
origin,
hir::OpaqueTyOrigin::TyAlias,
def_node_id,
Some(capturable_lifetimes),
|this| this.lower_param_bounds(bounds, nested_itctx),