-macro_rules! gen_display_debug_body {
- ( $with:path ) => {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- PrintCx::with_tls_tcx(FmtPrinter::new(f, Namespace::TypeNS), |cx| {
- $with(&cx.tcx.lift(self).expect("could not lift for printing"), cx)?;
- Ok(())
- })
- }
- };
-}
-macro_rules! gen_display_debug {
- ( ($($x:tt)+) $target:ty, display yes ) => {
- impl<$($x)+> fmt::Display for $target {
- gen_display_debug_body! { Print::print_display }
- }
- };
- ( () $target:ty, display yes ) => {
- impl fmt::Display for $target {
- gen_display_debug_body! { Print::print_display }
- }
- };
- ( ($($x:tt)+) $target:ty, debug yes ) => {
- impl<$($x)+> fmt::Debug for $target {
- gen_display_debug_body! { Print::print_debug }
- }
- };
- ( () $target:ty, debug yes ) => {
- impl fmt::Debug for $target {
- gen_display_debug_body! { Print::print_debug }
- }
- };
- ( $generic:tt $target:ty, $t:ident no ) => {};
-}
-macro_rules! gen_print_impl {
- ( ($($x:tt)+) $target:ty, ($self:ident, $cx:ident) $disp:block $dbg:block ) => {
- impl<$($x)+, P: PrettyPrinter> Print<'tcx, P> for $target {
+macro_rules! define_print {
+ (@display $target:ty, ($self:ident, $cx:ident) $disp:block) => {
+ impl<P: PrettyPrinter> Print<'tcx, P> for $target {