You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 12, 2024. It is now read-only.
From this commentBacktrace stabilization is currently blocked on prototyping one or more of the suggested solutions for moving the std::error::Error trait into core
That comment suggests three possible solutions.
1. Remove `backtrace` from `Error` and instead provide it via some generic context mechanism (RFC 2895).
2. Define a `Backtrace` trait in core and have an implementation of that trait in libstd. `Error::backtrace` would then return a `&dyn Backtrace`.
3. Define `Backtrace` in core but have it dispatch via an internal vtable. This is effectively the same as 2 but the trait is hidden. The `capture` method will have to be moved to a free function in libstd.
Option one is already known to work, and so it does not need to be prototyped. In addition to these backtrace related issues a prototype of the error trait in core will need to find a way to work around pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<dyn Error>> since Box won't be available in core. The top level comment in @withoutboats's stabilization PR goes into more detail on this second issue and outlines how a new core::error::Error implementation could use hooks that are defined in std, similar to panic hooks, to work solve the issues around Box.
Boats has already raised issues about option two in this comment so I think the best way forward is to start working on a core::error::Error trait and core::backtrace::Backtrace type that both rely on hooks / manual vtables to maintain backwards compatibility with the existing error trait.
EDIT: Current Status Update
Building upon these prior issues:
From this comment
Backtracestabilization is currently blocked on prototyping one or more of the suggested solutions for moving thestd::error::Errortrait into coreThat comment suggests three possible solutions.
Option one is already known to work, and so it does not need to be prototyped. In addition to these backtrace related issues a prototype of the error trait in
corewill need to find a way to work aroundpub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<dyn Error>>sinceBoxwon't be available incore. The top level comment in @withoutboats's stabilization PR goes into more detail on this second issue and outlines how a newcore::error::Errorimplementation could use hooks that are defined instd, similar to panic hooks, to work solve the issues aroundBox.Boats has already raised issues about option two in this comment so I think the best way forward is to start working on a
core::error::Errortrait andcore::backtrace::Backtracetype that both rely on hooks / manual vtables to maintain backwards compatibility with the existing error trait.