Skip to content

Commit e3ecd5f

Browse files
Auto merge of #143500 - compiler-errors:characterize-less, r=<try>
[perf] Skip walking into param-env component if it has no placeholder/re-var
2 parents 6dec76f + e13757e commit e3ecd5f

File tree

1 file changed

+9
-4
lines changed
  • compiler/rustc_next_trait_solver/src/solve/assembly

1 file changed

+9
-4
lines changed

compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use rustc_type_ir::inherent::*;
1010
use rustc_type_ir::lang_items::TraitSolverLangItem;
1111
use rustc_type_ir::solve::SizedTraitKind;
1212
use rustc_type_ir::{
13-
self as ty, Interner, TypeFoldable, TypeSuperVisitable, TypeVisitable, TypeVisitableExt as _,
14-
TypeVisitor, TypingMode, Upcast as _, elaborate,
13+
self as ty, Interner, TypeFlags, TypeFoldable, TypeSuperVisitable, TypeVisitable,
14+
TypeVisitableExt as _, TypeVisitor, TypingMode, Upcast as _, elaborate,
1515
};
1616
use tracing::{debug, instrument};
1717

@@ -132,6 +132,7 @@ where
132132
})
133133
.enter(|ecx| {
134134
Self::match_assumption(ecx, goal, assumption, |ecx| {
135+
ecx.try_evaluate_added_goals()?;
135136
source.set(ecx.characterize_param_env_assumption(goal.param_env, assumption)?);
136137
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
137138
})
@@ -1069,8 +1070,10 @@ where
10691070
} else {
10701071
ControlFlow::Continue(())
10711072
}
1072-
} else {
1073+
} else if ty.has_type_flags(TypeFlags::HAS_PLACEHOLDER | TypeFlags::HAS_RE_INFER) {
10731074
ty.super_visit_with(self)
1075+
} else {
1076+
ControlFlow::Continue(())
10741077
}
10751078
}
10761079

@@ -1086,8 +1089,10 @@ where
10861089
} else {
10871090
ControlFlow::Continue(())
10881091
}
1089-
} else {
1092+
} else if ct.has_type_flags(TypeFlags::HAS_PLACEHOLDER | TypeFlags::HAS_RE_INFER) {
10901093
ct.super_visit_with(self)
1094+
} else {
1095+
ControlFlow::Continue(())
10911096
}
10921097
}
10931098

0 commit comments

Comments
 (0)