]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail-fulldeps/proc-macro/auxiliary/test-macros.rs
New upstream version 1.27.1+dfsg1
[rustc.git] / src / test / compile-fail-fulldeps / proc-macro / auxiliary / test-macros.rs
CommitLineData
83c7162d
XL
1// Copyright 2018 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// no-prefer-dynamic
12
13#![crate_type = "proc-macro"]
14#![feature(proc_macro)]
15
16extern crate proc_macro;
17
18use proc_macro::TokenStream;
19
20#[proc_macro_attribute]
21pub fn nop_attr(_attr: TokenStream, input: TokenStream) -> TokenStream {
22 assert!(_attr.to_string().is_empty());
23 input
24}
25
26#[proc_macro_attribute]
27pub fn no_output(_attr: TokenStream, _input: TokenStream) -> TokenStream {
28 assert!(_attr.to_string().is_empty());
29 assert!(!_input.to_string().is_empty());
30 "".parse().unwrap()
31}
32
33#[proc_macro]
34pub fn emit_input(input: TokenStream) -> TokenStream {
35 input
36}