zkat / miette

Fancy extension for std::error::Error with pretty, detailed diagnostic printing.
https://docs.rs/miette
Apache License 2.0
1.85k stars 106 forks source link

Turns out, `Report` *really* doesn't want to be an `Error` or `Diagnostic`... #368

Open TheLostLambda opened 2 months ago

TheLostLambda commented 2 months ago

Failing some context tests, I'm pretty sure because self.wrap_err(msg) creates a context_chain_downcast table, whilst the Report::from_msg(msg, self) that it's impl clashed with only creates at context_downcast.

I messed around and got Rust to segfault, and discovered I was very much in over my head...

I do think it's possible to impl Diagnostic for Report, but there's a lot of internal restructuring that would need to happen, and in the best case, we lose the Into<Report> impl.

As with 90%+ of my issues with Rust nowadays, the stabilization of specialization would solve this (I believe), but that could be ages and ages away still...

Ultimately, this is here if anyone is feeling clever / brave, and it's work thinking about if we're okay losing those From and Into impls for Report, because I don't think there is a clever way around that...

TheLostLambda commented 2 months ago

If we decide this is better than having From and Into, I'll revisit with a couple of new ideas for how to solve the underlying issues, but for now I'll leave it be, since I'm not actually sure losing those From and Intos is worth it...

TheLostLambda commented 2 months ago

Very happy to retire this if #371 is merged!