Skip to content

Commit b7e69ec

Browse files
authored
[red-knot] Increase durability of read-only File fields (#17757)
1 parent 9c57862 commit b7e69ec

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/ruff_db/src/files.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ impl Files {
9494
.root(db, path)
9595
.map_or(Durability::default(), |root| root.durability(db));
9696

97-
let builder = File::builder(FilePath::System(absolute)).durability(durability);
97+
let builder = File::builder(FilePath::System(absolute))
98+
.durability(durability)
99+
.path_durability(Durability::HIGH);
98100

99101
let builder = match metadata {
100102
Ok(metadata) if metadata.file_type().is_file() => builder
@@ -159,9 +161,11 @@ impl Files {
159161
tracing::trace!("Adding virtual file {}", path);
160162
let virtual_file = VirtualFile(
161163
File::builder(FilePath::SystemVirtual(path.to_path_buf()))
164+
.path_durability(Durability::HIGH)
162165
.status(FileStatus::Exists)
163166
.revision(FileRevision::zero())
164167
.permissions(None)
168+
.permissions_durability(Durability::HIGH)
165169
.new(db),
166170
);
167171
self.inner
@@ -272,7 +276,7 @@ impl std::panic::RefUnwindSafe for Files {}
272276
/// A file that's either stored on the host system's file system or in the vendored file system.
273277
#[salsa::input]
274278
pub struct File {
275-
/// The path of the file.
279+
/// The path of the file (immutable).
276280
#[return_ref]
277281
pub path: FilePath,
278282

0 commit comments

Comments
 (0)