cranelift-isle: Rewrite error reporting (#5318)
There were several issues with ISLE's existing error reporting implementation. - When using Miette for more readable error reports, it would panic if errors were reported from multiple files in the same run. - Miette is pretty heavy-weight for what we're doing, with a lot of dependencies. - The `Error::Errors` enum variant led to normalization steps in many places, to avoid using that variant to represent a single error. This commit: - replaces Miette with codespan-reporting - gets rid of a bunch of cargo-vet exemptions - replaces the `Error::Errors` variant with a new `Errors` type - removes source info from `Error` variants so they're easy to construct - adds source info only when formatting `Errors` - formats `Errors` with a custom `Debug` impl - shares common code between ISLE's callers, islec and cranelift-codegen - includes a source snippet even with fancy-errors disabled I tried to make this a series of smaller commits but I couldn't find any good split points; everything was too entangled with everything else.
This commit is contained in:
@@ -40,7 +40,6 @@ criterion = "0.3"
|
||||
[build-dependencies]
|
||||
cranelift-codegen-meta = { path = "meta", version = "0.91.0" }
|
||||
cranelift-isle = { path = "../isle/isle", version = "=0.91.0" }
|
||||
miette = { version = "5.1.0", features = ["fancy"], optional = true }
|
||||
|
||||
[features]
|
||||
default = ["std", "unwind"]
|
||||
@@ -101,7 +100,7 @@ incremental-cache = [
|
||||
souper-harvest = ["souper-ir", "souper-ir/stringify"]
|
||||
|
||||
# Provide fancy Miette-produced errors for ISLE.
|
||||
isle-errors = ["miette", "cranelift-isle/miette-errors"]
|
||||
isle-errors = ["cranelift-isle/fancy-errors"]
|
||||
|
||||
# Put ISLE generated files in isle_generated_code/, for easier
|
||||
# inspection, rather than inside of target/.
|
||||
|
||||
Reference in New Issue
Block a user