1
0
Fork 0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-06-04 08:46:10 +02:00

Fix line numbers

Fixes #69.
This commit is contained in:
Carol (Nichols || Goulding) 2018-03-04 14:26:56 -05:00
parent 426e5cf3f5
commit 956ffa9d7c
No known key found for this signature in database
GPG Key ID: D04B39A6CA243902
9 changed files with 19 additions and 19 deletions

File diff suppressed because one or more lines are too long

View File

@ -39,6 +39,6 @@ fn is_even(num: i32) -> bool {
// The error message points to line 10 and says it expects a type after the
// The error message points to line 12 and says it expects a type after the
// `->`. This is where the function's return type should be-- take a look at
// the `is_even` function for an example!

View File

@ -38,6 +38,6 @@ fn fill_vec(vec: Vec<i32>) -> Vec<i32> {
// So you've got the "cannot borrow immutable local variable `vec1` as mutable" error on line 10,
// right? The fix for this is going to be adding one keyword, and the addition is NOT on line 10
// So you've got the "cannot borrow immutable local variable `vec1` as mutable" error on line 11,
// right? The fix for this is going to be adding one keyword, and the addition is NOT on line 11
// where the error is.

View File

@ -1,5 +1,5 @@
// move_semantics2.rs
// Make me compile without changing line 9! Scroll down for hints :)
// Make me compile without changing line 10! Scroll down for hints :)
pub fn main() {
let vec0 = Vec::new();
@ -39,8 +39,8 @@ fn fill_vec(vec: Vec<i32>) -> Vec<i32> {
// So `vec0` is being *moved* into the function `fill_vec` when we call it on
// line 6, which means it gets dropped at the end of `fill_vec`, which means we
// can't use `vec0` again on line 9 (or anywhere else in `main` after the
// line 7, which means it gets dropped at the end of `fill_vec`, which means we
// can't use `vec0` again on line 10 (or anywhere else in `main` after the
// `fill_vec` call for that matter). We could fix this in a few ways, try them
// all!
// 1. Make another, separate version of the data that's in `vec0` and pass that

View File

@ -41,4 +41,4 @@ fn is_a_color_word(attempt: &str) -> bool {
// Yes, it would be really easy to fix this by just changing the value bound to `word` to be a
// string slice instead of a `String`, wouldn't it?? There is a way to add one character to line
// 5, though, that will coerce the `String` into a string slice.
// 6, though, that will coerce the `String` into a string slice.

View File

@ -1,6 +1,6 @@
// threads1.rs
// Make this compile! Scroll down for hints :) The idea is the thread
// spawned on line 17 is completing jobs while the main thread is
// spawned on line 19 is completing jobs while the main thread is
// monitoring progress until 10 jobs are completed. If you see 6 lines
// of "waiting..." and the program ends without timing out the playground,
// you've got it :)

View File

@ -38,5 +38,5 @@ fn main() {
// Hint: The declaration on line 4 is missing a keyword that is needed in Rust
// Hint: The declaration on line 5 is missing a keyword that is needed in Rust
// to create a new variable binding.

View File

@ -40,7 +40,7 @@ fn main() {
// The compiler message is saying that Rust cannot infer the type that the
// variable binding `x` has with what is given here.
// What happens if you annotate line 4 with a type annotation?
// What happens if you annotate line 5 with a type annotation?
// What if you give x a value?
// What if you do both?
// What type should x be, anyway?

View File

@ -39,7 +39,7 @@ fn main() {
// Oops! In this exercise, we have a variable binding that we've created on
// line 4, and we're trying to use it on line 5, but we haven't given it a
// line 5, and we're trying to use it on line 6, but we haven't given it a
// value. We can't print out something that isn't there; try giving x a value!
// This is an error that can cause bugs that's very easy to make in any
// programming language -- thankfully the Rust compiler has caught this for us!