]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/trait-bounds-on-structs-and-enums.rs
Imported Upstream version 1.9.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
1a4d82fc 23impl<T> Foo<T> {
54a0048b 24//~^ ERROR `T: Trait` is not satisfied
1a4d82fc
JJ
25 fn uhoh() {}
26}
27
28struct Baz {
54a0048b 29 a: Foo<isize>, //~ ERROR E0277
1a4d82fc
JJ
30}
31
32enum Boo {
54a0048b 33 Quux(Bar<usize>), //~ ERROR E0277
1a4d82fc
JJ
34}
35
36struct Badness<U> {
54a0048b 37 b: Foo<U>, //~ ERROR E0277
1a4d82fc
JJ
38}
39
40enum MoreBadness<V> {
54a0048b 41 EvenMoreBadness(Bar<V>), //~ ERROR E0277
62682a34
SL
42}
43
44struct TupleLike(
54a0048b 45 Foo<i32>, //~ ERROR E0277
62682a34
SL
46);
47
48enum Enum {
54a0048b 49 DictionaryLike { field: Bar<u8> }, //~ ERROR E0277
1a4d82fc
JJ
50}
51
1a4d82fc
JJ
52fn main() {
53}