ensure lint are issued in a stable order
This commit is contained in:
parent
0a9dcaf04f
commit
6f98ee95d8
1 changed files with 14 additions and 14 deletions
|
@ -1306,33 +1306,33 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
for region in defined_by.values() {
|
let mut def_ids: Vec<_> = defined_by.values()
|
||||||
debug!(
|
.flat_map(|region| match region {
|
||||||
"check_uses_for_lifetimes_defined_by_scope: region = {:?}",
|
|
||||||
region
|
|
||||||
);
|
|
||||||
|
|
||||||
let def_id = match region {
|
|
||||||
Region::EarlyBound(_, def_id, _)
|
Region::EarlyBound(_, def_id, _)
|
||||||
| Region::LateBound(_, def_id, _)
|
| Region::LateBound(_, def_id, _)
|
||||||
| Region::Free(_, def_id) => def_id,
|
| Region::Free(_, def_id) => Some(*def_id),
|
||||||
|
|
||||||
Region::LateBoundAnon(..) | Region::Static => continue,
|
Region::LateBoundAnon(..) | Region::Static => None,
|
||||||
};
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
// ensure that we issue lints in a repeatable order
|
||||||
|
def_ids.sort_by_key(|&def_id| self.tcx.def_path_hash(def_id));
|
||||||
|
|
||||||
|
for def_id in def_ids {
|
||||||
debug!(
|
debug!(
|
||||||
"check_uses_for_lifetimes_defined_by_scope: def_id = {:?}",
|
"check_uses_for_lifetimes_defined_by_scope: def_id = {:?}",
|
||||||
def_id
|
def_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
let lifetimeuseset = self.lifetime_uses.remove(def_id);
|
let lifetimeuseset = self.lifetime_uses.remove(&def_id);
|
||||||
debug!(
|
debug!(
|
||||||
"check_uses_for_lifetimes_defined_by_scope: lifetimeuseset = {:?}",
|
"check_uses_for_lifetimes_defined_by_scope: lifetimeuseset = {:?}",
|
||||||
lifetimeuseset
|
lifetimeuseset
|
||||||
);
|
);
|
||||||
match lifetimeuseset {
|
match lifetimeuseset {
|
||||||
Some(LifetimeUseSet::One(_)) => {
|
Some(LifetimeUseSet::One(_)) => {
|
||||||
let node_id = self.tcx.hir.as_local_node_id(*def_id).unwrap();
|
let node_id = self.tcx.hir.as_local_node_id(def_id).unwrap();
|
||||||
debug!("node id first={:?}", node_id);
|
debug!("node id first={:?}", node_id);
|
||||||
if let hir::map::NodeLifetime(hir_lifetime) = self.tcx.hir.get(node_id) {
|
if let hir::map::NodeLifetime(hir_lifetime) = self.tcx.hir.get(node_id) {
|
||||||
let span = hir_lifetime.span;
|
let span = hir_lifetime.span;
|
||||||
|
@ -1359,7 +1359,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
debug!("Not one use lifetime");
|
debug!("Not one use lifetime");
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
let node_id = self.tcx.hir.as_local_node_id(*def_id).unwrap();
|
let node_id = self.tcx.hir.as_local_node_id(def_id).unwrap();
|
||||||
if let hir::map::NodeLifetime(hir_lifetime) = self.tcx.hir.get(node_id) {
|
if let hir::map::NodeLifetime(hir_lifetime) = self.tcx.hir.get(node_id) {
|
||||||
let span = hir_lifetime.span;
|
let span = hir_lifetime.span;
|
||||||
let id = hir_lifetime.id;
|
let id = hir_lifetime.id;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue