Change:
<ins> // Ensure that the compiler include the blanklet implementation suggestion // when inside a `impl` statment are used two local traits. // // edition:2021 use std::fmt; trait LocalTraitOne { } trait LocalTraitTwo { } trait GenericTrait<T> {} impl LocalTraitTwo for LocalTraitOne {} //~^ ERROR trait objects must include the `dyn` keyword //~| HELP add `dyn` keyword before this trait //~| HELP alternatively use a blanket implementation to implement `LocalTraitTwo` for all types that also implement `LocalTraitOne` impl fmt::Display for LocalTraitOne { //~^ ERROR trait objects must include the `dyn` keyword //~| HELP add `dyn` keyword before this trait fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { todo!(); } } impl fmt::Display for LocalTraitTwo + Send { //~^ ERROR trait objects must include the `dyn` keyword //~| HELP add `dyn` keyword before this trait fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { todo!(); } } impl LocalTraitOne for fmt::Display {} //~^ ERROR trait objects must include the `dyn` keyword //~| HELP add `dyn` keyword before this trait //~| HELP alternatively use a blanket implementation to implement `LocalTraitOne` for all types that also implement `fmt::Display` impl LocalTraitOne for fmt::Display + Send {} //~^ ERROR trait objects must include the `dyn` keyword //~| HELP add `dyn` keyword before this trait //~| HELP alternatively use a blanket implementation to implement `LocalTraitOne` for all types that also implement `fmt::Display + Send` impl<E> GenericTrait<E> for LocalTraitOne {} //~^ ERROR trait objects must include the `dyn` keyword //~| HELP add `dyn` keyword before this trait //~| HELP alternatively use a blanket implementation to implement `GenericTrait<E>` for all types that also implement `LocalTraitOne` trait GenericTraitTwo<T> {} impl<T, E> GenericTraitTwo<E> for GenericTrait<T> {} //~^ ERROR trait objects must include the `dyn` keyword //~| HELP add `dyn` keyword before this trait //~| HELP alternatively use a blanket implementation to implement `GenericTraitTwo<E>` for all types that also implement `GenericTrait<T>` fn main() {} </ins>

Discussion:
One of the big problems with the 2015-style trait object syntax (no ) was that users often write things like when what they really meant was . Back then, the error message would more often than not be some inscrutable message about , which would send them on a wild goose chase of adding bounds everywhere they could think of, leading to even more inscrutable messages. Now, the error message is clearer: it tells users they need to add for a trait object type. However, I find in many cases (most cases?) this is not what users actually want - what they actually want is the blanket impl. It would be helpful to have a note suggesting the correct syntax for a blanket impl, or better yet just presenting both correct syntaxes (impl for trait object and blanket impl) on equal footing and making it clear the difference between them. <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
claim
I work to reproduce this issue and start to understand what type of check we need to do, and in particular the work that we need to do is the following one: If the traits are local traits we can perform the suggestion of the blanket impls, for example in the following code But we need to skip the following suggestion in case we are using not local traits, like the following code here