From 3439cf3bfe9fdd47d6f0e86c4b61ca33c3082589 Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Mon, 14 Aug 2023 21:56:11 -0400 Subject: [PATCH 1/2] Add a FileSystemPathOption::none for cached cell reuse --- crates/turbo-tasks-fs/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/turbo-tasks-fs/src/lib.rs b/crates/turbo-tasks-fs/src/lib.rs index 1e866d636c199..1a5b819d0afae 100644 --- a/crates/turbo-tasks-fs/src/lib.rs +++ b/crates/turbo-tasks-fs/src/lib.rs @@ -1021,6 +1021,14 @@ impl FileSystemPath { #[turbo_tasks::value(transparent)] pub struct FileSystemPathOption(Option>); +#[turbo_tasks::value_impl] +impl FileSystemPathOption { + #[turbo_tasks::function] + pub fn none() -> Vc { + Vc::cell(None) + } +} + #[turbo_tasks::value_impl] impl FileSystemPath { /// Create a new Vc from a path withing a FileSystem. The From b8151c2f8323eb637b317f4847830026c35c7739 Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Mon, 14 Aug 2023 22:19:20 -0400 Subject: [PATCH 2/2] Use FileSystemPathOption::none() --- crates/turbo-tasks-fs/src/lib.rs | 4 ++-- crates/turbopack-css/src/chunk/mod.rs | 2 +- crates/turbopack-ecmascript/src/chunk/mod.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/turbo-tasks-fs/src/lib.rs b/crates/turbo-tasks-fs/src/lib.rs index 1a5b819d0afae..f823c6953a4fb 100644 --- a/crates/turbo-tasks-fs/src/lib.rs +++ b/crates/turbo-tasks-fs/src/lib.rs @@ -1120,7 +1120,7 @@ impl FileSystemPath { Self::new_normalized(this.fs, path).resolve().await?, ))) } else { - Ok(Vc::cell(None)) + Ok(FileSystemPathOption::none()) } } @@ -1136,7 +1136,7 @@ impl FileSystemPath { ))); } } - Ok(Vc::cell(None)) + Ok(FileSystemPathOption::none()) } #[turbo_tasks::function] diff --git a/crates/turbopack-css/src/chunk/mod.rs b/crates/turbopack-css/src/chunk/mod.rs index 26795fe810975..982835bde506b 100644 --- a/crates/turbopack-css/src/chunk/mod.rs +++ b/crates/turbopack-css/src/chunk/mod.rs @@ -90,7 +90,7 @@ impl CssChunk { while !*path.is_inside(current).await? { let parent = current.parent().resolve().await?; if parent == current { - return Ok(Vc::cell(None)); + return Ok(FileSystemPathOption::none()); } current = parent; } diff --git a/crates/turbopack-ecmascript/src/chunk/mod.rs b/crates/turbopack-ecmascript/src/chunk/mod.rs index 4cbe1c146a70f..1fda115396542 100644 --- a/crates/turbopack-ecmascript/src/chunk/mod.rs +++ b/crates/turbopack-ecmascript/src/chunk/mod.rs @@ -150,7 +150,7 @@ impl EcmascriptChunk { while !*path.is_inside_or_equal(current).await? { let parent = current.parent().resolve().await?; if parent == current { - return Ok(Vc::cell(None)); + return Ok(FileSystemPathOption::none()); } current = parent; }