]> git.lizzy.rs Git - rust.git/blob - src/test/ui/self/elision/ref-mut-self.rs
Use revisions instead of nll compare mode for `/self/` ui tests
[rust.git] / src / test / ui / self / elision / ref-mut-self.rs
1 // revisions: base nll
2 // ignore-compare-mode-nll
3 //[nll] compile-flags: -Z borrowck=mir
4
5 #![allow(non_snake_case)]
6
7 use std::pin::Pin;
8
9 struct Struct { }
10
11 impl Struct {
12     // Test using `&mut self` sugar:
13
14     fn ref_self(&mut self, f: &u32) -> &u32 {
15         f
16         //[base]~^ ERROR lifetime mismatch
17         //[nll]~^^ ERROR lifetime may not live long enough
18     }
19
20     // Test using `&mut Self` explicitly:
21
22     fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
23         f
24         //[base]~^ ERROR lifetime mismatch
25         //[nll]~^^ ERROR lifetime may not live long enough
26     }
27
28     fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
29         f
30         //[base]~^ ERROR lifetime mismatch
31         //[nll]~^^ ERROR lifetime may not live long enough
32     }
33
34     fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
35         f
36         //[base]~^ ERROR lifetime mismatch
37         //[nll]~^^ ERROR lifetime may not live long enough
38     }
39
40     fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
41         f
42         //[base]~^ ERROR lifetime mismatch
43         //[nll]~^^ ERROR lifetime may not live long enough
44     }
45
46     fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
47         f
48         //[base]~^ ERROR lifetime mismatch
49         //[nll]~^^ ERROR lifetime may not live long enough
50     }
51 }
52
53 fn main() { }