Only call generics_of query in should_encode_mir when necessary
This commit is contained in:
parent
1e6f7845ed
commit
05921d41e9
1 changed files with 1 additions and 2 deletions
|
|
@ -1113,11 +1113,10 @@ fn should_encode_mir(
|
|||
DefKind::SyntheticCoroutineBody => (false, true),
|
||||
// Full-fledged functions + closures
|
||||
DefKind::AssocFn | DefKind::Fn | DefKind::Closure => {
|
||||
let generics = tcx.generics_of(def_id);
|
||||
let opt = tcx.sess.opts.unstable_opts.always_encode_mir
|
||||
|| (tcx.sess.opts.output_types.should_codegen()
|
||||
&& reachable_set.contains(&def_id)
|
||||
&& (generics.requires_monomorphization(tcx)
|
||||
&& (tcx.generics_of(def_id).requires_monomorphization(tcx)
|
||||
|| tcx.cross_crate_inlinable(def_id)));
|
||||
// The function has a `const` modifier or is in a `const trait`.
|
||||
let is_const_fn = tcx.is_const_fn(def_id.to_def_id());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue