mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-29 00:34:17 -05:00
parent
7035d6787c
commit
02d78c3e84
1 changed files with 4 additions and 1 deletions
|
@ -795,7 +795,10 @@ name = "lifetimes2"
|
||||||
path = "exercises/lifetimes/lifetimes2.rs"
|
path = "exercises/lifetimes/lifetimes2.rs"
|
||||||
mode = "compile"
|
mode = "compile"
|
||||||
hint = """
|
hint = """
|
||||||
What is the compiler checking? How could you change how long an owned variable lives?"""
|
Remember that the generic lifetime 'a will get the concrete lifetime that is equal to the smaller of the lifetimes of x and y.
|
||||||
|
You can take at leats two paths to achieve the desidered result while keeping the inner block:
|
||||||
|
1. move string2 declaration to make it live as long as string1 (how is result declared?)
|
||||||
|
2. move println! into the inner block"""
|
||||||
|
|
||||||
[[exercises]]
|
[[exercises]]
|
||||||
name = "lifetimes3"
|
name = "lifetimes3"
|
||||||
|
|
Loading…
Reference in a new issue