casting trait methods to FnOnce(&mut dyn Trait) is not ergonomic #68589
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
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.
In the following code, I'm trying to cast
Trait::f
toFnOnce(&mut dyn Trait)
which should be possible, but the obvious method doesn't work. None of the combinations I tried got it to work (I could just use a lambda that calledf
, but that defeats the purpose).(Playground)
Errors:
The text was updated successfully, but these errors were encountered: