Skip to content

E0599 suggestion omits trailing parenthesis #150459

@phy1729

Description

@phy1729

Code

enum Foo {
    Foo,
}

fn foo() -> Result<(), Foo> {
    Err(Foo::Fooo)
}

Current output

error[E0599]: no variant or associated item named `Fooo` found for enum `Foo` in the current scope
 --> src/lib.rs:6:18
  |
1 | enum Foo {
  | -------- variant or associated item `Fooo` not found for this enum
...
6 |         Err(Foo::Fooo)
  |                  ^^^^ variant or associated item not found in `Foo`
  |
help: there is a variant with a similar name
  |
6 -         Err(Foo::Fooo)
6 +         Err(Foo::Foo
  |

For more information about this error, try `rustc --explain E0599`.

Desired output

6 +     Err(Foo::Foo)

Rationale and extra context

No response

Other cases

Rust Version

rustc 1.92.0 (ded5c06cf 2025-12-08) (built from a source tarball)
binary: rustc
commit-hash: ded5c06cf21d2b93bffd5d884aa6e96934ee4234
commit-date: 2025-12-08
host: x86_64-unknown-openbsd
release: 1.92.0
LLVM version: 20.1.8

Anything else?

No response

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`D-imprecise-spansDiagnostics: spans don't point to exactly the erroneous codeD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.D-papercutDiagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions