Skip to content
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

Arrays and Slices says the last line will cause a compiler error when it doesn't #1575

Closed
nathanheffley opened this issue Jul 13, 2022 · 0 comments · Fixed by #1626
Closed

Comments

@nathanheffley
Copy link

Arrays and Slices has an example at the bottom of the code example of an index out of bounds error, and the comment implies that it will cause a compiler error if you uncomment the line. But if you go ahead and uncomment the line the example will compile just fine and run until it panics because of the out of bounds error.

I figured out that all of the lines that borrow the xs value seem to be what interferes with the compilers ability to preemptively catch the error, but it was pretty confusing to me as someone who doesn't work with compilers all that extensively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant