Unverified Commit 8ff308e8 authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

fix(turbo-tasks): Make vc types use repr(transparent) (#78327)

I thought this was already here, but @lukesandberg pointed out it wasn't. I'm pretty sure we're doing transmutes in a few places that assume this, so we should have it.

There's likely no change in behavior: The only sane memory layout for these types is the transparent one, but the annotation guarantees it for our unsafe code.
parent 5cd6fdfa
...@@ -163,6 +163,7 @@ type VcReadTarget<T> = <<T as VcValueType>::Read as VcRead<T>>::Target; ...@@ -163,6 +163,7 @@ type VcReadTarget<T> = <<T as VcValueType>::Read as VcRead<T>>::Target;
#[must_use] #[must_use]
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
#[serde(transparent, bound = "")] #[serde(transparent, bound = "")]
#[repr(transparent)]
pub struct Vc<T> pub struct Vc<T>
where where
T: ?Sized, T: ?Sized,
......
...@@ -48,6 +48,7 @@ use crate::{ ...@@ -48,6 +48,7 @@ use crate::{
/// [`State`]: crate::State /// [`State`]: crate::State
/// [`ReadRef`]: crate::ReadRef /// [`ReadRef`]: crate::ReadRef
#[must_use] #[must_use]
#[repr(transparent)]
pub struct OperationVc<T> pub struct OperationVc<T>
where where
T: ?Sized, T: ?Sized,
......
...@@ -66,6 +66,7 @@ use crate::{ ...@@ -66,6 +66,7 @@ use crate::{
/// [`ReadRef`]: crate::ReadRef /// [`ReadRef`]: crate::ReadRef
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
#[serde(transparent, bound = "")] #[serde(transparent, bound = "")]
#[repr(transparent)]
pub struct ResolvedVc<T> pub struct ResolvedVc<T>
where where
T: ?Sized, T: ?Sized,
......
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