-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chapter 4.5, final quiz, question 2 #224
Comments
Adding on to this (as was going through the book to make sure I was solid on the basics with tests), I don't believe the suggested answer is valid as is either, as it needs lifetime annotations - would end up looking like
to be valid, and maximally correct (as the output vector should be bound to the lifetime of the haystack) |
The primary citation for this would be this part of 4.4:
I did not add lifetime parameters to these answers because that feature is not covered until later in the book. |
First of all - happy new year. Sorry, but I can't see any correlation between the chapter you cited and the question why |
I think the difficulty I found without lifetime parameters but as someone who knows rust but was using the quizzes in the book to ensure knowledge was sound, was that being an incorrect answer (can see that it wouldn't compile) threw me off. Appreciate people learning through the book won't have this problem - not sure showing them a technically wrong answer is ideal but you're the expert of paedagogy so happy to defer to you. |
main
branch to see if this has already been fixed, in this file:URL to the section(s) of the book with this problem:
https://rust-book.cs.brown.edu/ch04-05-ownership-recap.html
Description of the problem:
The answer for the question says
IMO this statement comes "out of the void" i.e. without a satisfying reasoning. A (short) explanation why &[String] can accept more inputs than &Vec<String> would be really helpful. In case that I've missing something in the main part of the book a reference to the accordingly chapter would be sufficient.
Suggested fix:
Adding an explanation or a reference to the accordingly chapter
The text was updated successfully, but these errors were encountered: