]> git.proxmox.com Git - rustc.git/blame - src/test/ui/self/elision/ref-mut-self-async.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / self / elision / ref-mut-self-async.rs
CommitLineData
e1599b0c
XL
1// edition:2018
2
e1599b0c
XL
3#![allow(non_snake_case)]
4
5use std::pin::Pin;
6
7struct Struct { }
8
9impl Struct {
10 // Test using `&mut self` sugar:
11
e74abb32 12 async fn ref_self(&mut self, f: &u32) -> &u32 {
04454e1e 13 f
923072b8 14 //~^ ERROR lifetime may not live long enough
e1599b0c
XL
15 }
16
17 // Test using `&mut Self` explicitly:
18
19 async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
04454e1e 20 f
923072b8 21 //~^ ERROR lifetime may not live long enough
e1599b0c
XL
22 }
23
24 async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
04454e1e 25 f
923072b8 26 //~^ ERROR lifetime may not live long enough
e1599b0c
XL
27 }
28
29 async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
04454e1e 30 f
923072b8 31 //~^ ERROR lifetime may not live long enough
e1599b0c
XL
32 }
33
34 async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
04454e1e 35 f
923072b8 36 //~^ ERROR lifetime may not live long enough
e1599b0c
XL
37 }
38
39 async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
04454e1e 40 f
923072b8 41 //~^ ERROR lifetime may not live long enough
e1599b0c
XL
42 }
43}
44
45fn main() { }