Skip to content

CodegenError should have optional context, rather than pretty-ifying it into a string #2204

Open
@fitzgen

Description

@fitzgen

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:

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    craneliftIssues related to the Cranelift code generatorcranelift:E-easyIssues suitable for newcomers to investigate, including Rust newcomers!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions