From 02d78c3e84c8f160b6f6487be0a368b5720bb67b Mon Sep 17 00:00:00 2001 From: Tostapunk Date: Mon, 18 Jul 2022 14:11:51 +0200 Subject: [PATCH 1/2] fix: Improve hint of lifetimes2 fixes #1071 --- info.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/info.toml b/info.toml index 5b7b9b4..3ec15d7 100644 --- a/info.toml +++ b/info.toml @@ -795,7 +795,10 @@ name = "lifetimes2" path = "exercises/lifetimes/lifetimes2.rs" mode = "compile" 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]] name = "lifetimes3" From e1d6abb4c919386fd5c728a30db73d160c6fe373 Mon Sep 17 00:00:00 2001 From: Mattia Schiavon Date: Mon, 18 Jul 2022 14:44:16 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: liv --- info.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/info.toml b/info.toml index 3ec15d7..0be3e91 100644 --- a/info.toml +++ b/info.toml @@ -796,9 +796,9 @@ path = "exercises/lifetimes/lifetimes2.rs" mode = "compile" hint = """ 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""" +You can take at least two paths to achieve the desired result while keeping the inner block: +1. Move the string2 declaration to make it live as long as string1 (how is result declared?) +2. Move println! into the inner block""" [[exercises]] name = "lifetimes3"