This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +28
-3
lines changed
rustc_trait_selection/src Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -794,7 +794,7 @@ impl Default for NextSolverConfig {
794794 fn default ( ) -> Self {
795795 NextSolverConfig {
796796 coherence : true ,
797- globally : false ,
797+ globally : true ,
798798 dump_tree : DumpSolverProofTree :: default ( ) ,
799799 }
800800 }
Original file line number Diff line number Diff line change @@ -846,7 +846,12 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
846846 if let Some ( result) = self . try_merge_responses ( & responses) {
847847 return Ok ( result) ;
848848 } else {
849- self . flounder ( & responses)
850- }
849+ let param_env_candidates = candidates. iter ( ) . filter ( |c| matches ! ( c. source, CandidateSource :: ParamEnv ( _) ) ) . map ( |c| c. result ) . collect :: < Vec < _ > > ( ) ;
850+ if let Some ( result) = self . try_merge_responses ( & param_env_candidates) {
851+ return Ok ( result) ;
852+ } else {
853+ self . flounder ( & responses)
854+ }
855+ }
851856 }
852857}
Original file line number Diff line number Diff line change @@ -389,6 +389,26 @@ pub fn normalize_param_env_or_error<'tcx>(
389389 let mut predicates = non_outlives_predicates;
390390 predicates. extend ( outlives_predicates) ;
391391 debug ! ( "normalize_param_env_or_error: final predicates={:?}" , predicates) ;
392+ if tcx. next_trait_solver_globally ( ) {
393+ predicates. retain ( |& p| {
394+ if p. is_global ( ) {
395+ let infcx = tcx. infer_ctxt ( ) . build ( ) ;
396+ let ocx = ObligationCtxt :: new ( & infcx) ;
397+ let param_env = ty:: ParamEnv :: empty ( ) ;
398+ ocx. register_obligation ( Obligation :: new ( tcx, ObligationCause :: dummy ( ) , param_env, p) ) ;
399+ if !ocx. select_all_or_error ( ) . is_empty ( ) {
400+ true
401+ } else if ocx. resolve_regions ( & OutlivesEnvironment :: new ( param_env) ) . is_empty ( ) {
402+ // A trivially true global bound, ignore it.
403+ false
404+ } else {
405+ true
406+ }
407+ } else {
408+ true
409+ }
410+ } )
411+ }
392412 ty:: ParamEnv :: new ( tcx. mk_clauses ( & predicates) , unnormalized_env. reveal ( ) )
393413}
394414
You can’t perform that action at this time.
0 commit comments