Merge branch 'rust-lang:main' into main

This commit is contained in:
Adhyan H. Patel 2024-09-02 12:00:22 -05:00 committed by GitHub
commit 3125561474
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,7 @@
format_version = 1 format_version = 1
welcome_message = """Is this your first time? Don't worry, Rustlings is made for beginners! welcome_message = """
Is this your first time? Don't worry, Rustlings is made for beginners!
We are going to teach you a lot of things about Rust, but before we can We are going to teach you a lot of things about Rust, but before we can
get started, here are some notes about how Rustlings operates: get started, here are some notes about how Rustlings operates:
@ -10,15 +11,16 @@ get started, here are some notes about how Rustlings operates:
and fix them! and fix them!
2. Make sure to have your editor open in the `rustlings/` directory. Rustlings 2. Make sure to have your editor open in the `rustlings/` directory. Rustlings
will show you the path of the current exercise under the progress bar. Open will show you the path of the current exercise under the progress bar. Open
the exercise file in your editor, fix errors and save the file. Rustlings will the exercise file in your editor, fix errors and save the file. Rustlings
automatically detect the file change and rerun the exercise. If all errors are will automatically detect the file change and rerun the exercise. If all
fixed, Rustlings will ask you to move on to the next exercise. errors are fixed, Rustlings will ask you to move on to the next exercise.
3. If you're stuck on an exercise, enter `h` to show a hint. 3. If you're stuck on an exercise, enter `h` to show a hint.
4. If an exercise doesn't make sense to you, feel free to open an issue on GitHub! 4. If an exercise doesn't make sense to you, feel free to open an issue on
(https://github.com/rust-lang/rustlings). We look at every issue, and sometimes, GitHub! (https://github.com/rust-lang/rustlings). We look at every issue, and
other learners do too so you can help each other out!""" sometimes, other learners do too so you can help each other out!"""
final_message = """We hope you enjoyed learning about the various aspects of Rust! final_message = """
We hope you enjoyed learning about the various aspects of Rust!
If you noticed any issues, don't hesitate to report them on Github. If you noticed any issues, don't hesitate to report them on Github.
You can also contribute your own exercises to help the greater community! You can also contribute your own exercises to help the greater community!
@ -122,8 +124,8 @@ hint = """
We know about variables and mutability, but there is another important type of We know about variables and mutability, but there is another important type of
variables available: constants. variables available: constants.
Constants are always immutable. They are declared with the keyword `const` instead Constants are always immutable. They are declared with the keyword `const`
of `let`. instead of `let`.
The type of Constants must always be annotated. The type of Constants must always be annotated.
@ -319,7 +321,8 @@ hint = """
In the first function, we create an empty vector and want to push new elements In the first function, we create an empty vector and want to push new elements
to it. to it.
In the second function, we map the values of the input and collect them into a vector. In the second function, we map the values of the input and collect them into
a vector.
After you've completed both functions, decide for yourself which approach you After you've completed both functions, decide for yourself which approach you
like better. like better.
@ -332,8 +335,8 @@ What do you think is the more commonly used pattern under Rust developers?"""
name = "move_semantics1" name = "move_semantics1"
dir = "06_move_semantics" dir = "06_move_semantics"
hint = """ hint = """
So you've got the "cannot borrow `vec` as mutable, as it is not declared as mutable" So you've got the "cannot borrow `vec` as mutable, as it is not declared as
error on the line where we push an element to the vector, right? mutable" error on the line where we push an element to the vector, right?
The fix for this is going to be adding one keyword, and the addition is NOT on The fix for this is going to be adding one keyword, and the addition is NOT on
the line where we push to the vector (where the error is). the line where we push to the vector (where the error is).
@ -369,7 +372,8 @@ hint = """
Carefully reason about the range in which each mutable reference is in Carefully reason about the range in which each mutable reference is in
scope. Does it help to update the value of `x` immediately after scope. Does it help to update the value of `x` immediately after
the mutable reference is taken? the mutable reference is taken?
Read more about 'Mutable References' in the book's section 'References and Borrowing': Read more about 'Mutable References' in the book's section 'References and
Borrowing':
https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#mutable-references.""" https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#mutable-references."""
[[exercises]] [[exercises]]
@ -508,7 +512,8 @@ name = "strings4"
dir = "09_strings" dir = "09_strings"
test = false test = false
hint = """ hint = """
Replace `placeholder` with either `string` or `string_slice` in the `main` function. Replace `placeholder` with either `string` or `string_slice` in the `main`
function.
Example: Example:
`placeholder("blue");` `placeholder("blue");`
@ -1200,7 +1205,8 @@ hint = """
Is there an implementation of `TryFrom` in the standard library that can both do Is there an implementation of `TryFrom` in the standard library that can both do
the required integer conversion and check the range of the input? the required integer conversion and check the range of the input?
Challenge: Can you make the `TryFrom` implementations generic over many integer types?""" Challenge: Can you make the `TryFrom` implementations generic over many integer
types?"""
[[exercises]] [[exercises]]
name = "as_ref_mut" name = "as_ref_mut"