Summary
Bare trait objects do not interact well with const generics, as if a user does not surround a const expression with {}, it can be parsed as a trait object (e.g. foo + bar is interpreted as dyn foo + bar), which leads to confusing errors. See, for instance: rust-lang/rust#77502 (comment). If we deny bare_trait_objects in the 2021 edition, which is a permitted edition change, we can emit better errors for const generics, a feature we hope to stabilise in the form of min_const_generics in the near future.
bare_trait_objects would continue to work pre-2021 edition. Thus, the better error messages will only be available in the 2021 edition.
About this issue
This issue corresponds to a lang-team design meeting proposal. It corresponds
to a possible topic of discussion that may be scheduled for deeper discussion
during one of our design meetings.
Summary
Bare trait objects do not interact well with const generics, as if a user does not surround a const expression with
{}, it can be parsed as a trait object (e.g.foo + baris interpreted asdyn foo + bar), which leads to confusing errors. See, for instance: rust-lang/rust#77502 (comment). If we denybare_trait_objectsin the 2021 edition, which is a permitted edition change, we can emit better errors for const generics, a feature we hope to stabilise in the form ofmin_const_genericsin the near future.bare_trait_objectswould continue to work pre-2021 edition. Thus, the better error messages will only be available in the 2021 edition.About this issue
This issue corresponds to a lang-team design meeting proposal. It corresponds
to a possible topic of discussion that may be scheduled for deeper discussion
during one of our design meetings.