-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Array lengths do not inherit outer unsafe blocks -- bad diagnostics #59729
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
Comments
Seems like unsafety is not propagated into constants. Not sure if it should. For |
I think we want this to stay as it is, but we should improve the diagnostic to inform you about what's going on. |
I think it's unintuitive, just like it would be for closures. |
Oh definitely, but do you think sufficiently good diagnostics cannot alleviate that enough for us to keep the current checks? On the other hand, the inconsistency with closures alone is enough to make me want to leak the unsafety into the constant. |
In terms of consistency, I think it would make sense to treat |
I propose to close this as "works as intended": |
I agree it works as intended, but the diagnostic could explain this (especially for anonymous constants) by adding a span to the outer |
Current output:
Only outstanding action would be to suggest |
I will close this. I feel that if a user doesn't know enough to add |
PLAY: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=e7374b639482f0ac6d0b168ff0c07a62
The text was updated successfully, but these errors were encountered: