Improve linking-related error messages (#3353)
Include more contextual information about why the link failed related to why the types didn't match. Closes #3172
This commit is contained in:
@@ -7,6 +7,7 @@ use cranelift_entity::entity_impl;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::convert::{TryFrom, TryInto};
|
||||
use std::fmt;
|
||||
|
||||
mod error;
|
||||
pub use error::*;
|
||||
@@ -68,6 +69,21 @@ impl From<WasmType> for wasmparser::Type {
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for WasmType {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
WasmType::I32 => write!(f, "i32"),
|
||||
WasmType::I64 => write!(f, "i64"),
|
||||
WasmType::F32 => write!(f, "f32"),
|
||||
WasmType::F64 => write!(f, "f64"),
|
||||
WasmType::V128 => write!(f, "v128"),
|
||||
WasmType::ExternRef => write!(f, "externref"),
|
||||
WasmType::FuncRef => write!(f, "funcref"),
|
||||
WasmType::ExnRef => write!(f, "exnref"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// WebAssembly function type -- equivalent of `wasmparser`'s FuncType.
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
|
||||
pub struct WasmFuncType {
|
||||
|
||||
Reference in New Issue
Block a user