]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/issue-77982.rs
Rollup merge of #82179 - mbartlett21:patch-5, r=joshtriplett
[rust.git] / src / test / ui / traits / issue-77982.rs
1 use std::collections::HashMap;
2
3 fn what() {
4     let descr = String::new();
5     let mut opts = HashMap::<String, ()>::new();
6     let opt = String::new();
7
8     opts.get(opt.as_ref()); //~ ERROR type annotations needed
9 }
10
11 fn main() {
12     let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect();
13     //~^ ERROR type annotations needed
14 }
15
16 trait Foo<'a, T: ?Sized> {
17     fn foo(&self) -> Box<T> {
18         todo!()
19     }
20 }
21
22 trait Bar<'a, T: ?Sized> {
23     fn bar(&self) -> Box<T> {
24         todo!()
25     }
26 }
27
28 impl Foo<'static, u32> for () {}
29 impl<'a> Foo<'a, i16> for () {}
30
31 impl<'a> Bar<'static, u32> for &'a () {}
32 impl<'a> Bar<'a, i16> for &'a () {}
33
34 fn foo() {
35     let _ = ().foo(); //~ ERROR type annotations needed
36 }
37
38 fn bar() {
39     let _ = (&()).bar(); //~ ERROR type annotations needed
40 }