]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.rs
Auto merge of #2731 - RalfJung:rustup, r=RalfJung
[rust.git] / src / test / ui / associated-types / associated-types-projection-to-unrelated-trait-in-method-without-default.rs
1 // run-rustfix
2 // Check that we get an error when you use `<Self as Get>::Value` in
3 // the trait definition even if there is no default method.
4
5 trait Get {
6     type Value;
7 }
8
9 trait Other {
10     fn okay<U:Get>(&self, foo: U, bar: <Self as Get>::Value);
11     //~^ ERROR E0277
12 }
13
14 impl Get for () {
15     type Value = f32;
16 }
17
18 impl Get for f64 {
19     type Value = u32;
20 }
21
22 impl Other for () {
23     fn okay<U:Get>(&self, _foo: U, _bar: <Self as Get>::Value) { }
24 }
25
26 impl Other for f64 {
27     fn okay<U:Get>(&self, _foo: U, _bar: <Self as Get>::Value) { }
28 }
29
30 fn main() { }