Potentially fix some macro hygiene
This commit is contained in:
parent
1f6e947223
commit
a1f4f9cbac
|
@ -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",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "gmod-macros"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
authors = ["William Venner <william@venner.io>"]
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
|
|
|
@ -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()
|
||||
}
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue