mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Rename OtherOpaqueTy to TypeAliasesOpaqueTy
This commit is contained in:
parent
66c9cd9e66
commit
13287d8dd2
@ -343,7 +343,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
// opaque type Foo1: Trait
|
||||
let ty = self.lower_ty(
|
||||
ty,
|
||||
ImplTraitContext::OtherOpaqueTy {
|
||||
ImplTraitContext::TypeAliasesOpaqueTy {
|
||||
capturable_lifetimes: &mut FxHashSet::default(),
|
||||
origin: hir::OpaqueTyOrigin::TyAlias,
|
||||
},
|
||||
@ -487,7 +487,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
let mut capturable_lifetimes;
|
||||
let itctx = if self.sess.features_untracked().impl_trait_in_bindings {
|
||||
capturable_lifetimes = FxHashSet::default();
|
||||
ImplTraitContext::OtherOpaqueTy {
|
||||
ImplTraitContext::TypeAliasesOpaqueTy {
|
||||
capturable_lifetimes: &mut capturable_lifetimes,
|
||||
origin: hir::OpaqueTyOrigin::Misc,
|
||||
}
|
||||
@ -926,7 +926,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
Some(ty) => {
|
||||
let ty = self.lower_ty(
|
||||
ty,
|
||||
ImplTraitContext::OtherOpaqueTy {
|
||||
ImplTraitContext::TypeAliasesOpaqueTy {
|
||||
capturable_lifetimes: &mut FxHashSet::default(),
|
||||
origin: hir::OpaqueTyOrigin::TyAlias,
|
||||
},
|
||||
|
@ -265,7 +265,7 @@ enum ImplTraitContext<'b, 'a> {
|
||||
origin: hir::OpaqueTyOrigin,
|
||||
},
|
||||
/// Impl trait in type aliases.
|
||||
OtherOpaqueTy {
|
||||
TypeAliasesOpaqueTy {
|
||||
/// Set of lifetimes that this opaque type can capture, if it uses
|
||||
/// them. This includes lifetimes bound since we entered this context.
|
||||
/// For example:
|
||||
@ -310,8 +310,8 @@ impl<'a> ImplTraitContext<'_, 'a> {
|
||||
ReturnPositionOpaqueTy { fn_def_id, origin } => {
|
||||
ReturnPositionOpaqueTy { fn_def_id: *fn_def_id, origin: *origin }
|
||||
}
|
||||
OtherOpaqueTy { capturable_lifetimes, origin } => {
|
||||
OtherOpaqueTy { capturable_lifetimes, origin: *origin }
|
||||
TypeAliasesOpaqueTy { capturable_lifetimes, origin } => {
|
||||
TypeAliasesOpaqueTy { capturable_lifetimes, origin: *origin }
|
||||
}
|
||||
Disallowed(pos) => Disallowed(*pos),
|
||||
}
|
||||
@ -1126,7 +1126,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
//
|
||||
// fn foo() -> impl Iterator<Item = impl Debug>
|
||||
ImplTraitContext::ReturnPositionOpaqueTy { .. }
|
||||
| ImplTraitContext::OtherOpaqueTy { .. } => (true, itctx),
|
||||
| ImplTraitContext::TypeAliasesOpaqueTy { .. } => (true, itctx),
|
||||
|
||||
// We are in the argument position, but within a dyn type:
|
||||
//
|
||||
@ -1150,7 +1150,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
capturable_lifetimes = FxHashSet::default();
|
||||
(
|
||||
true,
|
||||
ImplTraitContext::OtherOpaqueTy {
|
||||
ImplTraitContext::TypeAliasesOpaqueTy {
|
||||
capturable_lifetimes: &mut capturable_lifetimes,
|
||||
origin: hir::OpaqueTyOrigin::Misc,
|
||||
},
|
||||
@ -1416,11 +1416,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
None,
|
||||
|this| this.lower_param_bounds(bounds, itctx),
|
||||
),
|
||||
ImplTraitContext::OtherOpaqueTy { ref capturable_lifetimes, origin } => {
|
||||
ImplTraitContext::TypeAliasesOpaqueTy { ref capturable_lifetimes, origin } => {
|
||||
// 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::OtherOpaqueTy {
|
||||
let nested_itctx = ImplTraitContext::TypeAliasesOpaqueTy {
|
||||
capturable_lifetimes: &mut FxHashSet::default(),
|
||||
origin,
|
||||
};
|
||||
@ -2321,13 +2321,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
)),
|
||||
_ => None,
|
||||
});
|
||||
if let ImplTraitContext::OtherOpaqueTy { ref mut capturable_lifetimes, .. } = itctx {
|
||||
if let ImplTraitContext::TypeAliasesOpaqueTy { ref mut capturable_lifetimes, .. } =
|
||||
itctx
|
||||
{
|
||||
capturable_lifetimes.extend(lt_def_names.clone());
|
||||
}
|
||||
|
||||
let res = this.lower_trait_ref(&p.trait_ref, itctx.reborrow());
|
||||
|
||||
if let ImplTraitContext::OtherOpaqueTy { ref mut capturable_lifetimes, .. } = itctx {
|
||||
if let ImplTraitContext::TypeAliasesOpaqueTy { ref mut capturable_lifetimes, .. } =
|
||||
itctx
|
||||
{
|
||||
for param in lt_def_names {
|
||||
capturable_lifetimes.remove(¶m);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user