]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass-fulldeps/macro-crate.rs
New upstream version 1.12.0+dfsg1
[rustc.git] / src / test / run-pass-fulldeps / macro-crate.rs
CommitLineData
85aaf69f 1// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT
1a4d82fc
JJ
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// aux-build:macro_crate_test.rs
12// ignore-stage1
13
c34b1796 14#![feature(plugin, custom_attribute)]
85aaf69f 15#![plugin(macro_crate_test)]
1a4d82fc 16
85aaf69f 17#[macro_use] #[no_link]
1a4d82fc
JJ
18extern crate macro_crate_test;
19
85aaf69f
SL
20#[into_multi_foo]
21#[derive(PartialEq, Clone, Debug)]
22fn foo() -> AnotherFakeTypeThatHadBetterGoAway {}
23
5bcae85e
SL
24// Check that the `#[into_multi_foo]`-generated `foo2` is configured away
25fn foo2() {}
26
85aaf69f
SL
27trait Qux {
28 #[into_multi_foo]
29 fn bar();
30}
31
32impl Qux for i32 {
33 #[into_multi_foo]
34 fn bar() {}
35}
36
37impl Qux for u8 {}
38
1a4d82fc
JJ
39pub fn main() {
40 assert_eq!(1, make_a_1!());
41 assert_eq!(2, exported_macro!());
42
85aaf69f
SL
43 assert_eq!(Foo2::Bar2, Foo2::Bar2);
44 test(None::<Foo2>);
45
3157f602
XL
46 let _ = Foo3::Bar;
47
85aaf69f
SL
48 let x = 10i32;
49 assert_eq!(x.foo(), 42);
50 let x = 10u8;
51 assert_eq!(x.foo(), 0);
1a4d82fc
JJ
52}
53
54fn test<T: PartialEq+Clone>(_: Option<T>) {}