File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
compiler/rustc_next_trait_solver/src/solve Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1384,6 +1384,18 @@ where
13841384 // If there's an always applicable candidate, the result of all
13851385 // other candidates does not matter. This means we can ignore
13861386 // them when checking whether we've reached a fixpoint.
1387+ //
1388+ // We always prefer the first always applicable candidate, even if a
1389+ // later candidate is also always applicable and would result in fewer
1390+ // reruns. We could slightly improve this by e.g. searching for another
1391+ // always applicable candidate which doesn't depend on any cycle heads.
1392+ //
1393+ // NOTE: This is optimization is observable in case there is an always
1394+ // applicable global candidate and another non-global candidate which only
1395+ // applies because of a provisional result. I can't even think of a test
1396+ // case where this would occur and even then, this would not be unsound.
1397+ // Supporting this makes the code more involved, so I am just going to
1398+ // ignore this for now.
13871399 MergeCandidateInfo :: AlwaysApplicable ( i) => {
13881400 for ( j, c) in where_bounds. into_iter ( ) . enumerate ( ) {
13891401 if i != j {
You can’t perform that action at this time.
0 commit comments