mirror of https://github.com/astral-sh/ruff
[red-knot] Increase durability of read-only `File` fields (#17757)
This commit is contained in:
parent
9c57862262
commit
b7e69ecbfc
|
|
@ -94,7 +94,9 @@ impl Files {
|
||||||
.root(db, path)
|
.root(db, path)
|
||||||
.map_or(Durability::default(), |root| root.durability(db));
|
.map_or(Durability::default(), |root| root.durability(db));
|
||||||
|
|
||||||
let builder = File::builder(FilePath::System(absolute)).durability(durability);
|
let builder = File::builder(FilePath::System(absolute))
|
||||||
|
.durability(durability)
|
||||||
|
.path_durability(Durability::HIGH);
|
||||||
|
|
||||||
let builder = match metadata {
|
let builder = match metadata {
|
||||||
Ok(metadata) if metadata.file_type().is_file() => builder
|
Ok(metadata) if metadata.file_type().is_file() => builder
|
||||||
|
|
@ -159,9 +161,11 @@ impl Files {
|
||||||
tracing::trace!("Adding virtual file {}", path);
|
tracing::trace!("Adding virtual file {}", path);
|
||||||
let virtual_file = VirtualFile(
|
let virtual_file = VirtualFile(
|
||||||
File::builder(FilePath::SystemVirtual(path.to_path_buf()))
|
File::builder(FilePath::SystemVirtual(path.to_path_buf()))
|
||||||
|
.path_durability(Durability::HIGH)
|
||||||
.status(FileStatus::Exists)
|
.status(FileStatus::Exists)
|
||||||
.revision(FileRevision::zero())
|
.revision(FileRevision::zero())
|
||||||
.permissions(None)
|
.permissions(None)
|
||||||
|
.permissions_durability(Durability::HIGH)
|
||||||
.new(db),
|
.new(db),
|
||||||
);
|
);
|
||||||
self.inner
|
self.inner
|
||||||
|
|
@ -272,7 +276,7 @@ impl std::panic::RefUnwindSafe for Files {}
|
||||||
/// A file that's either stored on the host system's file system or in the vendored file system.
|
/// A file that's either stored on the host system's file system or in the vendored file system.
|
||||||
#[salsa::input]
|
#[salsa::input]
|
||||||
pub struct File {
|
pub struct File {
|
||||||
/// The path of the file.
|
/// The path of the file (immutable).
|
||||||
#[return_ref]
|
#[return_ref]
|
||||||
pub path: FilePath,
|
pub path: FilePath,
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue