From defa610aab6b181a88423c8a67cfd24bbea6e05e Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 2 Mar 2022 05:33:31 +0000 Subject: [PATCH] Explicitly refer to `format!()` with an `alloc` prefix for no-std --- c-bindings-gen/src/main.rs | 2 +- c-bindings-gen/src/types.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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: "), -- 2.30.2