fitzgen opened Issue #2204:
pretty_errorshould be replaced with methods onCodegenErrorthat mutate the error and provide the context thatpretty_errorotherwise adds, and theCodegenError'sDisplayimpl should print whatpretty_errorcreates when it has the necessary context.These context-adding methods would be similar to how the
wastcrate 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 incranelift-filetestsand itspretty_anyhow_errorworkaround).
fitzgen labeled Issue #2204:
pretty_errorshould be replaced with methods onCodegenErrorthat mutate the error and provide the context thatpretty_errorotherwise adds, and theCodegenError'sDisplayimpl should print whatpretty_errorcreates when it has the necessary context.These context-adding methods would be similar to how the
wastcrate 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 incranelift-filetestsand itspretty_anyhow_errorworkaround).
fitzgen labeled Issue #2204:
pretty_errorshould be replaced with methods onCodegenErrorthat mutate the error and provide the context thatpretty_errorotherwise adds, and theCodegenError'sDisplayimpl should print whatpretty_errorcreates when it has the necessary context.These context-adding methods would be similar to how the
wastcrate 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 incranelift-filetestsand itspretty_anyhow_errorworkaround).
github-actions[bot] commented on Issue #2204:
Subscribe to Label Action
cc @bnjbvr
<details>
This issue or pull request has been labeled: "cranelift"Thus the following users have been cc'd because of the following labels:
- bnjbvr: cranelift
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
bjorn3 commented on Issue #2204:
pretty_errortakes a reference toisaandfunc. Doing this would requireCodegenErrorto borrow from them.
fitzgen commented on Issue #2204:
The idea is to take copies of the data gathered from those things and store them into the error, rather than borrow those things.
bjorn3 commented on Issue #2204:
pretty_errorneeds the entire function, as the error shows the full function source. From the target isa it needs the register_info and encoding_info.
taegyunkim commented on Issue #2204:
I'd like to take this issue. Is anyone looking into this?
fitzgen commented on Issue #2204:
It's all you @taegyunkim!
Last updated: Dec 06 2025 at 06:05 UTC