From: Matt Corallo Date: Wed, 2 Mar 2022 05:33:31 +0000 (+0000) Subject: Explicitly refer to `format!()` with an `alloc` prefix for no-std X-Git-Tag: v0.0.105.0^2~3 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=defa610aab6b181a88423c8a67cfd24bbea6e05e;p=ldk-c-bindings Explicitly refer to `format!()` with an `alloc` prefix for no-std --- diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index 97f44a4..647f344 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -1248,7 +1248,7 @@ fn writeln_impl(w: &mut W, i: &syn::ItemImpl, types: &mut Typ let self_ty = &i.self_ty; let ref_type: syn::Type = syn::parse_quote!(&#self_ty); let new_var = types.write_from_c_conversion_new_var(w, &format_ident!("o"), &ref_type, Some(&gen_types)); - write!(w, "\tformat!(\"{{}}\", ").unwrap(); + write!(w, "\talloc::format!(\"{{}}\", ").unwrap(); types.write_from_c_conversion_prefix(w, &ref_type, Some(&gen_types)); write!(w, "{}o", if new_var { "local_" } else { "" }).unwrap(); types.write_from_c_conversion_suffix(w, &ref_type, Some(&gen_types)); diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 88d6640..aebeb48 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -1133,7 +1133,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "std::time::Duration"|"core::time::Duration" => Some(""), "std::time::SystemTime" => Some(""), "std::io::Error" if !is_ref => Some("crate::c_types::IOError::from_rust("), - "core::fmt::Arguments" => Some("format!(\"{}\", "), + "core::fmt::Arguments" => Some("alloc::format!(\"{}\", "), "core::convert::Infallible" => Some("panic!(\"Cannot construct an Infallible: "),