This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
compiler/rustc_next_trait_solver/src/solve Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -1301,7 +1301,6 @@ where
13011301 . filter ( |c| matches ! ( c. source, CandidateSource :: ParamEnv ( _) ) )
13021302 . map ( |c| c. result )
13031303 . collect ( ) ;
1304-
13051304 return if let Some ( response) = self . try_merge_responses ( & where_bounds) {
13061305 Ok ( ( response, Some ( TraitGoalProvenVia :: ParamEnv ) ) )
13071306 } else {
@@ -1322,9 +1321,18 @@ where
13221321 } ;
13231322 }
13241323
1324+ // If there are *only* global where bounds, then make sure to return that this
1325+ // is still reported as being proven-via the param-env so that rigid projections
1326+ // operate correctly.
1327+ let proven_via =
1328+ if candidates. iter ( ) . all ( |c| matches ! ( c. source, CandidateSource :: ParamEnv ( _) ) ) {
1329+ TraitGoalProvenVia :: ParamEnv
1330+ } else {
1331+ TraitGoalProvenVia :: Misc
1332+ } ;
13251333 let all_candidates: Vec < _ > = candidates. into_iter ( ) . map ( |c| c. result ) . collect ( ) ;
13261334 if let Some ( response) = self . try_merge_responses ( & all_candidates) {
1327- Ok ( ( response, Some ( TraitGoalProvenVia :: Misc ) ) )
1335+ Ok ( ( response, Some ( proven_via ) ) )
13281336 } else {
13291337 self . flounder ( & all_candidates) . map ( |r| ( r, None ) )
13301338 }
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