Skip to content

Commit a0a3b4c

Browse files
committed
replace UserTypeAnnotation::AdtDef with TypeOf
1 parent e94959b commit a0a3b4c

File tree

5 files changed

+3
-29
lines changed

5 files changed

+3
-29
lines changed

src/librustc/ich/impls_mir.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,10 +601,6 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for mir::UserTypeAnnotation<
601601
def_id.hash_stable(hcx, hasher);
602602
substs.hash_stable(hcx, hasher);
603603
}
604-
mir::UserTypeAnnotation::AdtDef(ref def_id, ref substs) => {
605-
def_id.hash_stable(hcx, hasher);
606-
substs.hash_stable(hcx, hasher);
607-
}
608604
}
609605
}
610606
}

src/librustc/mir/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2429,18 +2429,12 @@ pub enum UserTypeAnnotation<'tcx> {
24292429
/// The canonical type is the result of `type_of(def_id)` with the
24302430
/// given substitutions applied.
24312431
TypeOf(DefId, CanonicalUserSubsts<'tcx>),
2432-
2433-
/// The canonical type is the given ADT with the given
2434-
/// substitutions applied (in this case, `user_self_ty` had better
2435-
/// be `None`).
2436-
AdtDef(&'tcx AdtDef, CanonicalUserSubsts<'tcx>),
24372432
}
24382433

24392434
EnumTypeFoldableImpl! {
24402435
impl<'tcx> TypeFoldable<'tcx> for UserTypeAnnotation<'tcx> {
24412436
(UserTypeAnnotation::Ty)(ty),
24422437
(UserTypeAnnotation::TypeOf)(def, substs),
2443-
(UserTypeAnnotation::AdtDef)(def, substs),
24442438
}
24452439
}
24462440

src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -132,22 +132,6 @@ pub(super) fn relate_type_and_user_type<'tcx>(
132132

133133
Ok(ty)
134134
}
135-
UserTypeAnnotation::AdtDef(adt_def, canonical_substs) => {
136-
let (
137-
UserSubsts {
138-
substs,
139-
user_self_ty,
140-
},
141-
_,
142-
) = infcx.instantiate_canonical_with_fresh_inference_vars(DUMMY_SP, &canonical_substs);
143-
144-
// We don't extract adt-defs with a self-type.
145-
assert!(user_self_ty.is_none());
146-
147-
let ty = infcx.tcx.mk_adt(adt_def, substs);
148-
type_relating.relate(&ty, &a)?;
149-
Ok(ty)
150-
}
151135
}
152136
}
153137

src/librustc_mir/hair/cx/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
295295
let substs = cx.tables().node_substs(fun.hir_id);
296296

297297
let user_ty = cx.tables().user_substs(fun.hir_id)
298-
.map(|user_substs| UserTypeAnnotation::AdtDef(adt_def, user_substs));
298+
.map(|user_substs| UserTypeAnnotation::TypeOf(adt_def.did, user_substs));
299299

300300
let field_refs = args.iter()
301301
.enumerate()

src/librustc_mir/hair/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> {
2323
adt_def: &'tcx AdtDef,
2424
) -> Option<UserTypeAnnotation<'tcx>> {
2525
let user_substs = self.tables().user_substs(hir_id)?;
26-
Some(UserTypeAnnotation::AdtDef(adt_def, user_substs))
26+
Some(UserTypeAnnotation::TypeOf(adt_def.did, user_substs))
2727
}
2828

2929
/// Looks up the type associated with this hir-id and applies the
@@ -35,7 +35,7 @@ crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> {
3535
) -> Option<UserTypeAnnotation<'tcx>> {
3636
let user_substs = self.tables().user_substs(hir_id)?;
3737
match &self.tables().node_id_to_type(hir_id).sty {
38-
ty::Adt(adt_def, _) => Some(UserTypeAnnotation::AdtDef(adt_def, user_substs)),
38+
ty::Adt(adt_def, _) => Some(UserTypeAnnotation::TypeOf(adt_def.did, user_substs)),
3939
ty::FnDef(def_id, _) => Some(UserTypeAnnotation::TypeOf(*def_id, user_substs)),
4040
sty => bug!(
4141
"sty: {:?} should not have user-substs {:?} recorded ",

0 commit comments

Comments
 (0)