Skip to content

Commit 38e1ed0

Browse files
committed
Turbopack: rename some fields in fs
1 parent 4264667 commit 38e1ed0

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

turbopack/crates/turbo-tasks-fs/src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,7 @@ impl FileSystemPath {
13871387
// is invalid.
13881388
pub async fn realpath(&self) -> Result<FileSystemPath> {
13891389
let result = &(*self.realpath_with_links().await?);
1390-
match &result.path_or_error {
1390+
match &result.path_result {
13911391
Ok(path) => Ok(path.clone()),
13921392
Err(error) => Err(anyhow::anyhow!(error.as_error_message(self, result))),
13931393
}
@@ -1449,7 +1449,7 @@ impl ValueToString for FileSystemPath {
14491449
#[derive(Clone, Debug)]
14501450
#[turbo_tasks::value(shared)]
14511451
pub struct RealPathResult {
1452-
pub path_or_error: Result<FileSystemPath, RealPathResultError>,
1452+
pub path_result: Result<FileSystemPath, RealPathResultError>,
14531453
pub symlinks: Vec<FileSystemPath>,
14541454
}
14551455

@@ -2121,7 +2121,7 @@ impl DirectoryEntry {
21212121
pub async fn resolve_symlink(self) -> Result<Self> {
21222122
if let DirectoryEntry::Symlink(symlink) = &self {
21232123
let result = &*symlink.realpath_with_links().await?;
2124-
let real_path = match &result.path_or_error {
2124+
let real_path = match &result.path_result {
21252125
Ok(path) => path,
21262126
Err(error) => {
21272127
return Ok(DirectoryEntry::Error(
@@ -2136,9 +2136,9 @@ impl DirectoryEntry {
21362136
FileSystemEntryType::NotFound => DirectoryEntry::Error(
21372137
format!("Symlink {symlink} points at {real_path} which does not exist").into(),
21382138
),
2139+
// This is caused by eventual consistency
21392140
FileSystemEntryType::Symlink => bail!(
2140-
"Symlink {symlink} points at a symlink but realpath_with_links returned a \
2141-
path, this is caused by eventual consistency."
2141+
"Symlink {symlink} points at a symlink but realpath_with_links returned a path"
21422142
),
21432143
_ => self,
21442144
})
@@ -2376,7 +2376,7 @@ async fn realpath_with_links(path: FileSystemPath) -> Result<Vc<RealPathResult>>
23762376
if current_path.is_root() {
23772377
// fast path
23782378
return Ok(RealPathResult {
2379-
path_or_error: Ok(current_path),
2379+
path_result: Ok(current_path),
23802380
symlinks: symlinks.into_iter().collect(),
23812381
}
23822382
.cell());
@@ -2395,7 +2395,7 @@ async fn realpath_with_links(path: FileSystemPath) -> Result<Vc<RealPathResult>>
23952395
.rsplit_once('/')
23962396
.map_or(current_path.path.as_str(), |(_, name)| name);
23972397
symlinks.extend(parent_result.symlinks);
2398-
let parent_path = match parent_result.path_or_error {
2398+
let parent_path = match parent_result.path_result {
23992399
Ok(path) => {
24002400
if path != parent {
24012401
current_path = path.join(basename)?;
@@ -2415,7 +2415,7 @@ async fn realpath_with_links(path: FileSystemPath) -> Result<Vc<RealPathResult>>
24152415
FileSystemEntryType::Symlink
24162416
) {
24172417
return Ok(RealPathResult {
2418-
path_or_error: Ok(current_path),
2418+
path_result: Ok(current_path),
24192419
symlinks: symlinks.into_iter().collect(), // convert set to vec
24202420
}
24212421
.cell());
@@ -2450,7 +2450,7 @@ async fn realpath_with_links(path: FileSystemPath) -> Result<Vc<RealPathResult>>
24502450
// Returning the followed symlinks is still important, even if there is an error! Otherwise
24512451
// we may never notice if the symlink loop is fixed.
24522452
Ok(RealPathResult {
2453-
path_or_error: Err(error),
2453+
path_result: Err(error),
24542454
symlinks: symlinks.into_iter().collect(),
24552455
}
24562456
.cell())

turbopack/crates/turbopack-core/src/node_addon_module.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ async fn dir_references(package_dir: FileSystemPath) -> Result<Vc<ModuleReferenc
121121
PatternMatch::File(_, file) => {
122122
let realpath = file.realpath_with_links().await?;
123123
results.extend(realpath.symlinks.iter().cloned());
124-
match &realpath.path_or_error {
124+
match &realpath.path_result {
125125
Ok(path) => {
126126
results.insert(path.clone());
127127
}

turbopack/crates/turbopack-core/src/resolve/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ async fn realpath(
11851185
.try_join()
11861186
.await?,
11871187
);
1188-
match &result.path_or_error {
1188+
match &result.path_result {
11891189
Ok(path) => Ok(path.clone()),
11901190
Err(e) => bail!(e.as_error_message(fs_path, &result)),
11911191
}
@@ -1520,7 +1520,7 @@ pub async fn resolve_raw(
15201520
) -> Result<Vc<ResolveResult>> {
15211521
async fn to_result(request: RcStr, path: FileSystemPath) -> Result<Vc<ResolveResult>> {
15221522
let result = &*path.realpath_with_links().await?;
1523-
let path = match &result.path_or_error {
1523+
let path = match &result.path_result {
15241524
Ok(path) => path,
15251525
Err(e) => bail!(e.as_error_message(&path, result)),
15261526
};
@@ -2873,7 +2873,7 @@ async fn resolved(
28732873
fragment: RcStr,
28742874
) -> Result<Vc<ResolveResult>> {
28752875
let result = &*fs_path.realpath_with_links().await?;
2876-
let path = match &result.path_or_error {
2876+
let path = match &result.path_result {
28772877
Ok(path) => path,
28782878
Err(e) => bail!(e.as_error_message(&fs_path, result)),
28792879
};

turbopack/crates/turbopack-ecmascript/src/references/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ async fn resolve_reference_from_dir(
124124
FileSource::new(symlink.clone()).to_resolved().await?,
125125
));
126126
}
127-
let path: FileSystemPath = match &realpath.path_or_error {
127+
let path: FileSystemPath = match &realpath.path_result {
128128
Ok(path) => path.clone(),
129129
Err(e) => bail!(e.as_error_message(file, &realpath)),
130130
};

turbopack/crates/turbopack-resolve/src/node_native_binding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ pub async fn resolve_node_pre_gyp_files(
185185
}
186186
sources.insert(
187187
format!("deps/lib/{key}").into(),
188-
Vc::upcast(FileSource::new(match &realpath_with_links.path_or_error {
188+
Vc::upcast(FileSource::new(match &realpath_with_links.path_result {
189189
Ok(path) => path.clone(),
190190
Err(e) => bail!(e.as_error_message(dylib, &realpath_with_links)),
191191
})),

0 commit comments

Comments
 (0)