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

Delete some dead turbo task functions (#92596)

Removes a handful of dead code discovered while exploring deletion of the `ValueDefault` trait. That larger change turned out not to be worth it from a binary size perspective, so it was backed out — but the dead code found along the way is worth keeping.

**Removed:**
- `impl ValueDefault for VersionedContentMap` (not tagged with `#[turbo_tasks::value_impl]`, never a turbo-tasks singleton)
- `impl ValueDefault for Body` in `turbopack-dev-server` (same — plain Rust impl, no callers via `Vc::default()`)
- `EmotionTransformConfig::default_private()` and `impl ValueDefault for EmotionTransformConfig` (unused)
- `StyledComponentsTransformConfig::default_private()` and `impl ValueDefault for StyledComponentsTransformConfig` (unused)
- `EmittedEvaluatePoolAssetsWithEffects` struct in `evaluate.rs` (defined but never referenced)
- `OutputAsset::size_bytes()` default trait method (no call sites)

<!-- NEXT_JS_LLM_PR -->
parent 2f7f4d7d
...@@ -1707,7 +1707,7 @@ impl Project { ...@@ -1707,7 +1707,7 @@ impl Project {
/// Emit a telemetry event corresponding to [webpack configuration telemetry](https://github.com/vercel/next.js/blob/9da305fe320b89ee2f8c3cfb7ecbf48856368913/packages/next/src/build/webpack-config.ts#L2516) /// Emit a telemetry event corresponding to [webpack configuration telemetry](https://github.com/vercel/next.js/blob/9da305fe320b89ee2f8c3cfb7ecbf48856368913/packages/next/src/build/webpack-config.ts#L2516)
/// to detect which feature is enabled. /// to detect which feature is enabled.
#[turbo_tasks::function] #[turbo_tasks::function]
async fn collect_project_feature_telemetry(self: Vc<Self>) -> Result<Vc<()>> { async fn collect_project_feature_telemetry(self: Vc<Self>) -> Result<()> {
let emit_event = |feature_name: &str, enabled: bool| { let emit_event = |feature_name: &str, enabled: bool| {
NextFeatureTelemetry::new(feature_name.into(), enabled) NextFeatureTelemetry::new(feature_name.into(), enabled)
.resolved_cell() .resolved_cell()
...@@ -1778,7 +1778,7 @@ impl Project { ...@@ -1778,7 +1778,7 @@ impl Project {
emit_event("swcRemoveConsole", remove_console_enabled); emit_event("swcRemoveConsole", remove_console_enabled);
emit_event("swcEmotion", emotion_enabled); emit_event("swcEmotion", emotion_enabled);
Ok(Default::default()) Ok(())
} }
/// Scans the app/pages directories for entry points files (matching the /// Scans the app/pages directories for entry points files (matching the
......
...@@ -5,7 +5,7 @@ use rustc_hash::{FxHashMap, FxHashSet}; ...@@ -5,7 +5,7 @@ use rustc_hash::{FxHashMap, FxHashSet};
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{ use turbo_tasks::{
FxIndexSet, NonLocalValue, OperationValue, OperationVc, ResolvedVc, State, TryFlatJoinIterExt, FxIndexSet, NonLocalValue, OperationValue, OperationVc, ResolvedVc, State, TryFlatJoinIterExt,
TryJoinIterExt, ValueDefault, Vc, debug::ValueDebugFormat, trace::TraceRawVcs, turbobail, TryJoinIterExt, Vc, debug::ValueDebugFormat, trace::TraceRawVcs, turbobail,
}; };
use turbo_tasks_fs::{FileContent, FileSystemPath}; use turbo_tasks_fs::{FileContent, FileSystemPath};
use turbopack_core::{ use turbopack_core::{
...@@ -74,12 +74,6 @@ pub struct VersionedContentMap { ...@@ -74,12 +74,6 @@ pub struct VersionedContentMap {
map_op_to_compute_entry: State<OutputOperationToComputeEntry>, map_op_to_compute_entry: State<OutputOperationToComputeEntry>,
} }
impl ValueDefault for VersionedContentMap {
fn value_default() -> Vc<Self> {
*VersionedContentMap::new()
}
}
impl VersionedContentMap { impl VersionedContentMap {
// NOTE(alexkirsz) This must not be a `#[turbo_tasks::function]` because it // NOTE(alexkirsz) This must not be a `#[turbo_tasks::function]` because it
// should be a singleton for each project. // should be a singleton for each project.
......
...@@ -228,5 +228,5 @@ async fn collect_direct_exports(module: Vc<Box<dyn Module>>) -> Result<Vc<Vec<Rc ...@@ -228,5 +228,5 @@ async fn collect_direct_exports(module: Vc<Box<dyn Module>>) -> Result<Vc<Vec<Rc
return Ok(Vc::cell(exports.exports.keys().cloned().collect())); return Ok(Vc::cell(exports.exports.keys().cloned().collect()));
} }
Ok(Vc::cell(Vec::new())) Ok(Default::default())
} }
...@@ -55,9 +55,9 @@ async fn main() -> Result<()> { ...@@ -55,9 +55,9 @@ async fn main() -> Result<()> {
} }
#[turbo_tasks::function] #[turbo_tasks::function]
async fn print_hash(dir_hash: Vc<RcStr>) -> Result<Vc<()>> { async fn print_hash(dir_hash: Vc<RcStr>) -> Result<()> {
println!("DIR HASH: {}", dir_hash.await?.as_str()); println!("DIR HASH: {}", dir_hash.await?.as_str());
Ok(Default::default()) Ok(())
} }
async fn filename(path: FileSystemPath) -> Result<String> { async fn filename(path: FileSystemPath) -> Result<String> {
......
...@@ -63,9 +63,9 @@ pub fn empty_string() -> Vc<RcStr> { ...@@ -63,9 +63,9 @@ pub fn empty_string() -> Vc<RcStr> {
} }
#[turbo_tasks::function] #[turbo_tasks::function]
async fn print_hash(dir_hash: Vc<RcStr>) -> Result<Vc<()>> { async fn print_hash(dir_hash: Vc<RcStr>) -> Result<()> {
println!("DIR HASH: {}", dir_hash.await?.as_str()); println!("DIR HASH: {}", dir_hash.await?.as_str());
Ok(Default::default()) Ok(())
} }
#[turbo_tasks::function] #[turbo_tasks::function]
......
...@@ -2724,14 +2724,10 @@ impl FileSystem for NullFileSystem { ...@@ -2724,14 +2724,10 @@ impl FileSystem for NullFileSystem {
} }
#[turbo_tasks::function] #[turbo_tasks::function]
fn write(&self, _fs_path: FileSystemPath, _content: Vc<FileContent>) -> Vc<()> { fn write(&self, _fs_path: FileSystemPath, _content: Vc<FileContent>) {}
Vc::default()
}
#[turbo_tasks::function] #[turbo_tasks::function]
fn write_link(&self, _fs_path: FileSystemPath, _target: Vc<LinkContent>) -> Vc<()> { fn write_link(&self, _fs_path: FileSystemPath, _target: Vc<LinkContent>) {}
Vc::default()
}
#[turbo_tasks::function] #[turbo_tasks::function]
fn metadata(&self, _fs_path: FileSystemPath) -> Vc<FileMeta> { fn metadata(&self, _fs_path: FileSystemPath) -> Vc<FileMeta> {
......
use anyhow::{Result, bail}; use anyhow::{Result, bail};
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ValueDefault, ValueToString, Vc}; use turbo_tasks::{ValueToString, Vc};
use crate::{FileContent, FileMeta, FileSystem, FileSystemPath, LinkContent, RawDirectoryContent}; use crate::{FileContent, FileMeta, FileSystem, FileSystemPath, LinkContent, RawDirectoryContent};
...@@ -39,12 +39,6 @@ impl VirtualFileSystem { ...@@ -39,12 +39,6 @@ impl VirtualFileSystem {
} }
} }
impl ValueDefault for VirtualFileSystem {
fn value_default() -> Vc<Self> {
Self::new()
}
}
#[turbo_tasks::value_impl] #[turbo_tasks::value_impl]
impl FileSystem for VirtualFileSystem { impl FileSystem for VirtualFileSystem {
#[turbo_tasks::function] #[turbo_tasks::function]
......
...@@ -128,11 +128,6 @@ impl OutputAsset for EcmascriptBrowserChunk { ...@@ -128,11 +128,6 @@ impl OutputAsset for EcmascriptBrowserChunk {
.chunking_context .chunking_context
.chunk_path(Some(Vc::upcast(self)), ident, None, rcstr!(".js"))) .chunk_path(Some(Vc::upcast(self)), ident, None, rcstr!(".js")))
} }
#[turbo_tasks::function]
fn size_bytes(self: Vc<Self>) -> Vc<Option<u64>> {
self.own_content().content().len()
}
} }
#[turbo_tasks::value_impl] #[turbo_tasks::value_impl]
......
...@@ -196,7 +196,7 @@ async fn build_internal( ...@@ -196,7 +196,7 @@ async fn build_internal(
minify_type: MinifyType, minify_type: MinifyType,
target: Target, target: Target,
scope_hoist: bool, scope_hoist: bool,
) -> Result<Vc<()>> { ) -> Result<()> {
let output_fs = output_fs(project_dir.clone()); let output_fs = output_fs(project_dir.clone());
const OUTPUT_DIR: &str = "dist"; const OUTPUT_DIR: &str = "dist";
let project_relative = project_dir.strip_prefix(&*root_dir).unwrap(); let project_relative = project_dir.strip_prefix(&*root_dir).unwrap();
...@@ -518,7 +518,7 @@ async fn build_internal( ...@@ -518,7 +518,7 @@ async fn build_internal(
.try_join() .try_join()
.await?; .await?;
Ok(Default::default()) Ok(())
} }
pub async fn build(args: &BuildArguments) -> Result<()> { pub async fn build(args: &BuildArguments) -> Result<()> {
......
...@@ -113,7 +113,7 @@ impl Environment { ...@@ -113,7 +113,7 @@ impl Environment {
// browserslist correctly because CSS Modules in client components is double-processed, // browserslist correctly because CSS Modules in client components is double-processed,
// once for server once for browser. // once for server once for browser.
{ {
Vc::cell(rcstr!("")) Vc::default()
} }
ExecutionEnvironment::Browser(browser_env) => { ExecutionEnvironment::Browser(browser_env) => {
Vc::cell(browser_env.await?.browserslist_query.clone()) Vc::cell(browser_env.await?.browserslist_query.clone())
......
...@@ -43,11 +43,6 @@ pub trait OutputAsset: Asset + OutputAssetsReference { ...@@ -43,11 +43,6 @@ pub trait OutputAsset: Asset + OutputAssetsReference {
fn path_string(self: Vc<Self>) -> Vc<RcStr> { fn path_string(self: Vc<Self>) -> Vc<RcStr> {
self.path().to_string() self.path().to_string()
} }
#[turbo_tasks::function]
fn size_bytes(self: Vc<Self>) -> Vc<Option<u64>> {
Vc::cell(None)
}
} }
#[turbo_tasks::value(transparent)] #[turbo_tasks::value(transparent)]
......
...@@ -18,8 +18,8 @@ use bincode::{Decode, Encode}; ...@@ -18,8 +18,8 @@ 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, ValueDefault, Vc, Completion, NonLocalValue, OperationVc, ResolvedVc, TaskInput, Upcast, Vc, trace::TraceRawVcs,
trace::TraceRawVcs, util::SharedError, util::SharedError,
}; };
use turbo_tasks_bytes::{Bytes, Stream, StreamRead}; use turbo_tasks_bytes::{Bytes, Stream, StreamRead};
use turbo_tasks_fs::FileSystemPath; use turbo_tasks_fs::FileSystemPath;
...@@ -233,12 +233,6 @@ impl<T: Into<Bytes>> From<T> for Body { ...@@ -233,12 +233,6 @@ impl<T: Into<Bytes>> From<T> for Body {
} }
} }
impl ValueDefault for Body {
fn value_default() -> Vc<Self> {
Body::default().cell()
}
}
/// Filter function that describes which information is required. /// Filter function that describes which information is required.
#[derive(Debug, Clone, PartialEq, Eq, TraceRawVcs, Hash, NonLocalValue, Encode, Decode)] #[derive(Debug, Clone, PartialEq, Eq, TraceRawVcs, Hash, NonLocalValue, Encode, Decode)]
pub enum ContentSourceDataFilter { pub enum ContentSourceDataFilter {
......
...@@ -84,20 +84,6 @@ pub struct EmotionTransformConfig { ...@@ -84,20 +84,6 @@ pub struct EmotionTransformConfig {
pub import_map: Option<IndexMap<RcStr, EmotionImportMapValue, FxBuildHasher>>, pub import_map: Option<IndexMap<RcStr, EmotionImportMapValue, FxBuildHasher>>,
} }
#[turbo_tasks::value_impl]
impl EmotionTransformConfig {
#[turbo_tasks::function]
pub fn default_private() -> Vc<Self> {
Self::cell(Default::default())
}
}
impl ValueDefault for EmotionTransformConfig {
fn value_default() -> Vc<Self> {
EmotionTransformConfig::default_private()
}
}
#[derive(Debug)] #[derive(Debug)]
pub struct EmotionTransformer { pub struct EmotionTransformer {
#[cfg(feature = "transform_emotion")] #[cfg(feature = "transform_emotion")]
......
...@@ -2,7 +2,6 @@ use anyhow::Result; ...@@ -2,7 +2,6 @@ use anyhow::Result;
use async_trait::async_trait; use async_trait::async_trait;
use serde::Deserialize; use serde::Deserialize;
use swc_core::{atoms::Wtf8Atom, common::comments::NoopComments, ecma::ast::Program}; use swc_core::{atoms::Wtf8Atom, common::comments::NoopComments, ecma::ast::Program};
use turbo_tasks::{ValueDefault, Vc};
use turbopack_ecmascript::{CustomTransformer, TransformContext}; use turbopack_ecmascript::{CustomTransformer, TransformContext};
#[turbo_tasks::value(shared, operation)] #[turbo_tasks::value(shared, operation)]
...@@ -32,20 +31,6 @@ impl Default for StyledComponentsTransformConfig { ...@@ -32,20 +31,6 @@ impl Default for StyledComponentsTransformConfig {
} }
} }
#[turbo_tasks::value_impl]
impl StyledComponentsTransformConfig {
#[turbo_tasks::function]
fn default_private() -> Vc<Self> {
Self::cell(Default::default())
}
}
impl ValueDefault for StyledComponentsTransformConfig {
fn value_default() -> Vc<Self> {
StyledComponentsTransformConfig::default_private()
}
}
#[derive(Debug)] #[derive(Debug)]
pub struct StyledComponentsTransformer { pub struct StyledComponentsTransformer {
config: styled_components::Config, config: styled_components::Config,
......
...@@ -7,7 +7,7 @@ use async_trait::async_trait; ...@@ -7,7 +7,7 @@ use async_trait::async_trait;
use mdxjs::{MdxParseOptions, Options, compile}; use mdxjs::{MdxParseOptions, Options, compile};
use serde::Deserialize; use serde::Deserialize;
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ResolvedVc, ValueDefault, Vc}; use turbo_tasks::{ResolvedVc, Vc};
use turbo_tasks_fs::{File, FileContent, FileSystemPath, rope::Rope}; use turbo_tasks_fs::{File, FileContent, FileSystemPath, rope::Rope};
use turbopack_core::{ use turbopack_core::{
asset::{Asset, AssetContent}, asset::{Asset, AssetContent},
...@@ -59,20 +59,6 @@ impl Default for MdxTransformOptions { ...@@ -59,20 +59,6 @@ impl Default for MdxTransformOptions {
} }
} }
#[turbo_tasks::value_impl]
impl MdxTransformOptions {
#[turbo_tasks::function]
fn default_private() -> Vc<Self> {
Self::cell(Default::default())
}
}
impl ValueDefault for MdxTransformOptions {
fn value_default() -> Vc<Self> {
Self::default_private()
}
}
#[turbo_tasks::value] #[turbo_tasks::value]
pub struct MdxTransform { pub struct MdxTransform {
options: ResolvedVc<MdxTransformOptions>, options: ResolvedVc<MdxTransformOptions>,
......
...@@ -9,9 +9,9 @@ use serde::{Deserialize, Serialize, de::DeserializeOwned}; ...@@ -9,9 +9,9 @@ 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, ReadRef, ResolvedVc, Completion, FxIndexMap, NonLocalValue, OperationVc, PrettyPrintError, ResolvedVc, TaskInput,
TaskInput, TryJoinIterExt, ValueToString, Vc, duration_span, fxindexmap, TryJoinIterExt, ValueToString, Vc, duration_span, fxindexmap, mark_session_dependent,
mark_session_dependent, mark_top_level_task, take_effects, trace::TraceRawVcs, mark_top_level_task, take_effects, trace::TraceRawVcs,
}; };
use turbo_tasks_env::{EnvMap, ProcessEnv}; use turbo_tasks_env::{EnvMap, ProcessEnv};
use turbo_tasks_fs::{File, FileContent, FileSystemPath, to_sys_path}; use turbo_tasks_fs::{File, FileContent, FileSystemPath, to_sys_path};
...@@ -178,11 +178,6 @@ async fn emit_evaluate_pool_assets_operation( ...@@ -178,11 +178,6 @@ async fn emit_evaluate_pool_assets_operation(
.cell()) .cell())
} }
#[turbo_tasks::value(serialization = "none")]
struct EmittedEvaluatePoolAssetsWithEffects {
assets: ReadRef<EmittedEvaluatePoolAssets>,
}
#[turbo_tasks::function(operation)] #[turbo_tasks::function(operation)]
async fn create_evaluate_pool_assets_operation( async fn create_evaluate_pool_assets_operation(
entries: ResolvedVc<EvaluateEntries>, entries: ResolvedVc<EvaluateEntries>,
......
...@@ -633,7 +633,7 @@ async fn run_test_operation(prepared_test: ResolvedVc<PreparedTest>) -> Result<V ...@@ -633,7 +633,7 @@ async fn run_test_operation(prepared_test: ResolvedVc<PreparedTest>) -> Result<V
async fn snapshot_issues( async fn snapshot_issues(
prepared_test: Vc<PreparedTest>, prepared_test: Vc<PreparedTest>,
run_result_op: OperationVc<RunTestResult>, run_result_op: OperationVc<RunTestResult>,
) -> Result<Vc<()>> { ) -> Result<()> {
let PreparedTest { path, .. } = &*prepared_test.await?; let PreparedTest { path, .. } = &*prepared_test.await?;
let _ = run_result_op.resolve().strongly_consistent().await; let _ = run_result_op.resolve().strongly_consistent().await;
...@@ -646,5 +646,5 @@ async fn snapshot_issues( ...@@ -646,5 +646,5 @@ async fn snapshot_issues(
.await .await
.context("Unable to handle issues")?; .context("Unable to handle issues")?;
Ok(Default::default()) Ok(())
} }
...@@ -1225,11 +1225,11 @@ pub async fn emit_assets_into_dir( ...@@ -1225,11 +1225,11 @@ pub async fn emit_assets_into_dir(
pub async fn emit_assets_into_dir_operation( pub async fn emit_assets_into_dir_operation(
assets: ResolvedVc<ExpandedOutputAssets>, assets: ResolvedVc<ExpandedOutputAssets>,
output_dir: FileSystemPath, output_dir: FileSystemPath,
) -> Result<Vc<()>> { ) -> Result<()> {
emit_assets_into_dir(*assets, output_dir) emit_assets_into_dir(*assets, output_dir)
.as_side_effect() .as_side_effect()
.await?; .await?;
Ok(Vc::cell(())) Ok(())
} }
/// Replaces the externals in the result with `ExternalModuleAsset` instances. /// Replaces the externals in the result with `ExternalModuleAsset` instances.
......
...@@ -174,14 +174,6 @@ pub struct DecoratorsOptions { ...@@ -174,14 +174,6 @@ pub struct DecoratorsOptions {
pub use_define_for_class_fields: bool, pub use_define_for_class_fields: bool,
} }
#[turbo_tasks::value_impl]
impl ValueDefault for DecoratorsOptions {
#[turbo_tasks::function]
fn value_default() -> Vc<Self> {
Self::default().cell()
}
}
/// Subset of Typescript options configured via tsconfig.json or jsconfig.json, /// Subset of Typescript options configured via tsconfig.json or jsconfig.json,
/// which affects the runtime transform output. /// which affects the runtime transform output.
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
...@@ -191,14 +183,6 @@ pub struct TypescriptTransformOptions { ...@@ -191,14 +183,6 @@ pub struct TypescriptTransformOptions {
pub verbatim_module_syntax: bool, pub verbatim_module_syntax: bool,
} }
#[turbo_tasks::value_impl]
impl ValueDefault for TypescriptTransformOptions {
#[turbo_tasks::function]
fn value_default() -> Vc<Self> {
Self::default().cell()
}
}
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
#[derive(Default, Clone, Debug)] #[derive(Default, Clone, Debug)]
pub struct JsxTransformOptions { pub struct JsxTransformOptions {
......
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