]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/trait-bounds-on-structs-and-enums.rs
Auto merge of #22517 - brson:relnotes, r=Gankro
[rust.git] / src / test / compile-fail / trait-bounds-on-structs-and-enums.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 trait Trait {}
12
13 struct Foo<T:Trait> {
14     x: T,
15 }
16
17 enum Bar<T:Trait> {
18     ABar(isize),
19     BBar(T),
20     CBar(usize),
21 }
22
23 fn explode(x: Foo<u32>) {}
24 //~^ ERROR not implemented
25
26 fn kaboom(y: Bar<f32>) {}
27 //~^ ERROR not implemented
28
29 impl<T> Foo<T> {
30 //~^ ERROR the trait `Trait` is not implemented
31     fn uhoh() {}
32 }
33
34 struct Baz {
35 //~^ ERROR not implemented
36     a: Foo<isize>,
37 }
38
39 enum Boo {
40 //~^ ERROR not implemented
41     Quux(Bar<usize>),
42 }
43
44 struct Badness<U> {
45 //~^ ERROR not implemented
46     b: Foo<U>,
47 }
48
49 enum MoreBadness<V> {
50 //~^ ERROR not implemented
51     EvenMoreBadness(Bar<V>),
52 }
53
54 trait PolyTrait<T> {
55     fn whatever() {}
56 }
57
58 struct Struct;
59
60 impl PolyTrait<Foo<usize>> for Struct {
61 //~^ ERROR not implemented
62     fn whatever() {}
63 }
64
65 fn main() {
66 }
67