Skip to content

Commit 6e22239

Browse files
committed
w
1 parent 897abf1 commit 6e22239

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

compiler/rustc_session/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

compiler/rustc_trait_selection/src/solve/assembly/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff 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
}

compiler/rustc_trait_selection/src/traits/mod.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)