diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-07-16 16:54:47 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-09-01 20:13:16 +0200 |
| commit | 74fb87e3a0bb88cd3bd9857bedc236bda52a8af7 (patch) | |
| tree | 0d0cb93dccd8dabac1ebbc365c6122b99f4332b3 /compiler/rustc_ast_lowering/src | |
| parent | ad3407f482d29f26c67700974d86f89b3f2ab993 (diff) | |
| download | rust-74fb87e3a0bb88cd3bd9857bedc236bda52a8af7.tar.gz rust-74fb87e3a0bb88cd3bd9857bedc236bda52a8af7.zip | |
Stop sorting bodies by span.
The definition order is already close to the span order, and only differs in corner cases.
Diffstat (limited to 'compiler/rustc_ast_lowering/src')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index deb7e742e5c..196d48faf51 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -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]>, |
