From a1f4f9cbac500155ecbffc62d6c13e6b8e668fae Mon Sep 17 00:00:00 2001 From: William Venner Date: Thu, 9 Dec 2021 18:23:19 +0000 Subject: [PATCH] Potentially fix some macro hygiene --- Cargo.lock | 10 +++++----- gmod-macros/Cargo.toml | 2 +- gmod-macros/src/lib.rs | 6 +++--- gmod/Cargo.toml | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d3366b5..a44b1df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -126,7 +126,7 @@ dependencies = [ "fn_abi", "fn_has_this", "fn_type_alias", - "gmod-macros 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gmod-macros 1.0.0", "lazy_static", "libloading", "null_fn", @@ -144,7 +144,7 @@ dependencies = [ "fn_abi", "fn_has_this", "fn_type_alias", - "gmod-macros 1.0.0", + "gmod-macros 1.0.1", "gmserverplugin", "lazy_static", "libloading", @@ -155,6 +155,8 @@ dependencies = [ [[package]] name = "gmod-macros" version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b791745998b09a16260e803bb0cca1a641e9b70e2aae94d7a485d34259b29279" dependencies = [ "proc-macro2", "quote", @@ -163,9 +165,7 @@ dependencies = [ [[package]] name = "gmod-macros" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b791745998b09a16260e803bb0cca1a641e9b70e2aae94d7a485d34259b29279" +version = "1.0.1" dependencies = [ "proc-macro2", "quote", diff --git a/gmod-macros/Cargo.toml b/gmod-macros/Cargo.toml index 32439eb..62d26a3 100644 --- a/gmod-macros/Cargo.toml +++ b/gmod-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gmod-macros" -version = "1.0.0" +version = "1.0.1" authors = ["William Venner "] edition = "2018" license = "MIT" diff --git a/gmod-macros/src/lib.rs b/gmod-macros/src/lib.rs index 0123957..3b2fb59 100644 --- a/gmod-macros/src/lib.rs +++ b/gmod-macros/src/lib.rs @@ -22,19 +22,19 @@ pub fn gmod13_open(_attr: TokenStream, tokens: TokenStream) -> TokenStream { let mut input = parse_macro_input!(tokens as ItemFn); check_lua_function(&mut input); input.block.stmts.insert(0, syn::parse2(quote!(#[allow(unused_unsafe)] unsafe { ::gmod::lua::load() })).unwrap()); - TokenStream::from(quote!(#[no_mangle] #input)) + input.into_token_stream().into() } #[proc_macro_attribute] pub fn gmod13_close(_attr: TokenStream, tokens: TokenStream) -> TokenStream { let mut input = parse_macro_input!(tokens as ItemFn); check_lua_function(&mut input); - TokenStream::from(quote!(#[no_mangle] #input)) + input.into_token_stream().into() } #[proc_macro_attribute] pub fn lua_function(_attr: TokenStream, tokens: TokenStream) -> TokenStream { let mut input = parse_macro_input!(tokens as ItemFn); check_lua_function(&mut input); - TokenStream::from(quote!(#input)) + input.into_token_stream().into() } \ No newline at end of file diff --git a/gmod/Cargo.toml b/gmod/Cargo.toml index ba34c98..10f7315 100644 --- a/gmod/Cargo.toml +++ b/gmod/Cargo.toml @@ -15,7 +15,7 @@ hax = ["ctor", "skidscan", "detour", "fn_type_alias", "fn_abi", "cfg_table", "nu server-plugin = ["gmserverplugin"] [dependencies] -gmod-macros = { version = "1.0.0", path = "../gmod-macros" } +gmod-macros = { version = "1.0.1", path = "../gmod-macros" } gmserverplugin = { version = "1", optional = true } libloading = "0"