]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/static-method-generic-inference.rs
:arrow_up: rust-analyzer
[rust.git] / src / test / ui / traits / static-method-generic-inference.rs
1 // Issue #3902. We are (at least currently) unable to infer `Self`
2 // based on `T`, even though there is only a single impl, because of
3 // the possibility of associated types and other things (basically: no
4 // constraints on `Self` here at all).
5
6 mod base {
7     pub trait HasNew<T> {
8         fn new() -> T;
9         fn dummy(&self) { }
10     }
11
12     pub struct Foo {
13         dummy: (),
14     }
15
16     impl HasNew<Foo> for Foo {
17         fn new() -> Foo {
18             Foo { dummy: () }
19         }
20     }
21 }
22
23 pub fn foo() {
24     let _f: base::Foo = base::HasNew::new();
25     //~^ ERROR E0790
26 }
27
28 fn main() { }