fix small perf regressions
This commit is contained in:
parent
85338197d4
commit
a1459c3fca
@ -34,7 +34,7 @@
|
|||||||
use crate::infer::MemberConstraint;
|
use crate::infer::MemberConstraint;
|
||||||
use crate::mir::ConstraintCategory;
|
use crate::mir::ConstraintCategory;
|
||||||
use crate::ty::GenericArg;
|
use crate::ty::GenericArg;
|
||||||
use crate::ty::{self, BoundVar, List, Region, Ty, TyCtxt};
|
use crate::ty::{self, BoundVar, List, Region, Ty, TyCtxt, TypeFlags, TypeVisitableExt};
|
||||||
|
|
||||||
pub type Canonical<'tcx, V> = IrCanonical<TyCtxt<'tcx>, V>;
|
pub type Canonical<'tcx, V> = IrCanonical<TyCtxt<'tcx>, V>;
|
||||||
|
|
||||||
@ -315,6 +315,16 @@ pub fn get_or_insert(
|
|||||||
&mut OriginalQueryValues<'tcx>,
|
&mut OriginalQueryValues<'tcx>,
|
||||||
) -> Canonical<'tcx, ty::ParamEnv<'tcx>>,
|
) -> Canonical<'tcx, ty::ParamEnv<'tcx>>,
|
||||||
) -> Canonical<'tcx, ty::ParamEnv<'tcx>> {
|
) -> Canonical<'tcx, ty::ParamEnv<'tcx>> {
|
||||||
|
if !key.has_type_flags(
|
||||||
|
TypeFlags::HAS_INFER | TypeFlags::HAS_PLACEHOLDER | TypeFlags::HAS_FREE_REGIONS,
|
||||||
|
) {
|
||||||
|
return Canonical {
|
||||||
|
max_universe: ty::UniverseIndex::ROOT,
|
||||||
|
variables: List::empty(),
|
||||||
|
value: key,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
assert_eq!(state.var_values.len(), 0);
|
assert_eq!(state.var_values.len(), 0);
|
||||||
assert_eq!(state.universe_map.len(), 1);
|
assert_eq!(state.universe_map.len(), 1);
|
||||||
debug_assert_eq!(&*state.universe_map, &[ty::UniverseIndex::ROOT]);
|
debug_assert_eq!(&*state.universe_map, &[ty::UniverseIndex::ROOT]);
|
||||||
|
Loading…
Reference in New Issue
Block a user