Auto merge of #118189 - compiler-errors:cache-flags-for-const, r=nnethercote
Cache flags for `ty::Const` Not sure if this has been attempted yet, but worth a shot. It does make the code simpler in `rustc_type_ir`, since we can assume that consts have a `flags` method that is no-cost. r? `@ghost`
This commit is contained in:
commit
41fe75ec6b
9 changed files with 92 additions and 43 deletions
|
@ -9,7 +9,6 @@ use crate::infer::canonical::{
|
|||
Canonical, CanonicalTyVarKind, CanonicalVarInfo, CanonicalVarKind, OriginalQueryValues,
|
||||
};
|
||||
use crate::infer::InferCtxt;
|
||||
use rustc_middle::ty::flags::FlagComputation;
|
||||
use rustc_middle::ty::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable};
|
||||
use rustc_middle::ty::GenericArg;
|
||||
use rustc_middle::ty::{self, BoundVar, InferConst, List, Ty, TyCtxt, TypeFlags, TypeVisitableExt};
|
||||
|
@ -550,8 +549,11 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'cx, 'tcx> {
|
|||
_ => {}
|
||||
}
|
||||
|
||||
let flags = FlagComputation::for_const(ct);
|
||||
if flags.intersects(self.needs_canonical_flags) { ct.super_fold_with(self) } else { ct }
|
||||
if ct.flags().intersects(self.needs_canonical_flags) {
|
||||
ct.super_fold_with(self)
|
||||
} else {
|
||||
ct
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue