bare_trait_objects help is incorrect with Box<Trait + 'lifetime> in 2015 edition #63330
Labels
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`.
C-bug
Category: This is a bug.
D-edition
Diagnostics: An error or lint that should account for edition differences.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The help text message for
bare_trait_objects
is incorrect when using the 2015 edition.The following example gives a correct help text in the 2015 and 2018 edition:
but adding a lifetime to the trait bound produces an incorrect help message for the 2015 edition:
Applying the suggest help text in 2015 edition code results in:
The code actually compiles with the 2018 edition.
The correct fix for 2015 edition code (which also works for edition 2018) is probably to include parens:
I see two options:
I personally prefer the first option for consistency with the existing help text and easier copy/pasting between editions.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: