Skip to content

Commit 5ea1e63

Browse files
Add TyKind::TyAlias support in rustc_traits
1 parent 5cb94e7 commit 5ea1e63

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

compiler/rustc_traits/src/chalk/lowering.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Ty<RustInterner<'tcx>>> for Ty<'tcx> {
268268
let uint = |i| chalk_ir::TyKind::Scalar(chalk_ir::Scalar::Uint(i));
269269
let float = |f| chalk_ir::TyKind::Scalar(chalk_ir::Scalar::Float(f));
270270

271-
match *self.kind() {
271+
let ty = interner.tcx.peel_off_ty_alias(self);
272+
273+
match *ty.kind() {
272274
ty::Bool => chalk_ir::TyKind::Scalar(chalk_ir::Scalar::Bool),
273275
ty::Char => chalk_ir::TyKind::Scalar(chalk_ir::Scalar::Char),
274276
ty::Int(ty) => match ty {
@@ -365,6 +367,9 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Ty<RustInterner<'tcx>>> for Ty<'tcx> {
365367
}
366368
ty::Infer(_infer) => unimplemented!(),
367369
ty::Error(_) => chalk_ir::TyKind::Error,
370+
ty::TyAlias(..) => {
371+
bug!("TyAlias should have been normalized before reaching this point")
372+
}
368373
}
369374
.intern(interner)
370375
}

compiler/rustc_traits/src/dropck_outlives.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ fn dtorck_constraint_for_ty<'tcx>(
281281
}
282282

283283
// Types that can't be resolved. Pass them forward.
284-
ty::Projection(..) | ty::Opaque(..) | ty::Param(..) => {
284+
ty::Projection(..) | ty::Opaque(..) | ty::Param(..) | ty::TyAlias(..) => {
285285
constraints.dtorck_types.push(ty);
286286
}
287287

0 commit comments

Comments
 (0)