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.
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.
14 // check that having extern "C" functions in a proc macro doesn't crash.
16 #![crate_type="proc-macro"]
17 #![allow(non_snake_case)]
19 extern crate proc_macro
;
21 macro_rules
! proc_macro_tokenstream
{
23 ::proc_macro
::TokenStream
27 macro_rules
! proc_macro_expr_impl
{
30 pub fn $func
:ident($input
:ident
: &str) -> String $body
:block
33 // Parses an input that looks like:
37 // enum ProcMacroHack {
38 // Input = (stringify!(ARGS), 0).1,
42 #[proc_macro_derive($func)]
43 pub fn $
func(input
: proc_macro_tokenstream
!()) -> proc_macro_tokenstream
!() {
44 unsafe { rust_dbg_extern_identity_u64(0); }
51 proc_macro_expr_impl
! {
52 pub fn base2_impl(input
: &str) -> String
{
57 #[link(name="rust_test_helpers")]
59 pub fn rust_dbg_extern_identity_u64(v
: u64) -> u64;