Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] bootstrap with next solver enabled #124812

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update winnowing
  • Loading branch information
lcnr committed May 24, 2024
commit 26ef6e16037b7ec1b443570f1e61465cafa60ece
11 changes: 10 additions & 1 deletion compiler/rustc_trait_selection/src/solve/assembly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,16 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
if let Some(result) = self.try_merge_responses(&responses) {
return Ok(result);
} else {
self.flounder(&responses)
let param_env_candidates = candidates
.iter()
.filter(|c| matches!(c.source, CandidateSource::ParamEnv(_)))
.map(|c| c.result)
.collect::<Vec<_>>();
if let Some(result) = self.try_merge_responses(&param_env_candidates) {
return Ok(result);
} else {
self.flounder(&responses)
}
}
}
}
25 changes: 25 additions & 0 deletions compiler/rustc_trait_selection/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,31 @@ pub fn normalize_param_env_or_error<'tcx>(
let mut predicates = non_outlives_predicates;
predicates.extend(outlives_predicates);
debug!("normalize_param_env_or_error: final predicates={:?}", predicates);
if tcx.next_trait_solver_globally() {
predicates.retain(|&p| {
if p.is_global() {
let infcx = tcx.infer_ctxt().build();
let ocx = ObligationCtxt::new(&infcx);
let param_env = ty::ParamEnv::empty();
ocx.register_obligation(Obligation::new(
tcx,
ObligationCause::dummy(),
param_env,
p,
));
if !ocx.select_all_or_error().is_empty() {
true
} else if ocx.resolve_regions(&OutlivesEnvironment::new(param_env)).is_empty() {
// A trivially true global bound, ignore it.
false
} else {
true
}
} else {
true
}
})
}
ty::ParamEnv::new(tcx.mk_clauses(&predicates), unnormalized_env.reveal())
}

Expand Down