Skip to content

Commit 204ee4c

Browse files
committed
Auto merge of rust-lang#141226 - compiler-errors:param-candidate-fast-path, r=<try>
Only assemble impl candidates if there are no candidates that would have shadowed it Just for perf. Can confirm that rayon no longer hangs. r? lcnr
2 parents 7205fc5 + 825db50 commit 204ee4c

File tree

1 file changed

+16
-1
lines changed
  • compiler/rustc_next_trait_solver/src/solve/assembly

1 file changed

+16
-1
lines changed

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

+16-1
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,24 @@ where
391391

392392
match assemble_from {
393393
AssembleCandidatesFrom::All => {
394-
self.assemble_impl_candidates(goal, &mut candidates);
395394
self.assemble_builtin_impl_candidates(goal, &mut candidates);
395+
396+
// UwU
397+
if !matches!(self.typing_mode(), TypingMode::Coherence) {
398+
if candidates.iter().any(|cand| {
399+
matches!(
400+
cand.source,
401+
CandidateSource::ParamEnv(ParamEnvSource::NonGlobal)
402+
| CandidateSource::AliasBound
403+
| CandidateSource::BuiltinImpl(BuiltinImplSource::Trivial)
404+
)
405+
}) {
406+
return candidates;
407+
}
408+
}
409+
396410
self.assemble_object_bound_candidates(goal, &mut candidates);
411+
self.assemble_impl_candidates(goal, &mut candidates);
397412
}
398413
AssembleCandidatesFrom::EnvAndBounds => {}
399414
}

0 commit comments

Comments
 (0)