use the async keyword as syntax in the macro invocation

This commit is contained in:
Pat Hickey
2021-03-05 08:55:49 -08:00
parent af49505e73
commit 84df5fa54a
5 changed files with 11 additions and 13 deletions

View File

@@ -39,7 +39,6 @@ mod kw {
syn::custom_keyword!(name);
syn::custom_keyword!(docs);
syn::custom_keyword!(function_override);
syn::custom_keyword!(async_);
}
impl Parse for ConfigField {
@@ -65,8 +64,8 @@ impl Parse for ConfigField {
input.parse::<kw::modules>()?;
input.parse::<Token![:]>()?;
Ok(ConfigField::Modules(input.parse()?))
} else if lookahead.peek(kw::async_) {
input.parse::<kw::async_>()?;
} else if lookahead.peek(Token![async]) {
input.parse::<Token![async]>()?;
input.parse::<Token![:]>()?;
#[cfg(feature = "async")]
{
@@ -76,7 +75,7 @@ impl Parse for ConfigField {
{
Err(syn::Error::new(
input.span(),
"async_ not supported, enable cargo feature \"async\"",
"async not supported, enable cargo feature \"async\"",
))
}
} else {
@@ -122,7 +121,7 @@ impl Config {
#[cfg(feature = "async")]
ConfigField::Async(c) => {
if async_.is_some() {
return Err(Error::new(err_loc, "duplicate `async_` field"));
return Err(Error::new(err_loc, "duplicate `async` field"));
}
async_ = Some(c);
}

View File

@@ -6,7 +6,7 @@ use std::task::{Context, Poll, RawWaker, RawWakerVTable, Waker};
wasmtime_wiggle::from_witx!({
witx: ["$CARGO_MANIFEST_DIR/tests/atoms.witx"],
async_: {
async: {
atoms::{double_int_return_float}
}
});
@@ -16,7 +16,7 @@ wasmtime_wiggle::wasmtime_integration!({
witx: ["$CARGO_MANIFEST_DIR/tests/atoms.witx"],
ctx: Ctx,
modules: { atoms => { name: Atoms } },
async_: {
async: {
atoms::double_int_return_float
}
});