]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/trait-bounds-on-structs-and-enums.rs
Imported Upstream version 1.2.0+dfsg1
[rustc.git] / src / test / compile-fail / trait-bounds-on-structs-and-enums.rs
CommitLineData
1a4d82fc
JJ
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
9346a6ac 11trait Trait {}
1a4d82fc
JJ
12
13struct Foo<T:Trait> {
14 x: T,
15}
16
17enum Bar<T:Trait> {
18 ABar(isize),
19 BBar(T),
20 CBar(usize),
21}
22
23fn explode(x: Foo<u32>) {}
24//~^ ERROR not implemented
25
26fn kaboom(y: Bar<f32>) {}
27//~^ ERROR not implemented
28
29impl<T> Foo<T> {
30//~^ ERROR the trait `Trait` is not implemented
31 fn uhoh() {}
32}
33
34struct Baz {
62682a34 35 a: Foo<isize>, //~ ERROR not implemented
1a4d82fc
JJ
36}
37
38enum Boo {
62682a34 39 Quux(Bar<usize>), //~ ERROR not implemented
1a4d82fc
JJ
40}
41
42struct Badness<U> {
62682a34 43 b: Foo<U>, //~ ERROR not implemented
1a4d82fc
JJ
44}
45
46enum MoreBadness<V> {
62682a34
SL
47 EvenMoreBadness(Bar<V>), //~ ERROR not implemented
48}
49
50struct TupleLike(
51 Foo<i32>, //~ ERROR not implemented
52);
53
54enum Enum {
55 DictionaryLike { field: Bar<u8> }, //~ ERROR not implemented
1a4d82fc
JJ
56}
57
85aaf69f
SL
58trait PolyTrait<T>
59{
60 fn whatever(&self, t: T) {}
1a4d82fc
JJ
61}
62
63struct Struct;
64
62682a34 65impl PolyTrait<Foo<u16>> for Struct {
1a4d82fc 66//~^ ERROR not implemented
1a4d82fc
JJ
67}
68
69fn main() {
70}