]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/macros.rs
compiletest: Do not run debuginfo tests with gdb on msvc targets
[rust.git] / src / librustc / macros.rs
index aae1c7a299272d675ac4ffbc4546a1e474749186..2bda0c0bef02daf5fa589bf033e29f85120dc51d 100644 (file)
@@ -1,5 +1,3 @@
-// ignore-tidy-linelength
-
 macro_rules! enum_from_u32 {
     ($(#[$attr:meta])* pub enum $name:ident {
         $($variant:ident = $e:expr,)*
@@ -52,137 +50,6 @@ macro_rules! span_bug {
     })
 }
 
-#[macro_export]
-macro_rules! __impl_stable_hash_field {
-    ($field:ident, $ctx:expr, $hasher:expr) => ($field.hash_stable($ctx, $hasher));
-    ($field:ident, $ctx:expr, $hasher:expr, _) => ({ let _ = $field; });
-    ($field:ident, $ctx:expr, $hasher:expr, $delegate:expr) => ($delegate.hash_stable($ctx, $hasher));
-}
-
-#[macro_export]
-macro_rules! impl_stable_hash_for {
-    // Enums
-    (enum $enum_name:path {
-        $( $variant:ident
-           // this incorrectly allows specifying both tuple-like and struct-like fields, as in `Variant(a,b){c,d}`,
-           // when it should be only one or the other
-           $( ( $($field:ident $(-> $delegate:tt)?),* ) )?
-           $( { $($named_field:ident $(-> $named_delegate:tt)?),* } )?
-        ),* $(,)?
-    }) => {
-        impl_stable_hash_for!(
-            impl<> for enum $enum_name [ $enum_name ] { $( $variant
-                $( ( $($field $(-> $delegate)?),* ) )?
-                $( { $($named_field $(-> $named_delegate)?),* } )?
-            ),* }
-        );
-    };
-    // We want to use the enum name both in the `impl ... for $enum_name` as well as for
-    // importing all the variants. Unfortunately it seems we have to take the name
-    // twice for this purpose
-    (impl<$($T:ident),* $(,)?>
-        for enum $enum_name:path
-        [ $enum_path:path ]
-    {
-        $( $variant:ident
-           // this incorrectly allows specifying both tuple-like and struct-like fields, as in `Variant(a,b){c,d}`,
-           // when it should be only one or the other
-           $( ( $($field:ident $(-> $delegate:tt)?),* ) )?
-           $( { $($named_field:ident $(-> $named_delegate:tt)?),* } )?
-        ),* $(,)?
-    }) => {
-        impl<$($T,)*>
-            ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>>
-            for $enum_name
-            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) {
-                use $enum_path::*;
-                ::std::mem::discriminant(self).hash_stable(__ctx, __hasher);
-
-                match *self {
-                    $(
-                        $variant $( ( $(ref $field),* ) )? $( { $(ref $named_field),* } )? => {
-                            $($( __impl_stable_hash_field!($field, __ctx, __hasher $(, $delegate)?) );*)?
-                            $($( __impl_stable_hash_field!($named_field, __ctx, __hasher $(, $named_delegate)?) );*)?
-                        }
-                    )*
-                }
-            }
-        }
-    };
-    // Structs
-    (struct $struct_name:path { $($field:ident $(-> $delegate:tt)?),* $(,)? }) => {
-        impl_stable_hash_for!(
-            impl<> for struct $struct_name { $($field $(-> $delegate)?),* }
-        );
-    };
-    (impl<$($T:ident),* $(,)?> for struct $struct_name:path {
-        $($field:ident $(-> $delegate:tt)?),* $(,)?
-    }) => {
-        impl<$($T,)*>
-            ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>> for $struct_name
-            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) {
-                let $struct_name {
-                    $(ref $field),*
-                } = *self;
-
-                $( __impl_stable_hash_field!($field, __ctx, __hasher $(, $delegate)?) );*
-            }
-        }
-    };
-    // Tuple structs
-    // We cannot use normal parentheses here, the parser won't allow it
-    (tuple_struct $struct_name:path { $($field:ident $(-> $delegate:tt)?),*  $(,)? }) => {
-        impl_stable_hash_for!(
-            impl<> for tuple_struct $struct_name { $($field $(-> $delegate)?),* }
-        );
-    };
-    (impl<$($T:ident),* $(,)?>
-     for tuple_struct $struct_name:path { $($field:ident $(-> $delegate:tt)?),*  $(,)? }) => {
-        impl<$($T,)*>
-            ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>> for $struct_name
-            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) {
-                let $struct_name (
-                    $(ref $field),*
-                ) = *self;
-
-                $( __impl_stable_hash_field!($field, __ctx, __hasher $(, $delegate)?) );*
-            }
-        }
-    };
-}
-
-#[macro_export]
-macro_rules! impl_stable_hash_for_spanned {
-    ($T:path) => (
-
-        impl HashStable<StableHashingContext<'a>> for ::syntax::source_map::Spanned<$T>
-        {
-            #[inline]
-            fn hash_stable(&self,
-                           hcx: &mut StableHashingContext<'a>,
-                           hasher: &mut StableHasher) {
-                self.node.hash_stable(hcx, hasher);
-                self.span.hash_stable(hcx, hasher);
-            }
-        }
-    );
-}
-
 ///////////////////////////////////////////////////////////////////////////
 // Lift and TypeFoldable macros
 //