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