mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
metadata: skip empty polymorphization bitset
This commit skips encoding empty polymorphization results - while polymorphization is disabled, this should be every polymorphization result; but when polymorphization is re-enabled, this would help with non-generic functions and those which do use all their parameters (most functions). Signed-off-by: David Wood <david@davidtw.co>
This commit is contained in:
parent
5f89f02c4e
commit
70b49c7bdd
@ -1134,8 +1134,11 @@ impl EncodeContext<'a, 'tcx> {
|
||||
debug!("EntryBuilder::encode_mir({:?})", def_id);
|
||||
if self.tcx.mir_keys(LOCAL_CRATE).contains(&def_id) {
|
||||
record!(self.tables.mir[def_id.to_def_id()] <- self.tcx.optimized_mir(def_id));
|
||||
record!(self.tables.unused_generic_params[def_id.to_def_id()] <-
|
||||
self.tcx.unused_generic_params(def_id));
|
||||
|
||||
let unused = self.tcx.unused_generic_params(def_id);
|
||||
if !unused.is_empty() {
|
||||
record!(self.tables.unused_generic_params[def_id.to_def_id()] <- unused);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,13 @@ fn unused_generic_params(tcx: TyCtxt<'_>, def_id: DefId) -> FiniteBitSet<u32> {
|
||||
return FiniteBitSet::new_empty();
|
||||
}
|
||||
|
||||
// Polymorphization results are stored in cross-crate metadata only when there are unused
|
||||
// parameters, so assume that non-local items must have only used parameters (else this query
|
||||
// would not be invoked, and the cross-crate metadata used instead).
|
||||
if !def_id.is_local() {
|
||||
return FiniteBitSet::new_empty();
|
||||
}
|
||||
|
||||
let generics = tcx.generics_of(def_id);
|
||||
debug!("unused_generic_params: generics={:?}", generics);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user