MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / pretty_verifier_error

Function pretty_verifier_error

cranelift/codegen/src/print_errors.rs:17–42  ·  view source on GitHub ↗

Pretty-print a verifier error.

(
    func: &ir::Function,
    func_w: Option<Box<dyn FuncWriter + 'a>>,
    errors: VerifierErrors,
)

Source from the content-addressed store, hash-verified

15
16/// Pretty-print a verifier error.
17pub fn pretty_verifier_error<'a>(
18 func: &ir::Function,
19 func_w: Option<Box<dyn FuncWriter + 'a>>,
20 errors: VerifierErrors,
21) -> String {
22 let mut errors = errors.0;
23 let mut w = String::new();
24 let num_errors = errors.len();
25
26 decorate_function(
27 &mut PrettyVerifierError(func_w.unwrap_or_else(|| Box::new(PlainWriter)), &mut errors),
28 &mut w,
29 func,
30 )
31 .unwrap();
32
33 writeln!(
34 w,
35 "\n; {} verifier error{} detected (see above). Compilation aborted.",
36 num_errors,
37 if num_errors == 1 { "" } else { "s" }
38 )
39 .unwrap();
40
41 w
42}
43
44struct PrettyVerifierError<'a>(Box<dyn FuncWriter + 'a>, &'a mut Vec<VerifierError>);
45

Callers 4

runMethod · 0.85
switch_errorFunction · 0.85
pretty_errorFunction · 0.85
switch_errorFunction · 0.85

Calls 5

decorate_functionFunction · 0.85
PrettyVerifierErrorClass · 0.85
newFunction · 0.50
lenMethod · 0.45
unwrapMethod · 0.45

Tested by 3

runMethod · 0.68
switch_errorFunction · 0.68
switch_errorFunction · 0.68