Open
Description
pretty_error
should be replaced with methods on CodegenError
that mutate the error and provide the context that pretty_error
otherwise adds, and the CodegenError
's Display
impl should print what pretty_error
creates when it has the necessary context.
These context-adding methods would be similar to how the wast
crate adds file contents and filename context to errors with these methods:
- https://docs.rs/wast/24.0.0/wast/struct.Error.html#method.set_text
- https://docs.rs/wast/24.0.0/wast/struct.Error.html#method.set_path
Then we can delete pretty_error
, and avoid using string as an error type in more places (notably in cranelift-filetests
and its pretty_anyhow_error
workaround).