File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ compile_error! {
1717const PROBE : & str = r#"
1818 #![feature(error_generic_member_access, provide_any)]
1919
20- use std::any::Demand;
20+ use std::any::{ Demand, Provider} ;
2121 use std::backtrace::{Backtrace, BacktraceStatus};
2222 use std::error::Error;
2323 use std::fmt::{self, Display};
@@ -39,6 +39,12 @@ const PROBE: &str = r#"
3939 }
4040 }
4141
42+ struct P;
43+
44+ impl Provider for P {
45+ fn provide<'a>(&'a self, _demand: &mut Demand<'a>) {}
46+ }
47+
4248 const _: fn() = || {
4349 let backtrace: Backtrace = Backtrace::capture();
4450 let status: BacktraceStatus = backtrace.status();
Original file line number Diff line number Diff line change @@ -522,15 +522,16 @@ impl Error {
522522 Some ( addr. cast :: < E > ( ) . deref_mut ( ) )
523523 }
524524 }
525+ }
525526
527+ #[ cfg( backtrace) ]
528+ impl std:: any:: Provider for Error {
526529 // Called by thiserror when you have `#[source] anyhow::Error`. This provide
527530 // implementation includes the anyhow::Error's Backtrace if any, unlike
528531 // deref'ing to dyn Error where the provide implementation would include
529532 // only the original error's Backtrace from before it got wrapped into an
530533 // anyhow::Error.
531- #[ cfg( backtrace) ]
532- #[ doc( hidden) ]
533- pub fn provide < ' a > ( & ' a self , demand : & mut Demand < ' a > ) {
534+ fn provide < ' a > ( & ' a self , demand : & mut Demand < ' a > ) {
534535 unsafe { ErrorImpl :: provide ( self . inner . by_ref ( ) , demand) }
535536 }
536537}
You can’t perform that action at this time.
0 commit comments