Change def_id filter to use requires_monomorphization()

Per @wesleywiser's comment: https://github.com/rust-lang/rust/pull/83307#discussion_r599223342
This commit is contained in:
Rich Kadel 2021-03-23 00:33:57 -07:00
parent 5a484a1aed
commit 94a3454b03

View File

@ -269,7 +269,7 @@ fn add_unused_functions<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) {
.iter()
.filter_map(|local_def_id| {
let def_id = local_def_id.to_def_id();
if ignore_unused_generics && tcx.generics_of(def_id).count() > 0 {
if ignore_unused_generics && tcx.generics_of(def_id).requires_monomorphization(tcx) {
return None;
}
Some(local_def_id.to_def_id())