Refactor lifetime name into an enum
This commit is contained in:
parent
64314e3ae2
commit
f64af7a32e
13 changed files with 118 additions and 55 deletions
|
|
@ -26,10 +26,22 @@ fn foo3(x: &'_ u8) -> Foo {
|
|||
|
||||
fn foo4(_: Foo<'_>) {}
|
||||
|
||||
struct Foo2<'a, 'b> {
|
||||
a: &'a u8,
|
||||
b: &'b u8,
|
||||
}
|
||||
fn foo5<'b>(foo: Foo2<'_, 'b>) -> &'b u8 {
|
||||
foo.b
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = &5;
|
||||
let _ = foo(x);
|
||||
let _ = foo2(x);
|
||||
let _ = foo3(x);
|
||||
foo4(Foo(x));
|
||||
let _ = foo5(Foo2 {
|
||||
a: x,
|
||||
b: &6,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue