enable intercrate
in the solver InferCtxt
This commit is contained in:
parent
47f24a881b
commit
938434ab82
3 changed files with 20 additions and 8 deletions
|
@ -585,8 +585,8 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn intercrate(mut self) -> Self {
|
pub fn intercrate(mut self, intercrate: bool) -> Self {
|
||||||
self.intercrate = true;
|
self.intercrate = intercrate;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,8 +127,14 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
|
||||||
//
|
//
|
||||||
// The actual solver logic happens in `ecx.compute_goal`.
|
// The actual solver logic happens in `ecx.compute_goal`.
|
||||||
search_graph.with_new_goal(tcx, canonical_goal, |search_graph| {
|
search_graph.with_new_goal(tcx, canonical_goal, |search_graph| {
|
||||||
let (ref infcx, goal, var_values) =
|
let intercrate = match search_graph.solver_mode() {
|
||||||
tcx.infer_ctxt().build_with_canonical(DUMMY_SP, &canonical_goal);
|
SolverMode::Normal => false,
|
||||||
|
SolverMode::Coherence => true,
|
||||||
|
};
|
||||||
|
let (ref infcx, goal, var_values) = tcx
|
||||||
|
.infer_ctxt()
|
||||||
|
.intercrate(intercrate)
|
||||||
|
.build_with_canonical(DUMMY_SP, &canonical_goal);
|
||||||
let mut ecx = EvalCtxt {
|
let mut ecx = EvalCtxt {
|
||||||
infcx,
|
infcx,
|
||||||
var_values,
|
var_values,
|
||||||
|
|
|
@ -95,8 +95,11 @@ pub fn overlapping_impls(
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let infcx =
|
let infcx = tcx
|
||||||
tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bubble).intercrate().build();
|
.infer_ctxt()
|
||||||
|
.with_opaque_type_inference(DefiningAnchor::Bubble)
|
||||||
|
.intercrate(true)
|
||||||
|
.build();
|
||||||
let selcx = &mut SelectionContext::new(&infcx);
|
let selcx = &mut SelectionContext::new(&infcx);
|
||||||
let overlaps =
|
let overlaps =
|
||||||
overlap(selcx, skip_leak_check, impl1_def_id, impl2_def_id, overlap_mode).is_some();
|
overlap(selcx, skip_leak_check, impl1_def_id, impl2_def_id, overlap_mode).is_some();
|
||||||
|
@ -107,8 +110,11 @@ pub fn overlapping_impls(
|
||||||
// In the case where we detect an error, run the check again, but
|
// In the case where we detect an error, run the check again, but
|
||||||
// this time tracking intercrate ambiguity causes for better
|
// this time tracking intercrate ambiguity causes for better
|
||||||
// diagnostics. (These take time and can lead to false errors.)
|
// diagnostics. (These take time and can lead to false errors.)
|
||||||
let infcx =
|
let infcx = tcx
|
||||||
tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bubble).intercrate().build();
|
.infer_ctxt()
|
||||||
|
.with_opaque_type_inference(DefiningAnchor::Bubble)
|
||||||
|
.intercrate(true)
|
||||||
|
.build();
|
||||||
let selcx = &mut SelectionContext::new(&infcx);
|
let selcx = &mut SelectionContext::new(&infcx);
|
||||||
selcx.enable_tracking_intercrate_ambiguity_causes();
|
selcx.enable_tracking_intercrate_ambiguity_causes();
|
||||||
Some(overlap(selcx, skip_leak_check, impl1_def_id, impl2_def_id, overlap_mode).unwrap())
|
Some(overlap(selcx, skip_leak_check, impl1_def_id, impl2_def_id, overlap_mode).unwrap())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue