2024-05-07 14:35:25 -05:00
|
|
|
//@ run-rustfix
|
|
|
|
#![allow(non_snake_case, dead_code)]
|
|
|
|
|
|
|
|
use std::pin::Pin;
|
|
|
|
|
2024-05-07 14:45:51 -05:00
|
|
|
struct Struct {}
|
2024-05-07 14:35:25 -05:00
|
|
|
|
|
|
|
impl Struct {
|
|
|
|
// Test using `&Struct` explicitly:
|
|
|
|
|
2024-05-07 14:54:16 -05:00
|
|
|
fn ref_Struct<'a>(self: &Struct, f: &'a u32) -> &'a u32 {
|
2024-05-07 14:35:25 -05:00
|
|
|
f
|
|
|
|
//~^ ERROR lifetime may not live long enough
|
|
|
|
}
|
|
|
|
|
2024-05-07 14:54:16 -05:00
|
|
|
fn box_ref_Struct<'a>(self: Box<&Struct>, f: &'a u32) -> &'a u32 {
|
2024-05-07 14:35:25 -05:00
|
|
|
f
|
|
|
|
//~^ ERROR lifetime may not live long enough
|
|
|
|
}
|
|
|
|
|
2024-05-07 14:54:16 -05:00
|
|
|
fn pin_ref_Struct<'a>(self: Pin<&Struct>, f: &'a u32) -> &'a u32 {
|
2024-05-07 14:35:25 -05:00
|
|
|
f
|
|
|
|
//~^ ERROR lifetime may not live long enough
|
|
|
|
}
|
|
|
|
|
2024-05-07 14:54:16 -05:00
|
|
|
fn box_box_ref_Struct<'a>(self: Box<Box<&Struct>>, f: &'a u32) -> &'a u32 {
|
2024-05-07 14:35:25 -05:00
|
|
|
f
|
|
|
|
//~^ ERROR lifetime may not live long enough
|
|
|
|
}
|
|
|
|
|
2024-05-07 14:54:16 -05:00
|
|
|
fn box_pin_Struct<'a>(self: Box<Pin<&Struct>>, f: &'a u32) -> &'a u32 {
|
2024-05-07 14:35:25 -05:00
|
|
|
f
|
|
|
|
//~^ ERROR lifetime may not live long enough
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-07 14:45:51 -05:00
|
|
|
fn main() {}
|