Uh oh!
There was an error while loading. Please reload this page.
Point at original span when emitting unreachable lint - #64592
Conversation
Fixesrust-lang#64590 When we emit an 'unreachable' lint, we now add a note pointing at the expression that actually causes the code to be unreachable (e.g. `return`, `break`, `panic`). This is especially useful when macros are involved, since a diverging expression might be hidden inside of a macro invocation.
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Centril
commented
Sep 18, 2019
r? @Centril |
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
Rename the existing Diverges.always method to Diverges.is_always
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
Aaron1011
commented
Sep 19, 2019
@Centril fixed |
Centril
commented
Sep 19, 2019
👍 @bors r+ |
bors
commented
Sep 19, 2019
📌 Commit d67528f has been approved by |
… r=Centril Point at original span when emitting unreachable lint Fixesrust-lang#64590 When we emit an 'unreachable' lint, we now add a note pointing at the expression that actually causes the code to be unreachable (e.g. `return`, `break`, `panic`). This is especially useful when macros are involved, since a diverging expression might be hidden inside of a macro invocation.
Rollup of 6 pull requests Successful merges: - #63448 (fix Miri discriminant handling) - #64592 (Point at original span when emitting unreachable lint) - #64601 (Fix backticks in documentation) - #64606 (Remove unnecessary `mut` in doc example) - #64611 (rustbuild: Don't package libstd twice) - #64613 (rustbuild: Copy crate doc files fewer times) Failed merges: r? @ghost
| self.tcx().lint_hir(lint::builtin::UNREACHABLE_CODE, id, span, &msg); | ||
| let msg = format!("unreachable {}", kind); | ||
| self.tcx().struct_span_lint_hir(lint::builtin::UNREACHABLE_CODE, id, span, &msg) | ||
| .span_note( |
There was a problem hiding this comment.
Could you change this to be a span_label instead?
There was a problem hiding this comment.
Let's do it in a follow up since my rollup is running. :)
Also, @Aaron1011, can you look at @estebank's PR #64624 and close the relevant additional issues?
Rollup of 6 pull requests Successful merges: - #63448 (fix Miri discriminant handling) - #64592 (Point at original span when emitting unreachable lint) - #64601 (Fix backticks in documentation) - #64606 (Remove unnecessary `mut` in doc example) - #64611 (rustbuild: Don't package libstd twice) - #64613 (rustbuild: Copy crate doc files fewer times) Failed merges: r? @ghost
Fix#39858, CC #46426, CC #57377, fix#60394, fix#64590.
When we emit an 'unreachable' lint, we now add a note pointing at the
expression that actually causes the code to be unreachable (e.g.
return,break,panic).This is especially useful when macros are involved, since a diverging
expression might be hidden inside of a macro invocation.