zkat / miette

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

Implement `Diagnostic` for `Report` #307

Open gavrilikhin-d opened 11 months ago

gavrilikhin-d commented 11 months ago

It looks like Report can be casted to diagnostic reference, since it implements AsRef<dyn Diagnostic + Send + Sync>. But I can't find an implementation of Diagnostic for Report itself for some reason.

It could help you remove special case impl<C: SourceCode> Diagnostic for WithSourceCode<Report, C>

TheLostLambda commented 5 months ago

I've accidentally asked the same in #366 ... It looks fundamentally like the ever-annoying coherence issue with impl From<T> for T in the standard library...

I might be possible to remove the From impl for Report, meaning you also lose .into(), but then there are a lot more internal challenges I can't particularly figure out... Tragically, this seems like a very very hard change to make...

Out of curiosity, why are you wanting Report to impl Diagnostic? Is it also for .report_err, or for something else?