2014-12-02 10:07:41 -08:00
|
|
|
// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT
|
2013-12-25 11:10:33 -07:00
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
// aux-build:macro_crate_test.rs
|
2014-02-07 20:08:32 +01:00
|
|
|
// ignore-stage1
|
2013-12-25 11:10:33 -07:00
|
|
|
|
2015-03-06 15:10:20 -08:00
|
|
|
#![feature(plugin, custom_attribute)]
|
2015-02-06 13:56:38 -08:00
|
|
|
#![plugin(macro_crate_test)]
|
2013-12-25 11:10:33 -07:00
|
|
|
|
2015-02-06 13:56:38 -08:00
|
|
|
#[macro_use] #[no_link]
|
2014-02-14 10:10:06 -08:00
|
|
|
extern crate macro_crate_test;
|
2013-12-25 11:10:33 -07:00
|
|
|
|
2014-12-02 10:07:41 -08:00
|
|
|
#[into_multi_foo]
|
2015-01-28 08:34:18 -05:00
|
|
|
#[derive(PartialEq, Clone, Debug)]
|
2014-12-02 10:07:41 -08:00
|
|
|
fn foo() -> AnotherFakeTypeThatHadBetterGoAway {}
|
|
|
|
|
|
|
|
trait Qux {
|
|
|
|
#[into_multi_foo]
|
|
|
|
fn bar();
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Qux for i32 {
|
|
|
|
#[into_multi_foo]
|
|
|
|
fn bar() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Qux for u8 {}
|
|
|
|
|
2013-12-25 11:10:33 -07:00
|
|
|
pub fn main() {
|
|
|
|
assert_eq!(1, make_a_1!());
|
|
|
|
assert_eq!(2, exported_macro!());
|
2014-02-27 23:49:25 -08:00
|
|
|
|
2014-12-02 10:07:41 -08:00
|
|
|
assert_eq!(Foo2::Bar2, Foo2::Bar2);
|
|
|
|
test(None::<Foo2>);
|
|
|
|
|
|
|
|
let x = 10i32;
|
|
|
|
assert_eq!(x.foo(), 42);
|
|
|
|
let x = 10u8;
|
|
|
|
assert_eq!(x.foo(), 0);
|
2013-12-25 11:10:33 -07:00
|
|
|
}
|
2014-02-27 23:49:25 -08:00
|
|
|
|
2014-05-29 17:45:07 -07:00
|
|
|
fn test<T: PartialEq+Clone>(_: Option<T>) {}
|