]> git.lizzy.rs Git - rust.git/blob - tests/ui/higher-rank-trait-bounds/issue-59311.rs
Rollup merge of #106805 - madsravn:master, r=compiler-errors
[rust.git] / tests / ui / higher-rank-trait-bounds / issue-59311.rs
1 // Regression test for #59311. The test is taken from
2 // rust-lang/rust/issues/71546#issuecomment-620638437
3 // as they seem to have the same cause.
4
5 // FIXME: It's not clear that this code ought to report
6 // an error, but the regression test is here to ensure
7 // that it does not ICE. See discussion on #74889 for details.
8
9 pub trait T {
10     fn t<F: Fn()>(&self, _: F) {}
11 }
12
13 pub fn crash<V>(v: &V)
14 where
15     for<'a> &'a V: T + 'static,
16 {
17     v.t(|| {});
18     //~^ ERROR: higher-ranked lifetime error
19     //~| ERROR: higher-ranked lifetime error
20 }
21
22 fn main() {}