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