wiggle: bugfix, generated code should use Names::runtime_mod not wiggle

as the crate from which these deps come.

I worked around this in lucet, but I'll be able to revert that
workaround.
This commit is contained in:
Pat Hickey
2021-01-11 18:03:48 -08:00
parent 7ed7c088a4
commit 94467bcd9a
3 changed files with 5 additions and 4 deletions

View File

@@ -169,7 +169,7 @@ pub fn define_func(
let func_name = &func.name.as_str();
if func.noreturn {
quote!(pub fn #ident(#abi_args) -> Result<#abi_ret, wiggle::Trap> {
quote!(pub fn #ident(#abi_args) -> Result<#abi_ret, #rt::Trap> {
let _span = #rt::tracing::span!(
#rt::tracing::Level::TRACE,
"wiggle abi",
@@ -184,7 +184,7 @@ pub fn define_func(
Err(trap)
})
} else {
quote!(pub fn #ident(#abi_args) -> Result<#abi_ret, wiggle::Trap> {
quote!(pub fn #ident(#abi_args) -> Result<#abi_ret, #rt::Trap> {
let _span = #rt::tracing::span!(
#rt::tracing::Level::TRACE,
"wiggle abi",

View File

@@ -40,7 +40,7 @@ pub fn generate(doc: &witx::Document, names: &Names, errs: &ErrorTransform) -> T
let abi_typename = names.type_ref(&errtype.abi_type(), anon_lifetime());
let user_typename = errtype.typename();
let methodname = names.user_error_conversion_method(&errtype);
quote!(fn #methodname(&self, e: super::#user_typename) -> Result<#abi_typename, wiggle::Trap>;)
quote!(fn #methodname(&self, e: super::#user_typename) -> Result<#abi_typename, #rt::Trap>;)
});
let user_error_conversion = quote! {
pub trait UserErrorConversion {

View File

@@ -69,7 +69,8 @@ pub fn define_module_trait(names: &Names, m: &Module, errxform: &ErrorTransform)
.unwrap_or(quote!(()));
quote!( Result<(#(#rets),*), #err> )
} else {
quote!(wiggle::Trap)
let rt = names.runtime_mod();
quote!(#rt::Trap)
};
if is_anonymous {