Skip to content

Detect spurious ; before assoc fn body #105226

Closed
@estebank

Description

@estebank
Contributor

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.

Activity

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

chenyukang commented on Dec 4, 2022

@chenyukang
Member

@rustbot claim

added a commit that references this issue on Dec 11, 2022

Rollup merge of rust-lang#105369 - chenyukang:yukang/fix-105226, r=Ta…

171363c
added a commit that references this issue on Dec 11, 2022

Rollup merge of rust-lang#105369 - chenyukang:yukang/fix-105226, r=Ta…

4154e14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

    Participants

    @chenyukang@estebank

    Issue actions

      Detect spurious `;` before assoc fn body · Issue #105226 · rust-lang/rust