rust/tests/ui/self/elision/lt-ref-self-async.fixed

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.1 KiB
Rust
Raw Normal View History

//@ edition:2018
//@ run-rustfix
#![allow(non_snake_case, dead_code, elided_named_lifetimes)]
use std::pin::Pin;
2024-05-07 19:45:51 +00:00
struct Struct<'a> {
data: &'a u32,
}
impl<'a> Struct<'a> {
// Test using `&self` sugar:
2024-08-22 00:55:09 +00:00
async fn ref_self<'b>(&self, f: &'b u32) -> &'b u32 {
f
//~^ ERROR lifetime may not live long enough
}
// Test using `&Self` explicitly:
2024-08-22 00:55:09 +00:00
async fn ref_Self<'b>(self: &Self, f: &'b u32) -> &'b u32 {
f
//~^ ERROR lifetime may not live long enough
}
2024-08-22 00:55:09 +00:00
async fn box_ref_Self<'b>(self: Box<&Self>, f: &'b u32) -> &'b u32 {
f
//~^ ERROR lifetime may not live long enough
}
2024-08-22 00:55:09 +00:00
async fn pin_ref_Self<'b>(self: Pin<&Self>, f: &'b u32) -> &'b u32 {
f
//~^ ERROR lifetime may not live long enough
}
2024-08-22 00:55:09 +00:00
async fn box_box_ref_Self<'b>(self: Box<Box<&Self>>, f: &'b u32) -> &'b u32 {
f
//~^ ERROR lifetime may not live long enough
}
2024-08-22 00:55:09 +00:00
async fn box_pin_Self<'b>(self: Box<Pin<&Self>>, f: &'b u32) -> &'b u32 {
f
//~^ ERROR lifetime may not live long enough
}
}
2024-05-07 19:45:51 +00:00
fn main() {}