-
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
Detect spurious ; before assoc fn body #105369
Conversation
@@ -707,7 +707,7 @@ impl<'a> Parser<'a> { | |||
} | |||
match parse_item(self) { | |||
Ok(None) => { | |||
let is_unnecessary_semicolon = !items.is_empty() | |||
let mut is_unnecessary_semicolon = !items.is_empty() | |||
// When the close delim is `)` in a case like the following, `token.kind` is expected to be `token::CloseDelim(Delimiter::Parenthesis)`, | |||
// but the actual `token.kind` is `token::CloseDelim(Delimiter::Bracket)`. |
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.
// but the actual `token.kind` is `token::CloseDelim(Delimiter::Bracket)`. | |
// but the actual `token.kind` is `token::CloseDelim(Delimiter::Brace)`. |
I mistakenly wrote Bracket
for Brace
. Could you fix that instead?
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.
Ok,I didn't notice it, I will rollback my changes on your part.
I also think TokenTreesReader::parse_token_tree
does a very weird thing for this scenario, I had some try to fix it:
#104012 (comment)
currently pending on: #104012
4fa5694
to
5599f2a
Compare
@bors r+ rollup |
…KO8Ki Detect spurious ; before assoc fn body Fixes rust-lang#105226 r? `@TaKO8Ki`
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#101648 (Better documentation for env::home_dir()'s broken behaviour) - rust-lang#105283 (Don't call `diagnostic_hir_wf_check` query if we have infer variables) - rust-lang#105369 (Detect spurious ; before assoc fn body) - rust-lang#105472 (Make encode_info_for_trait_item use queries instead of accessing the HIR) - rust-lang#105521 (separate heading from body) - rust-lang#105555 (llvm-wrapper: adapt for LLVM API changes) - rust-lang#105560 (Extend rustdoc hashtag prepended line test) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
error: associated function in `impl` without body | ||
--> $DIR/issue-105226.rs:7:5 | ||
| | ||
LL | fn hello<P>(&self, val: &P) where P: fmt::Display; { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | ||
| | | ||
| help: provide a definition for the function: `{ <body> }` |
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.
Ideally we would also avoid emitting this error by making the parser recover from the spurious ;
Fixes #105226
r? @TaKO8Ki