blob: 14fef1b524892d78877981ad584138923f6c1ae6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// Ensure that the compiler include the blanklet implementation suggestion
// when inside a `impl` statement 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() {}
|