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
The Error / Display impl is still totally okay, and all of the Diagnostic stuff that goes though the Deref impl seems to work fine — both .as_ref() and calling things like .code() on a Report directly — so the issue does not seem to be present here:
NOTE: I'm now moving away from the example above, to the context where this issue occurs in my code!
The issue seems to come specifically from (I believe) somehow attaching the wrong vtable? Here the data of the error stays the same — the source code information is kept — but calling .source_code() seems to just fall back on the default None impl?
implFrom<Report>forBox<dynDiagnostic + Send + Sync + 'static>{fnfrom(error:Report) -> Self{dbg!("impl From<Report> for Box<dyn Diagnostic + Send + Sync + 'static>");dbg!(&error);dbg!(error.source_code().is_some());let outer = ManuallyDrop::new(error);unsafe{// Use vtable to attach ErrorImpl<E>'s native StdError vtable for// the right original type E.let res = (vtable(outer.inner.ptr).object_boxed)(outer.inner);dbg!(&res);dbg!(res.source_code().is_some());
res
}}}
The error and res structs remain the same, but calling the .source_code() method does not!
Any pointers on where to start fixing this would be excellent! The unsafe vtable code is beyond anything I've ever done in Rust, so figuring it out is a gradual process...
The text was updated successfully, but these errors were encountered:
I suspect this is a super subtle issue in the crazy vtable code, but here is a relatively compact reproduction of the issue:
The
Error
/Display
impl is still totally okay, and all of theDiagnostic
stuff that goes though theDeref
impl seems to work fine — both.as_ref()
and calling things like.code()
on aReport
directly — so the issue does not seem to be present here:NOTE: I'm now moving away from the example above, to the context where this issue occurs in my code!
The issue seems to come specifically from (I believe) somehow attaching the wrong vtable? Here the data of the error stays the same — the source code information is kept — but calling
.source_code()
seems to just fall back on the defaultNone
impl?Outputs, in my case:
The
error
andres
structs remain the same, but calling the.source_code()
method does not!Any pointers on where to start fixing this would be excellent! The unsafe vtable code is beyond anything I've ever done in Rust, so figuring it out is a gradual process...
The text was updated successfully, but these errors were encountered: