Improve E0782

After edition 2021, bare trait objects have been denied (E0782), still treating traits without dyn as bare trait objects in diagnostics confuses users (#111312).

Traits without dyn do not have (although had haved) such semantics anymore after making bare trait objects to be errors. In other words, traits without dyn should not appear somewhere but not because they were bare trait objects. E.g., the error of Box<Trait> should be that we use traits at wrong places but not we use bare trait objects, and we can emit a suggestion to add dyn. We should treat traits without dyn as traits simply instead of bare trait objects which may lead to confusion. This can make diagnostics for things like Trait::not_existing_func() more clearer.

9 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.