Skip to content

Commit 000b945

Browse files
committed
Remove OpaqueTyOrigin::Misc, use TyAlias instead
1 parent d983845 commit 000b945

File tree

5 files changed

+6
-9
lines changed

5 files changed

+6
-9
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ enum ImplTraitContext<'b, 'a> {
280280
// FIXME(impl_trait): but `required_region_bounds` will ICE later
281281
// anyway.
282282
capturable_lifetimes: &'b mut FxHashSet<hir::LifetimeName>,
283-
/// Origin: Either OpaqueTyOrigin::TyAlias or OpaqueTyOrigin::Misc,
283+
/// Origin: OpaqueTyOrigin::TyAlias
284284
origin: hir::OpaqueTyOrigin,
285285
},
286286
/// `impl Trait` is not accepted in this position.
@@ -1152,7 +1152,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11521152
true,
11531153
ImplTraitContext::TypeAliasesOpaqueTy {
11541154
capturable_lifetimes: &mut capturable_lifetimes,
1155-
origin: hir::OpaqueTyOrigin::Misc,
1155+
origin: hir::OpaqueTyOrigin::TyAlias,
11561156
},
11571157
)
11581158
}

compiler/rustc_hir/src/hir.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,8 +2272,6 @@ pub enum OpaqueTyOrigin {
22722272
AsyncFn,
22732273
/// type aliases: `type Foo = impl Trait;`
22742274
TyAlias,
2275-
/// Impl trait consts, statics, bounds.
2276-
Misc,
22772275
}
22782276

22792277
/// The various kinds of types recognized by the compiler.

compiler/rustc_trait_selection/src/opaque_types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
402402
}
403403
// These opaque type inherit all lifetime parameters from their
404404
// parent, so we have to check them all.
405-
hir::OpaqueTyOrigin::TyAlias | hir::OpaqueTyOrigin::Misc => 0,
405+
hir::OpaqueTyOrigin::TyAlias => 0,
406406
};
407407

408408
let span = tcx.def_span(def_id);
@@ -994,7 +994,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
994994
may_define_opaque_type(tcx, self.parent_def_id, opaque_hir_id),
995995
origin,
996996
),
997-
_ => (def_scope_default(), hir::OpaqueTyOrigin::Misc),
997+
_ => (def_scope_default(), hir::OpaqueTyOrigin::TyAlias),
998998
};
999999
if in_definition_scope {
10001000
let opaque_type_key =

compiler/rustc_typeck/src/check/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ fn check_opaque_meets_bounds<'tcx>(
700700
// Checked when type checking the function containing them.
701701
hir::OpaqueTyOrigin::FnReturn | hir::OpaqueTyOrigin::AsyncFn => return,
702702
// Can have different predicates to their defining use
703-
hir::OpaqueTyOrigin::Misc | hir::OpaqueTyOrigin::TyAlias => {}
703+
hir::OpaqueTyOrigin::TyAlias => {}
704704
}
705705

706706
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);

compiler/rustc_typeck/src/check/writeback.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
521521
let mut skip_add = false;
522522

523523
if let ty::Opaque(definition_ty_def_id, _substs) = *definition_ty.kind() {
524-
if let hir::OpaqueTyOrigin::Misc | hir::OpaqueTyOrigin::TyAlias = opaque_defn.origin
525-
{
524+
if let hir::OpaqueTyOrigin::TyAlias = opaque_defn.origin {
526525
if opaque_type_key.def_id == definition_ty_def_id {
527526
debug!(
528527
"skipping adding concrete definition for opaque type {:?} {:?}",

0 commit comments

Comments
 (0)