rust/tests/ui/higher-ranked/leak-check/leak-check-in-selection-1.rs
lcnr 4fa5fb684e move leak check out of candidate evaluation
this prevents higher ranked goals from guiding selection
2024-04-03 22:32:46 +01:00

25 lines
455 B
Rust

//@ run-pass
//@ revisions: old next
//@[next] compile-flags: -Znext-solver
#![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());
}