File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
compiler/rustc_next_trait_solver/src/solve Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1288,13 +1288,20 @@ where
12881288 }
12891289 _ => false ,
12901290 } ) ;
1291- if has_non_global_where_bounds {
1291+
1292+ // As mentioned above, if there are non-global where bounds, then prefer all where bounds
1293+ // (including global ones) over anything else. If there are *only* where bounds, then
1294+ // make sure to return that this is proven-via the param-env so that rigid projections
1295+ // operate correctly.
1296+ if has_non_global_where_bounds
1297+ || ( candidates. len ( ) > 0
1298+ && candidates. iter ( ) . all ( |c| matches ! ( c. source, CandidateSource :: ParamEnv ( _) ) ) )
1299+ {
12921300 let where_bounds: Vec < _ > = candidates
12931301 . iter ( )
12941302 . filter ( |c| matches ! ( c. source, CandidateSource :: ParamEnv ( _) ) )
12951303 . map ( |c| c. result )
12961304 . collect ( ) ;
1297-
12981305 return if let Some ( response) = self . try_merge_responses ( & where_bounds) {
12991306 Ok ( ( response, Some ( TraitGoalProvenVia :: ParamEnv ) ) )
13001307 } else {
Original file line number Diff line number Diff line change 1+ //@ revisions: current next
2+ //@ ignore-compare-mode-next-solver (explicit revisions)
3+ //@[next] compile-flags: -Znext-solver
14//@ compile-flags: -Clink-dead-code=on --crate-type=lib
25//@ build-pass
36
You can’t perform that action at this time.
0 commit comments