1 // This code exercises the surface area that we expect of the Error generic 2 // member access API. If the current toolchain is able to compile it, then 3 // thiserror is able to provide backtrace support. 4 5 #![no_std] 6 #![feature(error_generic_member_access)] 7 8 use core::error::{Error, Request}; 9 use core::fmt::{self, Debug, Display}; 10 11 struct MyError(Thing); 12 struct Thing; 13 14 impl Debug for MyError { fmt(&self, _formatter: &mut fmt::Formatter) -> fmt::Result15 fn fmt(&self, _formatter: &mut fmt::Formatter) -> fmt::Result { 16 unimplemented!() 17 } 18 } 19 20 impl Display for MyError { fmt(&self, _formatter: &mut fmt::Formatter) -> fmt::Result21 fn fmt(&self, _formatter: &mut fmt::Formatter) -> fmt::Result { 22 unimplemented!() 23 } 24 } 25 26 impl Error for MyError { provide<'a>(&'a self, request: &mut Request<'a>)27 fn provide<'a>(&'a self, request: &mut Request<'a>) { 28 request.provide_ref(&self.0); 29 } 30 } 31 32 // Include in sccache cache key. 33 const _: Option<&str> = option_env!("RUSTC_BOOTSTRAP"); 34