Skip to content

Commit 0e7de2e

Browse files
authored
Merge pull request #1079 from Tostapunk/fix/lifetimes-patch1
fix: Improve hint of lifetimes2
2 parents 727fc30 + e1d6abb commit 0e7de2e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

info.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,10 @@ name = "lifetimes2"
795795
path = "exercises/lifetimes/lifetimes2.rs"
796796
mode = "compile"
797797
hint = """
798-
What is the compiler checking? How could you change how long an owned variable lives?"""
798+
Remember that the generic lifetime 'a will get the concrete lifetime that is equal to the smaller of the lifetimes of x and y.
799+
You can take at least two paths to achieve the desired result while keeping the inner block:
800+
1. Move the string2 declaration to make it live as long as string1 (how is result declared?)
801+
2. Move println! into the inner block"""
799802

800803
[[exercises]]
801804
name = "lifetimes3"

0 commit comments

Comments
 (0)