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() {
#[tokio::test]
async fn enum_transparent_debug() {
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!(
format!("{:?}", a.dbg().await?),
r#"Enum :: Transparent(
......@@ -63,7 +63,7 @@ async fn enum_transparent_debug() {
#[tokio::test]
async fn enum_inner_vc_debug() {
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!(
format!("{:?}", a.dbg().await?),
r#"Enum :: Enum(
......@@ -163,8 +163,8 @@ struct Transparent(u32);
#[turbo_tasks::value(shared)]
enum Enum {
None,
Transparent(Vc<Transparent>),
Enum(Vc<Enum>),
Transparent(ResolvedVc<Transparent>),
Enum(ResolvedVc<Enum>),
}
#[turbo_tasks::value(shared)]
......
......@@ -22,6 +22,7 @@ use indexmap::{IndexMap, IndexSet};
use serde::{Deserialize, Serialize};
use crate::{
debug::{ValueDebug, ValueDebugFormat, ValueDebugFormatString},
trace::{TraceRawVcs, TraceRawVcsContext},
vc::Vc,
RcStr, ResolveTypeError, Upcast, VcRead, VcTransparentRead, VcValueTrait, VcValueType,
......@@ -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
/// 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