]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/macros.rs
Rollup merge of #66633 - GuillaumeGomez:err-codes-cleanup, r=Dylan-DPC
[rust.git] / src / librustc / macros.rs
index 256a08d7e90c34dcaef83589afa345ba8fa9b036..aae1c7a299272d675ac4ffbc4546a1e474749186 100644 (file)
@@ -253,131 +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 {
-        type Lifted = $lifted:ty;
-        $($variants:tt)*
-    } $(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> {
-                EnumLiftImpl!(@Variants(self, tcx) input($($variants)*) output())
-            }
-        }
-    };
-
-    (@Variants($this:expr, $tcx:expr) input() output($($output:tt)*)) => {
-        match $this {
-            $($output)*
-        }
-    };
-
-    (@Variants($this:expr, $tcx:expr)
-     input( ($variant:path) ( $($variant_arg:ident),* ) , $($input:tt)*)
-     output( $($output:tt)*) ) => {
-        EnumLiftImpl!(
-            @Variants($this, $tcx)
-                input($($input)*)
-                output(
-                    $variant ( $($variant_arg),* ) => {
-                        Some($variant ( $($tcx.lift($variant_arg)?),* ))
-                    }
-                    $($output)*
-                )
-        )
-    };
-
-    (@Variants($this:expr, $tcx:expr)
-     input( ($variant:path), $($input:tt)*)
-     output( $($output:tt)*) ) => {
-        EnumLiftImpl!(
-            @Variants($this, $tcx)
-                input($($input)*)
-                output(
-                    $variant => { Some($variant) }
-                    $($output)*
-                )
-        )
-    };
-}
-
-#[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<V: $crate::ty::fold::TypeFolder<$tcx>>(
-                &self,
-                folder: &mut V,
-            ) -> Self {
-                let $s { $($field,)* } = self;
-                $s { $($field: $crate::ty::fold::TypeFoldable::fold_with($field, folder),)* }
-            }
-
-            fn super_visit_with<V: $crate::ty::fold::TypeVisitor<$tcx>>(
-                &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<V: $crate::ty::fold::TypeFolder<$tcx>>(
-                &self,
-                folder: &mut V,
-            ) -> Self {
-                let $s($($field,)*)= self;
-                $s($($crate::ty::fold::TypeFoldable::fold_with($field, folder),)*)
-            }
-
-            fn super_visit_with<V: $crate::ty::fold::TypeVisitor<$tcx>>(
-                &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 {