Skip to content

Commit 702de6d

Browse files
committed
fix(rust): restore cabi_realloc for wasm32-unknown-unknown
`cabi_realloc` was switched to only be added for `p1` targets instead of not being added for `p2` targets. This causes modules built with `wasm32-unknown-unknown` and then enriched into a component with `wasm-tools component new` to fail. Signed-off-by: Scott Andrews <scott@andrews.me>
1 parent 0781ccd commit 702de6d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • crates/guest-rust/src/rt

crates/guest-rust/src/rt/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl<K: core::hash::Hash + Eq, V> WitMap<K, V> for std::collections::HashMap<K,
111111
}
112112

113113
/// For more information about this see `./ci/rebuild-libwit-bindgen-cabi.sh`.
114-
#[cfg(target_env = "p1")]
114+
#[cfg(any(target_env = "p1", target_env = ""))]
115115
mod wit_bindgen_cabi_realloc;
116116

117117
/// This function is called from generated bindings and will be deleted by
@@ -122,7 +122,7 @@ mod wit_bindgen_cabi_realloc;
122122
///
123123
/// For more information about this see `./ci/rebuild-libwit-bindgen-cabi.sh`.
124124
pub fn maybe_link_cabi_realloc() {
125-
#[cfg(target_env = "p1")]
125+
#[cfg(any(target_env = "p1", target_env = ""))]
126126
{
127127
unsafe extern "C" {
128128
fn cabi_realloc(
@@ -153,7 +153,7 @@ pub fn maybe_link_cabi_realloc() {
153153
/// `cabi_realloc` module above. It's otherwise never explicitly called.
154154
///
155155
/// For more information about this see `./ci/rebuild-libwit-bindgen-cabi.sh`.
156-
#[cfg(target_env = "p1")]
156+
#[cfg(any(target_env = "p1", target_env = ""))]
157157
pub unsafe fn cabi_realloc(
158158
old_ptr: *mut u8,
159159
old_len: usize,

0 commit comments

Comments
 (0)