add the leak check to the new solver
This commit is contained in:
parent
04056b5c04
commit
6f9041bd15
@ -137,6 +137,11 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
||||
|
||||
#[instrument(level = "debug", skip(self), ret)]
|
||||
fn compute_external_query_constraints(&self) -> Result<ExternalConstraints<'tcx>, NoSolution> {
|
||||
self.infcx.leak_check(ty::UniverseIndex::ROOT, None).map_err(|e| {
|
||||
debug!(?e, "failed the leak check");
|
||||
NoSolution
|
||||
})?;
|
||||
|
||||
// Cannot use `take_registered_region_obligations` as we may compute the response
|
||||
// inside of a `probe` whenever we have multiple choices inside of the solver.
|
||||
let region_obligations = self.infcx.inner.borrow().region_obligations().to_owned();
|
||||
|
24
tests/ui/higher-ranked/leak-check-in-selection.rs
Normal file
24
tests/ui/higher-ranked/leak-check-in-selection.rs
Normal file
@ -0,0 +1,24 @@
|
||||
// run-pass
|
||||
// revisions: old next
|
||||
//[next] compile-flags: -Ztrait-solver=next
|
||||
#![allow(coherence_leak_check)]
|
||||
|
||||
trait Trait: Sized {
|
||||
fn is_higher_ranked(self) -> bool;
|
||||
}
|
||||
|
||||
impl Trait for for<'a> fn(&'a ()) {
|
||||
fn is_higher_ranked(self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
impl<'a> Trait for fn(&'a ()) {
|
||||
fn is_higher_ranked(self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x: for<'a> fn(&'a ()) = |&()| ();
|
||||
assert!(x.is_higher_ranked());
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user