Stop sorting bodies by span.
The definition order is already close to the span order, and only differs in corner cases.
This commit is contained in:
parent
ad3407f482
commit
74fb87e3a0
17 changed files with 132 additions and 153 deletions
|
@ -516,7 +516,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
self.owners.ensure_contains_elem(CRATE_DEF_ID, || None);
|
||||
self.owners[CRATE_DEF_ID] = Some(hir::OwnerNode::Crate(module));
|
||||
|
||||
let body_ids = body_ids(&self.bodies);
|
||||
let proc_macros =
|
||||
c.proc_macros.iter().map(|id| self.node_id_to_hir_id[*id].unwrap()).collect();
|
||||
|
||||
|
@ -552,7 +551,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
let krate = hir::Crate {
|
||||
owners: self.owners,
|
||||
bodies: self.bodies,
|
||||
body_ids,
|
||||
trait_impls: self.trait_impls,
|
||||
modules: self.modules,
|
||||
proc_macros,
|
||||
|
@ -2771,14 +2769,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
}
|
||||
}
|
||||
|
||||
fn body_ids(bodies: &BTreeMap<hir::BodyId, hir::Body<'_>>) -> Vec<hir::BodyId> {
|
||||
// Sorting by span ensures that we get things in order within a
|
||||
// file, and also puts the files in a sensible order.
|
||||
let mut body_ids: Vec<_> = bodies.keys().cloned().collect();
|
||||
body_ids.sort_by_key(|b| bodies[b].value.span);
|
||||
body_ids
|
||||
}
|
||||
|
||||
/// Helper struct for delayed construction of GenericArgs.
|
||||
struct GenericArgsCtor<'hir> {
|
||||
args: SmallVec<[hir::GenericArg<'hir>; 4]>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue