Skip to content

Commit

Permalink
change/uucore_procs ~ add work-around for attribute/macro name collis…
Browse files Browse the repository at this point in the history
…ion during testing

- proc_macro "main" collides with attribute "#[main]" during testing (for rust < v1.38.0; fixed in v1.38.0+)
- ref: GH:rust-lang/rust#62127
  • Loading branch information
rivy committed Nov 7, 2020
1 parent d6c95d5 commit 8e73c84
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/uucore/src/uucore_procs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#![allow(dead_code)] // work-around for GH:rust-lang/rust#62127; maint: can be removed when MinSRV >= v1.38.0
#![allow(unused_macros)] // work-around for GH:rust-lang/rust#62127; maint: can be removed when MinSRV >= v1.38.0

extern crate proc_macro;

// spell-checker:ignore () SIGPIPE uucore uumain uutils
// spell-checker:ignore () SIGPIPE maint uucore uumain uutils

//## rust proc-macro background info
//* ref: <https://dev.to/naufraghi/procedural-macro-in-rust-101-k3f> @@ <http://archive.is/Vbr5e>
Expand Down Expand Up @@ -43,6 +46,7 @@ impl syn::parse::Parse for Tokens {
}

#[proc_macro]
#[cfg(not(test))] // work-around for GH:rust-lang/rust#62127; maint: can be removed when MinSRV >= v1.38.0
pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream {
let Tokens { expr } = syn::parse_macro_input!(stream as Tokens);
proc_dbg!(&expr);
Expand Down

0 comments on commit 8e73c84

Please sign in to comment.