emit error with span for empty asserts#56491
Merged
bors merged 1 commit intorust-lang:masterfrom Dec 11, 2018
Merged
Conversation
Contributor
|
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
Contributor
Author
|
r? @estebank |
estebank
reviewed
Dec 4, 2018
src/libsyntax_ext/assert.rs
Outdated
Contributor
There was a problem hiding this comment.
Thanks for the change!
Could you change this to something closer to
cx.struct_span_err(sp, "macro call requires boolean expression as argument")
.span_label(sp, "boolean expression required")
.emit();
Ideally you'd add a Applicability::MaybeIncorrect suggestion as well showing what the correct code would be, but that'd be overkill for this.
estebank
reviewed
Dec 10, 2018
| --> $DIR/assert.rs:2:5 | ||
| | | ||
| LL | assert!(); //~ ERROR requires a boolean expression | ||
| | ^^^^^^^^^^ boolean expression required |
Contributor
There was a problem hiding this comment.
It'd be nice to point at the (empty) argument list, but this is already quite an improvement.
Contributor
|
@bors r+ rollup |
Collaborator
|
📌 Commit a367cec has been approved by |
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Dec 10, 2018
emit error with span for empty asserts Fixes rust-lang#55547.
euclio
added a commit
to euclio/rust
that referenced
this pull request
Jan 2, 2019
This commit completely removes usage of the `panictry!` macro from outside libsyntax. The macro causes parse errors to be fatal, so using it in libsyntax_ext caused parse failures *within* a syntax extension to be fatal, which is probably not intended. Furthermore, this commit adds spans to diagnostics emitted by empty extensions if they were missing, à la rust-lang#56491.
Mark-Simulacrum
added a commit
to Mark-Simulacrum/rust
that referenced
this pull request
Jan 3, 2019
make `panictry!` private to libsyntax This commit completely removes usage of the `panictry!` macro from outside libsyntax. The macro causes parse errors to be fatal, so using it in libsyntax_ext caused parse failures *within* a syntax extension to be fatal, which is probably not intended. Furthermore, this commit adds spans to diagnostics emitted by empty extensions if they were missing, à la rust-lang#56491.
bors
added a commit
that referenced
this pull request
Jan 4, 2019
make `panictry!` private to libsyntax This commit completely removes usage of the `panictry!` macro from outside libsyntax. The macro causes parse errors to be fatal, so using it in libsyntax_ext caused parse failures *within* a syntax extension to be fatal, which is probably not intended. Furthermore, this commit adds spans to diagnostics emitted by empty extensions if they were missing, à la #56491.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #55547.