Unverified Commit 43460b17 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

Turbopack: MappedReadRef should be Send and Sync (#88558)

### What?

To be able to used MappedReadRefs in async context, they need to be Send.
parent 8d5b9374
......@@ -56,11 +56,11 @@ mod invalidation;
mod join_iter_ext;
mod key_value_pair;
pub mod keyed;
pub mod keyed_read_ref;
#[doc(hidden)]
pub mod macro_helpers;
mod magic_any;
mod manager;
pub mod mapped_read_ref;
mod marker_trait;
pub mod message_queue;
mod native_function;
......@@ -119,6 +119,7 @@ pub use crate::{
mark_session_dependent, prevent_gc, run, run_once, run_once_with_reason, trait_call,
turbo_tasks, turbo_tasks_scope, turbo_tasks_weak, with_turbo_tasks,
},
mapped_read_ref::MappedReadRef,
output::OutputContent,
raw_vc::{CellId, RawVc, ReadRawVcFuture, ResolveTypeError},
read_options::{ReadCellOptions, ReadOutputOptions},
......
......@@ -13,6 +13,9 @@ pub struct MappedReadRef<A, T> {
arc: triomphe::Arc<A>,
}
unsafe impl<A: Send + Sync, T: Sync> Send for MappedReadRef<A, T> {}
unsafe impl<A: Send + Sync, T: Sync> Sync for MappedReadRef<A, T> {}
impl<A, T> MappedReadRef<A, T> {
/// # Safety
/// The caller must ensure that the `arc` keeps the value pointed to by `value` alive.
......
......@@ -14,8 +14,8 @@ use rustc_hash::FxBuildHasher;
use super::traits::VcValueType;
use crate::{
ReadRawVcFuture, ReadRef, VcCast, VcValueTrait, VcValueTraitCast, VcValueTypeCast,
keyed::Keyed, keyed_read_ref::MappedReadRef,
MappedReadRef, ReadRawVcFuture, ReadRef, VcCast, VcValueTrait, VcValueTraitCast,
VcValueTypeCast, keyed::Keyed,
};
type VcReadTarget<T> = <<T as VcValueType>::Read as VcRead<T>>::Target;
......
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