mirror of https://github.com/rust-lang/rust
47 lines
1.0 KiB
Rust
47 lines
1.0 KiB
Rust
//@ run-rustfix
|
|
#![allow(non_snake_case, dead_code)]
|
|
|
|
use std::pin::Pin;
|
|
|
|
struct Struct<'a> {
|
|
data: &'a u32,
|
|
}
|
|
|
|
impl<'a> Struct<'a> {
|
|
// Test using `&self` sugar:
|
|
|
|
fn ref_self<'b>(&self, f: &'b u32) -> &'b u32 {
|
|
f
|
|
//~^ ERROR lifetime may not live long enough
|
|
}
|
|
|
|
// Test using `&Self` explicitly:
|
|
|
|
fn ref_Self<'b>(self: &Self, f: &'b u32) -> &'b u32 {
|
|
f
|
|
//~^ ERROR lifetime may not live long enough
|
|
}
|
|
|
|
fn box_ref_Self<'b>(self: Box<&Self>, f: &'b u32) -> &'b u32 {
|
|
f
|
|
//~^ ERROR lifetime may not live long enough
|
|
}
|
|
|
|
fn pin_ref_Self<'b>(self: Pin<&Self>, f: &'b u32) -> &'b u32 {
|
|
f
|
|
//~^ ERROR lifetime may not live long enough
|
|
}
|
|
|
|
fn box_box_ref_Self<'b>(self: Box<Box<&Self>>, f: &'b u32) -> &'b u32 {
|
|
f
|
|
//~^ ERROR lifetime may not live long enough
|
|
}
|
|
|
|
fn box_pin_Self<'b>(self: Box<Pin<&Self>>, f: &'b u32) -> &'b u32 {
|
|
f
|
|
//~^ ERROR lifetime may not live long enough
|
|
}
|
|
}
|
|
|
|
fn main() {}
|