]> git.lizzy.rs Git - rust.git/blob - src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
Rollup merge of #95503 - jyn514:build-single-crate, r=Mark-Simulacrum
[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    |       ^^^
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 help: try using a fully qualified path to specify the expected types
27    |
28 LL |     <Vec<T> as Foo>::foo(&x);
29    |     ++++++++++++++++++++++ ~
30
31 error[E0308]: mismatched types
32   --> $DIR/method-ambig-one-trait-unknown-int-type.rs:33:20
33    |
34 LL |     let y: usize = x.foo();
35    |            -----   ^^^^^^^ expected `usize`, found `isize`
36    |            |
37    |            expected due to this
38    |
39 help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
40    |
41 LL |     let y: usize = x.foo().try_into().unwrap();
42    |                           ++++++++++++++++++++
43
44 error: aborting due to 3 previous errors
45
46 Some errors have detailed explanations: E0282, E0283, E0308.
47 For more information about an error, try `rustc --explain E0282`.