fix compilation for rustc 1.57.0-nightly (#60)

This commit is contained in:
Valery Antopol 2021-09-15 18:18:53 +03:00 committed by GitHub
parent 6d045429dc
commit 7cad957fe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 23 deletions

View File

@ -18,25 +18,25 @@ use crate::parsed_type::ParsedType;
#[derive(Clone)]
pub(crate) struct AstFnArgument {
pub name: String,
pub ty: ParsedType,
pub(crate) name: String,
pub(crate) ty: ParsedType,
}
#[derive(Clone)]
pub(crate) struct AstFnSignature {
pub visibility: syn::Visibility,
pub name: String,
pub arguments: Vec<AstFnArgument>,
pub(crate) visibility: syn::Visibility,
pub(crate) name: String,
pub(crate) arguments: Vec<AstFnArgument>,
// only one or zero return values are supported now,
// waiting for adding multi-value support in Wasmer
pub output_type: Option<ParsedType>,
pub(crate) output_type: Option<ParsedType>,
}
#[derive(Clone)]
pub(crate) struct AstRecord {
pub name: String,
pub fields: AstRecordFields,
pub original: syn::ItemStruct,
pub(crate) name: String,
pub(crate) fields: AstRecordFields,
pub(crate) original: syn::ItemStruct,
}
#[derive(Debug, Clone, PartialEq)]
@ -55,29 +55,28 @@ pub(crate) enum AstRecordFields {
#[derive(Debug, Clone, PartialEq)]
pub(crate) struct AstRecordField {
/// Name of the field. Can be `None` for tuples.
pub name: Option<String>,
pub ty: ParsedType,
pub(crate) name: Option<String>,
pub(crate) ty: ParsedType,
}
#[derive(Clone)]
pub(crate) struct AstExternFn {
pub link_name: Option<String>,
pub(crate) link_name: Option<String>,
// only imports are possible here
pub signature: AstFnSignature,
pub(crate) signature: AstFnSignature,
}
#[derive(Clone)]
pub(crate) struct AstExternMod {
pub namespace: String,
pub(crate) namespace: String,
// only imports are possible here
pub imports: Vec<AstExternFn>,
pub original: syn::ItemForeignMod,
pub(crate) imports: Vec<AstExternFn>,
}
#[derive(Clone)]
pub(crate) struct AstFn {
pub signature: AstFnSignature,
pub original: syn::ItemFn,
pub(crate) signature: AstFnSignature,
pub(crate) original: syn::ItemFn,
}
#[derive(Clone)]

View File

@ -36,11 +36,7 @@ impl ParseMacroInput for syn::ItemForeignMod {
let imports = extract_import_functions(&self)?;
check_imports(imports.iter().zip(self.items.iter().map(|i| i.span())))?;
let extern_mod_item = ast_types::AstExternMod {
namespace,
imports,
original: self,
};
let extern_mod_item = ast_types::AstExternMod { namespace, imports };
Ok(MarineAst::ExternMod(extern_mod_item))
}
}