File tree 2 files changed +32
-2
lines changed
2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,18 @@ impl Generator for Impl {
8
8
fn create ( ) -> u32 { 1 }
9
9
}
10
10
11
+ impl Impl {
12
+ fn new ( ) -> Self {
13
+ Impl { }
14
+ }
15
+ }
16
+
17
+ impl Into < u32 > for Impl {
18
+ fn into ( self ) -> u32 { 1 }
19
+ }
20
+
21
+ fn foo ( bar : u32 ) { }
22
+
11
23
struct AnotherImpl ;
12
24
13
25
impl Generator for AnotherImpl {
@@ -17,3 +29,9 @@ impl Generator for AnotherImpl {
17
29
fn main ( ) {
18
30
let cont: u32 = Generator :: create ( ) ; //~ ERROR E0283
19
31
}
32
+
33
+ fn buzz ( ) {
34
+ let foo_impl = Impl :: new ( ) ;
35
+ let bar = foo_impl. into ( ) * 1u32 ; //~ ERROR E0283
36
+ foo ( bar) ;
37
+ }
Original file line number Diff line number Diff line change 1
1
error[E0283]: type annotations needed
2
- --> $DIR/E0283.rs:18 :21
2
+ --> $DIR/E0283.rs:30 :21
3
3
|
4
4
LL | fn create() -> u32;
5
5
| ------------------- required by `Generator::create`
@@ -9,6 +9,18 @@ LL | let cont: u32 = Generator::create();
9
9
|
10
10
= note: cannot satisfy `_: Generator`
11
11
12
- error: aborting due to previous error
12
+ error[E0283]: type annotations needed
13
+ --> $DIR/E0283.rs:35:24
14
+ |
15
+ LL | let bar = foo_impl.into() * 1u32;
16
+ | ---------^^^^--
17
+ | | |
18
+ | | cannot infer type for type parameter `T` declared on the trait `Into`
19
+ | this method call resolves to `T`
20
+ | help: use the fully qualified path for the potential candidate: `<Impl as Into<u32>>::into(foo_impl)`
21
+ |
22
+ = note: cannot satisfy `Impl: Into<_>`
23
+
24
+ error: aborting due to 2 previous errors
13
25
14
26
For more information about this error, try `rustc --explain E0283`.
You can’t perform that action at this time.
0 commit comments