Skip to content

Conversation

Aaron1011
Copy link
Contributor

@Aaron1011 Aaron1011 commented Sep 18, 2019

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.

Fixes rust-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.
@rust-highfive

This comment has been minimized.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 18, 2019
@Centril
Copy link
Contributor

Centril commented Sep 18, 2019

r? @Centril

@rust-highfive rust-highfive assigned Centril and unassigned cramertj Sep 18, 2019
@Aaron1011

This comment has been minimized.

Aaron1011 and others added 3 commits September 18, 2019 19:48
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
Rename the existing Diverges.always method to Diverges.is_always
@Aaron1011

This comment has been minimized.

Aaron1011 and others added 2 commits September 18, 2019 20:14
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
@Aaron1011
Copy link
Contributor Author

@Centril fixed

@Centril
Copy link
Contributor

Centril commented Sep 19, 2019

👍 @bors r+

@bors
Copy link
Collaborator

bors commented Sep 19, 2019

📌 Commit d67528f has been approved by Centril

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 19, 2019
Centril added a commit to Centril/rust that referenced this pull request Sep 19, 2019
… r=Centril

Point at original span when emitting unreachable lint

Fixes rust-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.
bors added a commit that referenced this pull request Sep 19, 2019
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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change this to be a span_label instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

bors added a commit that referenced this pull request Sep 19, 2019
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
@bors bors merged commit d67528f into rust-lang:master Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
6 participants