Skip to content

Commit b476969

Browse files
committed
Allow unnormalized types in drop elaboration
1 parent 0d95920 commit b476969

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

compiler/rustc_mir_transform/src/elaborate_drop.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -511,19 +511,12 @@ where
511511
let tcx = self.tcx();
512512

513513
assert_eq!(self.elaborator.typing_env().typing_mode, ty::TypingMode::PostAnalysis);
514-
let field_ty = match tcx.try_normalize_erasing_regions(
515-
self.elaborator.typing_env(),
516-
field.ty(tcx, args),
517-
) {
518-
Ok(t) => t,
519-
Err(_) => Ty::new_error(
520-
self.tcx(),
521-
self.tcx().dcx().span_delayed_bug(
522-
self.elaborator.body().span,
523-
"Error normalizing in drop elaboration.",
524-
),
525-
),
526-
};
514+
let field_ty = field.ty(tcx, args);
515+
// We silently leave an unnormalized type here to support polymorphic drop
516+
// elaboration for users of rustc internal APIs
517+
let field_ty = tcx
518+
.try_normalize_erasing_regions(self.elaborator.typing_env(), field_ty)
519+
.unwrap_or(field_ty);
527520

528521
(tcx.mk_place_field(base_place, field_idx, field_ty), subpath)
529522
})

0 commit comments

Comments
 (0)