-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Point to enclosing block/fn on nested unsafe #39202
Conversation
r? @arielb1 (rust_highfive has picked a reviewer for you, use r? to override) |
6338bc8
to
f31c8b7
Compare
Might want to carve out an exception for unsafe blocks within macros. |
@estebank this seems nice; but it'd be nicer still if we used a more targeted span (i.e., just the |
@nikomatsakis There's only one reason I'm reticent to that suggestion: The current presentation will only be as shown if the block is less than 8 lines (showing only the first line that contains the keyword otherwise), and I'm looking into making the multiline presentation smarter about longer blocks (instead of using the first line, showing the first X and last Y lines). I feel it is useful to know both the start and end of the enclosing block (as not everyone will know about "jump to closing brace" in their editor) when possible. What do you think? |
@estebank I think people can find the end of their blocks ok, personally. But also, I sort of like the "collapsed" error where both of the unsafe blocks are shown simultaneously, but
|
Personally, I don't like errors with separate spans - it blasts the console too much. |
The code seems ok. I think r? @jonathandturner |
Looks good. @bors r+ |
📌 Commit f31c8b7 has been approved by |
⌛ Testing commit f31c8b7 with merge 2ae8de7... |
💔 Test failed - status-travis |
Seems like a legit failure:
|
FYI: The fix for this is simply using |
f0c6be0
to
3a9560a
Compare
@jonathandturner fixed merge conflict and added label to the block. |
@bors r+ |
📌 Commit 3a9560a has been approved by |
…turner Point to enclosing block/fn on nested unsafe When declaring nested unsafe blocks (`unsafe {unsafe {}}`) that trigger the "unnecessary `unsafe` block" error, point out the enclosing `unsafe block` or `unsafe fn` that makes it unnecessary. <img width="621" alt="" src="https://cloud.githubusercontent.com/assets/1606434/22139922/26ad468a-de9e-11e6-8884-2945be882ea8.png"> Fixes rust-lang#39144.
🔒 Merge conflict |
@bors: retry |
…turner Point to enclosing block/fn on nested unsafe When declaring nested unsafe blocks (`unsafe {unsafe {}}`) that trigger the "unnecessary `unsafe` block" error, point out the enclosing `unsafe block` or `unsafe fn` that makes it unnecessary. <img width="621" alt="" src="https://cloud.githubusercontent.com/assets/1606434/22139922/26ad468a-de9e-11e6-8884-2945be882ea8.png"> Fixes rust-lang#39144.
🔒 Merge conflict |
When declaring nested unsafe blocks (`unsafe {unsafe {}}`) that trigger the "unnecessary `unsafe` block" error, point out the enclosing `unsafe block` or `unsafe fn` that makes it unnecessary.
cd7bde9
to
ac2bc7c
Compare
@bors: r=jonathandturner |
📌 Commit ac2bc7c has been approved by |
…turner Point to enclosing block/fn on nested unsafe When declaring nested unsafe blocks (`unsafe {unsafe {}}`) that trigger the "unnecessary `unsafe` block" error, point out the enclosing `unsafe block` or `unsafe fn` that makes it unnecessary. <img width="621" alt="" src="https://cloud.githubusercontent.com/assets/1606434/22139922/26ad468a-de9e-11e6-8884-2945be882ea8.png"> Fixes rust-lang#39144.
…turner Point to enclosing block/fn on nested unsafe When declaring nested unsafe blocks (`unsafe {unsafe {}}`) that trigger the "unnecessary `unsafe` block" error, point out the enclosing `unsafe block` or `unsafe fn` that makes it unnecessary. <img width="621" alt="" src="https://cloud.githubusercontent.com/assets/1606434/22139922/26ad468a-de9e-11e6-8884-2945be882ea8.png"> Fixes rust-lang#39144.
…turner Point to enclosing block/fn on nested unsafe When declaring nested unsafe blocks (`unsafe {unsafe {}}`) that trigger the "unnecessary `unsafe` block" error, point out the enclosing `unsafe block` or `unsafe fn` that makes it unnecessary. <img width="621" alt="" src="https://cloud.githubusercontent.com/assets/1606434/22139922/26ad468a-de9e-11e6-8884-2945be882ea8.png"> Fixes rust-lang#39144.
…turner Point to enclosing block/fn on nested unsafe When declaring nested unsafe blocks (`unsafe {unsafe {}}`) that trigger the "unnecessary `unsafe` block" error, point out the enclosing `unsafe block` or `unsafe fn` that makes it unnecessary. <img width="621" alt="" src="https://cloud.githubusercontent.com/assets/1606434/22139922/26ad468a-de9e-11e6-8884-2945be882ea8.png"> Fixes rust-lang#39144.
…turner Point to enclosing block/fn on nested unsafe When declaring nested unsafe blocks (`unsafe {unsafe {}}`) that trigger the "unnecessary `unsafe` block" error, point out the enclosing `unsafe block` or `unsafe fn` that makes it unnecessary. <img width="621" alt="" src="https://cloud.githubusercontent.com/assets/1606434/22139922/26ad468a-de9e-11e6-8884-2945be882ea8.png"> Fixes rust-lang#39144.
Rollup of 38 pull requests - Successful merges: #39202, #39820, #39918, #39921, #40092, #40146, #40199, #40225, #40239, #40257, #40259, #40261, #40277, #40278, #40287, #40297, #40311, #40315, #40319, #40324, #40336, #40340, #40344, #40345, #40367, #40369, #40372, #40373, #40379, #40385, #40386, #40389, #40400, #40404, #40410, #40422, #40423, #40424 - Failed merges: #40220, #40329, #40426
Rollup of 38 pull requests - Successful merges: #39202, #39820, #39918, #39921, #40092, #40146, #40199, #40225, #40239, #40257, #40259, #40261, #40277, #40278, #40287, #40297, #40311, #40315, #40319, #40324, #40336, #40340, #40344, #40345, #40367, #40369, #40372, #40373, #40379, #40385, #40386, #40389, #40400, #40404, #40410, #40422, #40423, #40424 - Failed merges: #40220, #40329, #40426
When declaring nested unsafe blocks (
unsafe {unsafe {}}
) that triggerthe "unnecessary
unsafe
block" error, point out the enclosingunsafe block
orunsafe fn
that makes it unnecessary.Fixes #39144.