1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-05 15:37:47 +00:00

change/uucore_procs ~ add work-around for attribute/macro name collision 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
This commit is contained in:
Roy Ivy III 2020-05-23 22:03:33 -05:00
parent e35bd4b79c
commit b8c22496bb

View file

@ -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; extern crate proc_macro;
// spell-checker:ignore () SIGPIPE uucore uumain uutils // spell-checker:ignore () SIGPIPE maint uucore uumain uutils
//## rust proc-macro background info //## rust proc-macro background info
//* ref: <https://dev.to/naufraghi/procedural-macro-in-rust-101-k3f> @@ <http://archive.is/Vbr5e> //* ref: <https://dev.to/naufraghi/procedural-macro-in-rust-101-k3f> @@ <http://archive.is/Vbr5e>
@ -43,6 +46,7 @@ impl syn::parse::Parse for Tokens {
} }
#[proc_macro] #[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 { pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream {
let Tokens { expr } = syn::parse_macro_input!(stream as Tokens); let Tokens { expr } = syn::parse_macro_input!(stream as Tokens);
proc_dbg!(&expr); proc_dbg!(&expr);