]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/derive-trait-for-method-call.rs
Rollup merge of #90420 - GuillaumeGomez:rustdoc-internals-feature, r=camelid
[rust.git] / src / test / ui / suggestions / derive-trait-for-method-call.rs
1 use std::time::Instant;
2
3 enum Enum {
4     First
5 }
6
7 #[derive(Clone)]
8 enum CloneEnum {
9     First
10 }
11
12 struct Struct {
13 }
14
15 #[derive(Clone)]
16 struct CloneStruct {
17 }
18
19 struct Foo<X, Y> (X, Y);
20 impl<X: Clone + Default + , Y: Clone + Default> Foo<X, Y> {
21     fn test(&self) -> (X, Y) {
22         (self.0, self.1)
23     }
24 }
25
26 fn test1() {
27     let x = Foo(Enum::First, CloneEnum::First);
28     let y = x.test();
29     //~^the method `test` exists for struct `Foo<Enum, CloneEnum>`, but its trait bounds were not satisfied [E0599]
30 }
31
32 fn test2() {
33     let x = Foo(Struct{}, CloneStruct{});
34     let y = x.test();
35     //~^the method `test` exists for struct `Foo<Struct, CloneStruct>`, but its trait bounds were not satisfied [E0599]
36 }
37
38 fn test3() {
39     let x = Foo(Vec::<Enum>::new(), Instant::now());
40     let y = x.test();
41     //~^the method `test` exists for struct `Foo<Vec<Enum>, Instant>`, but its trait bounds were not satisfied [E0599]
42 }
43
44 fn main() {}