]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/issue-77982.rs
:arrow_up: rust-analyzer
[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     //~^ ERROR type annotations needed
10 }
11
12 fn main() {
13     let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect();
14     //~^ ERROR type annotations needed
15 }
16
17 trait Foo<'a, T: ?Sized> {
18     fn foo(&self) -> Box<T> {
19         todo!()
20     }
21 }
22
23 trait Bar<'a, T: ?Sized> {
24     fn bar(&self) -> Box<T> {
25         todo!()
26     }
27 }
28
29 impl Foo<'static, u32> for () {}
30 impl<'a> Foo<'a, i16> for () {}
31
32 impl<'a> Bar<'static, u32> for &'a () {}
33 impl<'a> Bar<'a, i16> for &'a () {}
34
35 fn foo() {
36     let _ = ().foo(); //~ ERROR type annotations needed
37 }
38
39 fn bar() {
40     let _ = (&()).bar(); //~ ERROR type annotations needed
41 }