diff --git a/crates/turbo-tasks-macros/src/derive/value_debug_format_macro.rs b/crates/turbo-tasks-macros/src/derive/value_debug_format_macro.rs index 3cd1e524a87e58..4b42935f2dfc54 100644 --- a/crates/turbo-tasks-macros/src/derive/value_debug_format_macro.rs +++ b/crates/turbo-tasks-macros/src/derive/value_debug_format_macro.rs @@ -33,29 +33,18 @@ pub fn derive_value_debug_format(input: TokenStream) -> TokenStream { let formatting_logic = match_expansion(&derive_input, &format_named, &format_unnamed, &format_unit); - let value_debug_format_ident = get_value_debug_format_ident(ident); - quote! { - #[doc(hidden)] - impl #impl_generics #ident #ty_generics #where_clause { - #[doc(hidden)] - #[allow(non_snake_case)] - async fn #value_debug_format_ident(&self, depth: usize) -> anyhow::Result> { - if depth == 0 { - return Ok(turbo_tasks::debug::ValueDebugString::new(stringify!(#ident).to_string())); - } - - use turbo_tasks::debug::internal::*; - use turbo_tasks::debug::ValueDebugFormat; - Ok(turbo_tasks::debug::ValueDebugString::new(format!("{:#?}", #formatting_logic))) - } - } - impl #impl_generics turbo_tasks::debug::ValueDebugFormat for #ident #ty_generics #where_clause { fn value_debug_format<'a>(&'a self, depth: usize) -> turbo_tasks::debug::ValueDebugFormatString<'a> { turbo_tasks::debug::ValueDebugFormatString::Async( Box::pin(async move { - Ok(self.#value_debug_format_ident(depth).await?.await?.to_string()) + if depth == 0 { + return Ok(stringify!(#ident).to_string()); + } + + use turbo_tasks::debug::internal::*; + use turbo_tasks::debug::ValueDebugFormat; + Ok(format!("{:#?}", #formatting_logic)) }) ) } @@ -122,7 +111,3 @@ fn format_unit(ident: &Ident) -> (TokenStream2, TokenStream2) { }, ) } - -pub(crate) fn get_value_debug_format_ident(ident: &Ident) -> Ident { - Ident::new(&format!("__value_debug_format_{}", ident), ident.span()) -} diff --git a/crates/turbo-tasks-macros/src/derive/value_debug_macro.rs b/crates/turbo-tasks-macros/src/derive/value_debug_macro.rs index 7e9fc975040da2..4bf8fe445dd328 100644 --- a/crates/turbo-tasks-macros/src/derive/value_debug_macro.rs +++ b/crates/turbo-tasks-macros/src/derive/value_debug_macro.rs @@ -2,8 +2,6 @@ use proc_macro::TokenStream; use quote::quote; use syn::{parse_macro_input, DeriveInput}; -use super::value_debug_format_macro::get_value_debug_format_ident; - /// This macro generates the implementation of the `ValueDebug` trait for a /// given type. /// @@ -11,18 +9,17 @@ use super::value_debug_format_macro::get_value_debug_format_ident; pub fn derive_value_debug(input: TokenStream) -> TokenStream { let derive_input = parse_macro_input!(input as DeriveInput); let ident = &derive_input.ident; - let value_debug_format_ident = get_value_debug_format_ident(ident); quote! { #[turbo_tasks::value_impl] impl turbo_tasks::debug::ValueDebug for #ident { #[turbo_tasks::function] async fn dbg(&self) -> anyhow::Result> { - self.#value_debug_format_ident(usize::MAX).await + turbo_tasks::debug::ValueDebugFormat::value_debug_format(self, usize::MAX).try_to_value_debug_string().await } #[turbo_tasks::function] async fn dbg_depth(&self, depth: usize) -> anyhow::Result> { - self.#value_debug_format_ident(depth).await + turbo_tasks::debug::ValueDebugFormat::value_debug_format(self, depth).try_to_value_debug_string().await } } } diff --git a/crates/turbo-tasks/src/vc/mod.rs b/crates/turbo-tasks/src/vc/mod.rs index 586b9b3ad3be74..08039718235738 100644 --- a/crates/turbo-tasks/src/vc/mod.rs +++ b/crates/turbo-tasks/src/vc/mod.rs @@ -44,6 +44,7 @@ where // accessible. #[doc(hidden)] pub node: RawVc, + #[doc(hidden)] pub(crate) _t: PhantomData, }