Skip to content

Detect spurious ; before assoc fn body #105226

Closed
@estebank

Description

@estebank

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.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTD-verboseDiagnostics: Too much output caused by a single piece of incorrect code.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions