Print better auto-trait diagnostics when opaque return type is involved #67117
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.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The following code: (playground)
gives the following error message:
There are a couple of problems here:
impl std::marker::Copy
within mentioning where it's defined. Since auto traits 'leak through'impl trait
, it would probably be a good idea to reference the function where it's defined to help disambiguate between multiple distinctimpl SomeTrait
types.impl trait
types. Since we're already exposing the underlying type in the error message, we might want to say something like:'note: the anonymous return type
impl Copy
of functionbar
(with underlying type*const ()
) does not implementstd::marker::Send
.'The text was updated successfully, but these errors were encountered: