Unverified Commit 95720f4c authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

fix(turbo-tasks): Implement ValueDebugFormat for ResolvedVc (#71173)

Caught this missing implementation when the codemod in #71172 tried to
convert this test to use `ResolvedVc`.

This implementation just forwards to the one on `Vc`.

I don't think we need an explicit test case for `Vc` inside of a struct,
because the plan is to codemod away virtually every instance of this.
Co-authored-by: 's avatarNiklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
parent e06cd474
...@@ -47,7 +47,7 @@ async fn enum_none_debug() { ...@@ -47,7 +47,7 @@ async fn enum_none_debug() {
#[tokio::test] #[tokio::test]
async fn enum_transparent_debug() { async fn enum_transparent_debug() {
run(&REGISTRATION, || async { run(&REGISTRATION, || async {
let a: Vc<Enum> = Enum::Transparent(Transparent(42).cell()).cell(); let a: Vc<Enum> = Enum::Transparent(Transparent(42).resolved_cell()).cell();
assert_eq!( assert_eq!(
format!("{:?}", a.dbg().await?), format!("{:?}", a.dbg().await?),
r#"Enum :: Transparent( r#"Enum :: Transparent(
...@@ -63,7 +63,7 @@ async fn enum_transparent_debug() { ...@@ -63,7 +63,7 @@ async fn enum_transparent_debug() {
#[tokio::test] #[tokio::test]
async fn enum_inner_vc_debug() { async fn enum_inner_vc_debug() {
run(&REGISTRATION, || async { run(&REGISTRATION, || async {
let a: Vc<Enum> = Enum::Enum(Enum::None.cell()).cell(); let a: Vc<Enum> = Enum::Enum(Enum::None.resolved_cell()).cell();
assert_eq!( assert_eq!(
format!("{:?}", a.dbg().await?), format!("{:?}", a.dbg().await?),
r#"Enum :: Enum( r#"Enum :: Enum(
...@@ -163,8 +163,8 @@ struct Transparent(u32); ...@@ -163,8 +163,8 @@ struct Transparent(u32);
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
enum Enum { enum Enum {
None, None,
Transparent(Vc<Transparent>), Transparent(ResolvedVc<Transparent>),
Enum(Vc<Enum>), Enum(ResolvedVc<Enum>),
} }
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
......
...@@ -22,6 +22,7 @@ use indexmap::{IndexMap, IndexSet}; ...@@ -22,6 +22,7 @@ use indexmap::{IndexMap, IndexSet};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{ use crate::{
debug::{ValueDebug, ValueDebugFormat, ValueDebugFormatString},
trace::{TraceRawVcs, TraceRawVcsContext}, trace::{TraceRawVcs, TraceRawVcsContext},
vc::Vc, vc::Vc,
RcStr, ResolveTypeError, Upcast, VcRead, VcTransparentRead, VcValueTrait, VcValueType, RcStr, ResolveTypeError, Upcast, VcRead, VcTransparentRead, VcValueTrait, VcValueType,
...@@ -215,6 +216,16 @@ where ...@@ -215,6 +216,16 @@ where
} }
} }
impl<T> ValueDebugFormat for ResolvedVc<T>
where
T: ?Sized + Send,
T: Upcast<Box<dyn ValueDebug>>,
{
fn value_debug_format(&self, depth: usize) -> ValueDebugFormatString {
self.node.value_debug_format(depth)
}
}
/// Indicates that a type does not contain any instances of [`Vc`]. It may /// Indicates that a type does not contain any instances of [`Vc`]. It may
/// contain [`ResolvedVc`]. /// contain [`ResolvedVc`].
/// ///
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment