Confusing error message for impl Trait
consts/statics that use generics
#54560
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
F-impl_trait_in_bindings
`#![feature(impl_trait_in_bindings)]`
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
#53542 introduced
impl Trait
bindings in consts and statics (along with let bindings), but of course they cannot be assigned a value of a generic type. The error message is presently a bit confusing:Example:
A message like
cannot assign value of generic type to const or static of opaque type
would be better, I think (unless there's already a suitable error that can be reused).See also the
bindings
test from the above PR and its stderr.CC @cramertj @oli-obk
The text was updated successfully, but these errors were encountered: