mirror of
https://github.com/rwf2/Rocket.git
synced 2025-01-27 20:02:04 +00:00
Avoid using 'macro' items on stable.
This gets rid of the warning message on stable when building examples.
This commit is contained in:
parent
e7ef93be49
commit
79399bb1c0
@ -23,6 +23,7 @@ proc-macro2 = "1.0.27"
|
||||
devise = "0.4"
|
||||
rocket_http = { version = "=0.5.0-rc.3", path = "../http/" }
|
||||
unicode-xid = "0.2"
|
||||
version_check = "0.9"
|
||||
glob = "0.3"
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -31,6 +31,23 @@ pub fn _macro(input: proc_macro::TokenStream) -> devise::Result<TokenStream> {
|
||||
})
|
||||
.collect();
|
||||
|
||||
// Only try using the `macro` syntax on nightly/dev or when we don't know.
|
||||
let export = match version_check::is_feature_flaggable() {
|
||||
Some(true) | None => quote! {
|
||||
#(#attrs)*
|
||||
#[cfg(all(nightly, doc))]
|
||||
pub macro #macro_name {
|
||||
#decl_macro_tokens
|
||||
}
|
||||
|
||||
#[cfg(not(all(nightly, doc)))]
|
||||
pub use #mod_name::#internal_name as #macro_name;
|
||||
},
|
||||
Some(false) => quote! {
|
||||
pub use #mod_name::#internal_name as #macro_name;
|
||||
}
|
||||
};
|
||||
|
||||
Ok(quote! {
|
||||
#[allow(non_snake_case)]
|
||||
mod #mod_name {
|
||||
@ -43,13 +60,6 @@ pub fn _macro(input: proc_macro::TokenStream) -> devise::Result<TokenStream> {
|
||||
pub use #internal_name;
|
||||
}
|
||||
|
||||
#(#attrs)*
|
||||
#[cfg(all(nightly, doc))]
|
||||
pub macro #macro_name {
|
||||
#decl_macro_tokens
|
||||
}
|
||||
|
||||
#[cfg(not(all(nightly, doc)))]
|
||||
pub use #mod_name::#internal_name as #macro_name;
|
||||
#export
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user