summaryrefslogtreecommitdiffstats
path: root/tests/ui/higher-ranked/leak-check-in-selection.rs
blob: e8d6cff856c9e840a309d0da1553e1d097236b4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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());
}