Unverified Commit d7d97900 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

Turbopack: remove the .into() alias to .cell() (#85516)

### What?

Get rid of `impl Into` for value types. It's kind of legacy and we want cell creation to be kind of explicit instead of hidden in `into()` calls.

Also reduces the generated code size of the macro, potentially reducing rust build time and binary size.
parent 89cd2058
...@@ -487,7 +487,7 @@ impl Issue for CssGlobalImportIssue { ...@@ -487,7 +487,7 @@ impl Issue for CssGlobalImportIssue {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::ProcessModule.into() IssueStage::ProcessModule.cell()
} }
// TODO(PACK-4879): compute the source information by following the module references // TODO(PACK-4879): compute the source information by following the module references
......
...@@ -122,7 +122,7 @@ struct MiddlewareMissingExportIssue { ...@@ -122,7 +122,7 @@ struct MiddlewareMissingExportIssue {
impl Issue for MiddlewareMissingExportIssue { impl Issue for MiddlewareMissingExportIssue {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::Transform.into() IssueStage::Transform.cell()
} }
fn severity(&self) -> IssueSeverity { fn severity(&self) -> IssueSeverity {
......
...@@ -40,7 +40,7 @@ pub async fn get_app_route_entry( ...@@ -40,7 +40,7 @@ pub async fn get_app_route_entry(
let config = if let Some(original_segment_config) = original_segment_config { let config = if let Some(original_segment_config) = original_segment_config {
let mut segment_config = segment_from_source.owned().await?; let mut segment_config = segment_from_source.owned().await?;
segment_config.apply_parent_config(&*original_segment_config.await?); segment_config.apply_parent_config(&*original_segment_config.await?);
segment_config.into() segment_config.cell()
} else { } else {
segment_from_source segment_from_source
}; };
......
...@@ -557,7 +557,7 @@ impl Issue for StaticMetadataFileSizeIssue { ...@@ -557,7 +557,7 @@ impl Issue for StaticMetadataFileSizeIssue {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::ProcessModule.into() IssueStage::ProcessModule.cell()
} }
#[turbo_tasks::function] #[turbo_tasks::function]
......
...@@ -146,7 +146,7 @@ impl NextFontGoogleReplacer { ...@@ -146,7 +146,7 @@ impl NextFontGoogleReplacer {
impl ImportMappingReplacement for NextFontGoogleReplacer { impl ImportMappingReplacement for NextFontGoogleReplacer {
#[turbo_tasks::function] #[turbo_tasks::function]
fn replace(&self, _capture: Vc<Pattern>) -> Vc<ReplacedImportMapping> { fn replace(&self, _capture: Vc<Pattern>) -> Vc<ReplacedImportMapping> {
ReplacedImportMapping::Ignore.into() ReplacedImportMapping::Ignore.cell()
} }
/// Intercepts requests for `next/font/google/target.css` and returns a /// Intercepts requests for `next/font/google/target.css` and returns a
...@@ -166,14 +166,14 @@ impl ImportMappingReplacement for NextFontGoogleReplacer { ...@@ -166,14 +166,14 @@ impl ImportMappingReplacement for NextFontGoogleReplacer {
fragment: _, fragment: _,
} = request } = request
else { else {
return Ok(ImportMapResult::NoEntry.into()); return Ok(ImportMapResult::NoEntry.cell());
}; };
let this = &*self.await?; let this = &*self.await?;
if can_use_next_font(this.project_path.clone(), query).await? { if can_use_next_font(this.project_path.clone(), query).await? {
Ok(self.import_map_result(query.clone())) Ok(self.import_map_result(query.clone()))
} else { } else {
Ok(ImportMapResult::NoEntry.into()) Ok(ImportMapResult::NoEntry.cell())
} }
} }
} }
...@@ -338,7 +338,7 @@ impl NextFontGoogleCssModuleReplacer { ...@@ -338,7 +338,7 @@ impl NextFontGoogleCssModuleReplacer {
impl ImportMappingReplacement for NextFontGoogleCssModuleReplacer { impl ImportMappingReplacement for NextFontGoogleCssModuleReplacer {
#[turbo_tasks::function] #[turbo_tasks::function]
fn replace(&self, _capture: Vc<Pattern>) -> Vc<ReplacedImportMapping> { fn replace(&self, _capture: Vc<Pattern>) -> Vc<ReplacedImportMapping> {
ReplacedImportMapping::Ignore.into() ReplacedImportMapping::Ignore.cell()
} }
/// Intercepts requests for the css module made by the virtual JavaScript /// Intercepts requests for the css module made by the virtual JavaScript
......
...@@ -14,7 +14,7 @@ pub(crate) struct NextFontIssue { ...@@ -14,7 +14,7 @@ pub(crate) struct NextFontIssue {
impl Issue for NextFontIssue { impl Issue for NextFontIssue {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::CodeGen.into() IssueStage::CodeGen.cell()
} }
fn severity(&self) -> IssueSeverity { fn severity(&self) -> IssueSeverity {
......
...@@ -166,7 +166,7 @@ impl BeforeResolvePlugin for NextFontLocalResolvePlugin { ...@@ -166,7 +166,7 @@ impl BeforeResolvePlugin for NextFontLocalResolvePlugin {
"{}.js", "{}.js",
get_request_id(options_vc.font_family().await?, request_hash) get_request_id(options_vc.font_family().await?, request_hash)
))?, ))?,
AssetContent::file(FileContent::Content(file_content.into()).into()), AssetContent::file(FileContent::Content(file_content.into()).cell()),
) )
.to_resolved() .to_resolved()
.await?; .await?;
......
...@@ -1253,7 +1253,7 @@ impl Issue for MissingNextFolderIssue { ...@@ -1253,7 +1253,7 @@ impl Issue for MissingNextFolderIssue {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::Resolve.into() IssueStage::Resolve.cell()
} }
#[turbo_tasks::function] #[turbo_tasks::function]
......
...@@ -25,7 +25,7 @@ use turbopack_core::{ ...@@ -25,7 +25,7 @@ use turbopack_core::{
/// The predicated based on which the [ExternalCjsModulesResolvePlugin] decides /// The predicated based on which the [ExternalCjsModulesResolvePlugin] decides
/// whether to mark a module as external. /// whether to mark a module as external.
#[turbo_tasks::value(into = "shared")] #[turbo_tasks::value(shared)]
pub enum ExternalPredicate { pub enum ExternalPredicate {
/// Mark all modules as external if they're not listed in the list. /// Mark all modules as external if they're not listed in the list.
/// Applies only to imports outside of node_modules. /// Applies only to imports outside of node_modules.
...@@ -483,7 +483,7 @@ impl Issue for ExternalizeIssue { ...@@ -483,7 +483,7 @@ impl Issue for ExternalizeIssue {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::Config.into() IssueStage::Config.cell()
} }
#[turbo_tasks::function] #[turbo_tasks::function]
......
...@@ -64,7 +64,7 @@ impl Issue for InvalidImportModuleIssue { ...@@ -64,7 +64,7 @@ impl Issue for InvalidImportModuleIssue {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::Resolve.into() IssueStage::Resolve.cell()
} }
#[turbo_tasks::function] #[turbo_tasks::function]
......
...@@ -304,7 +304,7 @@ struct BabelPluginReactCompilerResolutionIssue { ...@@ -304,7 +304,7 @@ struct BabelPluginReactCompilerResolutionIssue {
impl Issue for BabelPluginReactCompilerResolutionIssue { impl Issue for BabelPluginReactCompilerResolutionIssue {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::Transform.into() IssueStage::Transform.cell()
} }
fn severity(&self) -> IssueSeverity { fn severity(&self) -> IssueSeverity {
......
...@@ -309,7 +309,7 @@ impl EcmascriptChunkItem for RawEcmascriptChunkItem { ...@@ -309,7 +309,7 @@ impl EcmascriptChunkItem for RawEcmascriptChunkItem {
}, },
..Default::default() ..Default::default()
} }
.into()) .cell())
} }
.instrument(span) .instrument(span)
.await .await
......
...@@ -235,7 +235,7 @@ impl Issue for NextSegmentConfigParsingIssue { ...@@ -235,7 +235,7 @@ impl Issue for NextSegmentConfigParsingIssue {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::Parse.into() IssueStage::Parse.cell()
} }
#[turbo_tasks::function] #[turbo_tasks::function]
......
...@@ -25,7 +25,7 @@ async fn all_in_one() { ...@@ -25,7 +25,7 @@ async fn all_in_one() {
value: 42, value: 42,
next: Some(MyStructValue::new(a).to_resolved().await?), next: Some(MyStructValue::new(a).to_resolved().await?),
} }
.into(); .cell();
let result = my_function(a, b.get_last(), c, MyEnumValue::Yeah(42)); let result = my_function(a, b.get_last(), c, MyEnumValue::Yeah(42));
assert_eq!(*result.my_trait_function().await?, "42"); assert_eq!(*result.my_trait_function().await?, "42");
......
...@@ -7,7 +7,7 @@ use turbo_tasks_testing::{Registration, register, run_once}; ...@@ -7,7 +7,7 @@ use turbo_tasks_testing::{Registration, register, run_once};
static REGISTRATION: Registration = register!(); static REGISTRATION: Registration = register!();
// Test that with `cell = "shared"`, the cell will be re-used as long as the // Test that with `cell = "compare"`, the cell will be re-used as long as the
// value is equal. // value is equal.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_trait_ref_shared_cell_mode() { async fn test_trait_ref_shared_cell_mode() {
...@@ -32,7 +32,7 @@ async fn test_trait_ref_shared_cell_mode() { ...@@ -32,7 +32,7 @@ async fn test_trait_ref_shared_cell_mode() {
assert_eq!(*TraitRef::cell(trait_ref.clone()).get_value().await?, 42); assert_eq!(*TraitRef::cell(trait_ref.clone()).get_value().await?, 42);
} }
// because we're using `cell = "shared"`, these trait refs must use the same // because we're using `cell = "compare"`, these trait refs must use the same
// underlying Arc/SharedRef (by identity) // underlying Arc/SharedRef (by identity)
assert!(TraitRef::ptr_eq(&trait_ref_a, &trait_ref_b)); assert!(TraitRef::ptr_eq(&trait_ref_a, &trait_ref_b));
...@@ -83,7 +83,7 @@ trait ValueTrait { ...@@ -83,7 +83,7 @@ trait ValueTrait {
fn get_value(&self) -> Vc<usize>; fn get_value(&self) -> Vc<usize>;
} }
#[turbo_tasks::value(transparent, cell = "shared")] #[turbo_tasks::value(transparent, cell = "compare")]
struct SharedValue(usize); struct SharedValue(usize);
#[turbo_tasks::value(transparent, cell = "new")] #[turbo_tasks::value(transparent, cell = "new")]
......
...@@ -130,7 +130,7 @@ impl Issue for FetchIssue { ...@@ -130,7 +130,7 @@ impl Issue for FetchIssue {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::Load.into() IssueStage::Load.cell()
} }
#[turbo_tasks::function] #[turbo_tasks::function]
......
...@@ -2201,25 +2201,25 @@ impl FileContent { ...@@ -2201,25 +2201,25 @@ impl FileContent {
#[turbo_tasks::function] #[turbo_tasks::function]
pub fn parse_json(&self) -> Result<Vc<FileJsonContent>> { pub fn parse_json(&self) -> Result<Vc<FileJsonContent>> {
Ok(self.parse_json_ref().into()) Ok(self.parse_json_ref().cell())
} }
#[turbo_tasks::function] #[turbo_tasks::function]
pub async fn parse_json_with_comments(self: Vc<Self>) -> Result<Vc<FileJsonContent>> { pub async fn parse_json_with_comments(self: Vc<Self>) -> Result<Vc<FileJsonContent>> {
let this = self.await?; let this = self.await?;
Ok(this.parse_json_with_comments_ref().into()) Ok(this.parse_json_with_comments_ref().cell())
} }
#[turbo_tasks::function] #[turbo_tasks::function]
pub async fn parse_json5(self: Vc<Self>) -> Result<Vc<FileJsonContent>> { pub async fn parse_json5(self: Vc<Self>) -> Result<Vc<FileJsonContent>> {
let this = self.await?; let this = self.await?;
Ok(this.parse_json5_ref().into()) Ok(this.parse_json5_ref().cell())
} }
#[turbo_tasks::function] #[turbo_tasks::function]
pub async fn lines(self: Vc<Self>) -> Result<Vc<FileLinesContent>> { pub async fn lines(self: Vc<Self>) -> Result<Vc<FileLinesContent>> {
let this = self.await?; let this = self.await?;
Ok(this.lines_ref().into()) Ok(this.lines_ref().cell())
} }
#[turbo_tasks::function] #[turbo_tasks::function]
...@@ -2464,7 +2464,7 @@ impl FileSystem for NullFileSystem { ...@@ -2464,7 +2464,7 @@ impl FileSystem for NullFileSystem {
#[turbo_tasks::function] #[turbo_tasks::function]
fn read_link(&self, _fs_path: FileSystemPath) -> Vc<LinkContent> { fn read_link(&self, _fs_path: FileSystemPath) -> Vc<LinkContent> {
LinkContent::NotFound.into() LinkContent::NotFound.cell()
} }
#[turbo_tasks::function] #[turbo_tasks::function]
......
...@@ -73,7 +73,7 @@ pub fn generic_type(input: TokenStream) -> TokenStream { ...@@ -73,7 +73,7 @@ pub fn generic_type(input: TokenStream) -> TokenStream {
turbo_tasks::VcTransparentRead<#ty, #ty, #repr> turbo_tasks::VcTransparentRead<#ty, #ty, #repr>
}, },
quote! { quote! {
turbo_tasks::VcCellSharedMode<#ty> turbo_tasks::VcCellCompareMode<#ty>
}, },
quote! { quote! {
turbo_tasks::ValueType::new_with_any_serialization::<#repr>(#name) turbo_tasks::ValueType::new_with_any_serialization::<#repr>(#name)
......
...@@ -41,7 +41,7 @@ pub fn primitive(input: TokenStream) -> TokenStream { ...@@ -41,7 +41,7 @@ pub fn primitive(input: TokenStream) -> TokenStream {
turbo_tasks::VcTransparentRead<#ty, #ty, #ty> turbo_tasks::VcTransparentRead<#ty, #ty, #ty>
}, },
quote! { quote! {
turbo_tasks::VcCellSharedMode<#ty> turbo_tasks::VcCellCompareMode<#ty>
}, },
quote! { quote! {
turbo_tasks::ValueType::new_with_any_serialization::<#ty>(#name) turbo_tasks::ValueType::new_with_any_serialization::<#ty>(#name)
......
...@@ -15,38 +15,9 @@ use turbo_tasks_macros_shared::get_value_type_ident; ...@@ -15,38 +15,9 @@ use turbo_tasks_macros_shared::get_value_type_ident;
use crate::global_name::global_name; use crate::global_name::global_name;
enum IntoMode {
None,
New,
Shared,
}
impl Parse for IntoMode {
fn parse(input: ParseStream) -> Result<Self> {
let ident = input.parse::<LitStr>()?;
Self::try_from(ident)
}
}
impl TryFrom<LitStr> for IntoMode {
type Error = Error;
fn try_from(lit: LitStr) -> std::result::Result<Self, Self::Error> {
match lit.value().as_str() {
"none" => Ok(IntoMode::None),
"new" => Ok(IntoMode::New),
"shared" => Ok(IntoMode::Shared),
_ => Err(Error::new_spanned(
&lit,
"expected \"none\", \"new\" or \"shared\"",
)),
}
}
}
enum CellMode { enum CellMode {
Compare,
New, New,
Shared,
} }
impl Parse for CellMode { impl Parse for CellMode {
...@@ -61,9 +32,9 @@ impl TryFrom<LitStr> for CellMode { ...@@ -61,9 +32,9 @@ impl TryFrom<LitStr> for CellMode {
fn try_from(lit: LitStr) -> std::result::Result<Self, Self::Error> { fn try_from(lit: LitStr) -> std::result::Result<Self, Self::Error> {
match lit.value().as_str() { match lit.value().as_str() {
"compare" => Ok(CellMode::Compare),
"new" => Ok(CellMode::New), "new" => Ok(CellMode::New),
"shared" => Ok(CellMode::Shared), _ => Err(Error::new_spanned(&lit, "expected \"new\" or \"compare\"")),
_ => Err(Error::new_spanned(&lit, "expected \"new\" or \"shared\"")),
} }
} }
} }
...@@ -99,7 +70,7 @@ impl TryFrom<LitStr> for SerializationMode { ...@@ -99,7 +70,7 @@ impl TryFrom<LitStr> for SerializationMode {
struct ValueArguments { struct ValueArguments {
serialization_mode: SerializationMode, serialization_mode: SerializationMode,
into_mode: IntoMode, shared: bool,
cell_mode: CellMode, cell_mode: CellMode,
manual_eq: bool, manual_eq: bool,
transparent: bool, transparent: bool,
...@@ -111,8 +82,8 @@ impl Parse for ValueArguments { ...@@ -111,8 +82,8 @@ impl Parse for ValueArguments {
fn parse(input: ParseStream) -> Result<Self> { fn parse(input: ParseStream) -> Result<Self> {
let mut result = ValueArguments { let mut result = ValueArguments {
serialization_mode: SerializationMode::Auto, serialization_mode: SerializationMode::Auto,
into_mode: IntoMode::None, shared: false,
cell_mode: CellMode::Shared, cell_mode: CellMode::Compare,
manual_eq: false, manual_eq: false,
transparent: false, transparent: false,
operation: None, operation: None,
...@@ -128,20 +99,7 @@ impl Parse for ValueArguments { ...@@ -128,20 +99,7 @@ impl Parse for ValueArguments {
meta, meta,
) { ) {
("shared", Meta::Path(_)) => { ("shared", Meta::Path(_)) => {
result.into_mode = IntoMode::Shared; result.shared = true;
result.cell_mode = CellMode::Shared;
}
(
"into",
Meta::NameValue(MetaNameValue {
value:
Expr::Lit(ExprLit {
lit: Lit::Str(str), ..
}),
..
}),
) => {
result.into_mode = IntoMode::try_from(str)?;
} }
( (
"serialization", "serialization",
...@@ -210,7 +168,7 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream { ...@@ -210,7 +168,7 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream {
let item = parse_macro_input!(input as Item); let item = parse_macro_input!(input as Item);
let ValueArguments { let ValueArguments {
serialization_mode, serialization_mode,
into_mode, shared,
cell_mode, cell_mode,
manual_eq, manual_eq,
transparent, transparent,
...@@ -287,15 +245,6 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream { ...@@ -287,15 +245,6 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream {
} }
}; };
let cell_mode = match cell_mode {
CellMode::New => quote! {
turbo_tasks::VcCellNewMode<#ident>
},
CellMode::Shared => quote! {
turbo_tasks::VcCellSharedMode<#ident>
},
};
let (cell_prefix, cell_access_content, read) = if let Some(inner_type) = &inner_type { let (cell_prefix, cell_access_content, read) = if let Some(inner_type) = &inner_type {
( (
quote! { pub }, quote! { pub },
...@@ -308,7 +257,7 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream { ...@@ -308,7 +257,7 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream {
) )
} else { } else {
( (
if let IntoMode::New | IntoMode::Shared = into_mode { if shared {
quote! { pub } quote! { pub }
} else { } else {
quote! {} quote! {}
...@@ -320,6 +269,15 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream { ...@@ -320,6 +269,15 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream {
) )
}; };
let cell_mode = match cell_mode {
CellMode::New => quote! {
turbo_tasks::VcCellNewMode<#ident>
},
CellMode::Compare => quote! {
turbo_tasks::VcCellCompareMode<#ident>
},
};
let cell_struct = quote! { let cell_struct = quote! {
/// Places a value in a cell of the current task. /// Places a value in a cell of the current task.
/// ///
...@@ -339,18 +297,6 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream { ...@@ -339,18 +297,6 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream {
} }
}; };
let into = if let IntoMode::New | IntoMode::Shared = into_mode {
quote! {
impl ::std::convert::From<#ident> for turbo_tasks::Vc<#ident> {
fn from(value: #ident) -> Self {
value.cell()
}
}
}
} else {
quote! {}
};
match serialization_mode { match serialization_mode {
SerializationMode::Auto => { SerializationMode::Auto => {
struct_attributes.push(quote! { struct_attributes.push(quote! {
...@@ -445,8 +391,6 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream { ...@@ -445,8 +391,6 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream {
#cell_struct #cell_struct
} }
#into
#value_type_and_register_code #value_type_and_register_code
#value_debug_impl #value_debug_impl
......
...@@ -131,8 +131,9 @@ pub use value::{TransientInstance, TransientValue}; ...@@ -131,8 +131,9 @@ pub use value::{TransientInstance, TransientValue};
pub use value_type::{TraitMethod, TraitType, ValueType}; pub use value_type::{TraitMethod, TraitType, ValueType};
pub use vc::{ pub use vc::{
Dynamic, NonLocalValue, OperationValue, OperationVc, OptionVcExt, ReadVcFuture, ResolvedVc, Dynamic, NonLocalValue, OperationValue, OperationVc, OptionVcExt, ReadVcFuture, ResolvedVc,
Upcast, UpcastStrict, ValueDefault, Vc, VcCast, VcCellNewMode, VcCellSharedMode, VcDefaultRead, Upcast, UpcastStrict, ValueDefault, Vc, VcCast, VcCellCompareMode, VcCellNewMode,
VcRead, VcTransparentRead, VcValueTrait, VcValueTraitCast, VcValueType, VcValueTypeCast, VcDefaultRead, VcRead, VcTransparentRead, VcValueTrait, VcValueTraitCast, VcValueType,
VcValueTypeCast,
}; };
pub type SliceMap<K, V> = Box<[(K, V)]>; pub type SliceMap<K, V> = Box<[(K, V)]>;
...@@ -189,7 +190,7 @@ macro_rules! fxindexset { ...@@ -189,7 +190,7 @@ macro_rules! fxindexset {
/// ``` /// ```
/// # #![feature(arbitrary_self_types)] /// # #![feature(arbitrary_self_types)]
// # #![feature(arbitrary_self_types_pointers)] // # #![feature(arbitrary_self_types_pointers)]
/// #[turbo_tasks::value(transparent, into = "shared")] /// #[turbo_tasks::value(transparent, shared)]
/// struct Foo(Vec<u32>); /// struct Foo(Vec<u32>);
/// ``` /// ```
/// ///
...@@ -199,7 +200,7 @@ macro_rules! fxindexset { ...@@ -199,7 +200,7 @@ macro_rules! fxindexset {
/// by setting the [`VcValueType::CellMode`] associated type. /// by setting the [`VcValueType::CellMode`] associated type.
/// ///
/// - **`"new"`:** Always overrides the value in the cell, invalidating all dependent tasks. /// - **`"new"`:** Always overrides the value in the cell, invalidating all dependent tasks.
/// - **`"shared"` *(default)*:** Compares with the existing value in the cell, before overriding it. /// - **`"compare"` *(default)*:** Compares with the existing value in the cell, before overriding it.
/// Requires the value to implement [`Eq`]. /// Requires the value to implement [`Eq`].
/// ///
/// Avoiding unnecessary invalidation is important to reduce downstream recomputation of tasks that /// Avoiding unnecessary invalidation is important to reduce downstream recomputation of tasks that
...@@ -211,31 +212,11 @@ macro_rules! fxindexset { ...@@ -211,31 +212,11 @@ macro_rules! fxindexset {
/// ///
/// ## `eq = "..."` /// ## `eq = "..."`
/// ///
/// By default, we `#[derive(PartialEq, Eq)]`. [`Eq`] is required by `cell = "shared"`. This /// By default, we `#[derive(PartialEq, Eq)]`. [`Eq`] is required by `cell = "compare"`. This
/// argument allows overriding that default implementation behavior. /// argument allows overriding that default implementation behavior.
/// ///
/// - **`"manual"`:** Prevents deriving [`Eq`] and [`PartialEq`] so you can do it manually. /// - **`"manual"`:** Prevents deriving [`Eq`] and [`PartialEq`] so you can do it manually.
/// ///
/// ## `into = "..."`
///
/// This macro always implements a `.cell()` method on your type with the signature:
///
/// ```ignore
/// /// Wraps the value in a cell.
/// fn cell(self) -> Vc<Self>;
/// ```
///
/// This argument controls the visibility of the `.cell()` method, as well as whether a
/// [`From<T> for Vc<T>`][From] implementation is generated.
///
/// - **`"new"` or `"shared"`:** Exposes both `.cell()` and [`From`]/[`Into`] implementations. Both
/// of these values (`"new"` or `"shared"`) do the same thing (for legacy reasons).
/// - **`"none"` *(default)*:** Makes `.cell()` private and prevents implementing [`From`]/[`Into`].
///
/// You should use the default value of `"none"` when providing your own public constructor methods.
///
/// The naming of this field and it's values are due to legacy reasons.
///
/// ## `serialization = "..."` /// ## `serialization = "..."`
/// ///
/// Affects serialization via [`serde::Serialize`] and [`serde::Deserialize`]. Serialization is /// Affects serialization via [`serde::Serialize`] and [`serde::Deserialize`]. Serialization is
...@@ -248,8 +229,7 @@ macro_rules! fxindexset { ...@@ -248,8 +229,7 @@ macro_rules! fxindexset {
/// ///
/// ## `shared` /// ## `shared`
/// ///
/// Sets both `cell = "shared"` *(already the default)* and `into = "shared"`, exposing the /// Makes the `cell()` method public so everyone can use it.
/// `.cell()` method and adding a [`From`]/[`Into`] implementation.
/// ///
/// ## `transparent` /// ## `transparent`
/// ///
......
...@@ -54,11 +54,11 @@ where ...@@ -54,11 +54,11 @@ where
/// Mode that compares the cell's content with the new value and only updates /// Mode that compares the cell's content with the new value and only updates
/// if the new value is different. /// if the new value is different.
pub struct VcCellSharedMode<T> { pub struct VcCellCompareMode<T> {
_phantom: PhantomData<T>, _phantom: PhantomData<T>,
} }
impl<T> VcCellMode<T> for VcCellSharedMode<T> impl<T> VcCellMode<T> for VcCellCompareMode<T>
where where
T: VcValueType + PartialEq, T: VcValueType + PartialEq,
{ {
......
...@@ -22,7 +22,7 @@ use shrink_to_fit::ShrinkToFit; ...@@ -22,7 +22,7 @@ use shrink_to_fit::ShrinkToFit;
pub use self::{ pub use self::{
cast::{VcCast, VcValueTraitCast, VcValueTypeCast}, cast::{VcCast, VcValueTraitCast, VcValueTypeCast},
cell_mode::{VcCellMode, VcCellNewMode, VcCellSharedMode}, cell_mode::{VcCellCompareMode, VcCellMode, VcCellNewMode},
default::ValueDefault, default::ValueDefault,
local::NonLocalValue, local::NonLocalValue,
operation::{OperationValue, OperationVc}, operation::{OperationValue, OperationVc},
......
...@@ -171,5 +171,5 @@ pub(super) async fn update_chunk_list( ...@@ -171,5 +171,5 @@ pub(super) async fn update_chunk_list(
}) })
}; };
Ok(update.into()) Ok(update.cell())
} }
...@@ -176,7 +176,7 @@ impl GraphEntries { ...@@ -176,7 +176,7 @@ impl GraphEntries {
} }
} }
#[turbo_tasks::value(cell = "new", eq = "manual", into = "new")] #[turbo_tasks::value(cell = "new", eq = "manual")]
#[derive(Clone, Default)] #[derive(Clone, Default)]
pub struct SingleModuleGraph { pub struct SingleModuleGraph {
pub graph: TracedDiGraph<SingleModuleGraphNode, RefData>, pub graph: TracedDiGraph<SingleModuleGraphNode, RefData>,
......
...@@ -50,7 +50,7 @@ pub struct ModuleBatchesGraphEdge { ...@@ -50,7 +50,7 @@ pub struct ModuleBatchesGraphEdge {
type EntriesList = FxIndexSet<ResolvedVc<Box<dyn Module>>>; type EntriesList = FxIndexSet<ResolvedVc<Box<dyn Module>>>;
#[turbo_tasks::value(cell = "new", eq = "manual", into = "new")] #[turbo_tasks::value(cell = "new", eq = "manual")]
pub struct ModuleBatchesGraph { pub struct ModuleBatchesGraph {
graph: TracedDiGraph<ModuleOrBatch, ModuleBatchesGraphEdge>, graph: TracedDiGraph<ModuleOrBatch, ModuleBatchesGraphEdge>,
......
...@@ -906,7 +906,7 @@ impl ResolveResult { ...@@ -906,7 +906,7 @@ impl ResolveResult {
primary: new_primary, primary: new_primary,
affecting_sources: self.affecting_sources.clone(), affecting_sources: self.affecting_sources.clone(),
} }
.into()) .cell())
} }
/// Returns a new [ResolveResult] where all [RequestKey]s are updated. The prefix is removed /// Returns a new [ResolveResult] where all [RequestKey]s are updated. The prefix is removed
...@@ -932,7 +932,7 @@ impl ResolveResult { ...@@ -932,7 +932,7 @@ impl ResolveResult {
primary: new_primary, primary: new_primary,
affecting_sources: self.affecting_sources.clone(), affecting_sources: self.affecting_sources.clone(),
} }
.into()) .cell())
} }
/// Returns a new [ResolveResult] where all [RequestKey]s are updated. All keys matching /// Returns a new [ResolveResult] where all [RequestKey]s are updated. All keys matching
...@@ -969,7 +969,7 @@ impl ResolveResult { ...@@ -969,7 +969,7 @@ impl ResolveResult {
primary: new_primary, primary: new_primary,
affecting_sources: self.affecting_sources.clone(), affecting_sources: self.affecting_sources.clone(),
} }
.into()) .cell())
} }
/// Returns a new [ResolveResult] where all [RequestKey]s are set to the /// Returns a new [ResolveResult] where all [RequestKey]s are set to the
...@@ -993,7 +993,7 @@ impl ResolveResult { ...@@ -993,7 +993,7 @@ impl ResolveResult {
primary: new_primary, primary: new_primary,
affecting_sources: self.affecting_sources.clone(), affecting_sources: self.affecting_sources.clone(),
} }
.into() .cell()
} }
} }
...@@ -1221,16 +1221,16 @@ pub async fn find_context_file_or_package_key( ...@@ -1221,16 +1221,16 @@ pub async fn find_context_file_or_package_key(
&*read_package_json(Vc::upcast(FileSource::new(package_json_path.clone()))).await? &*read_package_json(Vc::upcast(FileSource::new(package_json_path.clone()))).await?
&& json.get(&*package_key).is_some() && json.get(&*package_key).is_some()
{ {
return Ok(FindContextFileResult::Found(package_json_path, Vec::new()).into()); return Ok(FindContextFileResult::Found(package_json_path, Vec::new()).cell());
} }
for name in &*names.await? { for name in &*names.await? {
let fs_path = lookup_path.join(name)?; let fs_path = lookup_path.join(name)?;
if let Some(fs_path) = exists(&fs_path, None).await? { if let Some(fs_path) = exists(&fs_path, None).await? {
return Ok(FindContextFileResult::Found(fs_path, Vec::new()).into()); return Ok(FindContextFileResult::Found(fs_path, Vec::new()).cell());
} }
} }
if lookup_path.is_root() { if lookup_path.is_root() {
return Ok(FindContextFileResult::NotFound(Vec::new()).into()); return Ok(FindContextFileResult::NotFound(Vec::new()).cell());
} }
Ok(find_context_file(lookup_path.parent(), names, false)) Ok(find_context_file(lookup_path.parent(), names, false))
......
...@@ -584,10 +584,10 @@ impl ResolvedMap { ...@@ -584,10 +584,10 @@ impl ResolvedMap {
request, request,
) )
.await? .await?
.into()); .cell());
} }
} }
Ok(ImportMapResult::NoEntry.into()) Ok(ImportMapResult::NoEntry.cell())
} }
} }
...@@ -647,7 +647,7 @@ impl ResolveOptions { ...@@ -647,7 +647,7 @@ impl ResolveOptions {
.to_resolved() .to_resolved()
.await?, .await?,
); );
Ok(resolve_options.into()) Ok(resolve_options.cell())
} }
/// Returns a new [Vc<ResolveOptions>] with its fallback import map extended /// Returns a new [Vc<ResolveOptions>] with its fallback import map extended
...@@ -669,7 +669,7 @@ impl ResolveOptions { ...@@ -669,7 +669,7 @@ impl ResolveOptions {
} else { } else {
Some(extended_import_map) Some(extended_import_map)
}; };
Ok(resolve_options.into()) Ok(resolve_options.cell())
} }
/// Overrides the extensions used for resolving /// Overrides the extensions used for resolving
...@@ -677,7 +677,7 @@ impl ResolveOptions { ...@@ -677,7 +677,7 @@ impl ResolveOptions {
pub async fn with_extensions(self: Vc<Self>, extensions: Vec<RcStr>) -> Result<Vc<Self>> { pub async fn with_extensions(self: Vc<Self>, extensions: Vec<RcStr>) -> Result<Vc<Self>> {
let mut resolve_options = self.owned().await?; let mut resolve_options = self.owned().await?;
resolve_options.extensions = extensions; resolve_options.extensions = extensions;
Ok(resolve_options.into()) Ok(resolve_options.cell())
} }
/// Overrides the fully_specified flag for resolving /// Overrides the fully_specified flag for resolving
...@@ -708,7 +708,7 @@ pub async fn resolve_modules_options( ...@@ -708,7 +708,7 @@ pub async fn resolve_modules_options(
modules: options.modules.clone(), modules: options.modules.clone(),
extensions: options.extensions.clone(), extensions: options.extensions.clone(),
} }
.into()) .cell())
} }
#[turbo_tasks::value_trait] #[turbo_tasks::value_trait]
......
...@@ -39,7 +39,7 @@ pub trait VersionedContent { ...@@ -39,7 +39,7 @@ pub trait VersionedContent {
// Fast path: versions are the same. // Fast path: versions are the same.
if TraitRef::ptr_eq(&from_ref, &to_ref) { if TraitRef::ptr_eq(&from_ref, &to_ref) {
return Ok(Update::None.into()); return Ok(Update::None.cell());
} }
// The fast path might not always work since `self` might have been converted // The fast path might not always work since `self` might have been converted
...@@ -51,9 +51,9 @@ pub trait VersionedContent { ...@@ -51,9 +51,9 @@ pub trait VersionedContent {
let from_id = from_id.await?; let from_id = from_id.await?;
let to_id = to_id.await?; let to_id = to_id.await?;
Ok(if *from_id == *to_id { Ok(if *from_id == *to_id {
Update::None.into() Update::None.cell()
} else { } else {
Update::Total(TotalUpdate { to: to_ref }).into() Update::Total(TotalUpdate { to: to_ref }).cell()
}) })
} }
} }
......
...@@ -339,7 +339,7 @@ impl CssChunkItem for CssModuleChunkItem { ...@@ -339,7 +339,7 @@ impl CssChunkItem for CssModuleChunkItem {
import_context: self.module.await?.import_context, import_context: self.module.await?.import_context,
source_map: source_map.owned().await?, source_map: source_map.owned().await?,
} }
.into()) .cell())
} else { } else {
Ok(CssChunkItemContent { Ok(CssChunkItemContent {
inner_code: format!( inner_code: format!(
...@@ -351,7 +351,7 @@ impl CssChunkItem for CssModuleChunkItem { ...@@ -351,7 +351,7 @@ impl CssChunkItem for CssModuleChunkItem {
import_context: None, import_context: None,
source_map: None, source_map: None,
} }
.into()) .cell())
} }
} }
} }
...@@ -5,13 +5,7 @@ use crate::chunk::CssImport; ...@@ -5,13 +5,7 @@ use crate::chunk::CssImport;
/// impl of code generation inferred from a ModuleReference. /// impl of code generation inferred from a ModuleReference.
/// This is rust only and can't be implemented by non-rust plugins. /// This is rust only and can't be implemented by non-rust plugins.
#[turbo_tasks::value( #[turbo_tasks::value(shared, serialization = "none", eq = "manual", cell = "new")]
shared,
serialization = "none",
eq = "manual",
into = "new",
cell = "new"
)]
pub struct CodeGeneration { pub struct CodeGeneration {
#[turbo_tasks(debug_ignore, trace_ignore)] #[turbo_tasks(debug_ignore, trace_ignore)]
pub imports: Vec<CssImport>, pub imports: Vec<CssImport>,
......
...@@ -285,8 +285,8 @@ pub async fn finalize_css( ...@@ -285,8 +285,8 @@ pub async fn finalize_css(
code, code,
.. ..
} => (stylesheet.to_static(options.clone()), *code), } => (stylesheet.to_static(options.clone()), *code),
ParseCssResult::Unparsable => return Ok(FinalCssResult::Unparsable.into()), ParseCssResult::Unparsable => return Ok(FinalCssResult::Unparsable.cell()),
ParseCssResult::NotFound => return Ok(FinalCssResult::NotFound.into()), ParseCssResult::NotFound => return Ok(FinalCssResult::NotFound.cell()),
}; };
let url_references = *url_references; let url_references = *url_references;
...@@ -330,10 +330,10 @@ pub async fn finalize_css( ...@@ -330,10 +330,10 @@ pub async fn finalize_css(
exports: result.exports, exports: result.exports,
source_map: ResolvedVc::cell(srcmap), source_map: ResolvedVc::cell(srcmap),
} }
.into()) .cell())
} }
CssWithPlaceholderResult::Unparsable => Ok(FinalCssResult::Unparsable.into()), CssWithPlaceholderResult::Unparsable => Ok(FinalCssResult::Unparsable.cell()),
CssWithPlaceholderResult::NotFound => Ok(FinalCssResult::NotFound.into()), CssWithPlaceholderResult::NotFound => Ok(FinalCssResult::NotFound.cell()),
} }
} }
......
...@@ -20,7 +20,7 @@ use crate::{ ...@@ -20,7 +20,7 @@ use crate::{
references::css_resolve, references::css_resolve,
}; };
#[turbo_tasks::value(into = "new", eq = "manual", serialization = "none")] #[turbo_tasks::value(eq = "manual", serialization = "none", shared)]
pub enum ImportAttributes { pub enum ImportAttributes {
LightningCss { LightningCss {
#[turbo_tasks(trace_ignore)] #[turbo_tasks(trace_ignore)]
...@@ -174,7 +174,7 @@ impl CodeGenerateable for ImportAssetReference { ...@@ -174,7 +174,7 @@ impl CodeGenerateable for ImportAssetReference {
))) )))
} }
Ok(CodeGeneration { imports }.into()) Ok(CodeGeneration { imports }.cell())
} }
} }
......
...@@ -103,7 +103,7 @@ impl Visitor<'_> for ModuleReferencesVisitor<'_> { ...@@ -103,7 +103,7 @@ impl Visitor<'_> for ModuleReferencesVisitor<'_> {
self.references.push(Vc::upcast(ImportAssetReference::new( self.references.push(Vc::upcast(ImportAssetReference::new(
*self.origin, *self.origin,
Request::parse(RcStr::from(src).into()), Request::parse(RcStr::from(src).into()),
ImportAttributes::new_from_lightningcss(&i.clone().into_owned()).into(), ImportAttributes::new_from_lightningcss(&i.clone().into_owned()).cell(),
self.import_context.map(|ctx| *ctx), self.import_context.map(|ctx| *ctx),
IssueSource::from_line_col( IssueSource::from_line_col(
self.source, self.source,
......
...@@ -20,7 +20,7 @@ use turbopack_core::{ ...@@ -20,7 +20,7 @@ use turbopack_core::{
use crate::{StyleSheetLike, embed::CssEmbed}; use crate::{StyleSheetLike, embed::CssEmbed};
#[turbo_tasks::value(into = "new")] #[turbo_tasks::value]
pub enum ReferencedAsset { pub enum ReferencedAsset {
Some(ResolvedVc<Box<dyn OutputAsset>>), Some(ResolvedVc<Box<dyn OutputAsset>>),
None, None,
...@@ -63,7 +63,7 @@ impl UrlAssetReference { ...@@ -63,7 +63,7 @@ impl UrlAssetReference {
.to_resolved() .to_resolved()
.await?, .await?,
) )
.into()); .cell());
} }
Ok(ReferencedAsset::cell(ReferencedAsset::None)) Ok(ReferencedAsset::cell(ReferencedAsset::None))
} }
......
...@@ -13,7 +13,7 @@ use turbopack_ecmascript::{CustomTransformer, TransformContext}; ...@@ -13,7 +13,7 @@ use turbopack_ecmascript::{CustomTransformer, TransformContext};
/// Internally this contains a `CompiledPluginModuleBytes`, which points to the /// Internally this contains a `CompiledPluginModuleBytes`, which points to the
/// compiled, serialized wasmer::Module instead of raw file bytes to reduce the /// compiled, serialized wasmer::Module instead of raw file bytes to reduce the
/// cost of the compilation. /// cost of the compilation.
#[turbo_tasks::value(serialization = "none", eq = "manual", into = "new", cell = "new")] #[turbo_tasks::value(serialization = "none", eq = "manual", cell = "new", shared)]
pub struct SwcPluginModule( pub struct SwcPluginModule(
#[turbo_tasks(trace_ignore, debug_ignore)] #[turbo_tasks(trace_ignore, debug_ignore)]
#[cfg(feature = "swc_ecma_transform_plugin")] #[cfg(feature = "swc_ecma_transform_plugin")]
......
...@@ -146,7 +146,7 @@ impl EcmascriptChunkItem for AsyncLoaderChunkItem { ...@@ -146,7 +146,7 @@ impl EcmascriptChunkItem for AsyncLoaderChunkItem {
inner_code: code.into(), inner_code: code.into(),
..Default::default() ..Default::default()
} }
.into()) .cell())
} }
} }
......
...@@ -161,7 +161,7 @@ struct SideEffectsInPackageJsonIssue { ...@@ -161,7 +161,7 @@ struct SideEffectsInPackageJsonIssue {
impl Issue for SideEffectsInPackageJsonIssue { impl Issue for SideEffectsInPackageJsonIssue {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::Parse.into() IssueStage::Parse.cell()
} }
fn severity(&self) -> IssueSeverity { fn severity(&self) -> IssueSeverity {
......
...@@ -142,7 +142,7 @@ var decode = Uint8Array.fromBase64 || function Uint8Array_fromBase64(base64) { ...@@ -142,7 +142,7 @@ var decode = Uint8Array.fromBase64 || function Uint8Array_fromBase64(base64) {
inner_code: inner_code.build(), inner_code: inner_code.build(),
..Default::default() ..Default::default()
} }
.into()) .cell())
} }
FileContent::NotFound => { FileContent::NotFound => {
bail!("File not found: {}", self.module.ident().to_string().await?); bail!("File not found: {}", self.module.ident().to_string().await?);
......
...@@ -60,7 +60,7 @@ impl EcmascriptChunkItem for ManifestChunkItem { ...@@ -60,7 +60,7 @@ impl EcmascriptChunkItem for ManifestChunkItem {
inner_code: code.into(), inner_code: code.into(),
..Default::default() ..Default::default()
} }
.into()) .cell())
} }
} }
......
...@@ -177,6 +177,6 @@ impl EcmascriptChunkItem for ManifestLoaderChunkItem { ...@@ -177,6 +177,6 @@ impl EcmascriptChunkItem for ManifestLoaderChunkItem {
inner_code: code.into(), inner_code: code.into(),
..Default::default() ..Default::default()
} }
.into()) .cell())
} }
} }
...@@ -781,7 +781,7 @@ impl Issue for InvalidExport { ...@@ -781,7 +781,7 @@ impl Issue for InvalidExport {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::Bindings.into() IssueStage::Bindings.cell()
} }
#[turbo_tasks::function] #[turbo_tasks::function]
...@@ -876,7 +876,7 @@ impl Issue for CircularReExport { ...@@ -876,7 +876,7 @@ impl Issue for CircularReExport {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::Bindings.into() IssueStage::Bindings.cell()
} }
#[turbo_tasks::function] #[turbo_tasks::function]
......
...@@ -3731,7 +3731,7 @@ async fn resolve_as_webpack_runtime( ...@@ -3731,7 +3731,7 @@ async fn resolve_as_webpack_runtime(
if let Some(source) = *resolved.first_source().await? { if let Some(source) = *resolved.first_source().await? {
Ok(webpack_runtime(*source, transforms)) Ok(webpack_runtime(*source, transforms))
} else { } else {
Ok(WebpackRuntime::None.into()) Ok(WebpackRuntime::None.cell())
} }
} }
......
...@@ -83,7 +83,7 @@ impl Issue for SpecifiedModuleTypeIssue { ...@@ -83,7 +83,7 @@ impl Issue for SpecifiedModuleTypeIssue {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::Analysis.into() IssueStage::Analysis.cell()
} }
#[turbo_tasks::function] #[turbo_tasks::function]
......
...@@ -69,13 +69,7 @@ pub trait CustomTransformer: Debug { ...@@ -69,13 +69,7 @@ pub trait CustomTransformer: Debug {
/// A wrapper around a TransformPlugin instance, allowing it to operate with /// A wrapper around a TransformPlugin instance, allowing it to operate with
/// the turbo_task caching requirements. /// the turbo_task caching requirements.
#[turbo_tasks::value( #[turbo_tasks::value(transparent, serialization = "none", eq = "manual", cell = "new")]
transparent,
serialization = "none",
eq = "manual",
into = "new",
cell = "new"
)]
#[derive(Debug)] #[derive(Debug)]
pub struct TransformPlugin(#[turbo_tasks(trace_ignore)] Box<dyn CustomTransformer + Send + Sync>); pub struct TransformPlugin(#[turbo_tasks(trace_ignore)] Box<dyn CustomTransformer + Send + Sync>);
......
...@@ -225,11 +225,11 @@ pub async fn webpack_runtime( ...@@ -225,11 +225,11 @@ pub async fn webpack_runtime(
chunk_request_expr: value, chunk_request_expr: value,
context_path: source.ident().path().await?.parent(), context_path: source.ident().path().await?.parent(),
} }
.into()); .cell());
} }
} }
} }
ParseResult::Unparsable { .. } | ParseResult::NotFound => {} ParseResult::Unparsable { .. } | ParseResult::NotFound => {}
} }
Ok(WebpackRuntime::None.into()) Ok(WebpackRuntime::None.cell())
} }
...@@ -76,7 +76,7 @@ impl EcmascriptChunkItem for WorkerLoaderChunkItem { ...@@ -76,7 +76,7 @@ impl EcmascriptChunkItem for WorkerLoaderChunkItem {
inner_code: code.into(), inner_code: code.into(),
..Default::default() ..Default::default()
} }
.into()) .cell())
} }
} }
......
...@@ -19,7 +19,7 @@ impl Issue for ProcessEnvIssue { ...@@ -19,7 +19,7 @@ impl Issue for ProcessEnvIssue {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::Load.into() IssueStage::Load.cell()
} }
#[turbo_tasks::function] #[turbo_tasks::function]
......
...@@ -168,7 +168,7 @@ impl EcmascriptChunkItem for JsonChunkItem { ...@@ -168,7 +168,7 @@ impl EcmascriptChunkItem for JsonChunkItem {
inner_code: code.into_source_code(), inner_code: code.into_source_code(),
..Default::default() ..Default::default()
} }
.into()) .cell())
} }
FileJsonContent::Unparsable(e) => { FileJsonContent::Unparsable(e) => {
let mut message = "Unable to make a module from invalid JSON: ".to_string(); let mut message = "Unable to make a module from invalid JSON: ".to_string();
......
...@@ -745,7 +745,7 @@ impl Issue for EvaluationIssue { ...@@ -745,7 +745,7 @@ impl Issue for EvaluationIssue {
#[turbo_tasks::function] #[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> { fn stage(&self) -> Vc<IssueStage> {
IssueStage::Transform.into() IssueStage::Transform.cell()
} }
#[turbo_tasks::function] #[turbo_tasks::function]
......
...@@ -725,7 +725,7 @@ static ACTIVE_POOLS: Lazy<IdleProcessQueues> = Lazy::new(Default::default); ...@@ -725,7 +725,7 @@ static ACTIVE_POOLS: Lazy<IdleProcessQueues> = Lazy::new(Default::default);
/// ///
/// The worker will *not* use the env of the parent process by default. All env /// The worker will *not* use the env of the parent process by default. All env
/// vars need to be provided to make the execution as pure as possible. /// vars need to be provided to make the execution as pure as possible.
#[turbo_tasks::value(into = "new", cell = "new", serialization = "none", eq = "manual")] #[turbo_tasks::value(cell = "new", serialization = "none", eq = "manual", shared)]
pub struct NodeJsPool { pub struct NodeJsPool {
cwd: PathBuf, cwd: PathBuf,
entrypoint: PathBuf, entrypoint: PathBuf,
......
...@@ -83,7 +83,7 @@ pub async fn apply_cjs_specific_options(options: Vc<ResolveOptions>) -> Result<V ...@@ -83,7 +83,7 @@ pub async fn apply_cjs_specific_options(options: Vc<ResolveOptions>) -> Result<V
conditions.insert(rcstr!("import"), ConditionValue::Unset); conditions.insert(rcstr!("import"), ConditionValue::Unset);
conditions.insert(rcstr!("require"), ConditionValue::Set); conditions.insert(rcstr!("require"), ConditionValue::Set);
} }
Ok(options.into()) Ok(options.cell())
} }
pub async fn esm_resolve( pub async fn esm_resolve(
......
...@@ -207,7 +207,7 @@ async fn base_resolve_options( ...@@ -207,7 +207,7 @@ async fn base_resolve_options(
collect_affecting_sources: opt.collect_affecting_sources, collect_affecting_sources: opt.collect_affecting_sources,
..Default::default() ..Default::default()
} }
.into()) .cell())
} }
#[turbo_tasks::function] #[turbo_tasks::function]
......
...@@ -112,7 +112,7 @@ impl ResolveOptionsContext { ...@@ -112,7 +112,7 @@ impl ResolveOptionsContext {
.to_resolved() .to_resolved()
.await?, .await?,
); );
Ok(resolve_options_context.into()) Ok(resolve_options_context.cell())
} }
/// Returns a new [Vc<ResolveOptionsContext>] with its fallback import map /// Returns a new [Vc<ResolveOptionsContext>] with its fallback import map
...@@ -133,7 +133,7 @@ impl ResolveOptionsContext { ...@@ -133,7 +133,7 @@ impl ResolveOptionsContext {
.to_resolved() .to_resolved()
.await?, .await?,
); );
Ok(resolve_options_context.into()) Ok(resolve_options_context.cell())
} }
} }
......
...@@ -529,7 +529,7 @@ async fn apply_typescript_types_options( ...@@ -529,7 +529,7 @@ async fn apply_typescript_types_options(
for conditions in get_condition_maps(&mut resolve_options) { for conditions in get_condition_maps(&mut resolve_options) {
conditions.insert(rcstr!("types"), ConditionValue::Set); conditions.insert(rcstr!("types"), ConditionValue::Set);
} }
Ok(resolve_options.into()) Ok(resolve_options.cell())
} }
#[turbo_tasks::value_impl] #[turbo_tasks::value_impl]
......
...@@ -93,7 +93,7 @@ impl ChunkableModule for StaticUrlJsModule { ...@@ -93,7 +93,7 @@ impl ChunkableModule for StaticUrlJsModule {
impl EcmascriptChunkPlaceable for StaticUrlJsModule { impl EcmascriptChunkPlaceable for StaticUrlJsModule {
#[turbo_tasks::function] #[turbo_tasks::function]
fn get_exports(&self) -> Vc<EcmascriptExports> { fn get_exports(&self) -> Vc<EcmascriptExports> {
EcmascriptExports::Value.into() EcmascriptExports::Value.cell()
} }
} }
...@@ -152,6 +152,6 @@ impl EcmascriptChunkItem for StaticUrlJsChunkItem { ...@@ -152,6 +152,6 @@ impl EcmascriptChunkItem for StaticUrlJsChunkItem {
.into(), .into(),
..Default::default() ..Default::default()
} }
.into()) .cell())
} }
} }
...@@ -417,7 +417,7 @@ async fn run_test_operation(prepared_test: ResolvedVc<PreparedTest>) -> Result<V ...@@ -417,7 +417,7 @@ async fn run_test_operation(prepared_test: ResolvedVc<PreparedTest>) -> Result<V
)], )],
..Default::default() ..Default::default()
} }
.into(), .cell(),
ResolveOptionsContext { ResolveOptionsContext {
enable_typescript: true, enable_typescript: true,
enable_node_modules: Some(project_root.clone()), enable_node_modules: Some(project_root.clone()),
......
...@@ -370,7 +370,7 @@ async fn run_test_operation(resource: RcStr) -> Result<Vc<FileSystemPath>> { ...@@ -370,7 +370,7 @@ async fn run_test_operation(resource: RcStr) -> Result<Vc<FileSystemPath>> {
analyze_mode: AnalyzeMode::CodeGenerationAndTracing, analyze_mode: AnalyzeMode::CodeGenerationAndTracing,
..Default::default() ..Default::default()
} }
.into(), .cell(),
ResolveOptionsContext { ResolveOptionsContext {
enable_typescript: true, enable_typescript: true,
enable_react: true, enable_react: true,
......
...@@ -80,7 +80,7 @@ fn bench_emit(b: &mut Bencher, bench_input: &BenchInput) { ...@@ -80,7 +80,7 @@ fn bench_emit(b: &mut Bencher, bench_input: &BenchInput) {
let input = input_fs.root().await?.join(&input)?; let input = input_fs.root().await?.join(&input)?;
let input_dir = input.parent().parent(); let input_dir = input.parent().parent();
let output_fs: Vc<NullFileSystem> = NullFileSystem.into(); let output_fs: Vc<NullFileSystem> = NullFileSystem.cell();
let output_dir = output_fs.root().owned().await?; let output_dir = output_fs.root().owned().await?;
let source = FileSource::new(input); let source = FileSource::new(input);
......
...@@ -152,6 +152,6 @@ impl EcmascriptChunkItem for RawModuleChunkItem { ...@@ -152,6 +152,6 @@ impl EcmascriptChunkItem for RawModuleChunkItem {
.into(), .into(),
..Default::default() ..Default::default()
} }
.into()) .cell())
} }
} }
...@@ -35,9 +35,9 @@ impl AggregatedGraph { ...@@ -35,9 +35,9 @@ impl AggregatedGraph {
#[turbo_tasks::function] #[turbo_tasks::function]
pub async fn content(self: Vc<Self>) -> Result<Vc<AggregatedGraphNodeContent>> { pub async fn content(self: Vc<Self>) -> Result<Vc<AggregatedGraphNodeContent>> {
Ok(match *self.await? { Ok(match *self.await? {
AggregatedGraph::Leaf(asset) => AggregatedGraphNodeContent::Asset(asset).into(), AggregatedGraph::Leaf(asset) => AggregatedGraphNodeContent::Asset(asset).cell(),
AggregatedGraph::Node { ref content, .. } => { AggregatedGraph::Node { ref content, .. } => {
AggregatedGraphNodeContent::Children(content.clone()).into() AggregatedGraphNodeContent::Children(content.clone()).cell()
} }
}) })
} }
...@@ -52,7 +52,7 @@ impl AggregatedGraph { ...@@ -52,7 +52,7 @@ impl AggregatedGraph {
refs.insert(AggregatedGraph::leaf(**reference).to_resolved().await?); refs.insert(AggregatedGraph::leaf(**reference).to_resolved().await?);
} }
} }
AggregatedGraphsSet { set: refs }.into() AggregatedGraphsSet { set: refs }.cell()
} }
AggregatedGraph::Node { references, .. } => { AggregatedGraph::Node { references, .. } => {
let mut set = FxHashSet::default(); let mut set = FxHashSet::default();
...@@ -64,7 +64,7 @@ impl AggregatedGraph { ...@@ -64,7 +64,7 @@ impl AggregatedGraph {
{ {
set.insert(item.to_resolved().await?); set.insert(item.to_resolved().await?);
} }
AggregatedGraphsSet { set }.into() AggregatedGraphsSet { set }.cell()
} }
}) })
} }
...@@ -72,9 +72,9 @@ impl AggregatedGraph { ...@@ -72,9 +72,9 @@ impl AggregatedGraph {
#[turbo_tasks::function] #[turbo_tasks::function]
async fn cost(self: Vc<Self>) -> Result<Vc<AggregationCost>> { async fn cost(self: Vc<Self>) -> Result<Vc<AggregationCost>> {
Ok(match *self.await? { Ok(match *self.await? {
AggregatedGraph::Leaf(asset) => AggregationCost(asset.references().await?.len()).into(), AggregatedGraph::Leaf(asset) => AggregationCost(asset.references().await?.len()).cell(),
AggregatedGraph::Node { ref references, .. } => { AggregatedGraph::Node { ref references, .. } => {
AggregationCost(references.len()).into() AggregationCost(references.len()).cell()
} }
}) })
} }
...@@ -107,7 +107,7 @@ impl AggregatedGraph { ...@@ -107,7 +107,7 @@ impl AggregatedGraph {
outer, outer,
references, references,
} }
.into()) .cell())
} }
} }
...@@ -179,7 +179,7 @@ async fn aggregate_more(node: ResolvedVc<AggregatedGraph>) -> Result<Vc<Aggregat ...@@ -179,7 +179,7 @@ async fn aggregate_more(node: ResolvedVc<AggregatedGraph>) -> Result<Vc<Aggregat
content, content,
references, references,
} }
.into()) .cell())
} }
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
......
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