@@ -748,6 +748,33 @@ hint = """
748
748
To find the best solution to this challenge you're going to need to think back to your
749
749
knowledge of traits, specifically Trait Bound Syntax - you may also need this: `use std::fmt::Display;`."""
750
750
751
+ # LIFETIMES
752
+
753
+ [[exercises ]]
754
+ name = " lifetimes1"
755
+ path = " exercises/lifetimes/lifetimes1.rs"
756
+ mode = " compile"
757
+ hint = """
758
+ Let the compiler guide you. Also take a look at the book if you need help:
759
+ https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html"""
760
+
761
+ [[exercises ]]
762
+ name = " lifetimes2"
763
+ path = " exercises/lifetimes/lifetimes2.rs"
764
+ mode = " compile"
765
+ hint = """
766
+ Remember that the generic lifetime 'a will get the concrete lifetime that is equal to the smaller of the lifetimes of x and y.
767
+ You can take at least two paths to achieve the desired result while keeping the inner block:
768
+ 1. Move the string2 declaration to make it live as long as string1 (how is result declared?)
769
+ 2. Move println! into the inner block"""
770
+
771
+ [[exercises ]]
772
+ name = " lifetimes3"
773
+ path = " exercises/lifetimes/lifetimes3.rs"
774
+ mode = " compile"
775
+ hint = """
776
+ If you use a lifetime annotation in a struct's fields, where else does it need to be added?"""
777
+
751
778
# TESTS
752
779
753
780
[[exercises ]]
@@ -780,33 +807,6 @@ You can call a function right where you're passing arguments to `assert!` -- so
780
807
something like `assert!(having_fun())`. If you want to check that you indeed get false, you
781
808
can negate the result of what you're doing using `!`, like `assert!(!having_fun())`."""
782
809
783
- # LIFETIMES
784
-
785
- [[exercises ]]
786
- name = " lifetimes1"
787
- path = " exercises/lifetimes/lifetimes1.rs"
788
- mode = " compile"
789
- hint = """
790
- Let the compiler guide you. Also take a look at the book if you need help:
791
- https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html"""
792
-
793
- [[exercises ]]
794
- name = " lifetimes2"
795
- path = " exercises/lifetimes/lifetimes2.rs"
796
- mode = " compile"
797
- hint = """
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"""
802
-
803
- [[exercises ]]
804
- name = " lifetimes3"
805
- path = " exercises/lifetimes/lifetimes3.rs"
806
- mode = " compile"
807
- hint = """
808
- If you use a lifetime annotation in a struct's fields, where else does it need to be added?"""
809
-
810
810
# STANDARD LIBRARY TYPES
811
811
812
812
[[exercises ]]
0 commit comments