-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Update the behaviour of the compiler for code that will panic at runtime #2522
Conversation
@oli-obk @steveklabnik I was advised to ping you fine gentlemen. This is a small problem, with a solution that was a bit more involved than I had originally expected. I hope it won't take too much of your time. |
Aaaaaaaand it's a duplicate of #2454. My bad. Still, it's not an exact duplicate, as that PR does not contain any code displaying panic-at-runtime behaviour. |
Hi, thank you for working on this! I agree this section needs to be updated, but there's way too much complexity in the example you've provided to be included so early in the book as it is. I'm going to need some time to think about how we should handle this, because as you said, the point of this example is to show that some safety checks happen at runtime. |
Thank you for the review, madam (@carols10cents). If I may offer two alternatives instead, then...
|
Yeah, we want to avoid using external crates as much as possible.
I don't think we've explained I'm going to experiment with a solution when I have time. |
@carols10cents I was pointed here after asking about the same docs discrepancy on discord. For what it is worth, |
@eest |
Currently, the compiler output clearly displays a compilation error, and refuses to compile code that would clearly panic at runtime. Despite that, the text around the example still speaks as if the code will compile without error and wait until runtime to panic. Therefore, I have updated the text, and included a more convoluted example that the compiler cannot currently catch.