File tree 2 files changed +12
-2
lines changed
compiler/rustc_next_trait_solver/src/solve
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1288,13 +1288,20 @@ where
1288
1288
}
1289
1289
_ => false ,
1290
1290
} ) ;
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
+ {
1292
1300
let where_bounds: Vec < _ > = candidates
1293
1301
. iter ( )
1294
1302
. filter ( |c| matches ! ( c. source, CandidateSource :: ParamEnv ( _) ) )
1295
1303
. map ( |c| c. result )
1296
1304
. collect ( ) ;
1297
-
1298
1305
return if let Some ( response) = self . try_merge_responses ( & where_bounds) {
1299
1306
Ok ( ( response, Some ( TraitGoalProvenVia :: ParamEnv ) ) )
1300
1307
} 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
1
4
//@ compile-flags: -Clink-dead-code=on --crate-type=lib
2
5
//@ build-pass
3
6
You can’t perform that action at this time.
0 commit comments