mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-22 02:00:00 +03:00
Auto merge of #12383 - Veykril:diag, r=Veykril
fix: Clear native diagnostics for files when they are deleted Fixes https://github.com/rust-lang/rust-analyzer/issues/7004
This commit is contained in:
@@ -40,6 +40,11 @@ pub(crate) fn clear_check(&mut self) {
|
||||
self.changes.extend(self.check.drain().map(|(key, _value)| key))
|
||||
}
|
||||
|
||||
pub(crate) fn clear_native_for(&mut self, file_id: FileId) {
|
||||
self.native.remove(&file_id);
|
||||
self.changes.insert(file_id);
|
||||
}
|
||||
|
||||
pub(crate) fn add_check_diagnostic(
|
||||
&mut self,
|
||||
file_id: FileId,
|
||||
|
||||
@@ -201,6 +201,10 @@ pub(crate) fn process_changes(&mut self) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
if !file.exists() {
|
||||
self.diagnostics.clear_native_for(file.file_id);
|
||||
}
|
||||
|
||||
let text = if file.exists() {
|
||||
let bytes = vfs.file_contents(file.file_id).to_vec();
|
||||
String::from_utf8(bytes).ok().and_then(|text| {
|
||||
|
||||
Reference in New Issue
Block a user