panic message's location should be matched with the example in docs
Ian-sc-Kang opened this issue · comments
- I have searched open and closed issues and pull requests for duplicates, using these search terms:
- panic
-
I have checked the latest
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://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-with-panic.html#:~:text=The%20call%20to%20panic!%20causes%20the%20error%20message%20contained%20in%20the%20last%20two%20lines.%20The%20first%20line%20shows%20our%20panic%20message%20and%20the%20place%20in%20our%20source%20code%20where%20the%20panic%20occurred%3A%20src/main.rs%3A2%3A5%20indicates%20that%20it%E2%80%99s%20the%20second%20line%2C%20fifth%20character%20of%20our%20src/main.rs%20file.
Description of the problem:
Although the documentation refers the panic message in the same line with error message, the actual panic message is the next line of the error message with source code line that triggers error
Suggested fix:
The example output should be fixed with the actual output
The panic message style was changed in 1.73.0 to the one @Ian-sc-Kang attached. This book is currently based on 1.67.1. Updating the rustc version would solve this issue.
Fixed in #3844. Thanks!