Skip to content

Commit 50433a0

Browse files
committed
polymorphize: don't check foreign items
Foreign items do not have bodies and so cannot be polymorphized. Signed-off-by: David Wood <[email protected]>
1 parent 4e4942d commit 50433a0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/rustc_monomorphize/src/polymorphize.rs

+5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ fn unused_generic_params(tcx: TyCtxt<'_>, def_id: DefId) -> FiniteBitSet<u32> {
5252
return FiniteBitSet::new_empty();
5353
}
5454

55+
// Exit early for foreign items, these have no bodies to analyze.
56+
if tcx.is_foreign_item(def_id) {
57+
return FiniteBitSet::new_empty();
58+
}
59+
5560
// Exit early when there is no MIR available.
5661
let context = tcx.hir().body_const_context(def_id.expect_local());
5762
match context {

0 commit comments

Comments
 (0)