Skip to content

Commit 47f6b2c

Browse files
committed
Fix all CI undefined errors
1 parent bdc1356 commit 47f6b2c

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

crates/wasmtime/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ wat = { workspace = true, optional = true }
4545
serde = { workspace = true }
4646
serde_derive = { workspace = true }
4747
serde_json = { workspace = true, optional = true }
48-
postcard = { workspace = true, optional = true }
48+
postcard = { workspace = true }
4949
indexmap = { workspace = true }
5050
once_cell = { version = "1.12.0", optional = true }
5151
rayon = { version = "1.0", optional = true }
@@ -326,7 +326,6 @@ addr2line = ["dep:addr2line", "dep:gimli", "std"]
326326
# Many features of the Wasmtime crate implicitly require this `std` feature.
327327
# This will be automatically enabled if necessary.
328328
std = [
329-
'dep:postcard',
330329
'postcard/use-std',
331330
'wasmtime-environ/std',
332331
'object/std',
@@ -409,7 +408,7 @@ component-model-async-bytes = [
409408
# `rr` only configures the base infrastructure and is not practically useful by itself
410409
# Use `rr-component` or `rr-core` for generating record/replay events for components/core wasm
411410
# respectively
412-
rr = ["dep:embedded-io", "dep:postcard"]
411+
rr = ["dep:embedded-io"]
413412
# RR for components
414413
rr-component = ["component-model", "rr"]
415414
# RR for core wasm

crates/wasmtime/src/compile.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use crate::Engine;
2626
use crate::hash_map::HashMap;
2727
use crate::hash_set::HashSet;
2828
use crate::prelude::*;
29+
#[cfg(feature = "component-model")]
2930
use sha2::{Digest, Sha256};
3031
use std::{
3132
any::Any,

crates/wasmtime/src/runtime/component/func/options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::component::matching::InstanceType;
44
use crate::component::resources::{HostResourceData, HostResourceIndex, HostResourceTables};
55
use crate::component::{Instance, ResourceType};
66
use crate::prelude::*;
7-
#[cfg(feature = "rr-validate")]
7+
#[cfg(all(feature = "rr", feature = "rr-validate"))]
88
use crate::rr::Validate;
99
#[cfg(feature = "rr-component")]
1010
use crate::rr::component_events::{MemorySliceWriteEvent, ReallocEntryEvent, ReallocReturnEvent};

crates/wasmtime/src/runtime/rr/mod.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -476,23 +476,28 @@ impl Replayer for ReplayBuffer {
476476
mod tests {
477477
use super::*;
478478
use crate::ValRaw;
479+
use core::mem::MaybeUninit;
479480
use std::fs::File;
480481
use std::path::Path;
481482
use tempfile::{NamedTempFile, TempPath};
482483

483484
#[test]
485+
#[cfg(all(feature = "rr", feature = "rr-component"))]
484486
fn rr_buffers() -> Result<()> {
485487
let record_settings = RecordSettings::default();
486488
let tmp = NamedTempFile::new()?;
487489
let tmppath = tmp.path().to_str().expect("Filename should be UTF-8");
488490

489-
let values = vec![ValRaw::i32(1), ValRaw::f32(2), ValRaw::i64(3)];
491+
let values = vec![ValRaw::i32(1), ValRaw::f32(2), ValRaw::i64(3)]
492+
.into_iter()
493+
.map(|x| MaybeUninit::new(x))
494+
.collect::<Vec<_>>();
490495

491496
// Record values
492497
let mut recorder =
493498
RecordBuffer::new_recorder(Box::new(File::create(tmppath)?), record_settings)?;
494-
let event = component_wasm::HostFuncReturnEvent::new(values.as_slice(), None);
495-
recorder.record_event(event.clone())?;
499+
recorder
500+
.record_event(|| __component_events::HostFuncReturnEvent::new(values.as_slice()))?;
496501
recorder.flush()?;
497502

498503
let tmp = tmp.into_temp_path();
@@ -504,9 +509,16 @@ mod tests {
504509
// Assert that replayed values are identical
505510
let mut replayer =
506511
ReplayBuffer::new_replayer(Box::new(File::open(tmppath)?), replay_settings)?;
507-
replayer.next_event_and(|store_event: component_wasm::HostFuncReturnEvent, _| {
508-
// Check replay matches record
509-
assert!(store_event == event);
512+
let mut result_values = values.clone();
513+
replayer.next_event_and(|event: __component_events::HostFuncReturnEvent| {
514+
event.move_into_slice(result_values.as_mut_slice());
515+
516+
// Check replay `values` matches record `values`
517+
for (a, b) in values.iter().zip(result_values.iter()) {
518+
unsafe {
519+
assert!(a.assume_init().as_bytes() == b.assume_init().as_bytes());
520+
}
521+
}
510522
Ok(())
511523
})?;
512524

0 commit comments

Comments
 (0)