]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/issue-77982.stderr
Add regression test for #82830
[rust.git] / src / test / ui / traits / issue-77982.stderr
1 error[E0283]: type annotations needed
2   --> $DIR/issue-77982.rs:8:10
3    |
4 LL |     opts.get(opt.as_ref());
5    |          ^^^ ------------ this method call resolves to `&T`
6    |          |
7    |          cannot infer type for type parameter `Q` declared on the associated function `get`
8    |
9    = note: multiple `impl`s satisfying `String: Borrow<_>` found in the following crates: `alloc`, `core`:
10            - impl Borrow<str> for String;
11            - impl<T> Borrow<T> for T
12              where T: ?Sized;
13 note: required by a bound in `HashMap::<K, V, S>::get`
14   --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
15    |
16 LL |         K: Borrow<Q>,
17    |            ^^^^^^^^^ required by this bound in `HashMap::<K, V, S>::get`
18 help: consider specifying the type argument in the function call
19    |
20 LL |     opts.get::<Q>(opt.as_ref());
21    |             +++++
22
23 error[E0283]: type annotations needed
24   --> $DIR/issue-77982.rs:8:18
25    |
26 LL |     opts.get(opt.as_ref());
27    |              ----^^^^^^--
28    |              |   |
29    |              |   cannot infer type for type parameter `T` declared on the trait `AsRef`
30    |              this method call resolves to `&T`
31    |
32    = note: multiple `impl`s satisfying `String: AsRef<_>` found in the following crates: `alloc`, `std`:
33            - impl AsRef<OsStr> for String;
34            - impl AsRef<Path> for String;
35            - impl AsRef<[u8]> for String;
36            - impl AsRef<str> for String;
37 help: use the fully qualified path for the potential candidates
38    |
39 LL |     opts.get(<String as AsRef<OsStr>>::as_ref(opt));
40    |              +++++++++++++++++++++++++++++++++   ~
41 LL |     opts.get(<String as AsRef<Path>>::as_ref(opt));
42    |              ++++++++++++++++++++++++++++++++   ~
43 LL |     opts.get(<String as AsRef<[u8]>>::as_ref(opt));
44    |              ++++++++++++++++++++++++++++++++   ~
45 LL |     opts.get(<String as AsRef<str>>::as_ref(opt));
46    |              +++++++++++++++++++++++++++++++   ~
47      and 4 other candidates
48
49 error[E0283]: type annotations needed
50   --> $DIR/issue-77982.rs:13:44
51    |
52 LL |     let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect();
53    |                                            ^^^^^^^^^ ----------- this method call resolves to `T`
54    |                                            |
55    |                                            cannot infer type for type parameter `T` declared on the trait `From`
56    |
57    = note: multiple `impl`s satisfying `u32: From<_>` found in the following crates: `core`, `std`:
58            - impl From<Ipv4Addr> for u32;
59            - impl From<NonZeroU32> for u32;
60            - impl From<bool> for u32;
61            - impl From<char> for u32;
62            and 3 more
63
64 error[E0283]: type annotations needed for `Box<T>`
65   --> $DIR/issue-77982.rs:36:16
66    |
67 LL |     let _ = ().foo();
68    |         -      ^^^ cannot infer type for type parameter `T` declared on the trait `Foo`
69    |         |
70    |         consider giving this pattern the explicit type `Box<T>`, where the type parameter `T` is specified
71    |
72 note: multiple `impl`s satisfying `(): Foo<'_, _>` found
73   --> $DIR/issue-77982.rs:29:1
74    |
75 LL | impl Foo<'static, u32> for () {}
76    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
77 LL | impl<'a> Foo<'a, i16> for () {}
78    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
79
80 error[E0283]: type annotations needed for `Box<T>`
81   --> $DIR/issue-77982.rs:40:19
82    |
83 LL |     let _ = (&()).bar();
84    |         -         ^^^ cannot infer type for type parameter `T` declared on the trait `Bar`
85    |         |
86    |         consider giving this pattern the explicit type `Box<T>`, where the type parameter `T` is specified
87    |
88 note: multiple `impl`s satisfying `&(): Bar<'_, _>` found
89   --> $DIR/issue-77982.rs:32:1
90    |
91 LL | impl<'a> Bar<'static, u32> for &'a () {}
92    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
93 LL | impl<'a> Bar<'a, i16> for &'a () {}
94    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
95
96 error: aborting due to 5 previous errors
97
98 For more information about this error, try `rustc --explain E0283`.