Skip to content
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 #105226

Closed
estebank opened this issue Dec 3, 2022 · 1 comment · Fixed by #105369
Closed

Detect spurious ; before assoc fn body #105226

estebank opened this issue Dec 3, 2022 · 1 comment · Fixed by #105369
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@estebank
Copy link
Contributor

estebank commented Dec 3, 2022

When copying bounds from a trait assoc item, you can accidentally copy the semicolon. If you forget to remove it, multiple errors are emitted, while the second is:

error: associated function in `impl` without body
    --> compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs:2349:5
     |
2349 | /     fn note_obligation_cause_code<T>(
2350 | |         &self,
2351 | |         err: &mut Diagnostic,
2352 | |         predicate: &T,
...    |
2357 | |     ) where
2358 | |         T: fmt::Display + ToPredicate<'tcx, T>;
     | |                                               ^ help: provide a definition for the function: `{ <body> }`
     | |_______________________________________________|

This should be explicitly handled to avoid knock down errors.

@estebank estebank added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. labels Dec 3, 2022
@chenyukang
Copy link
Member

@rustbot claim

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Dec 11, 2022
…KO8Ki

Detect spurious ; before assoc fn body

Fixes rust-lang#105226

r? `@TaKO8Ki`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 11, 2022
…KO8Ki

Detect spurious ; before assoc fn body

Fixes rust-lang#105226

r? ``@TaKO8Ki``
@bors bors closed this as completed in 5599f2a Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants