Skip to content

never type appears in duplicate diagnostics #139790

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

Open
mejrs opened this issue Apr 14, 2025 · 0 comments
Open

never type appears in duplicate diagnostics #139790

mejrs opened this issue Apr 14, 2025 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@mejrs
Copy link
Contributor

mejrs commented Apr 14, 2025

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

@mejrs mejrs added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 14, 2025
@mejrs mejrs changed the title never type fallback produces duplicate diagnostics never type appears in duplicate diagnostics Apr 14, 2025
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 T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant