Skip to content

Commit 825db50

Browse files
Only assemble impl candidates if there are no candidates that would have shadowed it
1 parent 7205fc5 commit 825db50

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

Lines changed: 16 additions & 1 deletion
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)