Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add miette-schema #245

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Add miette-schema #245

wants to merge 4 commits into from

Conversation

Gankra
Copy link
Contributor

@Gankra Gankra commented Mar 28, 2023

See the top-level docstring for details

@zkat
Copy link
Owner

zkat commented Mar 28, 2023

It looks like it's complaining about the derive(Default) on the enum?

@zkat
Copy link
Owner

zkat commented Mar 28, 2023

Also yeah idk what is going on with those Miri errors

@Gankra
Copy link
Contributor Author

Gankra commented Mar 28, 2023

The main issue I'm seeing is the example in lib.rs that uses MietteHandlerOpts doesn't build with the default feature flags since handler.rs is behind fancy-no-backtrace

@Gankra
Copy link
Contributor Author

Gankra commented Mar 28, 2023

oh i see the CI is dying on msrv, yuck

@Gankra
Copy link
Contributor Author

Gankra commented Mar 28, 2023

...ok I can't reproduce this failure at all:

Genuinely nothing I touched should affect this at all..?

Couldn't compile the test.
---- src/eyreish/macros.rs - eyreish::macros::ensure (line 85) stdout ----
error: unexpected token
  --> src/eyreish/macros.rs:98:2
   |
15 | }, 1).1,
   |  ^

error[E0599]: the method `miette_kind` exists for reference `&ScienceError`, but its trait bounds were not satisfied
  --> src/eyreish/macros.rs:104:1
   |
9  | enum ScienceError {
   | -----------------
   | |
   | doesn't satisfy `ScienceError: Into<ErrReport>`
   | doesn't satisfy `ScienceError: miette::eyreish::kind::TraitKind`
   | doesn't satisfy `ScienceError: std::fmt::Display`
...
21 | ensure!(depth <= MAX_DEPTH, ScienceError::RecursionLimitExceeded);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `&ScienceError` due to unsatisfied trait bounds
   |
   = note: the following trait bounds were not satisfied:
           `ScienceError: Into<ErrReport>`
           which is required by `ScienceError: miette::eyreish::kind::TraitKind`
           `ScienceError: std::fmt::Display`
           which is required by `&ScienceError: miette::eyreish::kind::AdhocKind`
           `&ScienceError: Into<ErrReport>`
           which is required by `&ScienceError: miette::eyreish::kind::TraitKind`
note: the traits `Into` and `std::fmt::Display` must be implemented
  --> /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/convert/mod.rs:447:1
  --> /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/fmt/mod.rs:767:1
   = note: this error originates in the macro `$crate::miette` which comes from the expansion of the macro `ensure` (in Nightly builds, run with -Z macro-backtrace for more info)

@Gankra
Copy link
Contributor Author

Gankra commented Mar 29, 2023

btw i wouldn't land this until i've had a chance to test it out in axoproject and see if it makes any sense in practice -- which will probably be in a week or so with my current yak-shave stack

@zkat
Copy link
Owner

zkat commented Mar 30, 2023

@Gankra I'll move it to Draft until then, in that case. Feel free to un-draft it once you feel more confident in it.

@zkat zkat marked this pull request as draft March 30, 2023 01:04
@zkat zkat force-pushed the main branch 3 times, most recently from 92a28b7 to b045321 Compare April 1, 2023 00:08
@gavrilikhin-d gavrilikhin-d mentioned this pull request May 12, 2023
@gavrilikhin-d
Copy link
Contributor

@Gankra Hi! Recently I've added some basic support for serde in miette. Your idea with miette-schema sounds very interesting to me and may fall to my use case! Do you plan to continue working on it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants