2022-06-22 22:06:34 +00:00
|
|
|
// Ensure that the compiler include the blanklet implementation suggestion
|
2022-08-18 02:13:37 +00:00
|
|
|
// when inside a `impl` statement are used two local traits.
|
2022-06-22 22:06:34 +00:00
|
|
|
//
|
|
|
|
// edition:2021
|
|
|
|
use std::fmt;
|
|
|
|
|
|
|
|
trait LocalTraitOne { }
|
|
|
|
|
|
|
|
trait LocalTraitTwo { }
|
|
|
|
|
|
|
|
trait GenericTrait<T> {}
|
|
|
|
|
|
|
|
impl LocalTraitTwo for LocalTraitOne {}
|
|
|
|
//~^ ERROR trait objects must include the `dyn` keyword
|
2022-06-29 23:31:10 +00:00
|
|
|
//~| HELP add `dyn` keyword before this trait
|
|
|
|
//~| HELP alternatively use a blanket implementation to implement `LocalTraitTwo` for all types that also implement `LocalTraitOne`
|
2022-06-22 22:06:34 +00:00
|
|
|
|
|
|
|
impl fmt::Display for LocalTraitOne {
|
|
|
|
//~^ ERROR trait objects must include the `dyn` keyword
|
2022-06-29 23:31:10 +00:00
|
|
|
//~| HELP add `dyn` keyword before this trait
|
2022-06-22 22:06:34 +00:00
|
|
|
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
todo!();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl fmt::Display for LocalTraitTwo + Send {
|
|
|
|
//~^ ERROR trait objects must include the `dyn` keyword
|
2022-06-29 23:31:10 +00:00
|
|
|
//~| HELP add `dyn` keyword before this trait
|
2022-06-22 22:06:34 +00:00
|
|
|
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
todo!();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl LocalTraitOne for fmt::Display {}
|
|
|
|
//~^ ERROR trait objects must include the `dyn` keyword
|
2022-06-29 23:31:10 +00:00
|
|
|
//~| HELP add `dyn` keyword before this trait
|
|
|
|
//~| HELP alternatively use a blanket implementation to implement `LocalTraitOne` for all types that also implement `fmt::Display`
|
|
|
|
|
2022-06-22 22:06:34 +00:00
|
|
|
|
|
|
|
impl LocalTraitOne for fmt::Display + Send {}
|
|
|
|
//~^ ERROR trait objects must include the `dyn` keyword
|
2022-06-29 23:31:10 +00:00
|
|
|
//~| 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`
|
|
|
|
|
2022-06-22 22:06:34 +00:00
|
|
|
|
|
|
|
impl<E> GenericTrait<E> for LocalTraitOne {}
|
|
|
|
//~^ ERROR trait objects must include the `dyn` keyword
|
2022-06-29 23:31:10 +00:00
|
|
|
//~| HELP add `dyn` keyword before this trait
|
|
|
|
//~| HELP alternatively use a blanket implementation to implement `GenericTrait<E>` for all types that also implement `LocalTraitOne`
|
2022-06-22 22:06:34 +00:00
|
|
|
|
|
|
|
trait GenericTraitTwo<T> {}
|
|
|
|
|
|
|
|
impl<T, E> GenericTraitTwo<E> for GenericTrait<T> {}
|
|
|
|
//~^ ERROR trait objects must include the `dyn` keyword
|
2022-06-29 23:31:10 +00:00
|
|
|
//~| 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>`
|
2022-06-22 22:06:34 +00:00
|
|
|
|
|
|
|
fn main() {}
|