Skip to content
Myr

Remove use of attributes on function parameters

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This has been stabilized in nightly but has not yet reached a stable channel release yet.

authored by David Tolnay · committed by David Tolnay · parent 6d16247 · Browse files · 2 files+20 added−19 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+20 added−19 removed

  • other:+20 added−19 removed

2 files+20 added−19 removed

modified:src/error.rs+13 added-18 removed
41 unmodified lines
42 Some(_) => None,43 None => Some(Backtrace::capture()),44 };4546 Error::construct(47 error,48 TypeId::of::<E>(),49 #[cfg(backtrace)]50 backtrace,51 )46 #[cfg(not(backtrace))]47 let backtrace = None;4849 Error::construct(error, TypeId::of::<E>(), backtrace)50 }5154 pub(crate) fn new_adhoc<M>(message: M, #[cfg(backtrace)] backtrace: Option<Backtrace>) -> Self52 pub(crate) fn new_adhoc<M>(message: M, backtrace: Option<Backtrace>) -> Self53 where54 M: Display + Debug + Send + Sync + 'static,55 {58 Error::construct(59 MessageError(message),60 TypeId::of::<M>(),61 #[cfg(backtrace)]62 backtrace,63 )56 Error::construct(MessageError(message), TypeId::of::<M>(), backtrace)57 }5866 fn construct<E>(67 error: E,68 type_id: TypeId,69 #[cfg(backtrace)] backtrace: Option<Backtrace>,70 ) -> Self59 fn construct<E>(error: E, type_id: TypeId, backtrace: Option<Backtrace>) -> Self60 where61 E: StdError + Send + Sync + 'static,62 {63 #[cfg(not(backtrace))]64 let _ = backtrace;6566 unsafe {67 let obj = mem::transmute::<&dyn StdError, TraitObject>(&error);68 let inner = Box::new(ErrorImpl {69 vtable: obj.vtable,
106 unmodified lines
176 }177 }178}179180#[cfg(not(backtrace))]181pub(crate) enum Backtrace {}182183impl<E> From<E> for Error184where185 E: StdError + Send + Sync + 'static,186{
196 unmodified lines
modified:src/lib.rs+7 added-1 removed
192 unmodified lines
193 pub fn new_adhoc<M>(message: M) -> Error194 where195 M: Display + Debug + Send + Sync + 'static,196 {197 Error::new_adhoc(message, #[cfg(backtrace)] Some(Backtrace::capture()))197 #[cfg(backtrace)]198 let backtrace = Some(Backtrace::capture());199200 #[cfg(not(backtrace))]201 let backtrace = None;202203 Error::new_adhoc(message, backtrace)204 }205}