Jake Goulding

Results 615 comments of Jake Goulding

> I think the right path forward is to add this ability as an option on the opaque error definition, then flip the polarity of the option's default in the...

> I also want a `#[snafu(from)]` attribute, makes @Itsusinn I think you are looking to [disable the context selector](https://docs.rs/snafu/latest/snafu/derive.Snafu.html#disabling-the-context-selector): ```rust #[derive(Debug, Snafu)] pub enum Error { #[snafu(context(false))] Io { source:...

I'm going to pull the not-directly-related-to-opaque-error discussion out to #518; let's continue over there.

You can do this today by implementing [`GenerateImplicitData`](https://docs.rs/snafu/latest/snafu/trait.GenerateImplicitData.html). I think [this comment](https://news.ycombinator.com/item?id=42461446) is close.

Note that the provided [`Whatever`](https://docs.rs/snafu/latest/snafu/struct.Whatever.html) does something different by disabling the default providing and chaining the provider API to the source trait object: https://github.com/shepmaster/snafu/blob/00bba4b4243a340cdcafc7a8478f9e26b860692d/src/lib.rs#L1462-L1474 --- Potentially one very-forward-looking solution would...

> although I wonder if future versions of snafu couldn't infer `provide(opt)` in this case, at least from `source` fields. I've generally tried to avoid this kind of inference because...

If you wanted this in stable today, I'd leverage `Report` and your knowledge of the error type. A fully-worked example: ```rust use snafu::prelude::*; #[derive(Debug, Snafu)] enum Error { ItWasABadDay {...

> I think it should be possible for snafu Reports to print a backtrace if available, but it's probably only implemented through the unstable provider API at the moment. Unless...

A repro of the issue at hand: ```rust use snafu::prelude::*; fn make() -> Option { None } #[derive(Debug, Snafu)] pub enum ReproError { #[snafu(whatever, display("{}", message))] Custom { message: String,...

> The fix in 9.5.6 Note that the code compiles in 9.5.6: ``` % cargo update -p assertables --precise 9.5.6 Updating crates.io index Downgrading assertables v9.6.0 -> v9.5.6 % cargo...