Error logging (ErrorReport, .report()) POC
This is a proof of concept for reporting errors more fully in log messages, as requested in #680 (closed).
We provide the new facility, and use it in one call site to demonstrate it. The type judo is rather unfortunate but I don't see a better way. See the in-tree comments.
If this is thought to be a good way forward, we should apply this .report()
pattern to all places where errors are logged. I'm not sure how precisely to find these. I think a good start would be "anywhere we use the Display
impl of something that impl Error
". Maybe rust-analyser or something can find these?
CC @nickm, @eta: I would like a review from both of you, as this error logging pattern will have to become ubiquitous.