Remove OpaqueTyOrigin::Misc, use TyAlias instead
This commit is contained in:
parent
d98384595f
commit
000b945cea
5 changed files with 6 additions and 9 deletions
|
@ -280,7 +280,7 @@ enum ImplTraitContext<'b, 'a> {
|
|||
// FIXME(impl_trait): but `required_region_bounds` will ICE later
|
||||
// anyway.
|
||||
capturable_lifetimes: &'b mut FxHashSet<hir::LifetimeName>,
|
||||
/// Origin: Either OpaqueTyOrigin::TyAlias or OpaqueTyOrigin::Misc,
|
||||
/// Origin: OpaqueTyOrigin::TyAlias
|
||||
origin: hir::OpaqueTyOrigin,
|
||||
},
|
||||
/// `impl Trait` is not accepted in this position.
|
||||
|
@ -1152,7 +1152,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
true,
|
||||
ImplTraitContext::TypeAliasesOpaqueTy {
|
||||
capturable_lifetimes: &mut capturable_lifetimes,
|
||||
origin: hir::OpaqueTyOrigin::Misc,
|
||||
origin: hir::OpaqueTyOrigin::TyAlias,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
@ -2272,8 +2272,6 @@ pub enum OpaqueTyOrigin {
|
|||
AsyncFn,
|
||||
/// type aliases: `type Foo = impl Trait;`
|
||||
TyAlias,
|
||||
/// Impl trait consts, statics, bounds.
|
||||
Misc,
|
||||
}
|
||||
|
||||
/// The various kinds of types recognized by the compiler.
|
||||
|
|
|
@ -402,7 +402,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
}
|
||||
// These opaque type inherit all lifetime parameters from their
|
||||
// parent, so we have to check them all.
|
||||
hir::OpaqueTyOrigin::TyAlias | hir::OpaqueTyOrigin::Misc => 0,
|
||||
hir::OpaqueTyOrigin::TyAlias => 0,
|
||||
};
|
||||
|
||||
let span = tcx.def_span(def_id);
|
||||
|
@ -994,7 +994,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
|
|||
may_define_opaque_type(tcx, self.parent_def_id, opaque_hir_id),
|
||||
origin,
|
||||
),
|
||||
_ => (def_scope_default(), hir::OpaqueTyOrigin::Misc),
|
||||
_ => (def_scope_default(), hir::OpaqueTyOrigin::TyAlias),
|
||||
};
|
||||
if in_definition_scope {
|
||||
let opaque_type_key =
|
||||
|
|
|
@ -700,7 +700,7 @@ fn check_opaque_meets_bounds<'tcx>(
|
|||
// Checked when type checking the function containing them.
|
||||
hir::OpaqueTyOrigin::FnReturn | hir::OpaqueTyOrigin::AsyncFn => return,
|
||||
// Can have different predicates to their defining use
|
||||
hir::OpaqueTyOrigin::Misc | hir::OpaqueTyOrigin::TyAlias => {}
|
||||
hir::OpaqueTyOrigin::TyAlias => {}
|
||||
}
|
||||
|
||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
|
|
|
@ -521,8 +521,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
|||
let mut skip_add = false;
|
||||
|
||||
if let ty::Opaque(definition_ty_def_id, _substs) = *definition_ty.kind() {
|
||||
if let hir::OpaqueTyOrigin::Misc | hir::OpaqueTyOrigin::TyAlias = opaque_defn.origin
|
||||
{
|
||||
if let hir::OpaqueTyOrigin::TyAlias = opaque_defn.origin {
|
||||
if opaque_type_key.def_id == definition_ty_def_id {
|
||||
debug!(
|
||||
"skipping adding concrete definition for opaque type {:?} {:?}",
|
||||
|
|
Loading…
Add table
Reference in a new issue