Skip to content

never type appears in duplicate diagnostics #139790

@mejrs

Description

@mejrs

Code

const fn foo() -> Option<()> { None?; None }

Current output

error[E0015]: `?` is not allowed on `Option<!>` in constant functions
 --> src/lib.rs:1:32
  |
1 | const fn foo() -> Option<()> { None?; None }
  |                                ^^^^^
  |
  = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants

error[E0015]: `?` is not allowed on `Option<()>` in constant functions
 --> src/lib.rs:1:32
  |
1 | const fn foo() -> Option<()> { None?; None }
  |                                ^^^^^
  |
  = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants

For more information about this error, try `rustc --explain E0015`.
error: could not compile `playground` (lib) due to 2 previous errors

Desired output

Minus the diagnostic about `Option<!>`

Rationale and extra context

This only happens on edition 2024.

Other cases

Rust Version

edition 2024

Anything else?

https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=44414f7fe4f727ef3120e30015bfdd28

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-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