]> git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/impl-wrong-item-for-trait.rs
Imported Upstream version 1.1.0+dfsg1
[rustc.git] / src / test / compile-fail / impl-wrong-item-for-trait.rs
1 // Copyright 2015 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 #![feature(associated_consts)]
12
13 trait Foo {
14 fn bar(&self);
15 const MY_CONST: u32;
16 }
17
18 pub struct FooConstForMethod;
19
20 impl Foo for FooConstForMethod {
21 //~^ ERROR E0046
22 const bar: u64 = 1;
23 //~^ ERROR E0323
24 const MY_CONST: u32 = 1;
25 }
26
27 pub struct FooMethodForConst;
28
29 impl Foo for FooMethodForConst {
30 //~^ ERROR E0046
31 fn bar(&self) {}
32 fn MY_CONST() {}
33 //~^ ERROR E0324
34 }
35
36 pub struct FooTypeForMethod;
37
38 impl Foo for FooTypeForMethod {
39 //~^ ERROR E0046
40 type bar = u64;
41 //~^ ERROR E0325
42 const MY_CONST: u32 = 1;
43 }
44
45 fn main () {}