]> git.proxmox.com Git - rustc.git/blob - src/test/ui/regions/regions-infer-paramd-indirect.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / regions / regions-infer-paramd-indirect.rs
1 // Check that we correctly infer that b and c must be region
2 // parameterized because they reference a which requires a region.
3
4 type A<'a> = &'a isize;
5 type B<'a> = Box<A<'a>>;
6
7 struct C<'a> {
8 f: Box<B<'a>>
9 }
10
11 trait SetF<'a> {
12 fn set_f_ok(&mut self, b: Box<B<'a>>);
13 fn set_f_bad(&mut self, b: Box<B>);
14 }
15
16 impl<'a> SetF<'a> for C<'a> {
17 fn set_f_ok(&mut self, b: Box<B<'a>>) {
18 self.f = b;
19 }
20
21 fn set_f_bad(&mut self, b: Box<B>) {
22 self.f = b;
23 //~^ ERROR mismatched types
24 //~| expected struct `Box<Box<&'a isize>>`
25 //~| found struct `Box<Box<&isize>>`
26 //~| lifetime mismatch
27 }
28 }
29
30 fn main() {}