mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
fix: Fix empty check diagnostics not marking files as changed
This commit is contained in:
parent
ca17481170
commit
8da08e7100
3 changed files with 20 additions and 20 deletions
|
@ -22,7 +22,6 @@ use hir_def::{
|
|||
|
||||
use crate::{
|
||||
db::{HirDatabase, InternedCoroutine},
|
||||
display::HirDisplay,
|
||||
from_assoc_type_id, from_chalk_trait_id, from_foreign_def_id,
|
||||
generics::generics,
|
||||
make_binders, make_single_type_binders,
|
||||
|
@ -823,13 +822,12 @@ pub(crate) fn impl_datum_query(
|
|||
let _p = tracing::info_span!("impl_datum_query").entered();
|
||||
debug!("impl_datum {:?}", impl_id);
|
||||
let impl_: hir_def::ImplId = from_chalk(db, impl_id);
|
||||
impl_def_datum(db, krate, impl_id, impl_)
|
||||
impl_def_datum(db, krate, impl_)
|
||||
}
|
||||
|
||||
fn impl_def_datum(
|
||||
db: &dyn HirDatabase,
|
||||
krate: CrateId,
|
||||
chalk_id: ImplId,
|
||||
impl_id: hir_def::ImplId,
|
||||
) -> Arc<ImplDatum> {
|
||||
let trait_ref = db
|
||||
|
@ -850,13 +848,6 @@ fn impl_def_datum(
|
|||
};
|
||||
let where_clauses = convert_where_clauses(db, impl_id.into(), &bound_vars);
|
||||
let negative = impl_data.is_negative;
|
||||
debug!(
|
||||
"impl {:?}: {}{} where {:?}",
|
||||
chalk_id,
|
||||
if negative { "!" } else { "" },
|
||||
trait_ref.display(db, db.crate_graph()[krate].edition),
|
||||
where_clauses
|
||||
);
|
||||
|
||||
let polarity = if negative { rust_ir::Polarity::Negative } else { rust_ir::Polarity::Positive };
|
||||
|
||||
|
|
|
@ -55,9 +55,10 @@ pub(crate) struct Fix {
|
|||
|
||||
impl DiagnosticCollection {
|
||||
pub(crate) fn clear_check(&mut self, flycheck_id: usize) {
|
||||
if let Some(it) = self.check.get_mut(&flycheck_id) {
|
||||
it.clear();
|
||||
}
|
||||
let Some(check) = self.check.get_mut(&flycheck_id) else {
|
||||
return;
|
||||
};
|
||||
self.changes.extend(check.drain().flat_map(|(_, v)| v.into_keys()));
|
||||
if let Some(fixes) = Arc::make_mut(&mut self.check_fixes).get_mut(&flycheck_id) {
|
||||
fixes.clear();
|
||||
}
|
||||
|
@ -70,12 +71,6 @@ impl DiagnosticCollection {
|
|||
)
|
||||
}
|
||||
|
||||
pub(crate) fn clear_native_for(&mut self, file_id: FileId) {
|
||||
self.native_syntax.remove(&file_id);
|
||||
self.native_semantic.remove(&file_id);
|
||||
self.changes.insert(file_id);
|
||||
}
|
||||
|
||||
pub(crate) fn clear_check_for_package(
|
||||
&mut self,
|
||||
flycheck_id: usize,
|
||||
|
@ -84,7 +79,19 @@ impl DiagnosticCollection {
|
|||
let Some(check) = self.check.get_mut(&flycheck_id) else {
|
||||
return;
|
||||
};
|
||||
check.remove(&Some(package_id));
|
||||
let package_id = Some(package_id);
|
||||
if let Some(checks) = check.remove(&package_id) {
|
||||
self.changes.extend(checks.into_keys());
|
||||
}
|
||||
if let Some(fixes) = Arc::make_mut(&mut self.check_fixes).get_mut(&flycheck_id) {
|
||||
fixes.remove(&package_id);
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn clear_native_for(&mut self, file_id: FileId) {
|
||||
self.native_syntax.remove(&file_id);
|
||||
self.native_semantic.remove(&file_id);
|
||||
self.changes.insert(file_id);
|
||||
}
|
||||
|
||||
pub(crate) fn add_check_diagnostic(
|
||||
|
|
|
@ -369,6 +369,7 @@ impl FlycheckActor {
|
|||
tracing::trace!(
|
||||
flycheck_id = self.id,
|
||||
artifact = msg.target.name,
|
||||
package_id = msg.package_id.repr,
|
||||
"artifact received"
|
||||
);
|
||||
self.report_progress(Progress::DidCheckCrate(msg.target.name));
|
||||
|
@ -380,6 +381,7 @@ impl FlycheckActor {
|
|||
tracing::trace!(
|
||||
flycheck_id = self.id,
|
||||
message = diagnostic.message,
|
||||
package_id = package_id.as_ref().map(|it| &it.repr),
|
||||
"diagnostic received"
|
||||
);
|
||||
if let Some(package_id) = &package_id {
|
||||
|
|
Loading…
Reference in a new issue