Merge two query callbacks arrays.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
use rustc_ast::{self as ast, Attribute, NestedMetaItem};
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_hir::intravisit;
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc_hir::Node as HirNode;
|
||||
@@ -302,18 +302,6 @@ impl DirtyCleanVisitor<'tcx> {
|
||||
out
|
||||
}
|
||||
|
||||
fn dep_nodes<'l>(
|
||||
&self,
|
||||
labels: &'l Labels,
|
||||
def_id: DefId,
|
||||
) -> impl Iterator<Item = DepNode> + 'l {
|
||||
let def_path_hash = self.tcx.def_path_hash(def_id);
|
||||
labels.iter().map(move |label| match DepNode::from_label_string(label, def_path_hash) {
|
||||
Ok(dep_node) => dep_node,
|
||||
Err(()) => unreachable!("label: {}", label),
|
||||
})
|
||||
}
|
||||
|
||||
fn dep_node_str(&self, dep_node: &DepNode) -> String {
|
||||
if let Some(def_id) = dep_node.extract_def_id(self.tcx) {
|
||||
format!("{:?}({})", dep_node.kind, self.tcx.def_path_str(def_id))
|
||||
@@ -345,16 +333,19 @@ impl DirtyCleanVisitor<'tcx> {
|
||||
}
|
||||
|
||||
fn check_item(&mut self, item_id: LocalDefId, item_span: Span) {
|
||||
let def_path_hash = self.tcx.def_path_hash(item_id.to_def_id());
|
||||
for attr in self.tcx.get_attrs(item_id.to_def_id()).iter() {
|
||||
let assertion = match self.assertion_maybe(item_id, attr) {
|
||||
Some(a) => a,
|
||||
None => continue,
|
||||
};
|
||||
self.checked_attrs.insert(attr.id);
|
||||
for dep_node in self.dep_nodes(&assertion.clean, item_id.to_def_id()) {
|
||||
for label in assertion.clean {
|
||||
let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
|
||||
self.assert_clean(item_span, dep_node);
|
||||
}
|
||||
for dep_node in self.dep_nodes(&assertion.dirty, item_id.to_def_id()) {
|
||||
for label in assertion.dirty {
|
||||
let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
|
||||
self.assert_dirty(item_span, dep_node);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user