Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,28 +375,25 @@ impl RunCommand {
// The main module might be allowed to have unknown imports, which
// should be defined as traps:
if self.run.common.wasm.unknown_imports_trap == Some(true) {
#[cfg(feature = "cranelift")]
match linker {
CliLinker::Core(linker) => {
linker.define_unknown_imports_as_traps(module.unwrap_core())?;
}
_ => bail!("cannot use `--trap-unknown-imports` with components"),
#[cfg(feature = "component-model")]
CliLinker::Component(linker) => {
linker.define_unknown_imports_as_traps(module.unwrap_component())?;
}
}
#[cfg(not(feature = "cranelift"))]
bail!("support for `unknown-imports-trap` disabled at compile time");
}

// ...or as default values.
if self.run.common.wasm.unknown_imports_default == Some(true) {
#[cfg(feature = "cranelift")]
match linker {
CliLinker::Core(linker) => {
linker.define_unknown_imports_as_default_values(module.unwrap_core())?;
}
_ => bail!("cannot use `--default-values-unknown-imports` with components"),
}
#[cfg(not(feature = "cranelift"))]
bail!("support for `unknown-imports-trap` disabled at compile time");
}

let finish_epoch_handler = self.setup_epoch_handler(store, modules)?;
Expand Down