X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc%2Fmacros.rs;h=f04030050aade5a9efb50ec77f7203dacbadfc1c;hb=033d1df19b3835c184dabfa1c7cab42337fa36b6;hp=09fa924efc7ab0b467821d714e5217a802325c49;hpb=92f08b78a12ff119af853cb2bf58468208ea6a90;p=rust.git diff --git a/src/librustc/macros.rs b/src/librustc/macros.rs index 09fa924efc7..f04030050aa 100644 --- a/src/librustc/macros.rs +++ b/src/librustc/macros.rs @@ -97,9 +97,9 @@ impl<$($T,)*> where $($T: ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>>),* { #[inline] - fn hash_stable(&self, - __ctx: &mut $crate::ich::StableHashingContext<'a>, - __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) { + fn hash_stable(&self, + __ctx: &mut $crate::ich::StableHashingContext<'a>, + __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) { use $enum_path::*; ::std::mem::discriminant(self).hash_stable(__ctx, __hasher); @@ -128,9 +128,9 @@ impl<$($T,)*> where $($T: ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>>),* { #[inline] - fn hash_stable(&self, - __ctx: &mut $crate::ich::StableHashingContext<'a>, - __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) { + fn hash_stable(&self, + __ctx: &mut $crate::ich::StableHashingContext<'a>, + __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) { let $struct_name { $(ref $field),* } = *self; @@ -153,9 +153,9 @@ impl<$($T,)*> where $($T: ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>>),* { #[inline] - fn hash_stable(&self, - __ctx: &mut $crate::ich::StableHashingContext<'a>, - __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) { + fn hash_stable(&self, + __ctx: &mut $crate::ich::StableHashingContext<'a>, + __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) { let $struct_name ( $(ref $field),* ) = *self; @@ -173,9 +173,9 @@ macro_rules! impl_stable_hash_for_spanned { impl HashStable> for ::syntax::source_map::Spanned<$T> { #[inline] - fn hash_stable(&self, - hcx: &mut StableHashingContext<'a>, - hasher: &mut StableHasher) { + fn hash_stable(&self, + hcx: &mut StableHashingContext<'a>, + hasher: &mut StableHasher) { self.node.hash_stable(hcx, hasher); self.span.hash_stable(hcx, hasher); } @@ -253,25 +253,6 @@ macro_rules! CloneTypeFoldableAndLiftImpls { } } -#[macro_export] -macro_rules! BraceStructLiftImpl { - (impl<$($p:tt),*> Lift<$tcx:tt> for $s:path { - type Lifted = $lifted:ty; - $($field:ident),* $(,)? - } $(where $($wc:tt)*)*) => { - impl<$($p),*> $crate::ty::Lift<$tcx> for $s - $(where $($wc)*)* - { - type Lifted = $lifted; - - fn lift_to_tcx(&self, tcx: TyCtxt<$tcx>) -> Option<$lifted> { - $(let $field = tcx.lift(&self.$field)?;)* - Some(Self::Lifted { $($field),* }) - } - } - }; -} - #[macro_export] macro_rules! EnumLiftImpl { (impl<$($p:tt),*> Lift<$tcx:tt> for $s:path { @@ -324,60 +305,6 @@ fn lift_to_tcx(&self, tcx: TyCtxt<$tcx>) -> Option<$lifted> { }; } -#[macro_export] -macro_rules! BraceStructTypeFoldableImpl { - (impl<$($p:tt),*> TypeFoldable<$tcx:tt> for $s:path { - $($field:ident),* $(,)? - } $(where $($wc:tt)*)*) => { - impl<$($p),*> $crate::ty::fold::TypeFoldable<$tcx> for $s - $(where $($wc)*)* - { - fn super_fold_with>( - &self, - folder: &mut V, - ) -> Self { - let $s { $($field,)* } = self; - $s { $($field: $crate::ty::fold::TypeFoldable::fold_with($field, folder),)* } - } - - fn super_visit_with>( - &self, - visitor: &mut V, - ) -> bool { - let $s { $($field,)* } = self; - false $(|| $crate::ty::fold::TypeFoldable::visit_with($field, visitor))* - } - } - }; -} - -#[macro_export] -macro_rules! TupleStructTypeFoldableImpl { - (impl<$($p:tt),*> TypeFoldable<$tcx:tt> for $s:path { - $($field:ident),* $(,)? - } $(where $($wc:tt)*)*) => { - impl<$($p),*> $crate::ty::fold::TypeFoldable<$tcx> for $s - $(where $($wc)*)* - { - fn super_fold_with>( - &self, - folder: &mut V, - ) -> Self { - let $s($($field,)*)= self; - $s($($crate::ty::fold::TypeFoldable::fold_with($field, folder),)*) - } - - fn super_visit_with>( - &self, - visitor: &mut V, - ) -> bool { - let $s($($field,)*) = self; - false $(|| $crate::ty::fold::TypeFoldable::visit_with($field, visitor))* - } - } - }; -} - #[macro_export] macro_rules! EnumTypeFoldableImpl { (impl<$($p:tt),*> TypeFoldable<$tcx:tt> for $s:path {