-
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
Collect occurrences of empty blocks for mismatched braces diagnostic #65364
Conversation
Change-Id: I20ba0b62308370ee961141fa1aefc4b9c9f0cb3a
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
Change-Id: I20ba0b62308370ee961141fa1aefc4b9c9f0cb3a
r? @estebank |
@estebank Would you mind reviewing this pr if you have free time. |
@@ -121,13 +124,20 @@ impl<'a> TokenTreesReader<'a> { | |||
// Correct delimiter. | |||
token::CloseDelim(d) if d == delim => { | |||
let (open_brace, open_brace_span) = self.open_braces.pop().unwrap(); | |||
let close_brace_span = self.token.span; | |||
|
|||
if close_brace_span.lo() == open_brace_span.hi() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that it would make more sense to check whether tts
is empty instead of comparing spans. That way we also catch cases like { }
and {\n}
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the advice and I'll to change it.
@XiangQingW love it! There's one minor change I'd like, but otherwise r=me. |
Change-Id: I20ba0b62308370ee961141fa1aefc4b9c9f0cb3a
@bors +r rollup |
r+ ? |
@bors r+ rollup |
📌 Commit fe819a0 has been approved by |
@ebarnard Pinging again from triage. I have reverted the unrelated commit. Thank you. |
Please remove it entirely by rebasing. |
@XiangQingW I think you mean @estebank. |
@XiangQingW can you use Double check the log before and after the rebase before pushing to make sure what you expect to be there is there. |
It's really helpful. Thank you very much. |
@bors r+ rollup |
📌 Commit fe819a0 has been approved by |
Collect occurrences of empty blocks for mismatched braces diagnostic Fix rust-lang#63904
Rollup of 17 pull requests Successful merges: - #65016 (Always inline `mem::{size_of,align_of}` in debug builds) - #65197 (Prepare `MutVisitor`s to handle interned projections) - #65201 (Disable Go and OCaml bindings when building LLVM) - #65364 (Collect occurrences of empty blocks for mismatched braces diagnostic) - #65417 (Add more coherence tests) - #65434 (Add long error explanation for E0577) - #65455 (Avoid unnecessary `TokenTree` to `TokenStream` conversions) - #65472 (Use a sharded dep node to dep node index map) - #65480 (Speed up `LexicalResolve::expansion()`) - #65496 (properly document panics in div_euclid and rem_euclid) - #65508 (add option to ping llvm ice-breakers to triagebot) - #65511 (save-analysis: Nest tables when processing impl block definitions) - #65513 (reorder fmt docs for more clarity) - #65532 (doc: make BitSet intro more short) - #65540 (show up some extra info when t!() fails) - #65549 (Fix left/right shift typo in wrapping rotate docs) - #65552 (Clarify diagnostics when using `~` as a unary op) Failed merges: - #65471 (Add long error explanation for E0578) r? @ghost
Collect occurrences of empty blocks for mismatched braces diagnostic Fix rust-lang#63904
Rollup of 19 pull requests Successful merges: - #65016 (Always inline `mem::{size_of,align_of}` in debug builds) - #65197 (Prepare `MutVisitor`s to handle interned projections) - #65201 (Disable Go and OCaml bindings when building LLVM) - #65334 (Add long error explanation for E0575) - #65364 (Collect occurrences of empty blocks for mismatched braces diagnostic) - #65455 (Avoid unnecessary `TokenTree` to `TokenStream` conversions) - #65472 (Use a sharded dep node to dep node index map) - #65480 (Speed up `LexicalResolve::expansion()`) - #65493 (Add long error explanation for E0584) - #65496 (properly document panics in div_euclid and rem_euclid) - #65498 (Plugins deprecation: don’t suggest simply removing the attribute) - #65508 (add option to ping llvm ice-breakers to triagebot) - #65511 (save-analysis: Nest tables when processing impl block definitions) - #65513 (reorder fmt docs for more clarity) - #65532 (doc: make BitSet intro more short) - #65535 (rustc: arena-allocate the slice in `ty::GenericsPredicate`, not the whole struct.) - #65540 (show up some extra info when t!() fails) - #65549 (Fix left/right shift typo in wrapping rotate docs) - #65552 (Clarify diagnostics when using `~` as a unary op) Failed merges: - #65390 (Add long error explanation for E0576) - #65434 (Add long error explanation for E0577) - #65471 (Add long error explanation for E0578) r? @ghost
Fix #63904