Diagnostic for dyn Self
could be more specific
#58531
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-traits
Area: Trait system
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
D-papercut
Diagnostics: An error or lint that needs small tweaks.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code (play):
Current diagnostic (1.34.0-nightly 2019-02-15 eac0908):
@Moongoodboy-K on IRC points out that it might be more helpful for the
diagnostic to say something like,
(For context: while I’ve since learned that this code is pretty far from
valid, the intent was to find a way to use
Self
-types while preservingobject-safety. My intuition was that it should suffice to return the
receiver’s vtable from the function, which suggested to me the syntax
dyn Self
. Using simplyfn f() -> dyn S
is object-safe but loses theself-typing, which might matter if given something like
dyn S + Send
.)The text was updated successfully, but these errors were encountered: