Skip to content

Commit de0feb3

Browse files
committed
I entirely forgot to add Drop items to the used_mentioned_items fast path...
1 parent 82b44c3 commit de0feb3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler/rustc_monomorphize/src/collector.rs

+3
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@ struct MirUsedCollector<'a, 'tcx> {
721721
body: &'a mir::Body<'tcx>,
722722
used_items: &'a mut MonoItems<'tcx>,
723723
/// See the comment in `collect_items_of_instance` for the purpose of this set.
724+
/// Note that this contains *not-monomorphized* items!
724725
used_mentioned_items: &'a mut FxHashSet<MentionedItem<'tcx>>,
725726
instance: Instance<'tcx>,
726727
/// Spans for move size lints already emitted. Helps avoid duplicate lints.
@@ -1002,6 +1003,8 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirUsedCollector<'a, 'tcx> {
10021003
}
10031004
mir::TerminatorKind::Drop { ref place, .. } => {
10041005
let ty = place.ty(self.body, self.tcx).ty;
1006+
// *Before* monomorphizing, record that we already handled this mention.
1007+
self.used_mentioned_items.insert(MentionedItem::Drop(ty));
10051008
let ty = self.monomorphize(ty);
10061009
visit_drop_use(self.tcx, ty, true, source, self.used_items);
10071010
}

0 commit comments

Comments
 (0)