]> git.lizzy.rs Git - rust.git/blob - src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
Override rustc version in ui and mir-opt tests to get stable hashes
[rust.git] / src / test / ui / methods / method-ambig-one-trait-unknown-int-type.stderr
1 error[E0282]: type annotations needed for `Vec<T>`
2   --> $DIR/method-ambig-one-trait-unknown-int-type.rs:24:17
3    |
4 LL |     let mut x = Vec::new();
5    |         -----   ^^^^^^^^ cannot infer type for type parameter `T`
6    |         |
7    |         consider giving `x` the explicit type `Vec<T>`, where the type parameter `T` is specified
8
9 error[E0283]: type annotations needed
10   --> $DIR/method-ambig-one-trait-unknown-int-type.rs:26:7
11    |
12 LL |     x.foo();
13    |       ^^^ cannot infer type for struct `Vec<_>`
14    |
15 note: multiple `impl`s satisfying `Vec<_>: Foo` found
16   --> $DIR/method-ambig-one-trait-unknown-int-type.rs:9:1
17    |
18 LL | impl Foo for Vec<usize> {
19    | ^^^^^^^^^^^^^^^^^^^^^^^
20 ...
21 LL | impl Foo for Vec<isize> {
22    | ^^^^^^^^^^^^^^^^^^^^^^^
23
24 error[E0308]: mismatched types
25   --> $DIR/method-ambig-one-trait-unknown-int-type.rs:33:20
26    |
27 LL |     let y: usize = x.foo();
28    |            -----   ^^^^^^^ expected `usize`, found `isize`
29    |            |
30    |            expected due to this
31    |
32 help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
33    |
34 LL |     let y: usize = x.foo().try_into().unwrap();
35    |                           ++++++++++++++++++++
36
37 error: aborting due to 3 previous errors
38
39 Some errors have detailed explanations: E0282, E0283, E0308.
40 For more information about an error, try `rustc --explain E0282`.