Unverified Commit dc856d6c authored by Luke Sandberg's avatar Luke Sandberg Committed by GitHub

[turbopack] Optimize TaskInput implementations (#94202)

# What

Replace the `derive` macros for TaskInput with a proc macro
`[turbo_tasks::task_input]` (and analogous support inside of the
`turbo_tasks::value` macro.

Introduce a hand written `CloneResolved` future type for TaskInput
implementations that are always resolved.

# Why

This allows us to take advantage of the `NonLocalValue` marker trait. If
a type is `NonLocalValue` then `TaskInput` can have trivial
`is_resolved` and `resolve_input` implementations. This applies to the
vast majority of TaskInputs but the current `derive` implementation
always produces a recursive `async` `resolve_input` implementation but
it is rarely needed and rustc/llvm do a bad job of optimizing it.

## Code-size impact

`next-swc.darwin-arm64.node` — release profile, `pnpm swc-build-native
--release`, macOS aarch64.

| Metric | canary | this branch | Δ bytes | Δ % |
| --- | ---: | ---: | ---: | ---: |
| Raw `.node` | 124,494,592 | 124,217,280 | −277,312 | −0.22% |
| Stripped (`strip -x`) | 84,294,000 | 84,013,136 | −280,864 | −0.33% |
| Stripped + gzip -9 | 29,123,538 | 28,898,920 | −224,618 | −0.77% |

## Performance

A similar measurement of performance was neutral

| Metric | canary | temporary | Δ | % |
|---|---|---|---|---|
| wall time (s) | 42.659 ± 1.851 | 42.501 ± 2.028 | −0.158 | −0.4% |
| user time (s) | 294.322 ± 1.834 | 293.207 ± 2.070 | −1.115 | −0.4% |
| sys time (s) | 74.158 ± 4.197 | 73.543 ± 5.725 | −0.615 | −0.8% |
| MaxRSS (MB) | 13650.1 ± 66.0 | 13610.1 ± 57.5 | −40.0 | −0.3% |

All deltas are smaller than one standard deviation — statistically
indistinguishable from noise on this benchmark, as expected for a small
optimization.
parent cbb9a85b
...@@ -5,10 +5,7 @@ use bincode::{Decode, Encode}; ...@@ -5,10 +5,7 @@ use bincode::{Decode, Encode};
use either::Either; use either::Either;
use next_core::{get_next_package, next_server::get_tracing_compile_time_info}; use next_core::{get_next_package, next_server::get_tracing_compile_time_info};
use serde_json::json; use serde_json::json;
use turbo_tasks::{ use turbo_tasks::{ResolvedVc, TryFlatJoinIterExt, TryJoinIterExt, Vc, trace::TraceRawVcs};
NonLocalValue, ResolvedVc, TaskInput, TryFlatJoinIterExt, TryJoinIterExt, Vc,
trace::TraceRawVcs,
};
use turbo_tasks_fs::{ use turbo_tasks_fs::{
DirectoryContent, DirectoryEntry, File, FileContent, FileSystemPath, glob::Glob, DirectoryContent, DirectoryEntry, File, FileContent, FileSystemPath, glob::Glob,
}; };
...@@ -26,9 +23,8 @@ use turbopack_resolve::ecmascript::cjs_resolve; ...@@ -26,9 +23,8 @@ use turbopack_resolve::ecmascript::cjs_resolve;
use crate::{nft::traced_modules_for_entries, project::Project}; use crate::{nft::traced_modules_for_entries, project::Project};
#[derive( #[turbo_tasks::task_input]
PartialEq, Eq, TraceRawVcs, NonLocalValue, Debug, Clone, Hash, TaskInput, Encode, Decode, #[derive(PartialEq, Eq, TraceRawVcs, Debug, Clone, Hash, Encode, Decode)]
)]
enum ServerNftType { enum ServerNftType {
Minimal, Minimal,
Full, Full,
......
...@@ -2,7 +2,7 @@ use anyhow::Result; ...@@ -2,7 +2,7 @@ use anyhow::Result;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{ use turbo_tasks::{
FxIndexMap, NonLocalValue, OperationValue, OperationVc, ResolvedVc, TaskInput, Vc, FxIndexMap, NonLocalValue, OperationValue, OperationVc, ResolvedVc, Vc,
debug::ValueDebugFormat, take_effects, trace::TraceRawVcs, debug::ValueDebugFormat, take_effects, trace::TraceRawVcs,
}; };
use turbopack_core::issue::CollectibleIssuesExt; use turbopack_core::issue::CollectibleIssuesExt;
...@@ -108,19 +108,9 @@ fn pick_route(entrypoints: OperationVc<Entrypoints>, key: RcStr, route: &Route) ...@@ -108,19 +108,9 @@ fn pick_route(entrypoints: OperationVc<Entrypoints>, key: RcStr, route: &Route)
} }
} }
#[turbo_tasks::task_input]
#[derive( #[derive(
Debug, Debug, Clone, TraceRawVcs, PartialEq, Eq, Hash, ValueDebugFormat, OperationValue, Encode, Decode,
Clone,
TaskInput,
TraceRawVcs,
PartialEq,
Eq,
Hash,
ValueDebugFormat,
NonLocalValue,
OperationValue,
Encode,
Decode,
)] )]
enum EndpointSelector { enum EndpointSelector {
RoutePageHtml(RcStr), RoutePageHtml(RcStr),
......
...@@ -32,8 +32,8 @@ use next_core::{ ...@@ -32,8 +32,8 @@ use next_core::{
use tracing::Instrument; use tracing::Instrument;
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
Completion, FxIndexMap, NonLocalValue, ResolvedVc, TaskInput, ValueToString, Vc, fxindexmap, Completion, FxIndexMap, ResolvedVc, ValueToString, Vc, fxindexmap, fxindexset,
fxindexset, trace::TraceRawVcs, trace::TraceRawVcs,
}; };
use turbo_tasks_fs::{ use turbo_tasks_fs::{
self, File, FileContent, FileSystem, FileSystemPath, FileSystemPathOption, VirtualFileSystem, self, File, FileContent, FileSystem, FileSystemPath, FileSystemPathOption, VirtualFileSystem,
...@@ -588,9 +588,8 @@ struct PageEndpoint { ...@@ -588,9 +588,8 @@ struct PageEndpoint {
pages_structure: ResolvedVc<PagesStructure>, pages_structure: ResolvedVc<PagesStructure>,
} }
#[derive( #[turbo_tasks::task_input]
Copy, Clone, PartialEq, Eq, Hash, Debug, TaskInput, TraceRawVcs, NonLocalValue, Encode, Decode, #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, TraceRawVcs, Encode, Decode)]
)]
enum PageEndpointType { enum PageEndpointType {
Api, Api,
Html, Html,
...@@ -601,14 +600,16 @@ enum PageEndpointType { ...@@ -601,14 +600,16 @@ enum PageEndpointType {
SsrOnly, SsrOnly,
} }
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, TaskInput, TraceRawVcs, Encode, Decode)] #[turbo_tasks::task_input]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, TraceRawVcs, Encode, Decode)]
enum SsrChunkType { enum SsrChunkType {
Page, Page,
Data, Data,
Api, Api,
} }
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, TaskInput, TraceRawVcs, Encode, Decode)] #[turbo_tasks::task_input]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
enum EmitManifests { enum EmitManifests {
/// Don't emit any manifests /// Don't emit any manifests
None, None,
......
...@@ -36,7 +36,7 @@ use tracing::{Instrument, field::Empty}; ...@@ -36,7 +36,7 @@ use tracing::{Instrument, field::Empty};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
Completion, Completions, FxIndexMap, NonLocalValue, OperationValue, OperationVc, ReadRef, Completion, Completions, FxIndexMap, NonLocalValue, OperationValue, OperationVc, ReadRef,
ResolvedVc, State, TaskInput, TransientInstance, TryFlatJoinIterExt, TryJoinIterExt, Vc, ResolvedVc, State, TransientInstance, TryFlatJoinIterExt, TryJoinIterExt, Vc,
debug::ValueDebugFormat, fxindexmap, trace::TraceRawVcs, debug::ValueDebugFormat, fxindexmap, trace::TraceRawVcs,
}; };
use turbo_tasks_env::{EnvMap, ProcessEnv}; use turbo_tasks_env::{EnvMap, ProcessEnv};
...@@ -103,17 +103,16 @@ use crate::{ ...@@ -103,17 +103,16 @@ use crate::{
versioned_content_map::VersionedContentMap, versioned_content_map::VersionedContentMap,
}; };
#[turbo_tasks::task_input]
#[derive( #[derive(
Debug, Debug,
Serialize, Serialize,
Deserialize, Deserialize,
Clone, Clone,
TaskInput,
PartialEq, PartialEq,
Eq, Eq,
Hash, Hash,
TraceRawVcs, TraceRawVcs,
NonLocalValue,
OperationValue, OperationValue,
Encode, Encode,
Decode, Decode,
...@@ -125,6 +124,7 @@ pub struct DraftModeOptions { ...@@ -125,6 +124,7 @@ pub struct DraftModeOptions {
pub preview_mode_signing_key: RcStr, pub preview_mode_signing_key: RcStr,
} }
#[turbo_tasks::task_input]
#[derive( #[derive(
Debug, Debug,
Default, Default,
...@@ -132,12 +132,10 @@ pub struct DraftModeOptions { ...@@ -132,12 +132,10 @@ pub struct DraftModeOptions {
Deserialize, Deserialize,
Copy, Copy,
Clone, Clone,
TaskInput,
PartialEq, PartialEq,
Eq, Eq,
Hash, Hash,
TraceRawVcs, TraceRawVcs,
NonLocalValue,
OperationValue, OperationValue,
Encode, Encode,
Decode, Decode,
...@@ -152,18 +150,17 @@ pub struct WatchOptions { ...@@ -152,18 +150,17 @@ pub struct WatchOptions {
pub poll_interval: Option<Duration>, pub poll_interval: Option<Duration>,
} }
#[turbo_tasks::task_input]
#[derive( #[derive(
Debug, Debug,
Default, Default,
Serialize, Serialize,
Deserialize, Deserialize,
Clone, Clone,
TaskInput,
PartialEq, PartialEq,
Eq, Eq,
Hash, Hash,
TraceRawVcs, TraceRawVcs,
NonLocalValue,
OperationValue, OperationValue,
Encode, Encode,
Decode, Decode,
...@@ -175,20 +172,8 @@ pub struct DebugBuildPaths { ...@@ -175,20 +172,8 @@ pub struct DebugBuildPaths {
} }
/// Target for HMR operations - client-side (browser) or server-side (Node.js). /// Target for HMR operations - client-side (browser) or server-side (Node.js).
#[derive( #[turbo_tasks::task_input]
Debug, #[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
Default,
Copy,
Clone,
TaskInput,
PartialEq,
Eq,
Hash,
TraceRawVcs,
NonLocalValue,
Encode,
Decode,
)]
pub enum HmrTarget { pub enum HmrTarget {
#[default] #[default]
Client, Client,
...@@ -439,17 +424,16 @@ pub struct PartialProjectOptions { ...@@ -439,17 +424,16 @@ pub struct PartialProjectOptions {
pub debug_build_paths: Option<DebugBuildPaths>, pub debug_build_paths: Option<DebugBuildPaths>,
} }
#[turbo_tasks::task_input]
#[derive( #[derive(
Debug, Debug,
Serialize, Serialize,
Deserialize, Deserialize,
Clone, Clone,
TaskInput,
PartialEq, PartialEq,
Eq, Eq,
Hash, Hash,
TraceRawVcs, TraceRawVcs,
NonLocalValue,
OperationValue, OperationValue,
Encode, Encode,
Decode, Decode,
......
...@@ -8,7 +8,7 @@ use rustc_hash::FxHashMap; ...@@ -8,7 +8,7 @@ use rustc_hash::FxHashMap;
use tracing::Instrument; use tracing::Instrument;
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
FxIndexMap, FxIndexSet, NonLocalValue, ResolvedVc, TaskInput, TryJoinIterExt, ValueDefault, FxIndexMap, FxIndexSet, NonLocalValue, ResolvedVc, TryJoinIterExt, ValueDefault,
ValueToStringRef, Vc, debug::ValueDebugFormat, fxindexmap, trace::TraceRawVcs, turbobail, ValueToStringRef, Vc, debug::ValueDebugFormat, fxindexmap, trace::TraceRawVcs, turbobail,
}; };
use turbo_tasks_fs::{DirectoryContent, DirectoryEntry, FileSystemEntryType, FileSystemPath}; use turbo_tasks_fs::{DirectoryContent, DirectoryEntry, FileSystemEntryType, FileSystemPath};
...@@ -84,9 +84,8 @@ pub enum MetadataWithAltItem { ...@@ -84,9 +84,8 @@ pub enum MetadataWithAltItem {
} }
/// A single metadata file. /// A single metadata file.
#[derive( #[turbo_tasks::task_input]
Clone, Debug, Hash, PartialEq, Eq, TaskInput, TraceRawVcs, NonLocalValue, Encode, Decode, #[derive(Clone, Debug, Hash, PartialEq, Eq, TraceRawVcs, Encode, Decode)]
)]
pub enum MetadataItem { pub enum MetadataItem {
Static { path: FileSystemPath }, Static { path: FileSystemPath },
Dynamic { path: FileSystemPath }, Dynamic { path: FileSystemPath },
...@@ -561,19 +560,8 @@ impl ValueDefault for FileSystemPathVec { ...@@ -561,19 +560,8 @@ impl ValueDefault for FileSystemPathVec {
} }
} }
#[derive( #[turbo_tasks::task_input]
Clone, #[derive(Clone, PartialEq, Eq, Hash, TraceRawVcs, ValueDebugFormat, Debug, Encode, Decode)]
PartialEq,
Eq,
Hash,
TraceRawVcs,
ValueDebugFormat,
Debug,
TaskInput,
NonLocalValue,
Encode,
Decode,
)]
pub enum Entrypoint { pub enum Entrypoint {
AppPage { AppPage {
pages: Vec<AppPage>, pages: Vec<AppPage>,
......
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::TaskInput;
use turbopack_ecmascript_runtime::RuntimeType; use turbopack_ecmascript_runtime::RuntimeType;
use crate::next_shared::webpack_rules::WebpackLoaderBuiltinCondition; use crate::next_shared::webpack_rules::WebpackLoaderBuiltinCondition;
/// The mode in which Next.js is running. /// The mode in which Next.js is running.
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared, task_input)]
#[derive(Debug, Copy, Clone, TaskInput, Ord, PartialOrd, Hash)] #[derive(Debug, Copy, Clone, Ord, PartialOrd, Hash)]
pub enum NextMode { pub enum NextMode {
/// `next dev --turbopack` /// `next dev --turbopack`
Development, Development,
......
...@@ -14,7 +14,7 @@ use std::{ ...@@ -14,7 +14,7 @@ use std::{
use anyhow::{Result, bail}; use anyhow::{Result, bail};
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{NonLocalValue, TaskInput, trace::TraceRawVcs}; use turbo_tasks::trace::TraceRawVcs;
pub use crate::next_app::{ pub use crate::next_app::{
app_client_references_chunks::{ app_client_references_chunks::{
...@@ -28,20 +28,8 @@ pub use crate::next_app::{ ...@@ -28,20 +28,8 @@ pub use crate::next_app::{
}; };
/// See [AppPage]. /// See [AppPage].
#[derive( #[turbo_tasks::task_input]
Clone, #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, TraceRawVcs, Encode, Decode)]
Debug,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
TaskInput,
TraceRawVcs,
NonLocalValue,
Encode,
Decode,
)]
pub enum PageSegment { pub enum PageSegment {
/// e.g. `/dashboard` /// e.g. `/dashboard`
Static(RcStr), Static(RcStr),
...@@ -133,20 +121,8 @@ impl Display for PageSegment { ...@@ -133,20 +121,8 @@ impl Display for PageSegment {
} }
} }
#[derive( #[turbo_tasks::task_input]
Clone, #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, TraceRawVcs, Encode, Decode)]
Debug,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
TaskInput,
TraceRawVcs,
NonLocalValue,
Encode,
Decode,
)]
pub enum PageType { pub enum PageType {
Page, Page,
Route, Route,
...@@ -164,19 +140,8 @@ impl Display for PageType { ...@@ -164,19 +140,8 @@ impl Display for PageType {
/// Describes the pathname including all internal modifiers such as /// Describes the pathname including all internal modifiers such as
/// intercepting routes, parallel routes and route/page suffixes that are not /// intercepting routes, parallel routes and route/page suffixes that are not
/// part of the pathname. /// part of the pathname.
#[derive( #[turbo_tasks::task_input]
Clone, #[derive(Clone, Debug, Hash, PartialEq, Eq, Default, TraceRawVcs, Encode, Decode)]
Debug,
Hash,
PartialEq,
Eq,
Default,
TaskInput,
TraceRawVcs,
NonLocalValue,
Encode,
Decode,
)]
pub struct AppPage(pub Vec<PageSegment>); pub struct AppPage(pub Vec<PageSegment>);
impl AppPage { impl AppPage {
...@@ -359,20 +324,8 @@ impl PartialOrd for AppPage { ...@@ -359,20 +324,8 @@ impl PartialOrd for AppPage {
/// Path segments for a router path (not including parallel routes and groups). /// Path segments for a router path (not including parallel routes and groups).
/// ///
/// Also see [AppPath]. /// Also see [AppPath].
#[derive( #[turbo_tasks::task_input]
Clone, #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, TraceRawVcs, Encode, Decode)]
Debug,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
TaskInput,
TraceRawVcs,
NonLocalValue,
Encode,
Decode,
)]
pub enum PathSegment { pub enum PathSegment {
/// e.g. `/dashboard` /// e.g. `/dashboard`
Static(RcStr), Static(RcStr),
...@@ -412,19 +365,8 @@ impl Display for PathSegment { ...@@ -412,19 +365,8 @@ impl Display for PathSegment {
/// ///
/// Does not include internal modifiers as it's the equivalent of the http /// Does not include internal modifiers as it's the equivalent of the http
/// request path. /// request path.
#[derive( #[turbo_tasks::task_input]
Clone, #[derive(Clone, Debug, Hash, PartialEq, Eq, Default, TraceRawVcs, Encode, Decode)]
Debug,
Hash,
PartialEq,
Eq,
Default,
TaskInput,
TraceRawVcs,
NonLocalValue,
Encode,
Decode,
)]
pub struct AppPath(pub Vec<PathSegment>); pub struct AppPath(pub Vec<PathSegment>);
impl AppPath { impl AppPath {
......
...@@ -3,7 +3,7 @@ use std::collections::BTreeSet; ...@@ -3,7 +3,7 @@ use std::collections::BTreeSet;
use anyhow::Result; use anyhow::Result;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ResolvedVc, TaskInput, Vc, trace::TraceRawVcs}; use turbo_tasks::{ResolvedVc, Vc, trace::TraceRawVcs};
use turbo_tasks_fs::FileSystemPath; use turbo_tasks_fs::FileSystemPath;
use turbopack::module_options::{ use turbopack::module_options::{
CssOptionsContext, EcmascriptOptionsContext, JsxTransformOptions, ModuleRule, CssOptionsContext, EcmascriptOptionsContext, JsxTransformOptions, ModuleRule,
...@@ -135,8 +135,8 @@ pub async fn get_client_compile_time_info( ...@@ -135,8 +135,8 @@ pub async fn get_client_compile_time_info(
.await .await
} }
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared, task_input)]
#[derive(Debug, Clone, Hash, TaskInput)] #[derive(Debug, Clone, Hash)]
pub enum ClientContextType { pub enum ClientContextType {
Pages { pages_dir: FileSystemPath }, Pages { pages_dir: FileSystemPath },
App { app_dir: FileSystemPath }, App { app_dir: FileSystemPath },
...@@ -454,7 +454,8 @@ pub async fn get_client_module_options_context( ...@@ -454,7 +454,8 @@ pub async fn get_client_module_options_context(
Ok(module_options_context) Ok(module_options_context)
} }
#[derive(Clone, Debug, PartialEq, Eq, Hash, TaskInput, TraceRawVcs, Encode, Decode)] #[turbo_tasks::task_input(contains_unresolved_vcs)]
#[derive(Clone, Debug, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
pub struct ClientChunkingContextOptions { pub struct ClientChunkingContextOptions {
pub mode: Vc<NextMode>, pub mode: Vc<NextMode>,
pub root_path: FileSystemPath, pub root_path: FileSystemPath,
......
...@@ -8,7 +8,7 @@ use serde_json::Value as JsonValue; ...@@ -8,7 +8,7 @@ use serde_json::Value as JsonValue;
use turbo_esregex::EsRegex; use turbo_esregex::EsRegex;
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
FxIndexMap, NonLocalValue, OperationValue, ResolvedVc, TaskInput, TryJoinIterExt, Vc, FxIndexMap, NonLocalValue, OperationValue, ResolvedVc, TryJoinIterExt, Vc,
debug::ValueDebugFormat, trace::TraceRawVcs, debug::ValueDebugFormat, trace::TraceRawVcs,
}; };
use turbo_tasks_env::EnvMap; use turbo_tasks_env::EnvMap;
...@@ -350,6 +350,7 @@ pub enum OutputType { ...@@ -350,6 +350,7 @@ pub enum OutputType {
#[turbo_tasks::value(transparent)] #[turbo_tasks::value(transparent)]
pub struct OptionOutputType(Option<OutputType>); pub struct OptionOutputType(Option<OutputType>);
#[turbo_tasks::task_input]
#[derive( #[derive(
Debug, Debug,
Clone, Clone,
...@@ -358,11 +359,9 @@ pub struct OptionOutputType(Option<OutputType>); ...@@ -358,11 +359,9 @@ pub struct OptionOutputType(Option<OutputType>);
PartialEq, PartialEq,
Ord, Ord,
PartialOrd, PartialOrd,
TaskInput,
TraceRawVcs, TraceRawVcs,
Serialize, Serialize,
Deserialize, Deserialize,
NonLocalValue,
OperationValue, OperationValue,
Encode, Encode,
Decode, Decode,
......
use anyhow::Result; use anyhow::Result;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ResolvedVc, TaskInput, Vc, trace::TraceRawVcs}; use turbo_tasks::{ResolvedVc, Vc, trace::TraceRawVcs};
use turbo_tasks_fs::FileSystemPath; use turbo_tasks_fs::FileSystemPath;
use turbopack_browser::BrowserChunkingContext; use turbopack_browser::BrowserChunkingContext;
use turbopack_core::{ use turbopack_core::{
...@@ -183,7 +183,8 @@ pub async fn get_edge_resolve_options_context( ...@@ -183,7 +183,8 @@ pub async fn get_edge_resolve_options_context(
.cell()) .cell())
} }
#[derive(Clone, Debug, PartialEq, Eq, Hash, TaskInput, TraceRawVcs, Encode, Decode)] #[turbo_tasks::task_input(contains_unresolved_vcs)]
#[derive(Clone, Debug, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
pub struct EdgeChunkingContextOptions { pub struct EdgeChunkingContextOptions {
pub mode: Vc<NextMode>, pub mode: Vc<NextMode>,
pub root_path: FileSystemPath, pub root_path: FileSystemPath,
......
...@@ -2,9 +2,7 @@ use anyhow::{Context, Result}; ...@@ -2,9 +2,7 @@ use anyhow::{Context, Result};
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use serde::Deserialize; use serde::Deserialize;
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{FxIndexMap, FxIndexSet, NonLocalValue, Vc, fxindexset, trace::TraceRawVcs};
FxIndexMap, FxIndexSet, NonLocalValue, TaskInput, Vc, fxindexset, trace::TraceRawVcs,
};
use super::request::{NextFontRequest, OneOrManyStrings}; use super::request::{NextFontRequest, OneOrManyStrings};
...@@ -12,8 +10,8 @@ const ALLOWED_DISPLAY_VALUES: &[&str] = &["auto", "block", "swap", "fallback", " ...@@ -12,8 +10,8 @@ const ALLOWED_DISPLAY_VALUES: &[&str] = &["auto", "block", "swap", "fallback", "
pub(super) type FontData = FxIndexMap<RcStr, FontDataEntry>; pub(super) type FontData = FxIndexMap<RcStr, FontDataEntry>;
#[turbo_tasks::value] #[turbo_tasks::value(task_input)]
#[derive(Clone, Debug, PartialOrd, Ord, Hash, TaskInput)] #[derive(Clone, Debug, PartialOrd, Ord, Hash)]
pub(super) struct NextFontGoogleOptions { pub(super) struct NextFontGoogleOptions {
/// Name of the requested font from Google. Contains literal spaces. /// Name of the requested font from Google. Contains literal spaces.
pub font_family: RcStr, pub font_family: RcStr,
...@@ -44,20 +42,9 @@ impl NextFontGoogleOptions { ...@@ -44,20 +42,9 @@ impl NextFontGoogleOptions {
} }
} }
#[turbo_tasks::task_input]
#[derive( #[derive(
Clone, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Deserialize, TraceRawVcs, Encode, Decode,
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Deserialize,
TraceRawVcs,
NonLocalValue,
TaskInput,
Encode,
Decode,
)] )]
pub(super) enum FontWeights { pub(super) enum FontWeights {
Variable, Variable,
......
...@@ -3,7 +3,7 @@ use std::{fmt::Display, str::FromStr}; ...@@ -3,7 +3,7 @@ use std::{fmt::Display, str::FromStr};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{NonLocalValue, TaskInput, Vc, trace::TraceRawVcs}; use turbo_tasks::{Vc, trace::TraceRawVcs};
use crate::next_font::local::request::{ use crate::next_font::local::request::{
AdjustFontFallback, NextFontLocalDeclaration, NextFontLocalRequest, AdjustFontFallback, NextFontLocalDeclaration, NextFontLocalRequest,
...@@ -12,8 +12,8 @@ use crate::next_font::local::request::{ ...@@ -12,8 +12,8 @@ use crate::next_font::local::request::{
/// A normalized, Vc-friendly struct derived from validating and transforming /// A normalized, Vc-friendly struct derived from validating and transforming
/// [[NextFontLocalRequest]] /// [[NextFontLocalRequest]]
#[turbo_tasks::value] #[turbo_tasks::value(task_input)]
#[derive(Clone, Debug, PartialOrd, Ord, Hash, TaskInput)] #[derive(Clone, Debug, PartialOrd, Ord, Hash)]
pub(super) struct NextFontLocalOptions { pub(super) struct NextFontLocalOptions {
pub fonts: FontDescriptors, pub fonts: FontDescriptors,
pub default_weight: Option<FontWeight>, pub default_weight: Option<FontWeight>,
...@@ -52,20 +52,8 @@ impl NextFontLocalOptions { ...@@ -52,20 +52,8 @@ impl NextFontLocalOptions {
/// Describes an individual font file's path, weight, style, etc. Derived from /// Describes an individual font file's path, weight, style, etc. Derived from
/// the `src` field or top-level object provided by the user /// the `src` field or top-level object provided by the user
#[derive( #[turbo_tasks::task_input]
Clone, #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, TraceRawVcs, Encode, Decode)]
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
TraceRawVcs,
NonLocalValue,
TaskInput,
Encode,
Decode,
)]
pub(super) struct FontDescriptor { pub(super) struct FontDescriptor {
pub weight: Option<FontWeight>, pub weight: Option<FontWeight>,
pub style: Option<RcStr>, pub style: Option<RcStr>,
...@@ -94,20 +82,8 @@ impl FontDescriptor { ...@@ -94,20 +82,8 @@ impl FontDescriptor {
} }
} }
#[derive( #[turbo_tasks::task_input]
Clone, #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, TraceRawVcs, Encode, Decode)]
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
TraceRawVcs,
NonLocalValue,
TaskInput,
Encode,
Decode,
)]
pub(super) enum FontDescriptors { pub(super) enum FontDescriptors {
/// `One` is a special case when the user did not provide a `src` field and /// `One` is a special case when the user did not provide a `src` field and
/// instead included font path, weight etc in the top-level object: in /// instead included font path, weight etc in the top-level object: in
...@@ -117,20 +93,8 @@ pub(super) enum FontDescriptors { ...@@ -117,20 +93,8 @@ pub(super) enum FontDescriptors {
Many(Vec<FontDescriptor>), Many(Vec<FontDescriptor>),
} }
#[derive( #[turbo_tasks::task_input]
Clone, #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, TraceRawVcs, Encode, Decode)]
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
TraceRawVcs,
NonLocalValue,
TaskInput,
Encode,
Decode,
)]
pub(super) enum FontWeight { pub(super) enum FontWeight {
Variable(RcStr, RcStr), Variable(RcStr, RcStr),
Fixed(RcStr), Fixed(RcStr),
......
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{NonLocalValue, TaskInput, trace::TraceRawVcs}; use turbo_tasks::trace::TraceRawVcs;
/// The top-most structure encoded into the query param in requests to /// The top-most structure encoded into the query param in requests to
/// `next/font/local` generated by the next/font swc transform. e.g. /// `next/font/local` generated by the next/font swc transform. e.g.
...@@ -13,20 +13,9 @@ pub(super) struct NextFontLocalRequest { ...@@ -13,20 +13,9 @@ pub(super) struct NextFontLocalRequest {
pub variable_name: RcStr, pub variable_name: RcStr,
} }
#[turbo_tasks::task_input]
#[derive( #[derive(
Clone, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Deserialize, TraceRawVcs, Encode, Decode,
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
TaskInput,
Deserialize,
TraceRawVcs,
NonLocalValue,
Encode,
Decode,
)] )]
pub(super) struct NextFontLocalDeclaration { pub(super) struct NextFontLocalDeclaration {
pub prop: RcStr, pub prop: RcStr,
...@@ -68,6 +57,7 @@ pub(super) struct SrcDescriptor { ...@@ -68,6 +57,7 @@ pub(super) struct SrcDescriptor {
} }
/// The user's desired fallback font /// The user's desired fallback font
#[turbo_tasks::task_input]
#[derive( #[derive(
Clone, Clone,
Debug, Debug,
...@@ -79,8 +69,6 @@ pub(super) struct SrcDescriptor { ...@@ -79,8 +69,6 @@ pub(super) struct SrcDescriptor {
Eq, Eq,
Serialize, Serialize,
TraceRawVcs, TraceRawVcs,
NonLocalValue,
TaskInput,
Encode, Encode,
Decode, Decode,
)] )]
......
use anyhow::{Result, bail}; use anyhow::{Result, bail};
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_rcstr::rcstr; use turbo_rcstr::rcstr;
use turbo_tasks::{NonLocalValue, ResolvedVc, TaskInput, Vc, fxindexmap, trace::TraceRawVcs}; use turbo_tasks::{ResolvedVc, Vc, fxindexmap, trace::TraceRawVcs};
use turbopack::{ModuleAssetContext, module_options::CustomModuleType}; use turbopack::{ModuleAssetContext, module_options::CustomModuleType};
use turbopack_core::{ use turbopack_core::{
context::AssetContext, module::Module, reference_type::ReferenceType, source::Source, context::AssetContext, module::Module, reference_type::ReferenceType, source::Source,
...@@ -11,21 +11,8 @@ use turbopack_static::ecma::StaticUrlJsModule; ...@@ -11,21 +11,8 @@ use turbopack_static::ecma::StaticUrlJsModule;
use super::source_asset::StructuredImageFileSource; use super::source_asset::StructuredImageFileSource;
#[derive( #[turbo_tasks::task_input]
Eq, #[derive(Eq, PartialEq, Clone, Copy, Debug, PartialOrd, Ord, Hash, TraceRawVcs, Encode, Decode)]
PartialEq,
Clone,
Copy,
Debug,
PartialOrd,
Ord,
Hash,
TaskInput,
TraceRawVcs,
NonLocalValue,
Encode,
Decode,
)]
pub enum BlurPlaceholderMode { pub enum BlurPlaceholderMode {
/// Do not generate a blur placeholder at all. /// Do not generate a blur placeholder at all.
None, None,
......
...@@ -8,8 +8,7 @@ use bincode::{Decode, Encode}; ...@@ -8,8 +8,7 @@ use bincode::{Decode, Encode};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{ use turbo_tasks::{
FxIndexMap, NonLocalValue, ReadRef, ResolvedVc, TaskInput, TryFlatJoinIterExt, TryJoinIterExt, FxIndexMap, ReadRef, ResolvedVc, TryFlatJoinIterExt, TryJoinIterExt, Vc, trace::TraceRawVcs,
Vc, trace::TraceRawVcs,
}; };
use turbo_tasks_fs::{File, FileContent, FileSystemPath}; use turbo_tasks_fs::{File, FileContent, FileSystemPath};
use turbopack_core::{ use turbopack_core::{
...@@ -279,6 +278,7 @@ impl Default for MiddlewaresManifest { ...@@ -279,6 +278,7 @@ impl Default for MiddlewaresManifest {
} }
} }
#[turbo_tasks::task_input]
#[derive( #[derive(
Debug, Debug,
Clone, Clone,
...@@ -287,11 +287,9 @@ impl Default for MiddlewaresManifest { ...@@ -287,11 +287,9 @@ impl Default for MiddlewaresManifest {
PartialEq, PartialEq,
Ord, Ord,
PartialOrd, PartialOrd,
TaskInput,
TraceRawVcs, TraceRawVcs,
Serialize, Serialize,
Deserialize, Deserialize,
NonLocalValue,
Encode, Encode,
Decode, Decode,
)] )]
...@@ -462,6 +460,7 @@ pub enum ActionManifestModuleId<'a> { ...@@ -462,6 +460,7 @@ pub enum ActionManifestModuleId<'a> {
Number(u64), Number(u64),
} }
#[turbo_tasks::task_input]
#[derive( #[derive(
Debug, Debug,
Copy, Copy,
...@@ -471,11 +470,9 @@ pub enum ActionManifestModuleId<'a> { ...@@ -471,11 +470,9 @@ pub enum ActionManifestModuleId<'a> {
PartialEq, PartialEq,
Ord, Ord,
PartialOrd, PartialOrd,
TaskInput,
TraceRawVcs, TraceRawVcs,
Serialize, Serialize,
Deserialize, Deserialize,
NonLocalValue,
Encode, Encode,
Decode, Decode,
)] )]
......
...@@ -3,7 +3,7 @@ use std::collections::BTreeSet; ...@@ -3,7 +3,7 @@ use std::collections::BTreeSet;
use anyhow::{Result, bail}; use anyhow::{Result, bail};
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ResolvedVc, TaskInput, Vc, trace::TraceRawVcs}; use turbo_tasks::{ResolvedVc, Vc, trace::TraceRawVcs};
use turbo_tasks_fs::FileSystemPath; use turbo_tasks_fs::FileSystemPath;
use turbopack::{ use turbopack::{
module_options::{ module_options::{
...@@ -78,8 +78,8 @@ use crate::{ ...@@ -78,8 +78,8 @@ use crate::{
}, },
}; };
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared, task_input)]
#[derive(Debug, Clone, Hash, TaskInput)] #[derive(Debug, Clone, Hash)]
pub enum ServerContextType { pub enum ServerContextType {
Pages { Pages {
pages_dir: FileSystemPath, pages_dir: FileSystemPath,
...@@ -1002,7 +1002,8 @@ fn client_disallowed_directive_transform_plugin(error_proxy_module: RcStr) -> Vc ...@@ -1002,7 +1002,8 @@ fn client_disallowed_directive_transform_plugin(error_proxy_module: RcStr) -> Vc
)) as Box<dyn CustomTransformer + Send + Sync>) )) as Box<dyn CustomTransformer + Send + Sync>)
} }
#[derive(Clone, Debug, PartialEq, Eq, Hash, TaskInput, TraceRawVcs, Encode, Decode)] #[turbo_tasks::task_input(contains_unresolved_vcs)]
#[derive(Clone, Debug, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
pub struct ServerChunkingContextOptions { pub struct ServerChunkingContextOptions {
pub mode: Vc<NextMode>, pub mode: Vc<NextMode>,
pub root_path: FileSystemPath, pub root_path: FileSystemPath,
......
...@@ -6,7 +6,7 @@ use next_custom_transforms::transforms::strip_page_exports::{ ...@@ -6,7 +6,7 @@ use next_custom_transforms::transforms::strip_page_exports::{
}; };
use swc_core::ecma::ast::Program; use swc_core::ecma::ast::Program;
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{ResolvedVc, TaskInput, Vc, trace::TraceRawVcs}; use turbo_tasks::{ResolvedVc, Vc, trace::TraceRawVcs};
use turbo_tasks_fs::FileSystemPath; use turbo_tasks_fs::FileSystemPath;
use turbopack::module_options::{ModuleRule, ModuleRuleEffect, RuleCondition}; use turbopack::module_options::{ModuleRule, ModuleRuleEffect, RuleCondition};
use turbopack_ecmascript::{ use turbopack_ecmascript::{
...@@ -16,7 +16,8 @@ use turbopack_ecmascript::{ ...@@ -16,7 +16,8 @@ use turbopack_ecmascript::{
use super::module_rule_match_js_no_url; use super::module_rule_match_js_no_url;
/// A [`TaskInput`]-compatible mirror of [`ExportFilter`]. /// A [`TaskInput`]-compatible mirror of [`ExportFilter`].
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TaskInput, TraceRawVcs, Encode, Decode)] #[turbo_tasks::task_input]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
enum ExportFilterInput { enum ExportFilterInput {
StripDataExports, StripDataExports,
StripDefaultExport, StripDefaultExport,
......
...@@ -6,7 +6,7 @@ use next_custom_transforms::transforms::server_actions::{ ...@@ -6,7 +6,7 @@ use next_custom_transforms::transforms::server_actions::{
}; };
use swc_core::{common::FileName, ecma::ast::Program}; use swc_core::{common::FileName, ecma::ast::Program};
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{ResolvedVc, TaskInput, Vc, trace::TraceRawVcs}; use turbo_tasks::{ResolvedVc, Vc, trace::TraceRawVcs};
use turbopack::module_options::{ModuleRule, ModuleRuleEffect}; use turbopack::module_options::{ModuleRule, ModuleRuleEffect};
use turbopack_ecmascript::{ use turbopack_ecmascript::{
CustomTransformer, EcmascriptInputTransform, TransformContext, TransformPlugin, CustomTransformer, EcmascriptInputTransform, TransformContext, TransformPlugin,
...@@ -15,7 +15,8 @@ use turbopack_ecmascript::{ ...@@ -15,7 +15,8 @@ use turbopack_ecmascript::{
use super::module_rule_match_js_no_url; use super::module_rule_match_js_no_url;
use crate::{mode::NextMode, next_config::CacheKinds}; use crate::{mode::NextMode, next_config::CacheKinds};
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TaskInput, TraceRawVcs, Encode, Decode)] #[turbo_tasks::task_input]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
pub enum ActionsTransform { pub enum ActionsTransform {
/// Browser and SSR /// Browser and SSR
Client, Client,
......
...@@ -26,7 +26,7 @@ impl std::hash::Hash for JsonValue { ...@@ -26,7 +26,7 @@ impl std::hash::Hash for JsonValue {
} }
// Manual impl because `serde_json::Value` doesn't implement `TaskInput`, but `JsonValue` can // Manual impl because `serde_json::Value` doesn't implement `TaskInput`, but `JsonValue` can
// never contain any `Vc` types, so `is_transient` is always `false`. // never contain any `Vc` types.
impl turbo_tasks::TaskInput for JsonValue { impl turbo_tasks::TaskInput for JsonValue {
fn is_transient(&self) -> bool { fn is_transient(&self) -> bool {
false false
......
...@@ -5,7 +5,7 @@ use async_trait::async_trait; ...@@ -5,7 +5,7 @@ use async_trait::async_trait;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use serde::Deserialize; use serde::Deserialize;
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{NonLocalValue, OperationValue, ResolvedVc, TaskInput, Vc, trace::TraceRawVcs}; use turbo_tasks::{OperationValue, ResolvedVc, Vc, trace::TraceRawVcs};
use turbo_tasks_fs::FileSystemPath; use turbo_tasks_fs::FileSystemPath;
use turbopack::module_options::{ use turbopack::module_options::{
WebpackLoaderBuiltinConditionSet, WebpackLoaderBuiltinConditionSetMatch, WebpackLoadersOptions, WebpackLoaderBuiltinConditionSet, WebpackLoaderBuiltinConditionSetMatch, WebpackLoadersOptions,
...@@ -33,6 +33,7 @@ pub(crate) mod sass; ...@@ -33,6 +33,7 @@ pub(crate) mod sass;
// //
// Note: Sets of conditions could be stored more efficiently as a bitset, but it's probably not used // Note: Sets of conditions could be stored more efficiently as a bitset, but it's probably not used
// in enough places for it to matter. // in enough places for it to matter.
#[turbo_tasks::task_input]
#[derive( #[derive(
Copy, Copy,
Clone, Clone,
...@@ -43,9 +44,7 @@ pub(crate) mod sass; ...@@ -43,9 +44,7 @@ pub(crate) mod sass;
Ord, Ord,
Hash, Hash,
Deserialize, Deserialize,
TaskInput,
TraceRawVcs, TraceRawVcs,
NonLocalValue,
OperationValue, OperationValue,
Encode, Encode,
Decode, Decode,
......
...@@ -18,7 +18,7 @@ use swc_core::{ ...@@ -18,7 +18,7 @@ use swc_core::{
}; };
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
NonLocalValue, ResolvedVc, TaskInput, TryJoinIterExt, ValueDefault, Vc, trace::TraceRawVcs, NonLocalValue, ResolvedVc, TryJoinIterExt, ValueDefault, Vc, trace::TraceRawVcs,
util::WrapFuture, util::WrapFuture,
}; };
use turbo_tasks_fs::FileSystemPath; use turbo_tasks_fs::FileSystemPath;
...@@ -288,9 +288,8 @@ impl Issue for NextSegmentConfigParsingIssue { ...@@ -288,9 +288,8 @@ impl Issue for NextSegmentConfigParsingIssue {
} }
} }
#[derive( #[turbo_tasks::task_input]
Debug, Clone, Copy, PartialEq, Eq, Hash, TaskInput, NonLocalValue, TraceRawVcs, Encode, Decode, #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
)]
pub enum ParseSegmentMode { pub enum ParseSegmentMode {
Base, Base,
// Disallows "use client + generateStatic" and ignores/warns about `export const config` // Disallows "use client + generateStatic" and ignores/warns about `export const config`
......
...@@ -5,9 +5,7 @@ use bincode::{Decode, Encode}; ...@@ -5,9 +5,7 @@ use bincode::{Decode, Encode};
use next_taskless::{expand_next_js_template, expand_next_js_template_no_imports}; use next_taskless::{expand_next_js_template, expand_next_js_template_no_imports};
use serde::{Deserialize, de::DeserializeOwned}; use serde::{Deserialize, de::DeserializeOwned};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{FxIndexMap, NonLocalValue, Vc, fxindexset, trace::TraceRawVcs, turbobail};
FxIndexMap, NonLocalValue, TaskInput, Vc, fxindexset, trace::TraceRawVcs, turbobail,
};
use turbo_tasks_fs::{File, FileContent, FileJsonContent, FileSystem, FileSystemPath, rope::Rope}; use turbo_tasks_fs::{File, FileContent, FileJsonContent, FileSystem, FileSystemPath, rope::Rope};
use turbopack::module_options::RuleCondition; use turbopack::module_options::RuleCondition;
use turbopack_core::{ use turbopack_core::{
...@@ -205,7 +203,8 @@ pub fn free_var_references_with_vercel_system_env_warnings( ...@@ -205,7 +203,8 @@ pub fn free_var_references_with_vercel_system_env_warnings(
FreeVarReferences(entries) FreeVarReferences(entries)
} }
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TaskInput, TraceRawVcs, Encode, Decode)] #[turbo_tasks::task_input]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
pub enum PathType { pub enum PathType {
PagesPage, PagesPage,
PagesApi, PagesApi,
...@@ -327,6 +326,7 @@ pub fn pages_function_name(page: impl Display) -> String { ...@@ -327,6 +326,7 @@ pub fn pages_function_name(page: impl Display) -> String {
format!("pages{page}") format!("pages{page}")
} }
#[turbo_tasks::task_input]
#[derive( #[derive(
Default, Default,
PartialEq, PartialEq,
...@@ -339,8 +339,6 @@ pub fn pages_function_name(page: impl Display) -> String { ...@@ -339,8 +339,6 @@ pub fn pages_function_name(page: impl Display) -> String {
Hash, Hash,
PartialOrd, PartialOrd,
Ord, Ord,
TaskInput,
NonLocalValue,
Encode, Encode,
Decode, Decode,
)] )]
......
...@@ -47,9 +47,9 @@ use tracing::Instrument; ...@@ -47,9 +47,9 @@ use tracing::Instrument;
use tracing_subscriber::{Registry, layer::SubscriberExt, util::SubscriberInitExt}; use tracing_subscriber::{Registry, layer::SubscriberExt, util::SubscriberInitExt};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
Effects, FxIndexSet, NonLocalValue, OperationValue, OperationVc, PrettyPrintError, ReadRef, Effects, FxIndexSet, OperationValue, OperationVc, PrettyPrintError, ReadRef, ResolvedVc,
ResolvedVc, TaskInput, TransientInstance, TryJoinIterExt, TurboTasksApi, TurboTasksCallApi, TransientInstance, TryJoinIterExt, TurboTasksApi, TurboTasksCallApi, UpdateInfo, Vc,
UpdateInfo, Vc, mark_top_level_task, mark_top_level_task,
message_queue::{CompilationEvent, Severity}, message_queue::{CompilationEvent, Severity},
take_effects, take_effects,
trace::TraceRawVcs, trace::TraceRawVcs,
...@@ -1041,20 +1041,8 @@ pub struct NapiDebugBuildPaths { ...@@ -1041,20 +1041,8 @@ pub struct NapiDebugBuildPaths {
pub pages: Vec<RcStr>, pub pages: Vec<RcStr>,
} }
#[derive( #[turbo_tasks::task_input]
Clone, #[derive(Clone, Copy, Debug, Eq, Hash, OperationValue, PartialEq, TraceRawVcs, Encode, Decode)]
Copy,
Debug,
Eq,
Hash,
NonLocalValue,
OperationValue,
PartialEq,
TaskInput,
TraceRawVcs,
Encode,
Decode,
)]
enum EntrypointsWritePhase { enum EntrypointsWritePhase {
All, All,
NonDeferred, NonDeferred,
...@@ -2181,19 +2169,8 @@ pub fn project_compilation_events_subscribe( ...@@ -2181,19 +2169,8 @@ pub fn project_compilation_events_subscribe(
} }
#[napi(object)] #[napi(object)]
#[derive( #[turbo_tasks::task_input]
Clone, #[derive(Clone, Debug, Eq, Hash, OperationValue, PartialEq, TraceRawVcs, Encode, Decode)]
Debug,
Eq,
Hash,
NonLocalValue,
OperationValue,
PartialEq,
TaskInput,
TraceRawVcs,
Encode,
Decode,
)]
pub struct StackFrame { pub struct StackFrame {
pub is_server: bool, pub is_server: bool,
pub is_ignored: Option<bool>, pub is_ignored: Option<bool>,
......
...@@ -3,22 +3,11 @@ use std::sync::{Arc, LazyLock}; ...@@ -3,22 +3,11 @@ use std::sync::{Arc, LazyLock};
use anyhow::Result; use anyhow::Result;
use arbitrary::Arbitrary; use arbitrary::Arbitrary;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_tasks::{self, NonLocalValue, State, TaskInput, TurboTasks, Vc, trace::TraceRawVcs}; use turbo_tasks::{self, State, TurboTasks, Vc, trace::TraceRawVcs};
use turbo_tasks_malloc::TurboMalloc; use turbo_tasks_malloc::TurboMalloc;
#[derive( #[turbo_tasks::task_input]
Arbitrary, #[derive(Arbitrary, Clone, Debug, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
Clone,
Debug,
PartialEq,
Eq,
Hash,
NonLocalValue,
TraceRawVcs,
TaskInput,
Encode,
Decode,
)]
pub struct TaskReferenceSpec { pub struct TaskReferenceSpec {
task: u16, task: u16,
chain: u8, chain: u8,
...@@ -26,19 +15,8 @@ pub struct TaskReferenceSpec { ...@@ -26,19 +15,8 @@ pub struct TaskReferenceSpec {
read_strongly_consistent: bool, read_strongly_consistent: bool,
} }
#[derive( #[turbo_tasks::task_input]
Arbitrary, #[derive(Arbitrary, Clone, Debug, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
Clone,
Debug,
PartialEq,
Eq,
Hash,
NonLocalValue,
TraceRawVcs,
TaskInput,
Encode,
Decode,
)]
pub struct TaskSpec { pub struct TaskSpec {
references: Vec<TaskReferenceSpec>, references: Vec<TaskReferenceSpec>,
children: u8, children: u8,
......
...@@ -29,8 +29,8 @@ use tokio::time::{Duration, Instant}; ...@@ -29,8 +29,8 @@ use tokio::time::{Duration, Instant};
use tracing::{Span, trace_span}; use tracing::{Span, trace_span};
use turbo_bincode::{TurboBincodeBuffer, new_turbo_bincode_decoder, new_turbo_bincode_encoder}; use turbo_bincode::{TurboBincodeBuffer, new_turbo_bincode_decoder, new_turbo_bincode_encoder};
use turbo_tasks::{ use turbo_tasks::{
CellId, RawVc, ReadCellOptions, ReadCellTracking, ReadConsistency, ReadOutputOptions, CellId, DynTaskInputsStorage, RawVc, ReadCellOptions, ReadCellTracking, ReadConsistency,
ReadTracking, SharedReference, StackDynTaskInputs, TRANSIENT_TASK_BIT, TaskExecutionReason, ReadOutputOptions, ReadTracking, SharedReference, TRANSIENT_TASK_BIT, TaskExecutionReason,
TaskId, TaskPersistence, TaskPriority, TraitTypeId, TurboTasks, TurboTasksCallApi, TaskId, TaskPersistence, TaskPriority, TraitTypeId, TurboTasks, TurboTasksCallApi,
TurboTasksPanic, ValueTypeId, TurboTasksPanic, ValueTypeId,
backend::{ backend::{
...@@ -1463,7 +1463,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> { ...@@ -1463,7 +1463,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
&self, &self,
native_fn: &'static NativeFunction, native_fn: &'static NativeFunction,
this: Option<RawVc>, this: Option<RawVc>,
arg: &mut dyn StackDynTaskInputs, arg: &mut dyn DynTaskInputsStorage,
parent_task: Option<TaskId>, parent_task: Option<TaskId>,
persistence: TaskPersistence, persistence: TaskPersistence,
turbo_tasks: &TurboTasks<TurboTasksBackend<B>>, turbo_tasks: &TurboTasks<TurboTasksBackend<B>>,
...@@ -3463,7 +3463,7 @@ impl<B: BackingStorage> Backend for TurboTasksBackend<B> { ...@@ -3463,7 +3463,7 @@ impl<B: BackingStorage> Backend for TurboTasksBackend<B> {
&self, &self,
native_fn: &'static NativeFunction, native_fn: &'static NativeFunction,
this: Option<RawVc>, this: Option<RawVc>,
arg: &mut dyn StackDynTaskInputs, arg: &mut dyn DynTaskInputsStorage,
parent_task: Option<TaskId>, parent_task: Option<TaskId>,
persistence: TaskPersistence, persistence: TaskPersistence,
turbo_tasks: &TurboTasks<Self>, turbo_tasks: &TurboTasks<Self>,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
use anyhow::{Result, bail}; use anyhow::{Result, bail};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ResolvedVc, TaskInput, ValueToString, Vc}; use turbo_tasks::{ResolvedVc, ValueToString, Vc};
use turbo_tasks_testing::{Registration, register, run_once}; use turbo_tasks_testing::{Registration, register, run_once};
static REGISTRATION: Registration = register!(); static REGISTRATION: Registration = register!();
...@@ -80,8 +80,8 @@ async fn test_all_in_one_operation(nonce: u32) -> Result<Vc<()>> { ...@@ -80,8 +80,8 @@ async fn test_all_in_one_operation(nonce: u32) -> Result<Vc<()>> {
#[derive(Debug, Clone, Hash)] #[derive(Debug, Clone, Hash)]
struct MyTransparentValue(u32); struct MyTransparentValue(u32);
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared, task_input)]
#[derive(Debug, Clone, Hash, TaskInput)] #[derive(Debug, Clone, Hash)]
enum MyEnumValue { enum MyEnumValue {
Yeah(u32), Yeah(u32),
Nah, Nah,
......
...@@ -6,14 +6,13 @@ use std::sync::Arc; ...@@ -6,14 +6,13 @@ use std::sync::Arc;
use anyhow::Result; use anyhow::Result;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_tasks::{NonLocalValue, State, TaskInput, Vc, trace::TraceRawVcs}; use turbo_tasks::{State, Vc, trace::TraceRawVcs};
use turbo_tasks_testing::{Registration, register, run_once}; use turbo_tasks_testing::{Registration, register, run_once};
static REGISTRATION: Registration = register!(); static REGISTRATION: Registration = register!();
#[derive( #[turbo_tasks::task_input]
Clone, Debug, PartialEq, Eq, Hash, NonLocalValue, TraceRawVcs, TaskInput, Encode, Decode, #[derive(Clone, Debug, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
)]
pub struct TaskReferenceSpec { pub struct TaskReferenceSpec {
task: u16, task: u16,
chain: u8, chain: u8,
...@@ -21,9 +20,8 @@ pub struct TaskReferenceSpec { ...@@ -21,9 +20,8 @@ pub struct TaskReferenceSpec {
read_strongly_consistent: bool, read_strongly_consistent: bool,
} }
#[derive( #[turbo_tasks::task_input]
Clone, Debug, PartialEq, Eq, Hash, NonLocalValue, TraceRawVcs, TaskInput, Encode, Decode, #[derive(Clone, Debug, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
)]
pub struct TaskSpec { pub struct TaskSpec {
references: Vec<TaskReferenceSpec>, references: Vec<TaskReferenceSpec>,
children: u8, children: u8,
......
...@@ -10,7 +10,7 @@ use bincode::{ ...@@ -10,7 +10,7 @@ use bincode::{
}; };
use regex::bytes::{Regex, RegexBuilder}; use regex::bytes::{Regex, RegexBuilder};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{TaskInput, Vc, trace::TraceRawVcs}; use turbo_tasks::{Vc, trace::TraceRawVcs};
use crate::globset::parse; use crate::globset::parse;
...@@ -70,10 +70,8 @@ impl<Context> Decode<Context> for Glob { ...@@ -70,10 +70,8 @@ impl<Context> Decode<Context> for Glob {
impl_borrow_decode!(Glob); impl_borrow_decode!(Glob);
#[derive( #[turbo_tasks::task_input]
Copy, Clone, PartialEq, Eq, Hash, Default, TaskInput, TraceRawVcs, Debug, Encode, Decode, #[derive(Copy, Clone, PartialEq, Eq, Hash, Default, TraceRawVcs, Debug, Encode, Decode)]
)]
pub struct GlobOptions { pub struct GlobOptions {
/// Whether the glob is a partial match. /// Whether the glob is a partial match.
/// Allows glob to match any part of the given string(s). /// Allows glob to match any part of the given string(s).
......
...@@ -63,8 +63,8 @@ use tracing::Instrument; ...@@ -63,8 +63,8 @@ use tracing::Instrument;
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
Completion, Effect, EffectStateStorage, InvalidationReason, NonLocalValue, ReadRef, ResolvedVc, Completion, Effect, EffectStateStorage, InvalidationReason, NonLocalValue, ReadRef, ResolvedVc,
TaskInput, TurboTasksApi, ValueToString, ValueToStringRef, Vc, debug::ValueDebugFormat, TurboTasksApi, ValueToString, ValueToStringRef, Vc, debug::ValueDebugFormat, emit_effect,
emit_effect, parallel, spawn, trace::TraceRawVcs, turbo_tasks_weak, turbobail, turbofmt, parallel, spawn, trace::TraceRawVcs, turbo_tasks_weak, turbobail, turbofmt,
}; };
use turbo_tasks_hash::{ use turbo_tasks_hash::{
DeterministicHash, DeterministicHasher, HashAlgorithm, deterministic_hash, hash_xxh3_hash64, DeterministicHash, DeterministicHasher, HashAlgorithm, deterministic_hash, hash_xxh3_hash64,
...@@ -1432,8 +1432,8 @@ fn remove_symbolic_link_dir_helper(path: &Path) -> io::Result<()> { ...@@ -1432,8 +1432,8 @@ fn remove_symbolic_link_dir_helper(path: &Path) -> io::Result<()> {
} }
} }
#[derive(Debug, Clone, Hash, TaskInput)] #[derive(Debug, Clone, Hash)]
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared, task_input)]
pub struct FileSystemPath { pub struct FileSystemPath {
pub fs: ResolvedVc<Box<dyn FileSystem>>, pub fs: ResolvedVc<Box<dyn FileSystem>>,
pub path: RcStr, pub path: RcStr,
......
//! Tests for the `#[derive(TaskInput)]` macro are in `turbo_tasks` itself. //! Tests for the `#[turbo_tasks::task_input(contains_unresolved_vcs)]` macro are in `turbo_tasks`
//! However, we keep one test here as an integration test between the derive //! itself. However, we keep one test here as an integration test between the derive
//! macro and the `#[turbo_tasks::function]` macro. //! macro and the `#[turbo_tasks::function]` macro.
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this #![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use anyhow::Result; use anyhow::Result;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_tasks::{Completion, ReadRef, TaskInput, Vc, trace::TraceRawVcs}; use turbo_tasks::{Completion, ReadRef, Vc, trace::TraceRawVcs};
use turbo_tasks_testing::{Registration, register, run_once}; use turbo_tasks_testing::{Registration, register, run_once};
static REGISTRATION: Registration = register!(); static REGISTRATION: Registration = register!();
#[derive(Clone, TaskInput, Debug, PartialEq, Eq, Hash, Encode, Decode, TraceRawVcs)] #[turbo_tasks::task_input]
#[derive(Clone, Debug, PartialEq, Eq, Hash, Encode, Decode, TraceRawVcs)]
struct OneUnnamedField(u32); struct OneUnnamedField(u32);
#[turbo_tasks::function] #[turbo_tasks::function]
......
...@@ -13,7 +13,13 @@ pub fn derive_deterministic_hash(input: TokenStream) -> TokenStream { ...@@ -13,7 +13,13 @@ pub fn derive_deterministic_hash(input: TokenStream) -> TokenStream {
let derive_input = parse_macro_input!(input as DeriveInput); let derive_input = parse_macro_input!(input as DeriveInput);
let ident = &derive_input.ident; let ident = &derive_input.ident;
let match_hash = match_expansion(&derive_input, &hash_named, &hash_unnamed, &hash_unit); let match_hash = match_expansion(
ident,
&derive_input.data,
&hash_named,
&hash_unnamed,
&hash_unit,
);
let discriminant = match derive_input.data { let discriminant = match derive_input.data {
Data::Enum(_) => { Data::Enum(_) => {
quote! { quote! {
......
mod deterministic_hash_macro; mod deterministic_hash_macro;
mod non_local_value_macro; pub(crate) mod non_local_value_macro;
mod operation_value_macro; mod operation_value_macro;
mod task_input_macro;
mod task_storage_macro; mod task_storage_macro;
mod trace_raw_vcs_macro; pub(crate) mod trace_raw_vcs_macro;
mod value_debug_format_macro; mod value_debug_format_macro;
mod value_debug_macro; mod value_debug_macro;
pub(crate) mod value_to_string_macro; pub(crate) mod value_to_string_macro;
...@@ -12,7 +11,6 @@ pub use deterministic_hash_macro::derive_deterministic_hash; ...@@ -12,7 +11,6 @@ pub use deterministic_hash_macro::derive_deterministic_hash;
pub use non_local_value_macro::derive_non_local_value; pub use non_local_value_macro::derive_non_local_value;
pub use operation_value_macro::derive_operation_value; pub use operation_value_macro::derive_operation_value;
use syn::{Attribute, Meta, Token, punctuated::Punctuated, spanned::Spanned}; use syn::{Attribute, Meta, Token, punctuated::Punctuated, spanned::Spanned};
pub use task_input_macro::derive_task_input;
pub use task_storage_macro::task_storage; pub use task_storage_macro::task_storage;
pub use trace_raw_vcs_macro::derive_trace_raw_vcs; pub use trace_raw_vcs_macro::derive_trace_raw_vcs;
pub use value_debug_format_macro::derive_value_debug_format; pub use value_debug_format_macro::derive_value_debug_format;
......
use proc_macro::TokenStream; use proc_macro::TokenStream;
use proc_macro2::TokenStream as TokenStream2;
use quote::quote; use quote::quote;
use syn::{DeriveInput, parse_macro_input, parse_quote}; use syn::{Data, DeriveInput, Generics, Ident, parse_macro_input, parse_quote};
use crate::{assert_fields::assert_fields_impl_trait, derive::trace_raw_vcs_macro::filter_field}; use crate::{assert_fields::assert_fields_impl_trait, derive::trace_raw_vcs_macro::filter_field};
pub fn derive_non_local_value(input: TokenStream) -> TokenStream { /// Emits `unsafe impl NonLocalValue for #ident` plus the field assertions that fail compilation
let derive_input = parse_macro_input!(input as DeriveInput); /// (pointing at the offending field) if any field is not a `NonLocalValue`.
let ident = &derive_input.ident; ///
/// Shared by `#[derive(NonLocalValue)]` and the `#[turbo_tasks::task_input]` attribute macro.
/// When `add_bounds` is set, a `T: NonLocalValue` predicate is appended for each generic type
/// parameter — the attribute macro needs this so a `struct GenericField<T>(T)` both gets a sound
/// `unsafe impl` and passes the field assertion (the assertion struct must see the per-generic
/// bound). The derive macro relies on the type's existing `where` clause instead and passes
/// `false`.
pub fn non_local_value_impl(
ident: &Ident,
generics: &Generics,
data: &Data,
add_bounds: bool,
) -> TokenStream2 {
let mut generics = generics.clone();
if add_bounds {
let type_params: Vec<_> = generics.type_params().map(|p| p.ident.clone()).collect();
let where_clause = generics.make_where_clause();
for param in type_params {
where_clause
.predicates
.push(parse_quote!(#param: turbo_tasks::NonLocalValue));
}
}
let assertions = assert_fields_impl_trait( let assertions = assert_fields_impl_trait(
&parse_quote!(turbo_tasks::NonLocalValue), &parse_quote!(turbo_tasks::NonLocalValue),
&derive_input.generics, &generics,
&derive_input.data, data,
filter_field, filter_field,
); );
let (impl_generics, ty_generics, where_clause) = derive_input.generics.split_for_impl(); let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
quote! { quote! {
#[automatically_derived] #[automatically_derived]
unsafe impl #impl_generics turbo_tasks::NonLocalValue unsafe impl #impl_generics turbo_tasks::NonLocalValue
for #ident #ty_generics #where_clause {} for #ident #ty_generics #where_clause {}
#assertions #assertions
} }
}
pub fn derive_non_local_value(input: TokenStream) -> TokenStream {
let derive_input = parse_macro_input!(input as DeriveInput);
non_local_value_impl(
&derive_input.ident,
&derive_input.generics,
&derive_input.data,
/* add_bounds */ false,
)
.into() .into()
} }
use proc_macro::TokenStream;
use quote::quote;
use syn::{DeriveInput, parse_macro_input, spanned::Spanned};
use crate::expand::{generate_exhaustive_destructuring, match_expansion};
pub fn derive_task_input(input: TokenStream) -> TokenStream {
let derive_input = parse_macro_input!(input as DeriveInput);
let ident = &derive_input.ident;
let generics = &derive_input.generics;
if let Some(where_clause) = &generics.where_clause {
// NOTE(alexkirsz) We could support where clauses and generic parameters bounds
// in the future, but for simplicity's sake, we don't support them yet.
where_clause
.span()
.unwrap()
.error("the TaskInput derive macro does not support where clauses yet")
.emit();
}
for param in &generics.params {
match param {
syn::GenericParam::Type(param) => {
if !param.bounds.is_empty() {
// NOTE(alexkirsz) See where clause above.
param
.span()
.unwrap()
.error(
"the TaskInput derive macro does not support generic parameters \
bounds yet",
)
.emit();
}
}
syn::GenericParam::Lifetime(param) => {
param
.span()
.unwrap()
.error("the TaskInput derive macro does not support generic lifetimes")
.emit();
}
syn::GenericParam::Const(param) => {
// NOTE(alexkirsz) Ditto: not supported yet for simplicity's sake.
param
.span()
.unwrap()
.error("the TaskInput derive macro does not support const generics yet")
.emit();
}
}
}
let is_resolved_impl = match_expansion(
&derive_input,
&|_ident, fields| {
let (capture, fields) = generate_exhaustive_destructuring(fields.named.iter());
(
capture,
quote! {
{#(
turbo_tasks::TaskInput::is_resolved(#fields) &&
)* true}
},
)
},
&|_ident, fields| {
let (capture, fields) = generate_exhaustive_destructuring(fields.unnamed.iter());
(
capture,
quote! {
{#(
turbo_tasks::TaskInput::is_resolved(#fields) &&
)* true}
},
)
},
&|_ident| quote! {true},
);
let is_transient_impl = match_expansion(
&derive_input,
&|_ident, fields| {
let (capture, fields) = generate_exhaustive_destructuring(fields.named.iter());
(
capture,
quote! {
{#(
turbo_tasks::TaskInput::is_transient(#fields) ||
)* false}
},
)
},
&|_ident, fields| {
let (capture, fields) = generate_exhaustive_destructuring(fields.unnamed.iter());
(
capture,
quote! {
{#(
turbo_tasks::TaskInput::is_transient(#fields) ||
)* false}
},
)
},
&|_ident| quote! {false},
);
let resolve_impl = match_expansion(
&derive_input,
&|ident, fields| {
let (capture, fields) = generate_exhaustive_destructuring(fields.named.iter());
(
capture,
quote! {
{
#(
let #fields = turbo_tasks::TaskInput::resolve_input(#fields).await?;
)*
Ok(#ident { #(#fields),* })
}
},
)
},
&|ident, fields| {
let (capture, fields) = generate_exhaustive_destructuring(fields.unnamed.iter());
(
capture,
quote! {
{
#(
let #fields = turbo_tasks::TaskInput::resolve_input(#fields).await?;
)*
Ok(#ident(#(#fields),*))
}
},
)
},
&|ident| quote! {Ok(#ident)},
);
let generic_params: Vec<_> = generics
.params
.iter()
.filter_map(|param| match param {
syn::GenericParam::Type(param) => Some(param),
_ => {
// We already report an error for this above.
None
}
})
.collect();
quote! {
#[automatically_derived]
#[turbo_tasks::macro_helpers::async_trait]
impl #generics turbo_tasks::TaskInput for #ident #generics
where
#(#generic_params: turbo_tasks::TaskInput,)*
{
#[allow(non_snake_case)]
#[allow(unreachable_code)] // This can occur for enums with no variants.
fn is_resolved(&self) -> bool {
#is_resolved_impl
}
#[allow(non_snake_case)]
#[allow(unreachable_code)] // This can occur for enums with no variants.
fn is_transient(&self) -> bool {
#is_transient_impl
}
#[allow(non_snake_case)]
#[allow(unreachable_code)] // This can occur for enums with no variants.
#[allow(clippy::manual_async_fn)] // some impls need the manual return type to work :(
fn resolve_input(
&self,
) -> impl
::std::future::Future<Output = turbo_tasks::Result<Self>> +
::std::marker::Send +
'_
{
async move {
#resolve_impl
}
}
}
}
.into()
}
...@@ -21,7 +21,13 @@ pub fn derive_trace_raw_vcs(input: TokenStream) -> TokenStream { ...@@ -21,7 +21,13 @@ pub fn derive_trace_raw_vcs(input: TokenStream) -> TokenStream {
} }
let (impl_generics, ty_generics, where_clause) = derive_input.generics.split_for_impl(); let (impl_generics, ty_generics, where_clause) = derive_input.generics.split_for_impl();
let trace_items = match_expansion(&derive_input, &trace_named, &trace_unnamed, &trace_unit); let trace_items = match_expansion(
ident,
&derive_input.data,
&trace_named,
&trace_unnamed,
&trace_unit,
);
quote! { quote! {
#[automatically_derived] #[automatically_derived]
impl #impl_generics turbo_tasks::trace::TraceRawVcs for #ident #ty_generics #where_clause { impl #impl_generics turbo_tasks::trace::TraceRawVcs for #ident #ty_generics #where_clause {
......
...@@ -40,8 +40,13 @@ pub fn derive_value_debug_format(input: TokenStream) -> TokenStream { ...@@ -40,8 +40,13 @@ pub fn derive_value_debug_format(input: TokenStream) -> TokenStream {
} }
let (impl_generics_debug, _, where_clause_debug) = derive_input.generics.split_for_impl(); let (impl_generics_debug, _, where_clause_debug) = derive_input.generics.split_for_impl();
let formatting_logic = let formatting_logic = match_expansion(
match_expansion(&derive_input, &format_named, &format_unnamed, &format_unit); ident,
&derive_input.data,
&format_named,
&format_unnamed,
&format_unit,
);
let debug_impl = quote! { let debug_impl = quote! {
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
......
use proc_macro2::{Ident, TokenStream}; use proc_macro2::{Ident, TokenStream};
use quote::quote; use quote::quote;
use syn::{ use syn::{
Data, DataEnum, DataStruct, DeriveInput, Field, Fields, FieldsNamed, FieldsUnnamed, Data, DataEnum, DataStruct, Field, Fields, FieldsNamed, FieldsUnnamed, Item, ItemEnum,
spanned::Spanned, ItemStruct, spanned::Spanned,
}; };
/// Extract the field shape ([`Data`]) of a struct/enum [`Item`] for use with [`match_expansion`]
/// and the `NonLocalValue` field assertions. Returns `None` for any other item kind.
pub fn item_data(item: &Item) -> Option<Data> {
match item {
Item::Struct(ItemStruct {
fields, semi_token, ..
}) => Some(Data::Struct(DataStruct {
struct_token: Default::default(),
fields: fields.clone(),
semi_token: *semi_token,
})),
Item::Enum(ItemEnum { variants, .. }) => Some(Data::Enum(DataEnum {
enum_token: Default::default(),
brace_token: Default::default(),
variants: variants.clone(),
})),
_ => None,
}
}
/// Emit a field-walking body for `TaskInput::is_transient`: `field1.is_transient() ||
/// field2.is_transient() || ... || false`. Used by both `#[turbo_tasks::task_input]` and
/// `#[turbo_tasks::value(task_input)]` — they emit structurally identical `is_transient` impls,
/// just on a different surrounding `impl TaskInput` block.
pub fn task_input_is_transient_body(ident: &Ident, data: &Data) -> TokenStream {
match_expansion(
ident,
data,
&|_ident, fields| {
let (capture, fields) = generate_exhaustive_destructuring(fields.named.iter());
(
capture,
quote! {
{#(
turbo_tasks::TaskInput::is_transient(#fields) ||
)* false}
},
)
},
&|_ident, fields| {
let (capture, fields) = generate_exhaustive_destructuring(fields.unnamed.iter());
(
capture,
quote! {
{#(
turbo_tasks::TaskInput::is_transient(#fields) ||
)* false}
},
)
},
&|_ident| quote! {false},
)
}
/// Handles the expansion of a struct/enum into a match statement that accesses /// Handles the expansion of a struct/enum into a match statement that accesses
/// every field for procedural code generation. /// every field for procedural code generation.
/// ///
...@@ -23,21 +77,32 @@ pub fn match_expansion< ...@@ -23,21 +77,32 @@ pub fn match_expansion<
EU: Fn(TokenStream, &FieldsUnnamed) -> (TokenStream, TokenStream), EU: Fn(TokenStream, &FieldsUnnamed) -> (TokenStream, TokenStream),
U: Fn(TokenStream) -> TokenStream, U: Fn(TokenStream) -> TokenStream,
>( >(
derive_input: &DeriveInput, ident: &Ident,
data: &Data,
expand_named: &EN, expand_named: &EN,
expand_unnamed: &EU, expand_unnamed: &EU,
expand_unit: &U, expand_unit: &U,
) -> TokenStream { ) -> TokenStream {
let ident = &derive_input.ident;
let expand_unit = move |ident| (TokenStream::new(), expand_unit(ident)); let expand_unit = move |ident| (TokenStream::new(), expand_unit(ident));
match &derive_input.data { match data {
Data::Enum(DataEnum { variants, .. }) => { Data::Enum(DataEnum { variants, .. }) => {
let (idents, (variants_fields_capture, expansion)): (Vec<_>, (Vec<_>, Vec<_>)) = // Forward each variant's `#[cfg(...)]` attributes onto the generated match arm so a
variants // cfg'd-out variant doesn't appear in compiled code.
.iter() let (cfg_attrs, (idents, (variants_fields_capture, expansion))): (
.map(|variant| { Vec<_>,
let variants_idents = &variant.ident; (Vec<_>, (Vec<_>, Vec<_>)),
let ident = quote! { #ident::#variants_idents }; ) = variants
.iter()
.map(|variant| {
let variants_idents = &variant.ident;
let ident = quote! { #ident::#variants_idents };
let cfgs: Vec<_> = variant
.attrs
.iter()
.filter(|a| a.path().is_ident("cfg"))
.collect();
(
quote! { #(#cfgs)* },
( (
ident.clone(), ident.clone(),
expand_fields( expand_fields(
...@@ -47,9 +112,10 @@ pub fn match_expansion< ...@@ -47,9 +112,10 @@ pub fn match_expansion<
expand_unnamed, expand_unnamed,
expand_unit, expand_unit,
), ),
) ),
}) )
.unzip(); })
.unzip();
if idents.is_empty() { if idents.is_empty() {
let (_, expansion) = expand_unit(quote! { #ident }); let (_, expansion) = expand_unit(quote! { #ident });
...@@ -60,6 +126,7 @@ pub fn match_expansion< ...@@ -60,6 +126,7 @@ pub fn match_expansion<
quote! { quote! {
match self { match self {
#( #(
#cfg_attrs
#idents #variants_fields_capture => #expansion, #idents #variants_fields_capture => #expansion,
)* )*
} }
...@@ -92,11 +159,7 @@ pub fn match_expansion< ...@@ -92,11 +159,7 @@ pub fn match_expansion<
} }
} }
_ => { _ => {
derive_input ident.span().unwrap().error("unsupported syntax").emit();
.span()
.unwrap()
.error("unsupported syntax")
.emit();
quote! {} quote! {}
} }
......
...@@ -452,11 +452,11 @@ impl TurboFn<'_> { ...@@ -452,11 +452,11 @@ impl TurboFn<'_> {
let exposed_input_types: Vec<_> = self.exposed_input_types().collect(); let exposed_input_types: Vec<_> = self.exposed_input_types().collect();
return Some(FilterTraitCallArgsTokens { return Some(FilterTraitCallArgsTokens {
filter_owned: quote! { filter_owned: quote! {
|arg: &mut dyn turbo_tasks::StackDynTaskInputs| { |arg: &mut dyn turbo_tasks::DynTaskInputsStorage| {
let (#(#exposed_input_idents,)*) = let (#(#exposed_input_idents,)*) =
turbo_tasks::macro_helpers turbo_tasks::macro_helpers
::downcast_stack_args_owned::<(#(#exposed_input_types,)*)>(arg); ::downcast_stack_args_owned::<(#(#exposed_input_types,)*)>(arg);
turbo_tasks::OwnedStackDynTaskInputs::new( turbo_tasks::HeapDynTaskInputsStorage::new(
::std::boxed::Box::new((#(#inline_input_idents,)*)) ::std::boxed::Box::new((#(#inline_input_idents,)*))
) )
} }
...@@ -558,7 +558,7 @@ impl TurboFn<'_> { ...@@ -558,7 +558,7 @@ impl TurboFn<'_> {
let inputs = (#(#inputs,)*); let inputs = (#(#inputs,)*);
let this = #converted_this; let this = #converted_this;
let persistence = #persistence; let persistence = #persistence;
let mut arg = turbo_tasks::StackDynTaskInputsSlot::new(inputs); let mut arg = turbo_tasks::StackDynTaskInputsStorage::new(inputs);
static TRAIT_METHOD: &'static turbo_tasks::TraitMethod = &#trait_type_ident static TRAIT_METHOD: &'static turbo_tasks::TraitMethod = &#trait_type_ident
.methods[turbo_tasks::macro_helpers::index_of_method_name( .methods[turbo_tasks::macro_helpers::index_of_method_name(
#trait_type_ident.methods, #trait_type_ident.methods,
...@@ -591,7 +591,7 @@ impl TurboFn<'_> { ...@@ -591,7 +591,7 @@ impl TurboFn<'_> {
let this = #converted_this; let this = #converted_this;
let inputs = (#(#inputs,)*); let inputs = (#(#inputs,)*);
let persistence = #persistence; let persistence = #persistence;
let mut arg = turbo_tasks::StackDynTaskInputsSlot::new(inputs); let mut arg = turbo_tasks::StackDynTaskInputsStorage::new(inputs);
<#output as turbo_tasks::task::TaskOutput>::try_from_raw_vc( <#output as turbo_tasks::task::TaskOutput>::try_from_raw_vc(
turbo_tasks::dynamic_call( turbo_tasks::dynamic_call(
&#native_function_ident, &#native_function_ident,
...@@ -609,7 +609,7 @@ impl TurboFn<'_> { ...@@ -609,7 +609,7 @@ impl TurboFn<'_> {
#assertions #assertions
let inputs = (#(#inputs,)*); let inputs = (#(#inputs,)*);
let persistence = #persistence; let persistence = #persistence;
let mut arg = turbo_tasks::StackDynTaskInputsSlot::new(inputs); let mut arg = turbo_tasks::StackDynTaskInputsStorage::new(inputs);
<#output as turbo_tasks::task::TaskOutput>::try_from_raw_vc( <#output as turbo_tasks::task::TaskOutput>::try_from_raw_vc(
turbo_tasks::dynamic_call( turbo_tasks::dynamic_call(
&#native_function_ident, &#native_function_ident,
......
...@@ -8,6 +8,7 @@ mod func; ...@@ -8,6 +8,7 @@ mod func;
mod function_macro; mod function_macro;
mod global_name; mod global_name;
mod primitive_macro; mod primitive_macro;
mod task_input_attr_macro;
mod value_impl_macro; mod value_impl_macro;
mod value_macro; mod value_macro;
mod value_trait_macro; mod value_trait_macro;
...@@ -52,11 +53,6 @@ pub fn derive_deterministic_hash(input: TokenStream) -> TokenStream { ...@@ -52,11 +53,6 @@ pub fn derive_deterministic_hash(input: TokenStream) -> TokenStream {
derive::derive_deterministic_hash(input) derive::derive_deterministic_hash(input)
} }
#[proc_macro_derive(TaskInput, attributes(turbo_tasks))]
pub fn derive_task_input(input: TokenStream) -> TokenStream {
derive::derive_task_input(input)
}
/// Derive macro for `ValueToString`. Also generates `ValueToStringify for &T`. /// Derive macro for `ValueToString`. Also generates `ValueToStringify for &T`.
#[doc = include_str!("../../turbo-tasks/FORMATTING.md")] #[doc = include_str!("../../turbo-tasks/FORMATTING.md")]
#[proc_macro_derive(ValueToString, attributes(value_to_string))] #[proc_macro_derive(ValueToString, attributes(value_to_string))]
...@@ -84,6 +80,11 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream { ...@@ -84,6 +80,11 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream {
value_macro::value(args, input) value_macro::value(args, input)
} }
#[proc_macro_attribute]
pub fn task_input(args: TokenStream, input: TokenStream) -> TokenStream {
task_input_attr_macro::task_input(args, input)
}
/// <!-- /// <!--
/// Documentation for this macro is available on the re-export: /// Documentation for this macro is available on the re-export:
/// <https://turbopack-rust-docs.vercel.sh/rustdoc/turbo_tasks/attr.value_trait.html> /// <https://turbopack-rust-docs.vercel.sh/rustdoc/turbo_tasks/attr.value_trait.html>
......
...@@ -12,7 +12,11 @@ use syn::{ ...@@ -12,7 +12,11 @@ use syn::{
spanned::Spanned, spanned::Spanned,
}; };
use crate::{global_name::global_name_for_type, ident::get_value_type_ident}; use crate::{
expand::{item_data, task_input_is_transient_body},
global_name::global_name_for_type,
ident::get_value_type_ident,
};
enum CellMode { enum CellMode {
KeyedCompare, KeyedCompare,
...@@ -133,6 +137,8 @@ struct ValueArguments { ...@@ -133,6 +137,8 @@ struct ValueArguments {
transparent: bool, transparent: bool,
/// Should we `#[derive(turbo_tasks::OperationValue)]`? /// Should we `#[derive(turbo_tasks::OperationValue)]`?
operation: Option<Span>, operation: Option<Span>,
/// Set by `task_input` arg: emit an `impl TaskInput` with a field-walking `is_transient`.
task_input: bool,
} }
impl Parse for ValueArguments { impl Parse for ValueArguments {
...@@ -146,6 +152,7 @@ impl Parse for ValueArguments { ...@@ -146,6 +152,7 @@ impl Parse for ValueArguments {
manual_hash: false, manual_hash: false,
transparent: false, transparent: false,
operation: None, operation: None,
task_input: false,
}; };
let punctuated = input.parse_terminated(Meta::parse, Token![,])?; let punctuated = input.parse_terminated(Meta::parse, Token![,])?;
for meta in punctuated { for meta in punctuated {
...@@ -234,13 +241,16 @@ impl Parse for ValueArguments { ...@@ -234,13 +241,16 @@ impl Parse for ValueArguments {
("operation", Meta::Path(path)) => { ("operation", Meta::Path(path)) => {
result.operation = Some(path.span()); result.operation = Some(path.span());
} }
("task_input", Meta::Path(_)) => {
result.task_input = true;
}
(_, meta) => { (_, meta) => {
return Err(Error::new_spanned( return Err(Error::new_spanned(
&meta, &meta,
format!( format!(
"unexpected {meta:?}, expected \"shared\", \"into\", \ "unexpected {meta:?}, expected \"shared\", \"into\", \
\"serialization\", \"evict\", \"cell\", \"eq\", \"hash\", \ \"serialization\", \"evict\", \"cell\", \"eq\", \"hash\", \
\"transparent\", or \"operation\"" \"transparent\", \"operation\", or \"task_input\""
), ),
)); ));
} }
...@@ -262,6 +272,7 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream { ...@@ -262,6 +272,7 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream {
manual_hash, manual_hash,
transparent, transparent,
operation, operation,
task_input,
} = parse_macro_input!(args as ValueArguments); } = parse_macro_input!(args as ValueArguments);
// `serialization = "hash"` only makes sense with `cell = "compare"` (the default). // `serialization = "hash"` only makes sense with `cell = "compare"` (the default).
...@@ -309,7 +320,7 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream { ...@@ -309,7 +320,7 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream {
#[derive( #[derive(
turbo_tasks::ShrinkToFit, turbo_tasks::ShrinkToFit,
turbo_tasks::trace::TraceRawVcs, turbo_tasks::trace::TraceRawVcs,
turbo_tasks::NonLocalValue, turbo_tasks::NonLocalValue
)] )]
#[shrink_to_fit(crate = "turbo_tasks::macro_helpers::shrink_to_fit")] #[shrink_to_fit(crate = "turbo_tasks::macro_helpers::shrink_to_fit")]
}]; }];
...@@ -550,6 +561,27 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream { ...@@ -550,6 +561,27 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream {
has_serialization, has_serialization,
); );
// Emit an `impl TaskInput for X` only when opted in with
// `#[turbo_tasks::value(task_input)]`. Because values are `NonLocalValue` the `is_resolved` and
// `resolve_input` use the trivial trait defaults `is_transient` walks fields, because
// contained `ResolvedVc`/`OperationVc` can still point to transient cells.
let task_input_impl = if task_input {
let data = item_data(&item).expect("value macro only accepts struct/enum");
let is_transient_impl = task_input_is_transient_body(ident, &data);
quote! {
#[automatically_derived]
impl turbo_tasks::TaskInput for #ident {
#[allow(non_snake_case)]
#[allow(unreachable_code)]
fn is_transient(&self) -> bool {
#is_transient_impl
}
}
}
} else {
quote! {}
};
let expanded = quote! { let expanded = quote! {
#(#struct_attributes)* #(#struct_attributes)*
#item #item
...@@ -558,6 +590,8 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream { ...@@ -558,6 +590,8 @@ pub fn value(args: TokenStream, input: TokenStream) -> TokenStream {
#cell_struct #cell_struct
} }
#task_input_impl
#value_type_and_register_code #value_type_and_register_code
#value_debug_impl #value_debug_impl
......
...@@ -32,7 +32,7 @@ use crate::{ ...@@ -32,7 +32,7 @@ use crate::{
CellId, RawVc, ReadCellOptions, ReadOutputOptions, ReadRef, SharedReference, TaskId, TaskIdSet, CellId, RawVc, ReadCellOptions, ReadOutputOptions, ReadRef, SharedReference, TaskId, TaskIdSet,
TaskPriority, TraitRef, TraitTypeId, TurboTasksCallApi, TurboTasksPanic, ValueTypeId, TaskPriority, TraitRef, TraitTypeId, TurboTasksCallApi, TurboTasksPanic, ValueTypeId,
ValueTypePersistence, VcValueTrait, VcValueType, ValueTypePersistence, VcValueTrait, VcValueType,
dyn_task_inputs::{DynTaskInputs, StackDynTaskInputs}, dyn_task_inputs::{DynTaskInputs, DynTaskInputsStorage},
event::EventListener, event::EventListener,
macro_helpers::NativeFunction, macro_helpers::NativeFunction,
manager::{TaskPersistence, TurboTasks}, manager::{TaskPersistence, TurboTasks},
...@@ -718,7 +718,7 @@ pub trait Backend: Sized + Sync + Send { ...@@ -718,7 +718,7 @@ pub trait Backend: Sized + Sync + Send {
&self, &self,
native_fn: &'static NativeFunction, native_fn: &'static NativeFunction,
this: Option<RawVc>, this: Option<RawVc>,
arg: &mut dyn StackDynTaskInputs, arg: &mut dyn DynTaskInputsStorage,
parent_task: Option<TaskId>, parent_task: Option<TaskId>,
persistence: TaskPersistence, persistence: TaskPersistence,
turbo_tasks: &TurboTasks<Self>, turbo_tasks: &TurboTasks<Self>,
......
...@@ -42,10 +42,10 @@ pub fn any_as_encode<T: Any>(this: &dyn Any) -> &T { ...@@ -42,10 +42,10 @@ pub fn any_as_encode<T: Any>(this: &dyn Any) -> &T {
/// A trait for task arguments that may reside on the stack. /// A trait for task arguments that may reside on the stack.
/// ///
/// This enables deferred boxing: on the cache-hit path (~85%), we only borrow /// This enables deferred boxing: on the cache-hit path (~85%), we only borrow
/// the argument via [`as_ref`](StackDynTaskInputs::as_ref) for hash/equality lookups, /// the argument via [`as_ref`](DynTaskInputsStorage::as_ref) for hash/equality lookups,
/// avoiding any heap allocation. On cache miss, [`take_box`](StackDynTaskInputs::take_box) /// avoiding any heap allocation. On cache miss, [`take_box`](DynTaskInputsStorage::take_box)
/// moves the value into a `Box` with zero clones. /// moves the value into a `Box` with zero clones.
pub trait StackDynTaskInputs { pub trait DynTaskInputsStorage {
/// Borrow the argument as a type-erased reference (for cache lookup). /// Borrow the argument as a type-erased reference (for cache lookup).
fn as_ref(&self) -> &dyn DynTaskInputs; fn as_ref(&self) -> &dyn DynTaskInputs;
/// Move the argument out into a heap-allocated Box (panics if already taken). /// Move the argument out into a heap-allocated Box (panics if already taken).
...@@ -57,13 +57,13 @@ pub trait StackDynTaskInputs { ...@@ -57,13 +57,13 @@ pub trait StackDynTaskInputs {
/// Stack-resident slot wrapping a concrete typed value. /// Stack-resident slot wrapping a concrete typed value.
/// ///
/// Created by macro-generated callsites. The value starts in `Some` on the /// Created by macro-generated callsites. The value starts in `Some` on the
/// stack; [`take_box`](StackDynTaskInputs::take_box) moves it to the heap on cache miss. /// stack; [`take_box`](DynTaskInputsStorage::take_box) moves it to the heap on cache miss.
#[repr(transparent)] #[repr(transparent)]
pub struct StackDynTaskInputsSlot<T> { pub struct StackDynTaskInputsStorage<T> {
slot: Option<T>, slot: Option<T>,
} }
impl<T> StackDynTaskInputsSlot<T> { impl<T> StackDynTaskInputsStorage<T> {
#[inline] #[inline]
pub fn new(value: T) -> Self { pub fn new(value: T) -> Self {
Self { slot: Some(value) } Self { slot: Some(value) }
...@@ -73,16 +73,16 @@ impl<T> StackDynTaskInputsSlot<T> { ...@@ -73,16 +73,16 @@ impl<T> StackDynTaskInputsSlot<T> {
pub fn take(&mut self) -> T { pub fn take(&mut self) -> T {
self.slot self.slot
.take() .take()
.expect("StackDynTaskInputsSlot::take called after value was already taken") .expect("StackDynTaskInputsStorage::take called after value was already taken")
} }
} }
impl<T: DynTaskInputs> StackDynTaskInputs for StackDynTaskInputsSlot<T> { impl<T: DynTaskInputs> DynTaskInputsStorage for StackDynTaskInputsStorage<T> {
#[inline] #[inline]
fn as_ref(&self) -> &dyn DynTaskInputs { fn as_ref(&self) -> &dyn DynTaskInputs {
self.slot self.slot
.as_ref() .as_ref()
.expect("StackDynTaskInputsSlot::as_ref called after take_box") .expect("StackDynTaskInputsStorage::as_ref called after take_box")
} }
#[inline] #[inline]
...@@ -90,7 +90,7 @@ impl<T: DynTaskInputs> StackDynTaskInputs for StackDynTaskInputsSlot<T> { ...@@ -90,7 +90,7 @@ impl<T: DynTaskInputs> StackDynTaskInputs for StackDynTaskInputsSlot<T> {
Box::new( Box::new(
self.slot self.slot
.take() .take()
.expect("StackDynTaskInputsSlot::take_box called twice"), .expect("StackDynTaskInputsStorage::take_box called twice"),
) )
} }
...@@ -101,31 +101,31 @@ impl<T: DynTaskInputs> StackDynTaskInputs for StackDynTaskInputsSlot<T> { ...@@ -101,31 +101,31 @@ impl<T: DynTaskInputs> StackDynTaskInputs for StackDynTaskInputsSlot<T> {
} }
/// Adapter for an already-boxed value (e.g., from async resolution tasks). /// Adapter for an already-boxed value (e.g., from async resolution tasks).
pub struct OwnedStackDynTaskInputs { pub struct HeapDynTaskInputsStorage {
slot: Option<Box<dyn DynTaskInputs>>, slot: Option<Box<dyn DynTaskInputs>>,
} }
impl OwnedStackDynTaskInputs { impl HeapDynTaskInputsStorage {
#[inline] #[inline]
pub fn new(value: Box<dyn DynTaskInputs>) -> Self { pub fn new(value: Box<dyn DynTaskInputs>) -> Self {
Self { slot: Some(value) } Self { slot: Some(value) }
} }
} }
impl StackDynTaskInputs for OwnedStackDynTaskInputs { impl DynTaskInputsStorage for HeapDynTaskInputsStorage {
#[inline] #[inline]
fn as_ref(&self) -> &dyn DynTaskInputs { fn as_ref(&self) -> &dyn DynTaskInputs {
&**self &**self
.slot .slot
.as_ref() .as_ref()
.expect("OwnedStackDynTaskInputs::as_ref called after take_box") .expect("HeapDynTaskInputsStorage::as_ref called after take_box")
} }
#[inline] #[inline]
fn take_box(&mut self) -> Box<dyn DynTaskInputs> { fn take_box(&mut self) -> Box<dyn DynTaskInputs> {
self.slot self.slot
.take() .take()
.expect("OwnedStackDynTaskInputs::take_box called twice") .expect("HeapDynTaskInputsStorage::take_box called twice")
} }
#[inline] #[inline]
......
...@@ -81,7 +81,7 @@ pub use crate::{ ...@@ -81,7 +81,7 @@ pub use crate::{
completion::{Completion, Completions}, completion::{Completion, Completions},
display::{ValueToString, ValueToStringRef}, display::{ValueToString, ValueToStringRef},
dyn_task_inputs::{ dyn_task_inputs::{
DynTaskInputs, OwnedStackDynTaskInputs, StackDynTaskInputs, StackDynTaskInputsSlot, DynTaskInputs, DynTaskInputsStorage, HeapDynTaskInputsStorage, StackDynTaskInputsStorage,
}, },
effect::{Effect, EffectError, EffectStateStorage, Effects, emit_effect, take_effects}, effect::{Effect, EffectError, EffectStateStorage, Effects, emit_effect, take_effects},
error::PrettyPrintError, error::PrettyPrintError,
...@@ -274,6 +274,31 @@ pub use turbo_tasks_macros::function; ...@@ -274,6 +274,31 @@ pub use turbo_tasks_macros::function;
#[rustfmt::skip] #[rustfmt::skip]
pub use turbo_tasks_macros::value; pub use turbo_tasks_macros::value;
/// Attribute macro for declaring a [`TaskInput`] type. Emits:
///
/// - `unsafe impl NonLocalValue for X {}` (unless `contains_unresolved_vcs` is set).
/// - `impl TaskInput for X` with a field-walking `is_transient`. By default `is_resolved` and
/// `resolve_input` use the trait defaults (`true` and a [`CloneReady`] future — 8 bytes, no
/// async-fn envelope); when `contains_unresolved_vcs` is set, both are emitted as
/// field-walking implementations as well.
///
/// Default form (most types):
///
/// ```ignore
/// #[turbo_tasks::task_input]
/// #[derive(Clone, Debug, Hash, PartialEq, Eq, TraceRawVcs, Encode, Decode)]
/// pub struct MyTaskInput { ... }
/// ```
///
/// Opt out of `NonLocalValue` when the type contains `Vc<T>` fields:
///
/// ```ignore
/// #[turbo_tasks::task_input(contains_unresolved_vcs)]
/// #[derive(Clone, Debug, Hash, PartialEq, Eq, TraceRawVcs, Encode, Decode)]
/// pub struct VcCarrier { vc: Vc<...> }
/// ```
pub use turbo_tasks_macros::task_input;
/// Allows this trait to be used as part of a trait object inside of a value cell, in the form of /// Allows this trait to be used as part of a trait object inside of a value cell, in the form of
/// `Vc<Box<dyn MyTrait>>`. The annotated trait is made into a subtrait of [`VcValueTrait`]. /// `Vc<Box<dyn MyTrait>>`. The annotated trait is made into a subtrait of [`VcValueTrait`].
/// ///
...@@ -396,8 +421,4 @@ pub use turbo_tasks_macros::value_impl; ...@@ -396,8 +421,4 @@ pub use turbo_tasks_macros::value_impl;
#[rustfmt::skip] #[rustfmt::skip]
pub use turbo_tasks_macros::task_storage; pub use turbo_tasks_macros::task_storage;
/// Refer to [the trait documentation][trait@TaskInput] for usage.
#[rustfmt::skip]
pub use turbo_tasks_macros::TaskInput;
pub type TaskIdSet = AutoSet<TaskId, BuildHasherDefault<FxHasher>, 2>; pub type TaskIdSet = AutoSet<TaskId, BuildHasherDefault<FxHasher>, 2>;
...@@ -35,7 +35,7 @@ use crate::{ ...@@ -35,7 +35,7 @@ use crate::{
TurboTasksExecutionError, TypedCellContent, VerificationMode, TurboTasksExecutionError, TypedCellContent, VerificationMode,
}, },
capture_future::CaptureFuture, capture_future::CaptureFuture,
dyn_task_inputs::StackDynTaskInputs, dyn_task_inputs::DynTaskInputsStorage,
event::{Event, EventListener}, event::{Event, EventListener},
id::{ExecutionId, LocalTaskId, TraitTypeId}, id::{ExecutionId, LocalTaskId, TraitTypeId},
keyed::KeyedEq, keyed::KeyedEq,
...@@ -60,7 +60,7 @@ pub trait TurboTasksCallApi: Sync + Send { ...@@ -60,7 +60,7 @@ pub trait TurboTasksCallApi: Sync + Send {
&self, &self,
native_fn: &'static NativeFunction, native_fn: &'static NativeFunction,
this: Option<RawVc>, this: Option<RawVc>,
arg: &mut dyn StackDynTaskInputs, arg: &mut dyn DynTaskInputsStorage,
persistence: TaskPersistence, persistence: TaskPersistence,
) -> RawVc; ) -> RawVc;
/// Call a native function with arguments. /// Call a native function with arguments.
...@@ -69,7 +69,7 @@ pub trait TurboTasksCallApi: Sync + Send { ...@@ -69,7 +69,7 @@ pub trait TurboTasksCallApi: Sync + Send {
&self, &self,
native_fn: &'static NativeFunction, native_fn: &'static NativeFunction,
this: Option<RawVc>, this: Option<RawVc>,
arg: &mut dyn StackDynTaskInputs, arg: &mut dyn DynTaskInputsStorage,
persistence: TaskPersistence, persistence: TaskPersistence,
) -> RawVc; ) -> RawVc;
/// Calls a trait method with arguments. First input is the `self` object. /// Calls a trait method with arguments. First input is the `self` object.
...@@ -78,7 +78,7 @@ pub trait TurboTasksCallApi: Sync + Send { ...@@ -78,7 +78,7 @@ pub trait TurboTasksCallApi: Sync + Send {
&self, &self,
trait_method: &'static TraitMethod, trait_method: &'static TraitMethod,
this: RawVc, this: RawVc,
arg: &mut dyn StackDynTaskInputs, arg: &mut dyn DynTaskInputsStorage,
persistence: TaskPersistence, persistence: TaskPersistence,
) -> RawVc; ) -> RawVc;
...@@ -707,7 +707,7 @@ impl<B: Backend + 'static> TurboTasks<B> { ...@@ -707,7 +707,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
&self, &self,
native_fn: &'static NativeFunction, native_fn: &'static NativeFunction,
this: Option<RawVc>, this: Option<RawVc>,
arg: &mut dyn StackDynTaskInputs, arg: &mut dyn DynTaskInputsStorage,
persistence: TaskPersistence, persistence: TaskPersistence,
) -> RawVc { ) -> RawVc {
RawVc::TaskOutput(self.backend.get_or_create_task( RawVc::TaskOutput(self.backend.get_or_create_task(
...@@ -724,7 +724,7 @@ impl<B: Backend + 'static> TurboTasks<B> { ...@@ -724,7 +724,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
&self, &self,
native_fn: &'static NativeFunction, native_fn: &'static NativeFunction,
this: Option<RawVc>, this: Option<RawVc>,
arg: &mut dyn StackDynTaskInputs, arg: &mut dyn DynTaskInputsStorage,
persistence: TaskPersistence, persistence: TaskPersistence,
) -> RawVc { ) -> RawVc {
if this.is_none_or(|this| this.is_resolved()) if this.is_none_or(|this| this.is_resolved())
...@@ -746,7 +746,7 @@ impl<B: Backend + 'static> TurboTasks<B> { ...@@ -746,7 +746,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
&self, &self,
trait_method: &'static TraitMethod, trait_method: &'static TraitMethod,
this: RawVc, this: RawVc,
arg: &mut dyn StackDynTaskInputs, arg: &mut dyn DynTaskInputsStorage,
persistence: TaskPersistence, persistence: TaskPersistence,
) -> RawVc { ) -> RawVc {
// avoid creating a wrapper task if self is already resolved // avoid creating a wrapper task if self is already resolved
...@@ -1287,7 +1287,7 @@ impl<B: Backend + 'static> TurboTasksCallApi for TurboTasks<B> { ...@@ -1287,7 +1287,7 @@ impl<B: Backend + 'static> TurboTasksCallApi for TurboTasks<B> {
&self, &self,
native_fn: &'static NativeFunction, native_fn: &'static NativeFunction,
this: Option<RawVc>, this: Option<RawVc>,
arg: &mut dyn StackDynTaskInputs, arg: &mut dyn DynTaskInputsStorage,
persistence: TaskPersistence, persistence: TaskPersistence,
) -> RawVc { ) -> RawVc {
self.dynamic_call(native_fn, this, arg, persistence) self.dynamic_call(native_fn, this, arg, persistence)
...@@ -1296,7 +1296,7 @@ impl<B: Backend + 'static> TurboTasksCallApi for TurboTasks<B> { ...@@ -1296,7 +1296,7 @@ impl<B: Backend + 'static> TurboTasksCallApi for TurboTasks<B> {
&self, &self,
native_fn: &'static NativeFunction, native_fn: &'static NativeFunction,
this: Option<RawVc>, this: Option<RawVc>,
arg: &mut dyn StackDynTaskInputs, arg: &mut dyn DynTaskInputsStorage,
persistence: TaskPersistence, persistence: TaskPersistence,
) -> RawVc { ) -> RawVc {
self.native_call(native_fn, this, arg, persistence) self.native_call(native_fn, this, arg, persistence)
...@@ -1305,7 +1305,7 @@ impl<B: Backend + 'static> TurboTasksCallApi for TurboTasks<B> { ...@@ -1305,7 +1305,7 @@ impl<B: Backend + 'static> TurboTasksCallApi for TurboTasks<B> {
&self, &self,
trait_method: &'static TraitMethod, trait_method: &'static TraitMethod,
this: RawVc, this: RawVc,
arg: &mut dyn StackDynTaskInputs, arg: &mut dyn DynTaskInputsStorage,
persistence: TaskPersistence, persistence: TaskPersistence,
) -> RawVc { ) -> RawVc {
self.trait_call(trait_method, this, arg, persistence) self.trait_call(trait_method, this, arg, persistence)
...@@ -1698,7 +1698,7 @@ pub async fn run_once_with_reason<T: Send + 'static>( ...@@ -1698,7 +1698,7 @@ pub async fn run_once_with_reason<T: Send + 'static>(
pub fn dynamic_call( pub fn dynamic_call(
func: &'static NativeFunction, func: &'static NativeFunction,
this: Option<RawVc>, this: Option<RawVc>,
arg: &mut dyn StackDynTaskInputs, arg: &mut dyn DynTaskInputsStorage,
persistence: TaskPersistence, persistence: TaskPersistence,
) -> RawVc { ) -> RawVc {
with_turbo_tasks(|tt| tt.dynamic_call(func, this, arg, persistence)) with_turbo_tasks(|tt| tt.dynamic_call(func, this, arg, persistence))
...@@ -1708,7 +1708,7 @@ pub fn dynamic_call( ...@@ -1708,7 +1708,7 @@ pub fn dynamic_call(
pub fn trait_call( pub fn trait_call(
trait_method: &'static TraitMethod, trait_method: &'static TraitMethod,
this: RawVc, this: RawVc,
arg: &mut dyn StackDynTaskInputs, arg: &mut dyn DynTaskInputsStorage,
persistence: TaskPersistence, persistence: TaskPersistence,
) -> RawVc { ) -> RawVc {
with_turbo_tasks(|tt| tt.trait_call(trait_method, this, arg, persistence)) with_turbo_tasks(|tt| tt.trait_call(trait_method, this, arg, persistence))
......
...@@ -12,7 +12,7 @@ use crate::TaskDirtyCause; ...@@ -12,7 +12,7 @@ use crate::TaskDirtyCause;
use crate::{ use crate::{
RawVc, TaskExecutionReason, TaskInput, TaskPersistence, TaskPriority, RawVc, TaskExecutionReason, TaskInput, TaskPersistence, TaskPriority,
dyn_task_inputs::{ dyn_task_inputs::{
DynTaskInputs, OwnedStackDynTaskInputs, StackDynTaskInputs, StackDynTaskInputsSlot, DynTaskInputs, DynTaskInputsStorage, HeapDynTaskInputsStorage, StackDynTaskInputsStorage,
any_as_encode, any_as_encode,
}, },
macro_helpers::into_task_fn, macro_helpers::into_task_fn,
...@@ -27,7 +27,7 @@ type IsResolvedFunctor = fn(&dyn DynTaskInputs) -> bool; ...@@ -27,7 +27,7 @@ type IsResolvedFunctor = fn(&dyn DynTaskInputs) -> bool;
#[doc(hidden)] #[doc(hidden)]
pub type FilterOwnedArgsFunctor = pub type FilterOwnedArgsFunctor =
for<'a> fn(&'a mut dyn StackDynTaskInputs) -> OwnedStackDynTaskInputs; for<'a> fn(&'a mut dyn DynTaskInputsStorage) -> HeapDynTaskInputsStorage;
#[doc(hidden)] #[doc(hidden)]
pub type FilterAndResolveFunctor = ResolveFunctor; pub type FilterAndResolveFunctor = ResolveFunctor;
...@@ -188,15 +188,16 @@ pub fn downcast_args_ref<T: DynTaskInputs>(args: &dyn DynTaskInputs) -> &T { ...@@ -188,15 +188,16 @@ pub fn downcast_args_ref<T: DynTaskInputs>(args: &dyn DynTaskInputs) -> &T {
.unwrap() .unwrap()
} }
/// Downcast a `&mut dyn StackDynTaskInputs` to a concrete [`StackDynTaskInputsSlot<T>`] and /// Downcast a `&mut dyn DynTaskInputsStorage` to a concrete [`StackDynTaskInputsStorage<T>`] and
/// take the value out, avoiding the intermediate heap allocation that `take_box` + /// take the value out, avoiding the intermediate heap allocation that `take_box` +
/// `downcast_args_owned` would require. /// `downcast_args_owned` would require.
pub fn downcast_stack_args_owned<T: DynTaskInputs>(args: &mut dyn StackDynTaskInputs) -> T { pub fn downcast_stack_args_owned<T: DynTaskInputs>(args: &mut dyn DynTaskInputsStorage) -> T {
args.as_any_mut() args.as_any_mut()
.downcast_mut::<StackDynTaskInputsSlot<T>>() .downcast_mut::<StackDynTaskInputsStorage<T>>()
.unwrap_or_else(|| { .unwrap_or_else(|| {
panic!( panic!(
"downcast_stack_args_owned::<{}> called with incorrect StackDynTaskInputs type", "downcast_stack_args_owned::<{}> called with incorrect StackDynTaskInputsStorage \
type",
std::any::type_name::<T>(), std::any::type_name::<T>(),
) )
}) })
......
...@@ -3,7 +3,7 @@ use std::{fmt, sync::Arc}; ...@@ -3,7 +3,7 @@ use std::{fmt, sync::Arc};
use anyhow::{Result, bail}; use anyhow::{Result, bail};
use crate::{ use crate::{
CellId, DynTaskInputs, OutputContent, OwnedStackDynTaskInputs, RawVc, TaskPersistence, CellId, DynTaskInputs, HeapDynTaskInputsStorage, OutputContent, RawVc, TaskPersistence,
TraitMethod, TurboTasks, ValueTypeId, backend::Backend, event::Event, TraitMethod, TurboTasks, ValueTypeId, backend::Backend, event::Event,
macro_helpers::NativeFunction, registry, macro_helpers::NativeFunction, registry,
}; };
...@@ -61,7 +61,7 @@ impl LocalTaskType { ...@@ -61,7 +61,7 @@ impl LocalTaskType {
*this = this.resolve().await?; *this = this.resolve().await?;
} }
let arg = native_fn.arg_meta.resolve(arg).await?; let arg = native_fn.arg_meta.resolve(arg).await?;
let mut arg = OwnedStackDynTaskInputs::new(arg); let mut arg = HeapDynTaskInputsStorage::new(arg);
Ok(turbo_tasks.native_call(native_fn, this, &mut arg, persistence)) Ok(turbo_tasks.native_call(native_fn, this, &mut arg, persistence))
} }
/// Implementation of the LocalTaskType::ResolveTrait task. /// Implementation of the LocalTaskType::ResolveTrait task.
...@@ -79,7 +79,7 @@ impl LocalTaskType { ...@@ -79,7 +79,7 @@ impl LocalTaskType {
let native_fn = Self::resolve_trait_method_from_value(trait_method, type_id)?; let native_fn = Self::resolve_trait_method_from_value(trait_method, type_id)?;
let arg = native_fn.arg_meta.filter_and_resolve(arg).await?; let arg = native_fn.arg_meta.filter_and_resolve(arg).await?;
let mut arg = OwnedStackDynTaskInputs::new(arg); let mut arg = HeapDynTaskInputsStorage::new(arg);
Ok(turbo_tasks.native_call(native_fn, Some(this), &mut arg, persistence)) Ok(turbo_tasks.native_call(native_fn, Some(this), &mut arg, persistence))
} }
......
...@@ -4,7 +4,9 @@ use std::{ ...@@ -4,7 +4,9 @@ use std::{
future::Future, future::Future,
hash::Hash, hash::Hash,
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
pin::Pin,
sync::Arc, sync::Arc,
task::{Context, Poll},
time::Duration, time::Duration,
}; };
...@@ -28,6 +30,29 @@ use crate::{ ...@@ -28,6 +30,29 @@ use crate::{
trace::TraceRawVcs, trace::TraceRawVcs,
}; };
/// An 8-byte hand-rolled [`Future`] that immediately resolves to `Ok(self.clone())` of the
/// referenced value.
///
/// Used by the [`TaskInput::resolve_input`] default implementation
struct CloneReady<'a, T> {
pub inner: Option<&'a T>,
}
impl<'a, T: Clone> Future for CloneReady<'a, T> {
type Output = Result<T>;
fn poll(mut self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Self::Output> {
Poll::Ready(Ok(self
.inner
.take()
.expect("future already polled to completion")
.clone()))
}
}
// `CloneReady` holds only a shared reference; it has no self-referential state.
impl<'a, T> Unpin for CloneReady<'a, T> {}
/// Trait to implement in order for a type to be accepted as a /// Trait to implement in order for a type to be accepted as a
/// [`#[turbo_tasks::function]`][crate::function] argument. /// [`#[turbo_tasks::function]`][crate::function] argument.
/// ///
...@@ -65,7 +90,7 @@ use crate::{ ...@@ -65,7 +90,7 @@ use crate::{
/// Structs or enums can be made into task inputs by deriving `TaskInput`: /// Structs or enums can be made into task inputs by deriving `TaskInput`:
/// ///
/// ```rust /// ```rust
/// #[derive(TaskInput)] /// #[turbo_tasks::task_input]
/// struct MyStruct { /// struct MyStruct {
/// // Fields go here... /// // Fields go here...
/// } /// }
...@@ -87,7 +112,7 @@ pub trait TaskInput: ...@@ -87,7 +112,7 @@ pub trait TaskInput:
/// the process. If the input is unresolved ([`TaskInput::is_resolved`]) a "local" resolution /// the process. If the input is unresolved ([`TaskInput::is_resolved`]) a "local" resolution
/// task is created that runs this method. /// task is created that runs this method.
fn resolve_input(&self) -> impl Future<Output = Result<Self>> + Send + '_ { fn resolve_input(&self) -> impl Future<Output = Result<Self>> + Send + '_ {
async { Ok(self.clone()) } CloneReady { inner: Some(self) }
} }
/// This should return `true` if there are any unresolved [`Vc`]s in the type. /// This should return `true` if there are any unresolved [`Vc`]s in the type.
...@@ -258,8 +283,10 @@ where ...@@ -258,8 +283,10 @@ where
self.node.is_transient() self.node.is_transient()
} }
async fn resolve_input(&self) -> Result<Self> { fn resolve_input(&self) -> impl Future<Output = Result<Self>> + Send + '_ {
Ok(*(*self).to_resolved().await?) // It isn't ideal to use this function but it exactly matches this usecase (resolved but
// still a Vc)
(*self).resolve()
} }
} }
...@@ -276,10 +303,6 @@ where ...@@ -276,10 +303,6 @@ where
fn is_transient(&self) -> bool { fn is_transient(&self) -> bool {
self.node.is_transient() self.node.is_transient()
} }
async fn resolve_input(&self) -> Result<Self> {
Ok(*self)
}
} }
impl<T> TaskInput for TransientValue<T> impl<T> TaskInput for TransientValue<T>
...@@ -526,7 +549,6 @@ tuple_impls! { A B C D E F G H I J K L } ...@@ -526,7 +549,6 @@ tuple_impls! { A B C D E F G H I J K L }
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use turbo_rcstr::rcstr; use turbo_rcstr::rcstr;
use turbo_tasks_macros::TaskInput;
use super::*; use super::*;
...@@ -538,7 +560,8 @@ mod tests { ...@@ -538,7 +560,8 @@ mod tests {
#[test] #[test]
fn test_no_fields() -> Result<()> { fn test_no_fields() -> Result<()> {
#[derive(Clone, TaskInput, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)] #[turbo_tasks::task_input]
#[derive(Clone, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)]
struct NoFields; struct NoFields;
assert_task_input(NoFields); assert_task_input(NoFields);
...@@ -547,7 +570,8 @@ mod tests { ...@@ -547,7 +570,8 @@ mod tests {
#[test] #[test]
fn test_one_unnamed_field() -> Result<()> { fn test_one_unnamed_field() -> Result<()> {
#[derive(Clone, TaskInput, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)] #[turbo_tasks::task_input]
#[derive(Clone, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)]
struct OneUnnamedField(u32); struct OneUnnamedField(u32);
assert_task_input(OneUnnamedField(42)); assert_task_input(OneUnnamedField(42));
...@@ -556,7 +580,8 @@ mod tests { ...@@ -556,7 +580,8 @@ mod tests {
#[test] #[test]
fn test_multiple_unnamed_fields() -> Result<()> { fn test_multiple_unnamed_fields() -> Result<()> {
#[derive(Clone, TaskInput, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)] #[turbo_tasks::task_input]
#[derive(Clone, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)]
struct MultipleUnnamedFields(u32, RcStr); struct MultipleUnnamedFields(u32, RcStr);
assert_task_input(MultipleUnnamedFields(42, rcstr!("42"))); assert_task_input(MultipleUnnamedFields(42, rcstr!("42")));
...@@ -565,7 +590,8 @@ mod tests { ...@@ -565,7 +590,8 @@ mod tests {
#[test] #[test]
fn test_one_named_field() -> Result<()> { fn test_one_named_field() -> Result<()> {
#[derive(Clone, TaskInput, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)] #[turbo_tasks::task_input]
#[derive(Clone, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)]
struct OneNamedField { struct OneNamedField {
named: u32, named: u32,
} }
...@@ -576,7 +602,8 @@ mod tests { ...@@ -576,7 +602,8 @@ mod tests {
#[test] #[test]
fn test_multiple_named_fields() -> Result<()> { fn test_multiple_named_fields() -> Result<()> {
#[derive(Clone, TaskInput, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)] #[turbo_tasks::task_input]
#[derive(Clone, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)]
struct MultipleNamedFields { struct MultipleNamedFields {
named: u32, named: u32,
other: RcStr, other: RcStr,
...@@ -591,7 +618,8 @@ mod tests { ...@@ -591,7 +618,8 @@ mod tests {
#[test] #[test]
fn test_generic_field() -> Result<()> { fn test_generic_field() -> Result<()> {
#[derive(Clone, TaskInput, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)] #[turbo_tasks::task_input]
#[derive(Clone, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)]
struct GenericField<T>(T); struct GenericField<T>(T);
assert_task_input(GenericField(42)); assert_task_input(GenericField(42));
...@@ -599,7 +627,8 @@ mod tests { ...@@ -599,7 +627,8 @@ mod tests {
Ok(()) Ok(())
} }
#[derive(Clone, TaskInput, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)] #[turbo_tasks::task_input]
#[derive(Clone, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)]
enum OneVariant { enum OneVariant {
Variant, Variant,
} }
...@@ -612,7 +641,8 @@ mod tests { ...@@ -612,7 +641,8 @@ mod tests {
#[test] #[test]
fn test_multiple_variants() -> Result<()> { fn test_multiple_variants() -> Result<()> {
#[derive(Clone, TaskInput, PartialEq, Eq, Hash, Debug, Encode, Decode, TraceRawVcs)] #[turbo_tasks::task_input]
#[derive(Clone, PartialEq, Eq, Hash, Debug, Encode, Decode, TraceRawVcs)]
enum MultipleVariants { enum MultipleVariants {
Variant1, Variant1,
Variant2, Variant2,
...@@ -622,7 +652,8 @@ mod tests { ...@@ -622,7 +652,8 @@ mod tests {
Ok(()) Ok(())
} }
#[derive(Clone, TaskInput, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)] #[turbo_tasks::task_input]
#[derive(Clone, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)]
enum MultipleVariantsAndHeterogeneousFields { enum MultipleVariantsAndHeterogeneousFields {
Variant1, Variant1,
Variant2(u32), Variant2(u32),
...@@ -642,7 +673,8 @@ mod tests { ...@@ -642,7 +673,8 @@ mod tests {
#[test] #[test]
fn test_nested_variants() -> Result<()> { fn test_nested_variants() -> Result<()> {
#[derive(Clone, TaskInput, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)] #[turbo_tasks::task_input]
#[derive(Clone, Eq, PartialEq, Hash, Debug, Encode, Decode, TraceRawVcs)]
enum NestedVariants { enum NestedVariants {
Variant1, Variant1,
Variant2(MultipleVariantsAndHeterogeneousFields), Variant2(MultipleVariantsAndHeterogeneousFields),
......
...@@ -408,13 +408,7 @@ impl Unpin for ResolveRawVcFuture {} ...@@ -408,13 +408,7 @@ impl Unpin for ResolveRawVcFuture {}
#[must_use] #[must_use]
pub struct ReadRawVcFuture { pub struct ReadRawVcFuture {
/// Options for the cell read once we have a [`RawVc::TaskCell`]. Persists across both phases
/// because it is configured by the builder before phase 1 starts.
read_cell_options: ReadCellOptions, read_cell_options: ReadCellOptions,
/// Whether phase 1 was a strongly-consistent read. Needed in phase 2 to re-apply
/// [`suppress_top_level_task_check`]. Stored here so we can drop the [`ResolveRawVcFuture`]
/// once phase 1 completes.
strongly_consistent: bool,
state: ReadRawVcState, state: ReadRawVcState,
} }
...@@ -427,6 +421,11 @@ enum ReadRawVcState { ...@@ -427,6 +421,11 @@ enum ReadRawVcState {
Reading { Reading {
task: TaskId, task: TaskId,
index: CellId, index: CellId,
/// Whether phase 1 was a strongly-consistent read. Needed here to re-apply
/// [`suppress_top_level_task_check`] in phase 2. Lives in this variant (rather than the
/// outer struct) so it can share padding with the other `Reading` fields — keeping
/// `Reading` no larger than `Resolving`, and the whole future 8 bytes smaller.
strongly_consistent: bool,
listener: Option<EventListener>, listener: Option<EventListener>,
}, },
} }
...@@ -435,7 +434,6 @@ impl ReadRawVcFuture { ...@@ -435,7 +434,6 @@ impl ReadRawVcFuture {
pub(crate) fn new(vc: RawVc) -> Self { pub(crate) fn new(vc: RawVc) -> Self {
ReadRawVcFuture { ReadRawVcFuture {
read_cell_options: ReadCellOptions::default(), read_cell_options: ReadCellOptions::default(),
strongly_consistent: false,
state: ReadRawVcState::Resolving(ResolveRawVcFuture::new(vc)), state: ReadRawVcState::Resolving(ResolveRawVcFuture::new(vc)),
} }
} }
...@@ -453,8 +451,7 @@ impl ReadRawVcFuture { ...@@ -453,8 +451,7 @@ impl ReadRawVcFuture {
} }
/// Make reads strongly consistent. /// Make reads strongly consistent.
pub fn strongly_consistent(mut self) -> Self { pub fn strongly_consistent(self) -> Self {
self.strongly_consistent = true;
self.map_resolve(|r| r.strongly_consistent()) self.map_resolve(|r| r.strongly_consistent())
} }
...@@ -494,12 +491,14 @@ impl Future for ReadRawVcFuture { ...@@ -494,12 +491,14 @@ impl Future for ReadRawVcFuture {
// `ResolveRawVcFuture` is `Unpin`, so `Pin::new` is safe. // `ResolveRawVcFuture` is `Unpin`, so `Pin::new` is safe.
// It handles `with_turbo_tasks` and `suppress_top_level_task_check` internally. // It handles `with_turbo_tasks` and `suppress_top_level_task_check` internally.
if let ReadRawVcState::Resolving(resolve) = &mut this.state { if let ReadRawVcState::Resolving(resolve) = &mut this.state {
let strongly_consistent = resolve.strongly_consistent;
match ready!(Pin::new(resolve).poll(cx)) { match ready!(Pin::new(resolve).poll(cx)) {
Err(err) => return Poll::Ready(Err(err)), Err(err) => return Poll::Ready(Err(err)),
Ok(RawVc::TaskCell(task, index)) => { Ok(RawVc::TaskCell(task, index)) => {
this.state = ReadRawVcState::Reading { this.state = ReadRawVcState::Reading {
task, task,
index, index,
strongly_consistent,
listener: None, listener: None,
}; };
} }
...@@ -511,6 +510,7 @@ impl Future for ReadRawVcFuture { ...@@ -511,6 +510,7 @@ impl Future for ReadRawVcFuture {
let ReadRawVcState::Reading { let ReadRawVcState::Reading {
task, task,
index, index,
strongly_consistent,
listener, listener,
} = &mut this.state } = &mut this.state
else { else {
...@@ -536,7 +536,7 @@ impl Future for ReadRawVcFuture { ...@@ -536,7 +536,7 @@ impl Future for ReadRawVcFuture {
// strongly-consistent. The suppression from `ResolveRawVcFuture::poll` only lasts for // strongly-consistent. The suppression from `ResolveRawVcFuture::poll` only lasts for
// the duration of that individual `poll` call and does not carry over to subsequent calls // the duration of that individual `poll` call and does not carry over to subsequent calls
// or to this phase. // or to this phase.
suppress_top_level_task_check(this.strongly_consistent, || with_turbo_tasks(poll_fn)) suppress_top_level_task_check(*strongly_consistent, || with_turbo_tasks(poll_fn))
} }
} }
......
use anyhow::{Context, Result, bail}; use anyhow::{Context, Result, bail};
use tracing::Instrument; use tracing::Instrument;
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{FxIndexMap, FxIndexSet, ResolvedVc, TryJoinIterExt, Upcast, ValueToString, Vc};
FxIndexMap, FxIndexSet, ResolvedVc, TaskInput, TryJoinIterExt, Upcast, ValueToString, Vc,
};
use turbo_tasks_fs::FileSystemPath; use turbo_tasks_fs::FileSystemPath;
use turbo_tasks_hash::HashAlgorithm; use turbo_tasks_hash::HashAlgorithm;
use turbopack_core::{ use turbopack_core::{
...@@ -42,7 +40,7 @@ use crate::ecmascript::{ ...@@ -42,7 +40,7 @@ use crate::ecmascript::{
}; };
#[turbo_tasks::value] #[turbo_tasks::value]
#[derive(Debug, Clone, Copy, Hash, TaskInput)] #[derive(Debug, Clone, Copy, Hash)]
pub enum CurrentChunkMethod { pub enum CurrentChunkMethod {
StringLiteral, StringLiteral,
DocumentCurrentScript, DocumentCurrentScript,
......
...@@ -2,7 +2,7 @@ use anyhow::Result; ...@@ -2,7 +2,7 @@ use anyhow::Result;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use turbo_rcstr::rcstr; use turbo_rcstr::rcstr;
use turbo_tasks::{NonLocalValue, ResolvedVc, TaskInput, ValueToString, Vc, trace::TraceRawVcs}; use turbo_tasks::{ResolvedVc, ValueToString, Vc, trace::TraceRawVcs};
use turbo_tasks_fs::FileSystemPath; use turbo_tasks_fs::FileSystemPath;
use turbopack_core::{ use turbopack_core::{
asset::{Asset, AssetContent}, asset::{Asset, AssetContent},
...@@ -114,20 +114,9 @@ impl Asset for EcmascriptDevChunkList { ...@@ -114,20 +114,9 @@ impl Asset for EcmascriptDevChunkList {
} }
} }
#[turbo_tasks::task_input]
#[derive( #[derive(
Eq, Eq, PartialEq, Debug, Clone, Copy, Hash, TraceRawVcs, Serialize, Deserialize, Encode, Decode,
PartialEq,
Debug,
Clone,
Copy,
Hash,
TaskInput,
NonLocalValue,
TraceRawVcs,
Serialize,
Deserialize,
Encode,
Decode,
)] )]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum EcmascriptDevChunkListSource { pub enum EcmascriptDevChunkListSource {
......
...@@ -7,7 +7,7 @@ use std::{ ...@@ -7,7 +7,7 @@ use std::{
use anyhow::anyhow; use anyhow::anyhow;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use clap::{Args, Parser, ValueEnum}; use clap::{Args, Parser, ValueEnum};
use turbo_tasks::{NonLocalValue, TaskInput, trace::TraceRawVcs}; use turbo_tasks::trace::TraceRawVcs;
use turbopack_core::issue::IssueSeverity; use turbopack_core::issue::IssueSeverity;
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
...@@ -35,20 +35,8 @@ impl Arguments { ...@@ -35,20 +35,8 @@ impl Arguments {
} }
} }
#[derive( #[turbo_tasks::task_input]
Copy, #[derive(Copy, Clone, Debug, ValueEnum, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
Clone,
Debug,
ValueEnum,
PartialEq,
Eq,
Hash,
TaskInput,
NonLocalValue,
TraceRawVcs,
Encode,
Decode,
)]
pub enum Target { pub enum Target {
Browser, Browser,
Node, Node,
......
...@@ -4,12 +4,11 @@ use anyhow::{Context, Result}; ...@@ -4,12 +4,11 @@ use anyhow::{Context, Result};
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use dunce::canonicalize; use dunce::canonicalize;
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{NonLocalValue, TaskInput, Vc, trace::TraceRawVcs}; use turbo_tasks::{Vc, trace::TraceRawVcs};
use turbo_tasks_fs::{DiskFileSystem, FileSystem}; use turbo_tasks_fs::{DiskFileSystem, FileSystem};
#[derive( #[turbo_tasks::task_input]
Clone, Debug, TaskInput, Hash, PartialEq, Eq, NonLocalValue, TraceRawVcs, Encode, Decode, #[derive(Clone, Debug, Hash, PartialEq, Eq, TraceRawVcs, Encode, Decode)]
)]
pub enum EntryRequest { pub enum EntryRequest {
Relative(RcStr), Relative(RcStr),
Module(RcStr, RcStr), Module(RcStr, RcStr),
......
...@@ -2,20 +2,20 @@ use anyhow::Result; ...@@ -2,20 +2,20 @@ use anyhow::Result;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use bitfield::bitfield; use bitfield::bitfield;
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{NonLocalValue, OperationVc, ResolvedVc, TaskInput, trace::TraceRawVcs}; use turbo_tasks::{OperationVc, ResolvedVc, trace::TraceRawVcs};
use crate::chunk::available_modules::{AvailableModules, AvailableModulesSet}; use crate::chunk::available_modules::{AvailableModules, AvailableModulesSet};
bitfield! { bitfield! {
#[derive(Clone, Copy, Default, TaskInput, TraceRawVcs, NonLocalValue, PartialEq, Eq, Hash, Encode, Decode)] #[turbo_tasks::task_input]
#[derive(Clone, Copy, Default, TraceRawVcs, PartialEq, Eq, Hash, Encode, Decode)]
pub struct AvailabilityFlags(u8); pub struct AvailabilityFlags(u8);
impl Debug; impl Debug;
pub is_in_async_module, set_is_in_async_module: 0; pub is_in_async_module, set_is_in_async_module: 0;
} }
#[derive( #[turbo_tasks::task_input]
Eq, PartialEq, Hash, Clone, Copy, Debug, TaskInput, TraceRawVcs, NonLocalValue, Encode, Decode, #[derive(Eq, PartialEq, Hash, Clone, Copy, Debug, TraceRawVcs, Encode, Decode)]
)]
pub struct AvailabilityInfo { pub struct AvailabilityInfo {
flags: AvailabilityFlags, flags: AvailabilityFlags,
/// There are modules already available. /// There are modules already available.
......
use anyhow::Result; use anyhow::Result;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_tasks::{ use turbo_tasks::{
FxIndexSet, NonLocalValue, OperationVc, ReadRef, ResolvedVc, TaskInput, TryJoinIterExt, FxIndexSet, OperationVc, ReadRef, ResolvedVc, TryJoinIterExt, ValueToString, Vc,
ValueToString, Vc, trace::TraceRawVcs, turbofmt, trace::TraceRawVcs, turbofmt,
}; };
use turbo_tasks_hash::Xxh3Hash64Hasher; use turbo_tasks_hash::Xxh3Hash64Hasher;
...@@ -12,9 +12,8 @@ use crate::{ ...@@ -12,9 +12,8 @@ use crate::{
module_graph::module_batch::{ChunkableModuleOrBatch, IdentStrings, ModuleBatch}, module_graph::module_batch::{ChunkableModuleOrBatch, IdentStrings, ModuleBatch},
}; };
#[derive( #[turbo_tasks::task_input]
Debug, Copy, Clone, Hash, PartialEq, Eq, TraceRawVcs, NonLocalValue, TaskInput, Encode, Decode, #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, TraceRawVcs, Encode, Decode)]
)]
pub enum AvailableModuleItem { pub enum AvailableModuleItem {
Module(ResolvedVc<Box<dyn ChunkableModule>>), Module(ResolvedVc<Box<dyn ChunkableModule>>),
Batch(ResolvedVc<ModuleBatch>), Batch(ResolvedVc<ModuleBatch>),
......
...@@ -6,8 +6,7 @@ use rustc_hash::FxHashMap; ...@@ -6,8 +6,7 @@ use rustc_hash::FxHashMap;
use tracing::Instrument; use tracing::Instrument;
use turbo_rcstr::rcstr; use turbo_rcstr::rcstr;
use turbo_tasks::{ use turbo_tasks::{
FxIndexSet, NonLocalValue, OperationVc, ResolvedVc, TaskInput, TryFlatJoinIterExt, FxIndexSet, OperationVc, ResolvedVc, TryFlatJoinIterExt, TryJoinIterExt, Vc, trace::TraceRawVcs,
TryJoinIterExt, Vc, trace::TraceRawVcs,
}; };
use super::{ use super::{
...@@ -170,9 +169,8 @@ pub async fn make_chunk_group( ...@@ -170,9 +169,8 @@ pub async fn make_chunk_group(
}) })
} }
#[derive( #[turbo_tasks::task_input]
Debug, Clone, Hash, TaskInput, PartialEq, Eq, TraceRawVcs, NonLocalValue, Encode, Decode, #[derive(Debug, Clone, Hash, PartialEq, Eq, TraceRawVcs, Encode, Decode)]
)]
pub struct ChunkGroupContentOptions { pub struct ChunkGroupContentOptions {
/// The availability info of the chunk group /// The availability info of the chunk group
pub availability_info: AvailabilityInfo, pub availability_info: AvailabilityInfo,
......
...@@ -6,8 +6,7 @@ use either::Either; ...@@ -6,8 +6,7 @@ use either::Either;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use smallvec::{SmallVec, smallvec}; use smallvec::{SmallVec, smallvec};
use turbo_tasks::{ use turbo_tasks::{
FxIndexMap, NonLocalValue, ReadRef, ResolvedVc, TaskInput, TryFlatJoinIterExt, TryJoinIterExt, FxIndexMap, ReadRef, ResolvedVc, TryFlatJoinIterExt, TryJoinIterExt, Vc, trace::TraceRawVcs,
Vc, trace::TraceRawVcs,
}; };
use crate::{ use crate::{
...@@ -60,9 +59,8 @@ pub async fn attach_async_info_to_chunkable_module( ...@@ -60,9 +59,8 @@ pub async fn attach_async_info_to_chunkable_module(
}) })
} }
#[derive( #[turbo_tasks::task_input]
Debug, Clone, PartialEq, Eq, Hash, TraceRawVcs, NonLocalValue, TaskInput, Encode, Decode, #[derive(Debug, Clone, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
)]
pub enum ChunkItemOrBatchWithAsyncModuleInfo { pub enum ChunkItemOrBatchWithAsyncModuleInfo {
ChunkItem(ChunkItemWithAsyncModuleInfo), ChunkItem(ChunkItemWithAsyncModuleInfo),
Batch(ResolvedVc<ChunkItemBatchWithAsyncModuleInfo>), Batch(ResolvedVc<ChunkItemBatchWithAsyncModuleInfo>),
...@@ -119,7 +117,7 @@ impl ChunkItemOrBatchWithAsyncModuleInfo { ...@@ -119,7 +117,7 @@ impl ChunkItemOrBatchWithAsyncModuleInfo {
} }
#[turbo_tasks::value] #[turbo_tasks::value]
#[derive(Debug, Clone, Hash, TaskInput)] #[derive(Debug, Clone, Hash)]
pub struct ChunkItemBatchWithAsyncModuleInfo { pub struct ChunkItemBatchWithAsyncModuleInfo {
pub chunk_items: Vec<ChunkItemWithAsyncModuleInfo>, pub chunk_items: Vec<ChunkItemWithAsyncModuleInfo>,
pub chunk_groups: Option<RoaringBitmapWrapper>, pub chunk_groups: Option<RoaringBitmapWrapper>,
......
...@@ -3,9 +3,7 @@ use bincode::{Decode, Encode}; ...@@ -3,9 +3,7 @@ use bincode::{Decode, Encode};
use rustc_hash::{FxHashMap, FxHashSet}; use rustc_hash::{FxHashMap, FxHashSet};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{ use turbo_tasks::{ResolvedVc, Upcast, Vc, trace::TraceRawVcs, turbobail};
NonLocalValue, ResolvedVc, TaskInput, Upcast, Vc, trace::TraceRawVcs, turbobail,
};
use turbo_tasks_fs::FileSystemPath; use turbo_tasks_fs::FileSystemPath;
use turbo_tasks_hash::DeterministicHash; use turbo_tasks_hash::DeterministicHash;
...@@ -29,9 +27,9 @@ use crate::{ ...@@ -29,9 +27,9 @@ use crate::{
reference::ModuleReference, reference::ModuleReference,
}; };
#[turbo_tasks::task_input]
#[derive( #[derive(
Debug, Debug,
TaskInput,
Clone, Clone,
Copy, Copy,
PartialEq, PartialEq,
...@@ -40,7 +38,6 @@ use crate::{ ...@@ -40,7 +38,6 @@ use crate::{
Deserialize, Deserialize,
TraceRawVcs, TraceRawVcs,
DeterministicHash, DeterministicHash,
NonLocalValue,
Encode, Encode,
Decode, Decode,
)] )]
...@@ -50,8 +47,8 @@ pub enum MangleType { ...@@ -50,8 +47,8 @@ pub enum MangleType {
Deterministic, Deterministic,
} }
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared, task_input)]
#[derive(Debug, TaskInput, Clone, Copy, Hash, DeterministicHash, Deserialize)] #[derive(Debug, Clone, Copy, Hash, DeterministicHash, Deserialize)]
pub enum MinifyType { pub enum MinifyType {
// TODO instead of adding a new property here, // TODO instead of adding a new property here,
// refactor that to Minify(MinifyOptions) to allow defaults on MinifyOptions // refactor that to Minify(MinifyOptions) to allow defaults on MinifyOptions
...@@ -67,8 +64,8 @@ impl Default for MinifyType { ...@@ -67,8 +64,8 @@ impl Default for MinifyType {
} }
} }
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared, task_input)]
#[derive(Debug, Default, TaskInput, Clone, Copy, Hash, DeterministicHash)] #[derive(Debug, Default, Clone, Copy, Hash, DeterministicHash)]
pub enum SourceMapsType { pub enum SourceMapsType {
/// Extracts source maps from input files and writes source maps for output files. /// Extracts source maps from input files and writes source maps for output files.
#[default] #[default]
...@@ -105,9 +102,9 @@ pub struct UrlBehavior { ...@@ -105,9 +102,9 @@ pub struct UrlBehavior {
pub static_suffix: ResolvedVc<Option<RcStr>>, pub static_suffix: ResolvedVc<Option<RcStr>>,
} }
#[turbo_tasks::task_input]
#[derive( #[derive(
Debug, Debug,
TaskInput,
Clone, Clone,
Copy, Copy,
PartialEq, PartialEq,
...@@ -117,7 +114,6 @@ pub struct UrlBehavior { ...@@ -117,7 +114,6 @@ pub struct UrlBehavior {
Deserialize, Deserialize,
TraceRawVcs, TraceRawVcs,
DeterministicHash, DeterministicHash,
NonLocalValue,
Encode, Encode,
Decode, Decode,
)] )]
...@@ -244,19 +240,8 @@ pub struct EntryChunkGroupResult { ...@@ -244,19 +240,8 @@ pub struct EntryChunkGroupResult {
pub availability_info: AvailabilityInfo, pub availability_info: AvailabilityInfo,
} }
#[derive( #[turbo_tasks::task_input]
Default, #[derive(Default, Debug, Clone, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
Debug,
Clone,
PartialEq,
Eq,
Hash,
TraceRawVcs,
NonLocalValue,
TaskInput,
Encode,
Decode,
)]
pub struct ChunkingConfig { pub struct ChunkingConfig {
/// Try to avoid creating more than 1 chunk smaller than this size. /// Try to avoid creating more than 1 chunk smaller than this size.
/// It merges multiple small chunks into bigger ones to avoid that. /// It merges multiple small chunks into bigger ones to avoid that.
...@@ -283,7 +268,7 @@ pub struct ChunkingConfig { ...@@ -283,7 +268,7 @@ pub struct ChunkingConfig {
pub struct ChunkingConfigs(FxHashMap<ResolvedVc<Box<dyn ChunkType>>, ChunkingConfig>); pub struct ChunkingConfigs(FxHashMap<ResolvedVc<Box<dyn ChunkType>>, ChunkingConfig>);
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
#[derive(Debug, Clone, Copy, Hash, TaskInput, Default, Deserialize)] #[derive(Debug, Clone, Copy, Hash, Default, Deserialize)]
pub enum SourceMapSourceType { pub enum SourceMapSourceType {
AbsoluteFileUri, AbsoluteFileUri,
RelativeUri, RelativeUri,
......
...@@ -16,7 +16,7 @@ use bincode::{Decode, Encode}; ...@@ -16,7 +16,7 @@ use bincode::{Decode, Encode};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{ use turbo_tasks::{
FxIndexSet, NonLocalValue, ReadRef, ResolvedVc, TaskInput, Upcast, ValueToString, Vc, FxIndexSet, NonLocalValue, ReadRef, ResolvedVc, Upcast, ValueToString, Vc,
debug::ValueDebugFormat, trace::TraceRawVcs, debug::ValueDebugFormat, trace::TraceRawVcs,
}; };
use turbo_tasks_hash::DeterministicHash; use turbo_tasks_hash::DeterministicHash;
...@@ -46,19 +46,9 @@ use crate::{ ...@@ -46,19 +46,9 @@ use crate::{
output::{OutputAssets, OutputAssetsReference}, output::{OutputAssets, OutputAssetsReference},
}; };
#[turbo_tasks::task_input]
#[derive( #[derive(
Debug, Debug, Clone, Copy, PartialEq, Eq, Hash, TraceRawVcs, DeterministicHash, Encode, Decode,
TaskInput,
Clone,
Copy,
PartialEq,
Eq,
Hash,
TraceRawVcs,
DeterministicHash,
NonLocalValue,
Encode,
Decode,
)] )]
pub enum ContentHashing { pub enum ContentHashing {
/// Direct content hashing: Embeds the chunk content hash directly into the referencing chunk. /// Direct content hashing: Embeds the chunk content hash directly into the referencing chunk.
...@@ -72,7 +62,7 @@ pub enum ContentHashing { ...@@ -72,7 +62,7 @@ pub enum ContentHashing {
} }
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
#[derive(Debug, Default, Clone, Copy, Hash, Serialize, Deserialize, TaskInput)] #[derive(Debug, Default, Clone, Copy, Hash, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")] #[serde(rename_all = "kebab-case")]
pub enum CrossOrigin { pub enum CrossOrigin {
#[default] #[default]
...@@ -186,9 +176,8 @@ impl MergeableModules { ...@@ -186,9 +176,8 @@ impl MergeableModules {
} }
/// Whether a given module needs to be exposed (depending on how it is imported by other modules) /// Whether a given module needs to be exposed (depending on how it is imported by other modules)
#[derive( #[turbo_tasks::task_input]
Copy, Clone, Debug, PartialEq, Eq, TraceRawVcs, NonLocalValue, TaskInput, Hash, Encode, Decode, #[derive(Copy, Clone, Debug, PartialEq, Eq, TraceRawVcs, Hash, Encode, Decode)]
)]
pub enum MergeableModuleExposure { pub enum MergeableModuleExposure {
// This module is only used from within the current group, and only individual exports are // This module is only used from within the current group, and only individual exports are
// used (and no namespace object is required). // used (and no namespace object is required).
...@@ -293,11 +282,10 @@ pub trait OutputChunk: Asset { ...@@ -293,11 +282,10 @@ pub trait OutputChunk: Asset {
Eq, Eq,
PartialEq, PartialEq,
ValueDebugFormat, ValueDebugFormat,
NonLocalValue,
Encode, Encode,
Decode, Decode,
TaskInput,
)] )]
#[turbo_tasks::task_input]
pub enum TracedMode { pub enum TracedMode {
/// Going from bundled to unbundled code, i.e. an external dependency or readFile static assets. /// Going from bundled to unbundled code, i.e. an external dependency or readFile static assets.
Entry, Entry,
...@@ -560,9 +548,8 @@ impl AsyncModuleInfo { ...@@ -560,9 +548,8 @@ impl AsyncModuleInfo {
} }
} }
#[derive( #[turbo_tasks::task_input]
Debug, Clone, Copy, PartialEq, Eq, Hash, TraceRawVcs, TaskInput, NonLocalValue, Encode, Decode, #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
)]
pub struct ChunkItemWithAsyncModuleInfo { pub struct ChunkItemWithAsyncModuleInfo {
pub chunk_item: ResolvedVc<Box<dyn ChunkItem>>, pub chunk_item: ResolvedVc<Box<dyn ChunkItem>>,
pub chunk_type: ResolvedVc<Box<dyn ChunkType>>, pub chunk_type: ResolvedVc<Box<dyn ChunkType>>,
......
...@@ -7,7 +7,7 @@ use anyhow::{Context, Result, anyhow, bail}; ...@@ -7,7 +7,7 @@ use anyhow::{Context, Result, anyhow, bail};
use browserslist::Distrib; use browserslist::Distrib;
use swc_core::ecma::preset_env::{Version, Versions}; use swc_core::ecma::preset_env::{Version, Versions};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ResolvedVc, TaskInput, Vc}; use turbo_tasks::{ResolvedVc, Vc};
use turbo_tasks_env::ProcessEnv; use turbo_tasks_env::ProcessEnv;
use turbo_tasks_fs::FileSystemPathOption; use turbo_tasks_fs::FileSystemPathOption;
...@@ -16,7 +16,7 @@ use crate::target::CompileTarget; ...@@ -16,7 +16,7 @@ use crate::target::CompileTarget;
static DEFAULT_NODEJS_VERSION: &str = "18.0.0"; static DEFAULT_NODEJS_VERSION: &str = "18.0.0";
#[turbo_tasks::value] #[turbo_tasks::value]
#[derive(Clone, Copy, Default, Hash, TaskInput, Debug)] #[derive(Clone, Copy, Default, Hash, Debug)]
pub enum Rendering { pub enum Rendering {
#[default] #[default]
None, None,
...@@ -53,8 +53,8 @@ impl Environment { ...@@ -53,8 +53,8 @@ impl Environment {
} }
} }
#[turbo_tasks::value] #[turbo_tasks::value(task_input)]
#[derive(Debug, Hash, Clone, Copy, TaskInput)] #[derive(Debug, Hash, Clone, Copy)]
pub enum ExecutionEnvironment { pub enum ExecutionEnvironment {
NodeJsBuildTime(ResolvedVc<NodeJsEnvironment>), NodeJsBuildTime(ResolvedVc<NodeJsEnvironment>),
NodeJsLambda(ResolvedVc<NodeJsEnvironment>), NodeJsLambda(ResolvedVc<NodeJsEnvironment>),
......
...@@ -5,8 +5,7 @@ use bincode::{Decode, Encode}; ...@@ -5,8 +5,7 @@ use bincode::{Decode, Encode};
use regex::Regex; use regex::Regex;
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{ use turbo_tasks::{
NonLocalValue, ReadRef, ResolvedVc, TaskInput, ValueToString, ValueToStringRef, Vc, ReadRef, ResolvedVc, ValueToString, ValueToStringRef, Vc, trace::TraceRawVcs, turbofmt,
trace::TraceRawVcs, turbofmt,
}; };
use turbo_tasks_fs::FileSystemPath; use turbo_tasks_fs::FileSystemPath;
use turbo_tasks_hash::{DeterministicHash, Xxh3Hash64Hasher, encode_base38, hash_xxh3_hash64}; use turbo_tasks_hash::{DeterministicHash, Xxh3Hash64Hasher, encode_base38, hash_xxh3_hash64};
...@@ -14,19 +13,8 @@ use turbo_tasks_hash::{DeterministicHash, Xxh3Hash64Hasher, encode_base38, hash_ ...@@ -14,19 +13,8 @@ use turbo_tasks_hash::{DeterministicHash, Xxh3Hash64Hasher, encode_base38, hash_
use crate::resolve::ModulePart; use crate::resolve::ModulePart;
/// A layer identifies a distinct part of the module graph. /// A layer identifies a distinct part of the module graph.
#[derive( #[turbo_tasks::task_input]
Clone, #[derive(Clone, Hash, Debug, DeterministicHash, Eq, PartialEq, TraceRawVcs, Encode, Decode)]
TaskInput,
Hash,
Debug,
DeterministicHash,
Eq,
PartialEq,
TraceRawVcs,
NonLocalValue,
Encode,
Decode,
)]
pub struct Layer { pub struct Layer {
name: RcStr, name: RcStr,
user_friendly_name: Option<RcStr>, user_friendly_name: Option<RcStr>,
...@@ -59,8 +47,8 @@ impl Layer { ...@@ -59,8 +47,8 @@ impl Layer {
} }
} }
#[turbo_tasks::value] #[turbo_tasks::value(task_input)]
#[derive(Clone, Debug, Hash, TaskInput)] #[derive(Clone, Debug, Hash)]
pub struct AssetIdent { pub struct AssetIdent {
/// The primary path of the asset /// The primary path of the asset
pub path: FileSystemPath, pub path: FileSystemPath,
......
...@@ -16,9 +16,9 @@ use serde::{Deserialize, Serialize}; ...@@ -16,9 +16,9 @@ use serde::{Deserialize, Serialize};
use turbo_esregex::EsRegex; use turbo_esregex::EsRegex;
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
CollectiblesSource, NonLocalValue, OperationVc, RawVc, ReadRef, ResolvedVc, TaskInput, CollectiblesSource, NonLocalValue, OperationVc, RawVc, ReadRef, ResolvedVc, TransientValue,
TransientValue, TryFlatJoinIterExt, TryJoinIterExt, Upcast, ValueDefault, ValueToString, TryFlatJoinIterExt, TryJoinIterExt, Upcast, ValueDefault, ValueToString, ValueToStringRef, Vc,
ValueToStringRef, Vc, emit, trace::TraceRawVcs, emit, trace::TraceRawVcs,
}; };
use turbo_tasks_fs::{ use turbo_tasks_fs::{
FileContent, FileLine, FileLinesContent, FileSystem, FileSystemPath, glob::Glob, FileContent, FileLine, FileLinesContent, FileSystem, FileSystemPath, glob::Glob,
...@@ -36,10 +36,8 @@ use crate::{ ...@@ -36,10 +36,8 @@ use crate::{
source_pos::SourcePos, source_pos::SourcePos,
}; };
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared, task_input)]
#[derive( #[derive(PartialOrd, Ord, Copy, Clone, Hash, Debug, DeterministicHash, Serialize, Deserialize)]
PartialOrd, Ord, Copy, Clone, Hash, Debug, DeterministicHash, TaskInput, Serialize, Deserialize,
)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum IssueSeverity { pub enum IssueSeverity {
Bug, Bug,
...@@ -438,18 +436,16 @@ impl CapturedIssues { ...@@ -438,18 +436,16 @@ impl CapturedIssues {
} }
} }
#[derive( #[turbo_tasks::task_input]
Clone, Copy, Debug, PartialEq, Eq, Hash, TaskInput, TraceRawVcs, NonLocalValue, Encode, Decode, #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
)]
pub struct IssueSource { pub struct IssueSource {
source: ResolvedVc<Box<dyn Source>>, source: ResolvedVc<Box<dyn Source>>,
range: Option<SourceRange>, range: Option<SourceRange>,
} }
/// The end position is the first character after the range /// The end position is the first character after the range
#[derive( #[turbo_tasks::task_input]
Clone, Copy, Debug, PartialEq, Eq, Hash, TaskInput, TraceRawVcs, NonLocalValue, Encode, Decode, #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
)]
enum SourceRange { enum SourceRange {
LineColumn(SourcePos, SourcePos), LineColumn(SourcePos, SourcePos),
ByteOffset(u32, u32), ByteOffset(u32, u32),
......
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{ResolvedVc, TaskInput, ValueToString, Vc}; use turbo_tasks::{ResolvedVc, ValueToString, Vc};
use crate::{ident::AssetIdent, reference::ModuleReferences, source::OptionSource}; use crate::{ident::AssetIdent, reference::ModuleReferences, source::OptionSource};
#[derive(Clone, Copy, Debug, TaskInput, Hash)] #[derive(Clone, Copy, Debug, Hash)]
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
pub enum StyleType { pub enum StyleType {
IsolatedStyle, IsolatedStyle,
......
...@@ -127,9 +127,8 @@ impl ChunkGroupInfo { ...@@ -127,9 +127,8 @@ impl ChunkGroupInfo {
} }
/// See [ChunkGroup] for documentation /// See [ChunkGroup] for documentation
#[derive( #[turbo_tasks::task_input]
Debug, Clone, Hash, TaskInput, PartialEq, Eq, TraceRawVcs, NonLocalValue, Encode, Decode, #[derive(Debug, Clone, Hash, PartialEq, Eq, TraceRawVcs, Encode, Decode)]
)]
pub enum ChunkGroupEntry { pub enum ChunkGroupEntry {
Entry(Vec<ResolvedVc<Box<dyn Module>>>), Entry(Vec<ResolvedVc<Box<dyn Module>>>),
Async(ResolvedVc<Box<dyn Module>>), Async(ResolvedVc<Box<dyn Module>>),
...@@ -161,9 +160,8 @@ impl ChunkGroupEntry { ...@@ -161,9 +160,8 @@ impl ChunkGroupEntry {
} }
} }
#[derive( #[turbo_tasks::task_input]
Debug, Clone, Hash, TaskInput, PartialEq, Eq, TraceRawVcs, Encode, Decode, NonLocalValue, #[derive(Debug, Clone, Hash, PartialEq, Eq, TraceRawVcs, Encode, Decode)]
)]
pub enum ChunkGroup { pub enum ChunkGroup {
/// The entry chunk group of the compilation, e.g. src/index.js for a SPA, or app/foo/page.js /// The entry chunk group of the compilation, e.g. src/index.js for a SPA, or app/foo/page.js
/// for Next.js. /// for Next.js.
......
...@@ -4,29 +4,15 @@ use anyhow::Result; ...@@ -4,29 +4,15 @@ use anyhow::Result;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{ use turbo_tasks::{ReadRef, ResolvedVc, TryJoinIterExt, ValueToString, Vc, trace::TraceRawVcs};
NonLocalValue, ReadRef, ResolvedVc, TaskInput, TryJoinIterExt, ValueToString, Vc,
trace::TraceRawVcs,
};
use crate::{ use crate::{
chunk::ChunkableModule, module::Module, module_graph::chunk_group_info::RoaringBitmapWrapper, chunk::ChunkableModule, module::Module, module_graph::chunk_group_info::RoaringBitmapWrapper,
}; };
#[turbo_tasks::task_input]
#[derive( #[derive(
Debug, Debug, Copy, Clone, Hash, PartialEq, Eq, Serialize, Deserialize, TraceRawVcs, Encode, Decode,
Copy,
Clone,
Hash,
PartialEq,
Eq,
Serialize,
Deserialize,
TraceRawVcs,
NonLocalValue,
TaskInput,
Encode,
Decode,
)] )]
pub enum ModuleOrBatch { pub enum ModuleOrBatch {
Module(ResolvedVc<Box<dyn Module>>), Module(ResolvedVc<Box<dyn Module>>),
...@@ -46,9 +32,8 @@ impl ModuleOrBatch { ...@@ -46,9 +32,8 @@ impl ModuleOrBatch {
} }
} }
#[derive( #[turbo_tasks::task_input]
Debug, Copy, Clone, Hash, PartialEq, Eq, TraceRawVcs, NonLocalValue, TaskInput, Encode, Decode, #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, TraceRawVcs, Encode, Decode)]
)]
pub enum ChunkableModuleOrBatch { pub enum ChunkableModuleOrBatch {
Module(ResolvedVc<Box<dyn ChunkableModule>>), Module(ResolvedVc<Box<dyn ChunkableModule>>),
Batch(ResolvedVc<ModuleBatch>), Batch(ResolvedVc<ModuleBatch>),
......
...@@ -13,8 +13,8 @@ use serde::{Deserialize, Serialize}; ...@@ -13,8 +13,8 @@ use serde::{Deserialize, Serialize};
use tracing::Instrument; use tracing::Instrument;
use turbo_prehash::BuildHasherExt; use turbo_prehash::BuildHasherExt;
use turbo_tasks::{ use turbo_tasks::{
FxIndexMap, FxIndexSet, NonLocalValue, ResolvedVc, TaskInput, TryJoinIterExt, ValueToString, FxIndexMap, FxIndexSet, NonLocalValue, ResolvedVc, TryJoinIterExt, ValueToString, Vc,
Vc, trace::TraceRawVcs, turbobail, trace::TraceRawVcs, turbobail,
}; };
use crate::{ use crate::{
...@@ -27,8 +27,8 @@ use crate::{ ...@@ -27,8 +27,8 @@ use crate::{
traced_di_graph::{TracedDiGraph, iter_neighbors_rev}, traced_di_graph::{TracedDiGraph, iter_neighbors_rev},
}, },
}; };
#[turbo_tasks::value] #[turbo_tasks::value(task_input)]
#[derive(Debug, Clone, Default, TaskInput, Hash)] #[derive(Debug, Clone, Default, Hash)]
pub struct BatchingConfig { pub struct BatchingConfig {
/// Use a heuristic based on the module path to create batches. It aims for batches of a good /// Use a heuristic based on the module path to create batches. It aims for batches of a good
/// size. /// size.
......
...@@ -5,9 +5,7 @@ ...@@ -5,9 +5,7 @@
//! produce. Living here means neither algorithm has to import from the other. //! produce. Living here means neither algorithm has to import from the other.
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_tasks::{ use turbo_tasks::{FxIndexMap, OperationValue, ResolvedVc, Vc, trace::TraceRawVcs};
FxIndexMap, NonLocalValue, OperationValue, ResolvedVc, TaskInput, Vc, trace::TraceRawVcs,
};
use crate::chunk::{ChunkItemBatchWithAsyncModuleInfo, ChunkItemWithAsyncModuleInfo}; use crate::chunk::{ChunkItemBatchWithAsyncModuleInfo, ChunkItemWithAsyncModuleInfo};
...@@ -15,20 +13,8 @@ use crate::chunk::{ChunkItemBatchWithAsyncModuleInfo, ChunkItemWithAsyncModuleIn ...@@ -15,20 +13,8 @@ use crate::chunk::{ChunkItemBatchWithAsyncModuleInfo, ChunkItemWithAsyncModuleIn
/// [`StyleGroupsAlgorithm`] enum needs) by going through the IEEE-754 bit pattern. Use /// [`StyleGroupsAlgorithm`] enum needs) by going through the IEEE-754 bit pattern. Use
/// [`F32TaskInput::get`] / [`F32TaskInput::from`] at the boundary; do not match on the inner /// [`F32TaskInput::get`] / [`F32TaskInput::from`] at the boundary; do not match on the inner
/// `u32` directly. /// `u32` directly.
#[derive( #[turbo_tasks::task_input]
TaskInput, #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, OperationValue, TraceRawVcs, Encode, Decode)]
Debug,
Clone,
Copy,
PartialEq,
Eq,
Hash,
NonLocalValue,
OperationValue,
TraceRawVcs,
Encode,
Decode,
)]
pub struct F32TaskInput(u32); pub struct F32TaskInput(u32);
impl F32TaskInput { impl F32TaskInput {
...@@ -41,8 +27,8 @@ impl F32TaskInput { ...@@ -41,8 +27,8 @@ impl F32TaskInput {
} }
/// Selects the algorithm used to compute [`StyleGroups`]. /// Selects the algorithm used to compute [`StyleGroups`].
#[turbo_tasks::value(shared, operation)] #[turbo_tasks::value(shared, operation, task_input)]
#[derive(Clone, Debug, Default, Hash, TaskInput)] #[derive(Clone, Debug, Default, Hash)]
pub enum StyleGroupsAlgorithm { pub enum StyleGroupsAlgorithm {
/// Default ("loose") algorithm, see /// Default ("loose") algorithm, see
/// [`crate::module_graph::style_groups_loose::compute_style_groups`]. /// [`crate::module_graph::style_groups_loose::compute_style_groups`].
...@@ -68,18 +54,16 @@ impl StyleGroupsAlgorithm { ...@@ -68,18 +54,16 @@ impl StyleGroupsAlgorithm {
} }
} }
#[derive( #[turbo_tasks::task_input]
TaskInput, Debug, Clone, PartialEq, Eq, Hash, NonLocalValue, TraceRawVcs, Encode, Decode, #[derive(Debug, Clone, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
)]
pub struct StyleGroupsConfig { pub struct StyleGroupsConfig {
pub max_chunk_size: usize, pub max_chunk_size: usize,
pub algorithm: StyleGroupsAlgorithm, pub algorithm: StyleGroupsAlgorithm,
} }
/// Per-item metadata produced by the style chunking algorithms. /// Per-item metadata produced by the style chunking algorithms.
#[derive( #[turbo_tasks::task_input]
Debug, Clone, PartialEq, Eq, Hash, NonLocalValue, TraceRawVcs, Encode, Decode, TaskInput, #[derive(Debug, Clone, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
)]
pub struct StyleItemInfo { pub struct StyleItemInfo {
/// Stable sort key applied by the production-chunking pass when ordering chunks within a chunk /// Stable sort key applied by the production-chunking pass when ordering chunks within a chunk
/// group. The loose algorithm produces all `None` orders and relies on input order; the graph /// group. The loose algorithm produces all `None` orders and relies on input order; the graph
......
...@@ -3,7 +3,7 @@ use std::fmt::Display; ...@@ -3,7 +3,7 @@ use std::fmt::Display;
use anyhow::Result; use anyhow::Result;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{FxIndexMap, NonLocalValue, ResolvedVc, TaskInput, Vc, trace::TraceRawVcs}; use turbo_tasks::{FxIndexMap, ResolvedVc, Vc, trace::TraceRawVcs};
use crate::{loader::ResolvedWebpackLoaderItem, module::Module, resolve::ModulePart}; use crate::{loader::ResolvedWebpackLoaderItem, module::Module, resolve::ModulePart};
...@@ -30,47 +30,23 @@ impl InnerAssets { ...@@ -30,47 +30,23 @@ impl InnerAssets {
// TODO when plugins are supported, replace u8 with a trait that defines the // TODO when plugins are supported, replace u8 with a trait that defines the
// behavior. // behavior.
#[derive( #[turbo_tasks::task_input]
PartialEq, #[derive(PartialEq, Eq, TraceRawVcs, Debug, Default, Clone, Copy, Hash, Encode, Decode)]
Eq,
TraceRawVcs,
NonLocalValue,
Debug,
Default,
Clone,
Copy,
Hash,
TaskInput,
Encode,
Decode,
)]
pub enum CommonJsReferenceSubType { pub enum CommonJsReferenceSubType {
Custom(u8), Custom(u8),
#[default] #[default]
Undefined, Undefined,
} }
#[derive( #[turbo_tasks::task_input]
PartialEq, Eq, TraceRawVcs, NonLocalValue, Debug, Clone, Copy, Hash, TaskInput, Encode, Decode, #[derive(PartialEq, Eq, TraceRawVcs, Debug, Clone, Copy, Hash, Encode, Decode)]
)]
pub enum ImportWithType { pub enum ImportWithType {
Json, Json,
Bytes, Bytes,
} }
#[derive( #[turbo_tasks::task_input]
PartialEq, #[derive(PartialEq, Eq, TraceRawVcs, Debug, Default, Clone, Hash, Encode, Decode)]
Eq,
TraceRawVcs,
NonLocalValue,
Debug,
Default,
Clone,
Hash,
TaskInput,
Encode,
Decode,
)]
pub enum EcmaScriptModulesReferenceSubType { pub enum EcmaScriptModulesReferenceSubType {
ImportPart(ModulePart), ImportPart(ModulePart),
Import, Import,
...@@ -205,20 +181,8 @@ impl ImportContext { ...@@ -205,20 +181,8 @@ impl ImportContext {
} }
} }
#[derive( #[turbo_tasks::task_input]
PartialEq, #[derive(PartialEq, Eq, TraceRawVcs, Debug, Default, Clone, Copy, Hash, Encode, Decode)]
Eq,
TraceRawVcs,
NonLocalValue,
Debug,
Default,
Clone,
Copy,
Hash,
TaskInput,
Encode,
Decode,
)]
pub enum CssReferenceSubType { pub enum CssReferenceSubType {
AtImport(Option<ResolvedVc<ImportContext>>), AtImport(Option<ResolvedVc<ImportContext>>),
/// Reference from EcmascriptCssModule to an imported EcmascriptCssModule for retrieving the /// Reference from EcmascriptCssModule to an imported EcmascriptCssModule for retrieving the
...@@ -233,20 +197,8 @@ pub enum CssReferenceSubType { ...@@ -233,20 +197,8 @@ pub enum CssReferenceSubType {
Undefined, Undefined,
} }
#[derive( #[turbo_tasks::task_input]
PartialEq, #[derive(PartialEq, Eq, TraceRawVcs, Debug, Default, Clone, Copy, Hash, Encode, Decode)]
Eq,
TraceRawVcs,
NonLocalValue,
Debug,
Default,
Clone,
Copy,
Hash,
TaskInput,
Encode,
Decode,
)]
pub enum UrlReferenceSubType { pub enum UrlReferenceSubType {
EcmaScriptNewUrl, EcmaScriptNewUrl,
CssUrl, CssUrl,
...@@ -255,17 +207,15 @@ pub enum UrlReferenceSubType { ...@@ -255,17 +207,15 @@ pub enum UrlReferenceSubType {
Undefined, Undefined,
} }
#[derive( #[turbo_tasks::task_input]
PartialEq, Eq, TraceRawVcs, NonLocalValue, Debug, Clone, Copy, Hash, TaskInput, Encode, Decode, #[derive(PartialEq, Eq, TraceRawVcs, Debug, Clone, Copy, Hash, Encode, Decode)]
)]
pub enum TypeScriptReferenceSubType { pub enum TypeScriptReferenceSubType {
Custom(u8), Custom(u8),
Undefined, Undefined,
} }
#[derive( #[turbo_tasks::task_input]
PartialEq, Eq, TraceRawVcs, NonLocalValue, Debug, Clone, Copy, Hash, TaskInput, Encode, Decode, #[derive(PartialEq, Eq, TraceRawVcs, Debug, Clone, Copy, Hash, Encode, Decode)]
)]
pub enum WorkerReferenceSubType { pub enum WorkerReferenceSubType {
WebWorker, WebWorker,
SharedWorker, SharedWorker,
...@@ -277,9 +227,8 @@ pub enum WorkerReferenceSubType { ...@@ -277,9 +227,8 @@ pub enum WorkerReferenceSubType {
// TODO(sokra) this was next.js specific values. We want to solve this in a // TODO(sokra) this was next.js specific values. We want to solve this in a
// different way. // different way.
#[derive( #[turbo_tasks::task_input]
PartialEq, Eq, TraceRawVcs, NonLocalValue, Debug, Clone, Copy, Hash, TaskInput, Encode, Decode, #[derive(PartialEq, Eq, TraceRawVcs, Debug, Clone, Copy, Hash, Encode, Decode)]
)]
pub enum EntryReferenceSubType { pub enum EntryReferenceSubType {
Web, Web,
Page, Page,
...@@ -297,19 +246,8 @@ pub enum EntryReferenceSubType { ...@@ -297,19 +246,8 @@ pub enum EntryReferenceSubType {
Undefined, Undefined,
} }
#[derive( #[turbo_tasks::task_input]
PartialEq, #[derive(PartialEq, Eq, TraceRawVcs, Debug, Default, Clone, Hash, Encode, Decode)]
Eq,
TraceRawVcs,
NonLocalValue,
Debug,
Default,
Clone,
Hash,
TaskInput,
Encode,
Decode,
)]
pub enum ReferenceType { pub enum ReferenceType {
CommonJs(CommonJsReferenceSubType), CommonJs(CommonJsReferenceSubType),
EcmaScriptModules(EcmaScriptModulesReferenceSubType), EcmaScriptModules(EcmaScriptModulesReferenceSubType),
...@@ -372,9 +310,8 @@ impl ReferenceType { ...@@ -372,9 +310,8 @@ impl ReferenceType {
/// - to match against a specific subtype, e.g. with /// - to match against a specific subtype, e.g. with
/// `ReferenceTypeCondition::Url(Some(UrlReferenceSubType::EcmaScriptNewUrl))` matching /// `ReferenceTypeCondition::Url(Some(UrlReferenceSubType::EcmaScriptNewUrl))` matching
/// `ReferenceType::Url(UrlReferenceSubType::EcmaScriptNewUrl)` /// `ReferenceType::Url(UrlReferenceSubType::EcmaScriptNewUrl)`
#[derive( #[turbo_tasks::task_input]
PartialEq, Eq, TraceRawVcs, NonLocalValue, Debug, Clone, Hash, TaskInput, Encode, Decode, #[derive(PartialEq, Eq, TraceRawVcs, Debug, Clone, Hash, Encode, Decode)]
)]
pub enum ReferenceTypeCondition { pub enum ReferenceTypeCondition {
CommonJs(Option<CommonJsReferenceSubType>), CommonJs(Option<CommonJsReferenceSubType>),
EcmaScriptModules(Option<EcmaScriptModulesReferenceSubType>), EcmaScriptModules(Option<EcmaScriptModulesReferenceSubType>),
......
...@@ -17,7 +17,7 @@ use tracing::{Instrument, Level}; ...@@ -17,7 +17,7 @@ use tracing::{Instrument, Level};
use turbo_frozenmap::{FrozenMap, FrozenSet}; use turbo_frozenmap::{FrozenMap, FrozenSet};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
FxIndexMap, NonLocalValue, ReadRef, ResolvedVc, TaskInput, TryFlatJoinIterExt, TryJoinIterExt, FxIndexMap, NonLocalValue, ReadRef, ResolvedVc, TryFlatJoinIterExt, TryJoinIterExt,
ValueToString, ValueToStringRef, Vc, trace::TraceRawVcs, ValueToString, ValueToStringRef, Vc, trace::TraceRawVcs,
}; };
use turbo_tasks_fs::{FileSystemEntryType, FileSystemPath}; use turbo_tasks_fs::{FileSystemEntryType, FileSystemPath};
...@@ -68,8 +68,8 @@ pub use alias_map::{ ...@@ -68,8 +68,8 @@ pub use alias_map::{
pub use remap::{ResolveAliasMap, SubpathValue}; pub use remap::{ResolveAliasMap, SubpathValue};
/// Controls how resolve errors are handled. /// Controls how resolve errors are handled.
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared, task_input)]
#[derive(Debug, Clone, Copy, Default, Hash, TaskInput)] #[derive(Debug, Clone, Copy, Default, Hash)]
pub enum ResolveErrorMode { pub enum ResolveErrorMode {
/// Emit an error issue (default behavior) /// Emit an error issue (default behavior)
#[default] #[default]
...@@ -446,20 +446,9 @@ impl ModuleResolveResult { ...@@ -446,20 +446,9 @@ impl ModuleResolveResult {
} }
} }
#[turbo_tasks::task_input]
#[derive( #[derive(
Copy, Copy, Clone, Debug, PartialEq, Eq, Hash, TraceRawVcs, Serialize, Deserialize, Encode, Decode,
Clone,
Debug,
PartialEq,
Eq,
TaskInput,
Hash,
NonLocalValue,
TraceRawVcs,
Serialize,
Deserialize,
Encode,
Decode,
)] )]
pub enum ExternalTraced { pub enum ExternalTraced {
Untraced, Untraced,
...@@ -475,20 +464,9 @@ impl Display for ExternalTraced { ...@@ -475,20 +464,9 @@ impl Display for ExternalTraced {
} }
} }
#[turbo_tasks::task_input]
#[derive( #[derive(
Copy, Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize, TraceRawVcs, Encode, Decode,
Clone,
Debug,
Eq,
PartialEq,
Hash,
Serialize,
Deserialize,
TraceRawVcs,
TaskInput,
NonLocalValue,
Encode,
Decode,
)] )]
pub enum ExternalType { pub enum ExternalType {
Url, Url,
...@@ -538,8 +516,8 @@ pub enum ResolveResultItem { ...@@ -538,8 +516,8 @@ pub enum ResolveResultItem {
/// A primary factor is the actual request string, but there are /// A primary factor is the actual request string, but there are
/// other factors like exports conditions that can affect resolving and become /// other factors like exports conditions that can affect resolving and become
/// part of the key (assuming the condition is unknown at compile time) /// part of the key (assuming the condition is unknown at compile time)
#[derive(Clone, Debug, Default, Hash, TaskInput)] #[derive(Clone, Debug, Default, Hash)]
#[turbo_tasks::value] #[turbo_tasks::value(task_input)]
pub struct RequestKey { pub struct RequestKey {
pub request: Option<RcStr>, pub request: Option<RcStr>,
pub conditions: FrozenMap<RcStr, bool>, pub conditions: FrozenMap<RcStr, bool>,
...@@ -3368,19 +3346,9 @@ async fn resolve_package_internal_with_imports_field( ...@@ -3368,19 +3346,9 @@ async fn resolve_package_internal_with_imports_field(
/// ModulePart represents a part of a module. /// ModulePart represents a part of a module.
/// ///
/// Currently this is used only for ESMs. /// Currently this is used only for ESMs.
#[turbo_tasks::task_input]
#[derive( #[derive(
Serialize, Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode,
Deserialize,
Debug,
Clone,
PartialEq,
Eq,
Hash,
TraceRawVcs,
TaskInput,
NonLocalValue,
Encode,
Decode,
)] )]
pub enum ModulePart { pub enum ModulePart {
/// Represents the side effects of a module. This part is evaluated even if /// Represents the side effects of a module. This part is evaluated even if
......
...@@ -30,12 +30,11 @@ pub enum Pattern { ...@@ -30,12 +30,11 @@ pub enum Pattern {
Concatenation(Vec<Pattern>), Concatenation(Vec<Pattern>),
} }
/// manually implement TaskInput to avoid recursion in the implementation of `resolve_input` in the // Use a manual impl since llvm cannot prove the default generated recursive impl always returns
/// derived implementation. We can instead use the default implementation since `Pattern` contains // false from `is_transient`
/// no VCs.
impl TaskInput for Pattern { impl TaskInput for Pattern {
fn is_transient(&self) -> bool { fn is_transient(&self) -> bool {
// We contain no vcs so they cannot be transient. // contains no vcs
false false
} }
} }
......
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use serde::Serialize; use serde::Serialize;
use turbo_tasks::{NonLocalValue, TaskInput, trace::TraceRawVcs}; use turbo_tasks::trace::TraceRawVcs;
use turbo_tasks_hash::DeterministicHash; use turbo_tasks_hash::DeterministicHash;
/// LINE FEED (LF), one of the basic JS line terminators. /// LINE FEED (LF), one of the basic JS line terminators.
...@@ -8,6 +8,7 @@ const U8_LF: u8 = 0x0A; ...@@ -8,6 +8,7 @@ const U8_LF: u8 = 0x0A;
/// CARRIAGE RETURN (CR), one of the basic JS line terminators. /// CARRIAGE RETURN (CR), one of the basic JS line terminators.
const U8_CR: u8 = 0x0D; const U8_CR: u8 = 0x0D;
#[turbo_tasks::task_input]
#[derive( #[derive(
Default, Default,
Debug, Debug,
...@@ -18,11 +19,9 @@ const U8_CR: u8 = 0x0D; ...@@ -18,11 +19,9 @@ const U8_CR: u8 = 0x0D;
Hash, Hash,
PartialOrd, PartialOrd,
Ord, Ord,
TaskInput,
TraceRawVcs, TraceRawVcs,
Serialize, Serialize,
DeterministicHash, DeterministicHash,
NonLocalValue,
Encode, Encode,
Decode, Decode,
)] )]
......
...@@ -12,26 +12,14 @@ pub(crate) mod process; ...@@ -12,26 +12,14 @@ pub(crate) mod process;
pub(crate) mod references; pub(crate) mod references;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_tasks::{NonLocalValue, TaskInput, trace::TraceRawVcs}; use turbo_tasks::trace::TraceRawVcs;
use crate::references::import::ImportAssetReference; use crate::references::import::ImportAssetReference;
pub use crate::{asset::CssModule, module_asset::EcmascriptCssModule, process::*}; pub use crate::{asset::CssModule, module_asset::EcmascriptCssModule, process::*};
#[turbo_tasks::task_input]
#[derive( #[derive(
PartialOrd, PartialOrd, Ord, Eq, PartialEq, Hash, Debug, Copy, Clone, Default, TraceRawVcs, Encode, Decode,
Ord,
Eq,
PartialEq,
Hash,
Debug,
Copy,
Clone,
Default,
TaskInput,
TraceRawVcs,
NonLocalValue,
Encode,
Decode,
)] )]
pub enum CssModuleType { pub enum CssModuleType {
/// Default parsing mode. /// Default parsing mode.
...@@ -45,8 +33,8 @@ pub enum CssModuleType { ...@@ -45,8 +33,8 @@ pub enum CssModuleType {
/// ///
/// Both fields are raw `Features` bitmasks. `include` bits are OR-ed into the /// Both fields are raw `Features` bitmasks. `include` bits are OR-ed into the
/// default feature set; `exclude` bits are masked off. /// default feature set; `exclude` bits are masked off.
#[turbo_tasks::value(shared, serialization = "auto")] #[turbo_tasks::value(shared, serialization = "auto", task_input)]
#[derive(PartialOrd, Ord, Hash, Copy, Clone, Debug, Default, TaskInput)] #[derive(PartialOrd, Ord, Hash, Copy, Clone, Debug, Default)]
pub struct LightningCssFeatureFlags { pub struct LightningCssFeatureFlags {
pub include: u32, pub include: u32,
pub exclude: u32, pub exclude: u32,
......
...@@ -2,9 +2,7 @@ use anyhow::Result; ...@@ -2,9 +2,7 @@ use anyhow::Result;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use mime_guess::mime::TEXT_HTML_UTF_8; use mime_guess::mime::TEXT_HTML_UTF_8;
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{ use turbo_tasks::{ReadRef, ResolvedVc, TryJoinIterExt, Vc, trace::TraceRawVcs};
NonLocalValue, ReadRef, ResolvedVc, TaskInput, TryJoinIterExt, Vc, trace::TraceRawVcs,
};
use turbo_tasks_fs::{File, FileContent, FileSystemPath}; use turbo_tasks_fs::{File, FileContent, FileSystemPath};
use turbo_tasks_hash::{Xxh3Hash64Hasher, encode_base64}; use turbo_tasks_hash::{Xxh3Hash64Hasher, encode_base64};
use turbopack_core::{ use turbopack_core::{
...@@ -19,9 +17,8 @@ use turbopack_core::{ ...@@ -19,9 +17,8 @@ use turbopack_core::{
version::{Version, VersionedContent}, version::{Version, VersionedContent},
}; };
#[derive( #[turbo_tasks::task_input]
Clone, Debug, Eq, Hash, NonLocalValue, PartialEq, TaskInput, TraceRawVcs, Encode, Decode, #[derive(Clone, Debug, Eq, Hash, PartialEq, TraceRawVcs, Encode, Decode)]
)]
pub struct DevHtmlEntry { pub struct DevHtmlEntry {
pub chunkable_module: ResolvedVc<Box<dyn ChunkableModule>>, pub chunkable_module: ResolvedVc<Box<dyn ChunkableModule>>,
pub module_graph: ResolvedVc<ModuleGraph>, pub module_graph: ResolvedVc<ModuleGraph>,
......
use std::{collections::BTreeMap, hash::Hash, mem::replace, ops::DerefMut}; use std::{collections::BTreeMap, hash::Hash, mem::replace, ops::DerefMut};
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_tasks::{NonLocalValue, TaskInput, trace::TraceRawVcs}; use turbo_tasks::trace::TraceRawVcs;
/// A parsed query string from a http request /// A parsed query string from a http request
#[derive( #[turbo_tasks::task_input]
Clone, #[derive(Clone, Debug, PartialEq, Eq, Default, Hash, TraceRawVcs, Encode, Decode)]
Debug,
PartialEq,
Eq,
Default,
Hash,
TraceRawVcs,
NonLocalValue,
TaskInput,
Encode,
Decode,
)]
pub struct Headers(BTreeMap<String, HeaderValue>); pub struct Headers(BTreeMap<String, HeaderValue>);
/// The value of an http header. HTTP headers might contain non-utf-8 bytes. An /// The value of an http header. HTTP headers might contain non-utf-8 bytes. An
/// header might also occur multiple times. /// header might also occur multiple times.
#[derive( #[turbo_tasks::task_input]
Clone, Debug, PartialEq, Eq, Hash, TraceRawVcs, NonLocalValue, TaskInput, Encode, Decode, #[derive(Clone, Debug, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
)]
pub enum HeaderValue { pub enum HeaderValue {
SingleString(String), SingleString(String),
SingleBytes(Vec<u8>), SingleBytes(Vec<u8>),
......
...@@ -18,7 +18,7 @@ use bincode::{Decode, Encode}; ...@@ -18,7 +18,7 @@ use bincode::{Decode, Encode};
use futures::{TryStreamExt, stream::Stream as StreamTrait}; use futures::{TryStreamExt, stream::Stream as StreamTrait};
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{ use turbo_tasks::{
Completion, NonLocalValue, OperationVc, ResolvedVc, TaskInput, Upcast, Vc, trace::TraceRawVcs, Completion, NonLocalValue, OperationVc, ResolvedVc, Upcast, Vc, trace::TraceRawVcs,
util::SharedError, util::SharedError,
}; };
use turbo_tasks_bytes::{Bytes, Stream, StreamRead}; use turbo_tasks_bytes::{Bytes, Stream, StreamRead};
...@@ -158,19 +158,8 @@ impl HeaderList { ...@@ -158,19 +158,8 @@ impl HeaderList {
/// ///
/// Note that you might not receive information that has not been requested via /// Note that you might not receive information that has not been requested via
/// [`GetContentSourceContent::vary`]. So make sure to request all information that's needed. /// [`GetContentSourceContent::vary`]. So make sure to request all information that's needed.
#[derive( #[turbo_tasks::task_input]
PartialEq, #[derive(PartialEq, Eq, TraceRawVcs, Clone, Debug, Hash, Default, Encode, Decode)]
Eq,
NonLocalValue,
TraceRawVcs,
Clone,
Debug,
Hash,
Default,
TaskInput,
Encode,
Decode,
)]
pub struct ContentSourceData { pub struct ContentSourceData {
/// HTTP method, if requested. /// HTTP method, if requested.
pub method: Option<RcStr>, pub method: Option<RcStr>,
......
...@@ -4,17 +4,16 @@ use anyhow::Result; ...@@ -4,17 +4,16 @@ use anyhow::Result;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{ use turbo_tasks::{
FxIndexMap, NonLocalValue, ReadRef, ResolvedVc, TaskInput, TryJoinIterExt, ValueToString, Vc, FxIndexMap, ReadRef, ResolvedVc, TryJoinIterExt, ValueToString, Vc, fxindexmap,
fxindexmap, trace::TraceRawVcs, trace::TraceRawVcs,
}; };
use crate::source::{GetContentSourceContent, GetContentSourceContents}; use crate::source::{GetContentSourceContent, GetContentSourceContents};
/// The type of the route. This will decide about the remaining segments of the /// The type of the route. This will decide about the remaining segments of the
/// route after the base. /// route after the base.
#[derive( #[turbo_tasks::task_input]
TaskInput, Clone, Debug, PartialEq, Eq, Hash, TraceRawVcs, NonLocalValue, Encode, Decode, #[derive(Clone, Debug, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
)]
pub enum RouteType { pub enum RouteType {
Exact, Exact,
CatchAll, CatchAll,
...@@ -23,9 +22,8 @@ pub enum RouteType { ...@@ -23,9 +22,8 @@ pub enum RouteType {
} }
/// Some normal segment of a route. /// Some normal segment of a route.
#[derive( #[turbo_tasks::task_input]
TaskInput, Clone, Debug, PartialEq, Eq, Hash, TraceRawVcs, NonLocalValue, Encode, Decode, #[derive(Clone, Debug, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
)]
pub enum BaseSegment { pub enum BaseSegment {
Static(RcStr), Static(RcStr),
Dynamic, Dynamic,
......
use serde::Deserialize; use serde::Deserialize;
use turbo_tasks::TaskInput;
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared, task_input)]
#[derive(Debug, Clone, Copy, Hash, TaskInput, Deserialize)] #[derive(Debug, Clone, Copy, Hash, Deserialize)]
pub enum RuntimeType { pub enum RuntimeType {
Development, Development,
Production, Production,
......
use anyhow::Result; use anyhow::Result;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_tasks::{NonLocalValue, ResolvedVc, TaskInput, TryJoinIterExt, Vc, trace::TraceRawVcs}; use turbo_tasks::{ResolvedVc, TryJoinIterExt, Vc, trace::TraceRawVcs};
use turbopack_core::{ use turbopack_core::{
chunk::{ chunk::{
ChunkItemBatchGroup, ChunkItemBatchWithAsyncModuleInfo, ChunkItemOrBatchWithAsyncModuleInfo, ChunkItemBatchGroup, ChunkItemBatchWithAsyncModuleInfo, ChunkItemOrBatchWithAsyncModuleInfo,
...@@ -10,9 +10,8 @@ use turbopack_core::{ ...@@ -10,9 +10,8 @@ use turbopack_core::{
use crate::chunk::EcmascriptChunkItemWithAsyncInfo; use crate::chunk::EcmascriptChunkItemWithAsyncInfo;
#[derive( #[turbo_tasks::task_input]
Debug, Clone, Hash, PartialEq, Eq, TraceRawVcs, NonLocalValue, TaskInput, Encode, Decode, #[derive(Debug, Clone, Hash, PartialEq, Eq, TraceRawVcs, Encode, Decode)]
)]
pub enum EcmascriptChunkItemOrBatchWithAsyncInfo { pub enum EcmascriptChunkItemOrBatchWithAsyncInfo {
ChunkItem(EcmascriptChunkItemWithAsyncInfo), ChunkItem(EcmascriptChunkItemWithAsyncInfo),
Batch(ResolvedVc<EcmascriptChunkBatchWithAsyncInfo>), Batch(ResolvedVc<EcmascriptChunkBatchWithAsyncInfo>),
......
...@@ -6,8 +6,7 @@ use bincode::{Decode, Encode}; ...@@ -6,8 +6,7 @@ use bincode::{Decode, Encode};
use smallvec::SmallVec; use smallvec::SmallVec;
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
NonLocalValue, PrettyPrintError, ResolvedVc, TaskInput, Upcast, ValueToString, Vc, NonLocalValue, PrettyPrintError, ResolvedVc, Upcast, ValueToString, Vc, trace::TraceRawVcs,
trace::TraceRawVcs,
}; };
use turbo_tasks_fs::{FileSystemPath, rope::Rope}; use turbo_tasks_fs::{FileSystemPath, rope::Rope};
use turbopack_core::{ use turbopack_core::{
...@@ -32,19 +31,8 @@ use crate::{ ...@@ -32,19 +31,8 @@ use crate::{
utils::StringifyJs, utils::StringifyJs,
}; };
#[derive( #[turbo_tasks::task_input]
Debug, #[derive(Debug, Clone, PartialEq, Eq, Hash, TraceRawVcs, Default, Encode, Decode)]
Clone,
PartialEq,
Eq,
Hash,
TraceRawVcs,
TaskInput,
NonLocalValue,
Default,
Encode,
Decode,
)]
pub enum RewriteSourcePath { pub enum RewriteSourcePath {
AbsoluteFilePath(FileSystemPath), AbsoluteFilePath(FileSystemPath),
RelativeFilePath(FileSystemPath, RcStr), RelativeFilePath(FileSystemPath, RcStr),
...@@ -227,9 +215,8 @@ pub struct EcmascriptChunkItemOptions { ...@@ -227,9 +215,8 @@ pub struct EcmascriptChunkItemOptions {
pub placeholder_for_future_extensions: (), pub placeholder_for_future_extensions: (),
} }
#[derive( #[turbo_tasks::task_input]
Debug, Clone, PartialEq, Eq, Hash, TraceRawVcs, TaskInput, NonLocalValue, Encode, Decode, #[derive(Debug, Clone, PartialEq, Eq, Hash, TraceRawVcs, Encode, Decode)]
)]
pub struct EcmascriptChunkItemWithAsyncInfo { pub struct EcmascriptChunkItemWithAsyncInfo {
pub chunk_item: ResolvedVc<Box<dyn EcmascriptChunkItem>>, pub chunk_item: ResolvedVc<Box<dyn EcmascriptChunkItem>>,
pub async_info: Option<ResolvedVc<AsyncModuleInfo>>, pub async_info: Option<ResolvedVc<AsyncModuleInfo>>,
......
...@@ -77,9 +77,9 @@ use swc_core::{ ...@@ -77,9 +77,9 @@ use swc_core::{
use tracing::{Instrument, Level, instrument}; use tracing::{Instrument, Level, instrument};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
FxDashMap, FxIndexMap, NonLocalValue, ReadRef, ResolvedVc, SerializationInvalidator, TaskInput, FxDashMap, FxIndexMap, ReadRef, ResolvedVc, SerializationInvalidator, TryJoinIterExt, Upcast,
TryJoinIterExt, Upcast, ValueToString, Vc, get_serialization_invalidator, ValueToString, Vc, get_serialization_invalidator, parking_lot_mutex_bincode,
parking_lot_mutex_bincode, trace::TraceRawVcs, turbofmt, trace::TraceRawVcs, turbofmt,
}; };
use turbo_tasks_fs::{FileJsonContent, FileSystemPath, glob::Glob, rope::Rope}; use turbo_tasks_fs::{FileJsonContent, FileSystemPath, glob::Glob, rope::Rope};
use turbopack_core::{ use turbopack_core::{
...@@ -130,20 +130,9 @@ pub use crate::{ ...@@ -130,20 +130,9 @@ pub use crate::{
}, },
}; };
#[turbo_tasks::task_input]
#[derive( #[derive(
Eq, Eq, PartialEq, Hash, Debug, Clone, Copy, Default, TraceRawVcs, Deserialize, Encode, Decode,
PartialEq,
Hash,
Debug,
Clone,
Copy,
Default,
TaskInput,
TraceRawVcs,
NonLocalValue,
Deserialize,
Encode,
Decode,
)] )]
pub enum SpecifiedModuleType { pub enum SpecifiedModuleType {
#[default] #[default]
...@@ -152,6 +141,7 @@ pub enum SpecifiedModuleType { ...@@ -152,6 +141,7 @@ pub enum SpecifiedModuleType {
EcmaScript, EcmaScript,
} }
#[turbo_tasks::task_input]
#[derive( #[derive(
PartialOrd, PartialOrd,
Ord, Ord,
...@@ -163,9 +153,7 @@ pub enum SpecifiedModuleType { ...@@ -163,9 +153,7 @@ pub enum SpecifiedModuleType {
Copy, Copy,
Default, Default,
Deserialize, Deserialize,
TaskInput,
TraceRawVcs, TraceRawVcs,
NonLocalValue,
Encode, Encode,
Decode, Decode,
)] )]
...@@ -176,6 +164,7 @@ pub enum TreeShakingMode { ...@@ -176,6 +164,7 @@ pub enum TreeShakingMode {
ReexportsOnly, ReexportsOnly,
} }
#[turbo_tasks::task_input]
#[derive( #[derive(
PartialOrd, PartialOrd,
Ord, Ord,
...@@ -187,9 +176,7 @@ pub enum TreeShakingMode { ...@@ -187,9 +176,7 @@ pub enum TreeShakingMode {
Copy, Copy,
Default, Default,
Deserialize, Deserialize,
TaskInput,
TraceRawVcs, TraceRawVcs,
NonLocalValue,
Encode, Encode,
Decode, Decode,
)] )]
...@@ -224,9 +211,8 @@ impl AnalyzeMode { ...@@ -224,9 +211,8 @@ impl AnalyzeMode {
pub struct OptionTreeShaking(pub Option<TreeShakingMode>); pub struct OptionTreeShaking(pub Option<TreeShakingMode>);
/// The constant to replace `typeof window` with. /// The constant to replace `typeof window` with.
#[derive( #[turbo_tasks::task_input]
Copy, Clone, PartialEq, Eq, Debug, Hash, TraceRawVcs, NonLocalValue, TaskInput, Encode, Decode, #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, TraceRawVcs, Encode, Decode)]
)]
pub enum TypeofWindow { pub enum TypeofWindow {
Object, Object,
Undefined, Undefined,
...@@ -273,8 +259,8 @@ pub struct EcmascriptOptions { ...@@ -273,8 +259,8 @@ pub struct EcmascriptOptions {
pub infer_module_side_effects: bool, pub infer_module_side_effects: bool,
} }
#[turbo_tasks::value] #[turbo_tasks::value(task_input)]
#[derive(Hash, Debug, Copy, Clone, TaskInput)] #[derive(Hash, Debug, Copy, Clone)]
pub enum EcmascriptModuleAssetType { pub enum EcmascriptModuleAssetType {
/// Module with EcmaScript code /// Module with EcmaScript code
Ecmascript, Ecmascript,
...@@ -988,7 +974,7 @@ pub struct EcmascriptModuleContent { ...@@ -988,7 +974,7 @@ pub struct EcmascriptModuleContent {
} }
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
#[derive(Clone, Debug, Hash, TaskInput)] #[derive(Clone, Debug, Hash)]
pub struct EcmascriptModuleContentOptions { pub struct EcmascriptModuleContentOptions {
module: ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>, module: ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>,
parsed: Option<ResolvedVc<ParseResult>>, parsed: Option<ResolvedVc<ParseResult>>,
......
...@@ -5,8 +5,7 @@ use swc_core::{ ...@@ -5,8 +5,7 @@ use swc_core::{
quote, quote,
}; };
use turbo_tasks::{ use turbo_tasks::{
NonLocalValue, ResolvedVc, TaskInput, ValueToString, Vc, debug::ValueDebugFormat, NonLocalValue, ResolvedVc, ValueToString, Vc, debug::ValueDebugFormat, trace::TraceRawVcs,
trace::TraceRawVcs,
}; };
use turbopack_core::{ use turbopack_core::{
chunk::{ChunkingContext, ChunkingType, ModuleChunkItemIdExt}, chunk::{ChunkingContext, ChunkingType, ModuleChunkItemIdExt},
...@@ -33,9 +32,8 @@ use crate::{ ...@@ -33,9 +32,8 @@ use crate::{
/// Determines how to treat `new URL(...)` rewrites. /// Determines how to treat `new URL(...)` rewrites.
/// This allows to construct url depends on the different building context, /// This allows to construct url depends on the different building context,
/// e.g. SSR, CSR, or Node.js. /// e.g. SSR, CSR, or Node.js.
#[derive( #[turbo_tasks::task_input]
Copy, Clone, Debug, Eq, PartialEq, Hash, TraceRawVcs, TaskInput, NonLocalValue, Encode, Decode, #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, TraceRawVcs, Encode, Decode)]
)]
pub enum UrlRewriteBehavior { pub enum UrlRewriteBehavior {
/// Omits base, resulting in a relative URL. /// Omits base, resulting in a relative URL.
Relative, Relative,
......
...@@ -3,9 +3,7 @@ use std::{borrow::Cow, fmt::Display, io::Write}; ...@@ -3,9 +3,7 @@ use std::{borrow::Cow, fmt::Display, io::Write};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{ResolvedVc, TryJoinIterExt, ValueToStringRef, Vc, trace::TraceRawVcs};
NonLocalValue, ResolvedVc, TaskInput, TryJoinIterExt, ValueToStringRef, Vc, trace::TraceRawVcs,
};
use turbo_tasks_fs::{FileSystem, FileSystemPath, LinkType, VirtualFileSystem, rope::RopeBuilder}; use turbo_tasks_fs::{FileSystem, FileSystemPath, LinkType, VirtualFileSystem, rope::RopeBuilder};
use turbo_tasks_hash::{encode_hex, hash_xxh3_hash64}; use turbo_tasks_hash::{encode_hex, hash_xxh3_hash64};
use turbopack_core::{ use turbopack_core::{
...@@ -43,9 +41,8 @@ use crate::{ ...@@ -43,9 +41,8 @@ use crate::{
utils::StringifyJs, utils::StringifyJs,
}; };
#[derive( #[turbo_tasks::task_input]
Copy, Clone, Debug, Eq, PartialEq, TraceRawVcs, TaskInput, Hash, NonLocalValue, Encode, Decode, #[derive(Copy, Clone, Debug, Eq, PartialEq, TraceRawVcs, Hash, Encode, Decode)]
)]
pub enum CachedExternalType { pub enum CachedExternalType {
CommonJs, CommonJs,
EcmaScriptViaRequire, EcmaScriptViaRequire,
...@@ -54,9 +51,8 @@ pub enum CachedExternalType { ...@@ -54,9 +51,8 @@ pub enum CachedExternalType {
Script, Script,
} }
#[derive( #[turbo_tasks::task_input]
Clone, Debug, Eq, PartialEq, TraceRawVcs, TaskInput, Hash, NonLocalValue, Encode, Decode, #[derive(Clone, Debug, Eq, PartialEq, TraceRawVcs, Hash, Encode, Decode)]
)]
/// Whether to add a traced reference to the external module using the given context and resolve /// Whether to add a traced reference to the external module using the given context and resolve
/// origin. /// origin.
pub enum CachedExternalTracingMode { pub enum CachedExternalTracingMode {
......
...@@ -12,7 +12,7 @@ use swc_core::{ ...@@ -12,7 +12,7 @@ use swc_core::{
}; };
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
FxIndexMap, NonLocalValue, ResolvedVc, TaskInput, TryJoinIterExt, Vc, debug::ValueDebugFormat, FxIndexMap, NonLocalValue, ResolvedVc, TryJoinIterExt, Vc, debug::ValueDebugFormat,
trace::TraceRawVcs, trace::TraceRawVcs,
}; };
use turbopack_core::{ use turbopack_core::{
...@@ -88,9 +88,8 @@ pub(crate) enum PatternMapping { ...@@ -88,9 +88,8 @@ pub(crate) enum PatternMapping {
Map(#[bincode(with = "turbo_bincode::indexmap")] FxIndexMap<RcStr, SinglePatternMapping>), Map(#[bincode(with = "turbo_bincode::indexmap")] FxIndexMap<RcStr, SinglePatternMapping>),
} }
#[derive( #[turbo_tasks::task_input]
Copy, Clone, Debug, Eq, PartialEq, Hash, TraceRawVcs, TaskInput, NonLocalValue, Encode, Decode, #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, TraceRawVcs, Encode, Decode)]
)]
pub(crate) enum ResolveType { pub(crate) enum ResolveType {
AsyncChunkLoader, AsyncChunkLoader,
ChunkItem, ChunkItem,
......
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{NonLocalValue, TaskInput, trace::TraceRawVcs}; use turbo_tasks::trace::TraceRawVcs;
use turbopack_core::reference_type::{ReferenceType, WorkerReferenceSubType}; use turbopack_core::reference_type::{ReferenceType, WorkerReferenceSubType};
#[derive( #[turbo_tasks::task_input]
Debug, Clone, Copy, Hash, PartialEq, Eq, Encode, Decode, TraceRawVcs, NonLocalValue, TaskInput, #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Encode, Decode, TraceRawVcs)]
)]
pub enum WorkerType { pub enum WorkerType {
WebWorker, WebWorker,
SharedWebWorker, SharedWebWorker,
......
...@@ -9,8 +9,8 @@ use serde::{Deserialize, Serialize, de::DeserializeOwned}; ...@@ -9,8 +9,8 @@ use serde::{Deserialize, Serialize, de::DeserializeOwned};
use serde_json::Value as JsonValue; use serde_json::Value as JsonValue;
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
Completion, FxIndexMap, NonLocalValue, OperationVc, PrettyPrintError, ResolvedVc, TaskInput, Completion, FxIndexMap, OperationVc, PrettyPrintError, ResolvedVc, TryJoinIterExt,
TryJoinIterExt, ValueToString, Vc, duration_span, fxindexmap, mark_top_level_task, ValueToString, Vc, duration_span, fxindexmap, mark_top_level_task,
parallel::available_parallelism, take_effects, trace::TraceRawVcs, parallel::available_parallelism, take_effects, trace::TraceRawVcs,
}; };
use turbo_tasks_env::{EnvMap, ProcessEnv}; use turbo_tasks_env::{EnvMap, ProcessEnv};
...@@ -206,9 +206,8 @@ async fn create_evaluate_pool_assets_operation( ...@@ -206,9 +206,8 @@ async fn create_evaluate_pool_assets_operation(
Ok(*assets) Ok(*assets)
} }
#[derive( #[turbo_tasks::task_input]
Clone, Copy, Hash, Debug, PartialEq, Eq, TaskInput, NonLocalValue, TraceRawVcs, Encode, Decode, #[derive(Clone, Copy, Hash, Debug, PartialEq, Eq, TraceRawVcs, Encode, Decode)]
)]
pub enum EnvVarTracking { pub enum EnvVarTracking {
WholeEnvTracked, WholeEnvTracked,
Untracked, Untracked,
......
...@@ -4,8 +4,7 @@ use indoc::formatdoc; ...@@ -4,8 +4,7 @@ use indoc::formatdoc;
use serde::Deserialize; use serde::Deserialize;
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
Completion, Completions, NonLocalValue, ResolvedVc, TaskInput, TryFlatJoinIterExt, Vc, Completion, Completions, ResolvedVc, TryFlatJoinIterExt, Vc, fxindexmap, trace::TraceRawVcs,
fxindexmap, trace::TraceRawVcs,
}; };
use turbo_tasks_fs::{ use turbo_tasks_fs::{
File, FileContent, FileSystemEntryType, FileSystemPath, json::parse_json_with_source_context, File, FileContent, FileSystemEntryType, FileSystemPath, json::parse_json_with_source_context,
...@@ -45,20 +44,8 @@ struct PostCssProcessingResult { ...@@ -45,20 +44,8 @@ struct PostCssProcessingResult {
assets: Option<Vec<EmittedAsset>>, assets: Option<Vec<EmittedAsset>>,
} }
#[derive( #[turbo_tasks::task_input]
Default, #[derive(Default, Copy, Clone, PartialEq, Eq, Hash, Debug, TraceRawVcs, Encode, Decode)]
Copy,
Clone,
PartialEq,
Eq,
Hash,
Debug,
TraceRawVcs,
TaskInput,
NonLocalValue,
Encode,
Decode,
)]
pub enum PostCssConfigLocation { pub enum PostCssConfigLocation {
/// Searches for postcss config only starting from the project root directory. /// Searches for postcss config only starting from the project root directory.
/// Used for foreign code (node_modules) where per-directory configs should be ignored. /// Used for foreign code (node_modules) where per-directory configs should be ignored.
......
...@@ -12,8 +12,8 @@ use serde_with::serde_as; ...@@ -12,8 +12,8 @@ use serde_with::serde_as;
use tracing::Instrument; use tracing::Instrument;
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
Completion, OperationVc, ReadRef, ResolvedVc, TaskInput, TryJoinIterExt, ValueToString, Completion, OperationVc, ReadRef, ResolvedVc, TryJoinIterExt, ValueToString, ValueToStringRef,
ValueToStringRef, Vc, trace::TraceRawVcs, Vc, trace::TraceRawVcs,
}; };
use turbo_tasks_env::ProcessEnv; use turbo_tasks_env::ProcessEnv;
use turbo_tasks_fs::{ use turbo_tasks_fs::{
...@@ -437,9 +437,8 @@ pub enum InfoMessage { ...@@ -437,9 +437,8 @@ pub enum InfoMessage {
}, },
} }
#[derive( #[turbo_tasks::task_input]
Debug, Clone, TaskInput, Hash, PartialEq, Eq, Deserialize, TraceRawVcs, Encode, Decode, #[derive(Debug, Clone, Hash, PartialEq, Eq, Deserialize, TraceRawVcs, Encode, Decode)]
)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct WebpackResolveOptions { pub struct WebpackResolveOptions {
alias_fields: Option<Vec<RcStr>>, alias_fields: Option<Vec<RcStr>>,
...@@ -495,7 +494,8 @@ pub enum ResponseMessage { ...@@ -495,7 +494,8 @@ pub enum ResponseMessage {
}, },
} }
#[derive(Clone, PartialEq, Eq, Hash, TaskInput, Debug, TraceRawVcs, Encode, Decode)] #[turbo_tasks::task_input]
#[derive(Clone, PartialEq, Eq, Hash, Debug, TraceRawVcs, Encode, Decode)]
pub struct WebpackLoaderContext { pub struct WebpackLoaderContext {
pub entries: ResolvedVc<EvaluateEntries>, pub entries: ResolvedVc<EvaluateEntries>,
pub cwd: FileSystemPath, pub cwd: FileSystemPath,
......
...@@ -14,8 +14,8 @@ use serde::Deserialize; ...@@ -14,8 +14,8 @@ use serde::Deserialize;
use tracing_subscriber::{Registry, layer::SubscriberExt, util::SubscriberInitExt}; use tracing_subscriber::{Registry, layer::SubscriberExt, util::SubscriberInitExt};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
Completion, Effects, NonLocalValue, OperationVc, ReadRef, ResolvedVc, TaskInput, TurboTasks, Completion, Effects, NonLocalValue, OperationVc, ReadRef, ResolvedVc, TurboTasks, Vc,
Vc, debug::ValueDebugFormat, fxindexmap, take_effects, trace::TraceRawVcs, debug::ValueDebugFormat, fxindexmap, take_effects, trace::TraceRawVcs,
}; };
use turbo_tasks_backend::{BackendOptions, TurboTasksBackend, noop_backing_storage}; use turbo_tasks_backend::{BackendOptions, TurboTasksBackend, noop_backing_storage};
use turbo_tasks_env::CommandLineProcessEnv; use turbo_tasks_env::CommandLineProcessEnv;
...@@ -81,8 +81,8 @@ struct JsResult { ...@@ -81,8 +81,8 @@ struct JsResult {
jest_result: JestRunResult, jest_result: JestRunResult,
} }
#[turbo_tasks::value] #[turbo_tasks::value(task_input)]
#[derive(Copy, Clone, Debug, Hash, TaskInput)] #[derive(Copy, Clone, Debug, Hash)]
enum IssueSnapshotMode { enum IssueSnapshotMode {
Snapshots, Snapshots,
NoSnapshots, NoSnapshots,
......
use anyhow::Result; use anyhow::Result;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{NonLocalValue, ResolvedVc, TaskInput, Vc, trace::TraceRawVcs}; use turbo_tasks::{ResolvedVc, Vc, trace::TraceRawVcs};
use turbo_tasks_fs::{File, FileContent}; use turbo_tasks_fs::{File, FileContent};
use turbopack_core::{ use turbopack_core::{
asset::{Asset, AssetContent}, asset::{Asset, AssetContent},
...@@ -9,21 +9,8 @@ use turbopack_core::{ ...@@ -9,21 +9,8 @@ use turbopack_core::{
source::Source, source::Source,
}; };
#[derive( #[turbo_tasks::task_input]
PartialOrd, #[derive(PartialOrd, Ord, Eq, PartialEq, Hash, Debug, Copy, Clone, TraceRawVcs, Encode, Decode)]
Ord,
Eq,
PartialEq,
Hash,
Debug,
Copy,
Clone,
TaskInput,
TraceRawVcs,
NonLocalValue,
Encode,
Decode,
)]
pub enum WebAssemblySourceType { pub enum WebAssemblySourceType {
/// Binary WebAssembly files (.wasm). /// Binary WebAssembly files (.wasm).
Binary, Binary,
......
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