]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-infer-not-param.rs
Rollup merge of #57107 - mjbshaw:thread_local_test, r=nikomatsakis
[rust.git] / src / test / ui / regions / regions-infer-not-param.rs
1 struct Direct<'a> {
2     f: &'a isize
3 }
4
5 struct Indirect1 {
6     // Here the lifetime parameter of direct is bound by the fn()
7     g: Box<FnOnce(Direct) + 'static>
8 }
9
10 struct Indirect2<'a> {
11     // But here it is set to 'a
12     g: Box<FnOnce(Direct<'a>) + 'static>
13 }
14
15 fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types
16
17 fn take_indirect1(p: Indirect1) -> Indirect1 { p }
18
19 fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types
20 //~| expected type `Indirect2<'b>`
21 //~| found type `Indirect2<'a>`
22 //~| ERROR mismatched types
23 //~| expected type `Indirect2<'b>`
24 //~| found type `Indirect2<'a>`
25
26 fn main() {}