Repository: vercel/next.js
Pull request: Turbopack: rename some fields in fs

Apply suggestions from https://github.com/vercel/next.js/pull/83805

Closes PACK-5461

Changed files:
filename: turbopack/crates/turbo-tasks-fs/src/lib.rs
patch: @@ -1387,7 +1387,7 @@ impl FileSystemPath {
     // is invalid.
     pub async fn realpath(&self) -> Result<FileSystemPath> {
         let result = &(*self.realpath_with_links().await?);
-        match &result.path_or_error {
+        match &result.path_result {
             Ok(path) => Ok(path.clone()),
             Err(error) => Err(anyhow::anyhow!(error.as_error_message(self, result))),
         }
@@ -1449,7 +1449,7 @@ impl ValueToString for FileSystemPath {
 #[derive(Clone, Debug)]
 #[turbo_tasks::value(shared)]
 pub struct RealPathResult {
-    pub path_or_error: Result<FileSystemPath, RealPathResultError>,
+    pub path_result: Result<FileSystemPath, RealPathResultError>,
     pub symlinks: Vec<FileSystemPath>,
 }
 
@@ -2121,7 +2121,7 @@ impl DirectoryEntry {
     pub async fn resolve_symlink(self) -> Result<Self> {
         if let DirectoryEntry::Symlink(symlink) = &self {
             let result = &*symlink.realpath_with_links().await?;
-            let real_path = match &result.path_or_error {
+            let real_path = match &result.path_result {
                 Ok(path) => path,
                 Err(error) => {
                     return Ok(DirectoryEntry::Error(
@@ -2136,9 +2136,9 @@ impl DirectoryEntry {
                 FileSystemEntryType::NotFound => DirectoryEntry::Error(
                     format!("Symlink {symlink} points at {real_path} which does not exist").into(),
                 ),
+                // This is caused by eventual consistency
                 FileSystemEntryType::Symlink => bail!(
-                    "Symlink {symlink} points at a symlink but realpath_with_links returned a \
-                     path, this is caused by eventual consistency."
+                    "Symlink {symlink} points at a symlink but realpath_with_links returned a path"
                 ),
                 _ => self,
             })
@@ -2376,7 +2376,7 @@ async fn realpath_with_links(path: FileSystemPath) -> Result<Vc<RealPathResult>>
         if current_path.is_root() {
             // fast path
             return Ok(RealPathResult {
-                path_or_error: Ok(current_path),
+                path_result: Ok(current_path),
                 symlinks: symlinks.into_iter().collect(),
             }
             .cell());
@@ -2395,7 +2395,7 @@ async fn realpath_with_links(path: FileSystemPath) -> Result<Vc<RealPathResult>>
             .rsplit_once('/')
             .map_or(current_path.path.as_str(), |(_, name)| name);
         symlinks.extend(parent_result.symlinks);
-        let parent_path = match parent_result.path_or_error {
+        let parent_path = match parent_result.path_result {
             Ok(path) => {
                 if path != parent {
                     current_path = path.join(basename)?;
@@ -2415,7 +2415,7 @@ async fn realpath_with_links(path: FileSystemPath) -> Result<Vc<RealPathResult>>
             FileSystemEntryType::Symlink
         ) {
             return Ok(RealPathResult {
-                path_or_error: Ok(current_path),
+                path_result: Ok(current_path),
                 symlinks: symlinks.into_iter().collect(), // convert set to vec
             }
             .cell());
@@ -2450,7 +2450,7 @@ async fn realpath_with_links(path: FileSystemPath) -> Result<Vc<RealPathResult>>
     // Returning the followed symlinks is still important, even if there is an error! Otherwise
     // we may never notice if the symlink loop is fixed.
     Ok(RealPathResult {
-        path_or_error: Err(error),
+        path_result: Err(error),
         symlinks: symlinks.into_iter().collect(),
     }
     .cell())

filename: turbopack/crates/turbopack-core/src/node_addon_module.rs
patch: @@ -121,7 +121,7 @@ async fn dir_references(package_dir: FileSystemPath) -> Result<Vc<ModuleReferenc
             PatternMatch::File(_, file) => {
                 let realpath = file.realpath_with_links().await?;
                 results.extend(realpath.symlinks.iter().cloned());
-                match &realpath.path_or_error {
+                match &realpath.path_result {
                     Ok(path) => {
                         results.insert(path.clone());
                     }

filename: turbopack/crates/turbopack-core/src/resolve/mod.rs
patch: @@ -1185,7 +1185,7 @@ async fn realpath(
             .try_join()
             .await?,
     );
-    match &result.path_or_error {
+    match &result.path_result {
         Ok(path) => Ok(path.clone()),
         Err(e) => bail!(e.as_error_message(fs_path, &result)),
     }
@@ -1520,7 +1520,7 @@ pub async fn resolve_raw(
 ) -> Result<Vc<ResolveResult>> {
     async fn to_result(request: RcStr, path: FileSystemPath) -> Result<Vc<ResolveResult>> {
         let result = &*path.realpath_with_links().await?;
-        let path = match &result.path_or_error {
+        let path = match &result.path_result {
             Ok(path) => path,
             Err(e) => bail!(e.as_error_message(&path, result)),
         };
@@ -2873,7 +2873,7 @@ async fn resolved(
     fragment: RcStr,
 ) -> Result<Vc<ResolveResult>> {
     let result = &*fs_path.realpath_with_links().await?;
-    let path = match &result.path_or_error {
+    let path = match &result.path_result {
         Ok(path) => path,
         Err(e) => bail!(e.as_error_message(&fs_path, result)),
     };

filename: turbopack/crates/turbopack-ecmascript/src/references/node.rs
patch: @@ -124,7 +124,7 @@ async fn resolve_reference_from_dir(
                         FileSource::new(symlink.clone()).to_resolved().await?,
                     ));
                 }
-                let path: FileSystemPath = match &realpath.path_or_error {
+                let path: FileSystemPath = match &realpath.path_result {
                     Ok(path) => path.clone(),
                     Err(e) => bail!(e.as_error_message(file, &realpath)),
                 };

filename: turbopack/crates/turbopack-resolve/src/node_native_binding.rs
patch: @@ -185,7 +185,7 @@ pub async fn resolve_node_pre_gyp_files(
                         }
                         sources.insert(
                             format!("deps/lib/{key}").into(),
-                            Vc::upcast(FileSource::new(match &realpath_with_links.path_or_error {
+                            Vc::upcast(FileSource::new(match &realpath_with_links.path_result {
                                 Ok(path) => path.clone(),
                                 Err(e) => bail!(e.as_error_message(dylib, &realpath_with_links)),
                             })),