diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 6ce03a9c5649..37809c377cae 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -280,7 +280,7 @@ enum ImplTraitContext<'b, 'a> { // FIXME(impl_trait): but `required_region_bounds` will ICE later // anyway. capturable_lifetimes: &'b mut FxHashSet, - /// 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, }, ) } diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 141788e7df47..fd5ee75effe6 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -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. diff --git a/compiler/rustc_trait_selection/src/opaque_types.rs b/compiler/rustc_trait_selection/src/opaque_types.rs index f380ad54d7f7..39013a317fd9 100644 --- a/compiler/rustc_trait_selection/src/opaque_types.rs +++ b/compiler/rustc_trait_selection/src/opaque_types.rs @@ -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 = diff --git a/compiler/rustc_typeck/src/check/check.rs b/compiler/rustc_typeck/src/check/check.rs index 98ac604b09f8..8db959578161 100644 --- a/compiler/rustc_typeck/src/check/check.rs +++ b/compiler/rustc_typeck/src/check/check.rs @@ -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); diff --git a/compiler/rustc_typeck/src/check/writeback.rs b/compiler/rustc_typeck/src/check/writeback.rs index 0aa059b7de80..190ce782cfeb 100644 --- a/compiler/rustc_typeck/src/check/writeback.rs +++ b/compiler/rustc_typeck/src/check/writeback.rs @@ -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 {:?} {:?}",