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:
Jamey Sharp
2022-11-23 14:20:48 -08:00
committed by GitHub
parent 48ee42efc2
commit 044b57f334
18 changed files with 342 additions and 548 deletions

View File

@@ -28,7 +28,7 @@ criteria = "safe-to-deploy"
[[exemptions.adler]]
version = "1.0.2"
criteria = "safe-to-deploy"
criteria = "safe-to-run"
[[exemptions.aead]]
version = "0.4.3"
@@ -394,10 +394,6 @@ criteria = "safe-to-deploy"
version = "2.5.0"
criteria = "safe-to-deploy"
[[exemptions.is_ci]]
version = "1.1.1"
criteria = "safe-to-deploy"
[[exemptions.itertools]]
version = "0.10.3"
criteria = "safe-to-deploy"
@@ -482,17 +478,9 @@ criteria = "safe-to-deploy"
version = "0.6.5"
criteria = "safe-to-deploy"
[[exemptions.miette]]
version = "5.1.0"
criteria = "safe-to-deploy"
[[exemptions.miette-derive]]
version = "5.1.0"
criteria = "safe-to-deploy"
[[exemptions.miniz_oxide]]
version = "0.5.1"
criteria = "safe-to-deploy"
criteria = "safe-to-run"
[[exemptions.mio]]
version = "0.8.2"
@@ -562,10 +550,6 @@ criteria = "safe-to-run"
version = "6.0.0"
criteria = "safe-to-deploy"
[[exemptions.owo-colors]]
version = "3.4.0"
criteria = "safe-to-deploy"
[[exemptions.p256]]
version = "0.9.0"
criteria = "safe-to-deploy"
@@ -818,10 +802,6 @@ criteria = "safe-to-deploy"
version = "1.8.0"
criteria = "safe-to-deploy"
[[exemptions.smawk]]
version = "0.3.1"
criteria = "safe-to-deploy"
[[exemptions.socket2]]
version = "0.4.4"
criteria = "safe-to-deploy"
@@ -854,18 +834,6 @@ criteria = "safe-to-deploy"
version = "2.4.1"
criteria = "safe-to-deploy"
[[exemptions.supports-color]]
version = "1.3.0"
criteria = "safe-to-deploy"
[[exemptions.supports-hyperlinks]]
version = "1.2.0"
criteria = "safe-to-deploy"
[[exemptions.supports-unicode]]
version = "1.0.2"
criteria = "safe-to-deploy"
[[exemptions.symbolic_expressions]]
version = "5.0.3"
criteria = "safe-to-run"
@@ -946,10 +914,6 @@ criteria = "safe-to-run"
version = "1.15.0"
criteria = "safe-to-deploy"
[[exemptions.unicode-linebreak]]
version = "0.1.2"
criteria = "safe-to-deploy"
[[exemptions.unicode-width]]
version = "0.1.9"
criteria = "safe-to-deploy"