]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail-fulldeps/rustc-macro/attribute.rs
New upstream version 1.13.0+dfsg1
[rustc.git] / src / test / compile-fail-fulldeps / rustc-macro / attribute.rs
CommitLineData
9e0c209e
SL
1// Copyright 2016 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#![crate_type = "rustc-macro"]
12#![feature(rustc_macro)]
13
14extern crate rustc_macro;
15
16#[rustc_macro_derive]
17//~^ ERROR: attribute must be of form: #[rustc_macro_derive(TraitName)]
18pub fn foo1(input: rustc_macro::TokenStream) -> rustc_macro::TokenStream {
19 input
20}
21
22#[rustc_macro_derive = "foo"]
23//~^ ERROR: attribute must be of form: #[rustc_macro_derive(TraitName)]
24pub fn foo2(input: rustc_macro::TokenStream) -> rustc_macro::TokenStream {
25 input
26}
27
28#[rustc_macro_derive(
29 a = "b"
30)]
31//~^^ ERROR: must only be one word
32pub fn foo3(input: rustc_macro::TokenStream) -> rustc_macro::TokenStream {
33 input
34}
35
36#[rustc_macro_derive(b, c)]
37//~^ ERROR: attribute must only have one argument
38pub fn foo4(input: rustc_macro::TokenStream) -> rustc_macro::TokenStream {
39 input
40}
41
42#[rustc_macro_derive(d(e))]
43//~^ ERROR: must only be one word
44pub fn foo5(input: rustc_macro::TokenStream) -> rustc_macro::TokenStream {
45 input
46}