Skip to content

Commit f46b888

Browse files
committed
Remove LazyBTreeMap.
It was introduced in #50240 to avoid an allocation when creating a new BTreeMap, which gave some speed-ups. But then #50352 made that the default behaviour for BTreeMap, so LazyBTreeMap is no longer necessary.
1 parent 6fc409e commit f46b888

File tree

5 files changed

+12
-123
lines changed

5 files changed

+12
-123
lines changed

src/librustc/infer/higher_ranked/mod.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ use super::{CombinedSnapshot,
1919
use super::combine::CombineFields;
2020
use super::region_constraints::{TaintDirections};
2121

22-
use rustc_data_structures::lazy_btree_map::LazyBTreeMap;
2322
use ty::{self, TyCtxt, Binder, TypeFoldable};
2423
use ty::error::TypeError;
2524
use ty::relate::{Relate, RelateResult, TypeRelation};
25+
use std::collections::BTreeMap;
2626
use syntax_pos::Span;
2727
use util::nodemap::{FxHashMap, FxHashSet};
2828

@@ -247,8 +247,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
247247
snapshot: &CombinedSnapshot<'a, 'tcx>,
248248
debruijn: ty::DebruijnIndex,
249249
new_vars: &[ty::RegionVid],
250-
a_map: &LazyBTreeMap<ty::BoundRegion,
251-
ty::Region<'tcx>>,
250+
a_map: &BTreeMap<ty::BoundRegion, ty::Region<'tcx>>,
252251
r0: ty::Region<'tcx>)
253252
-> ty::Region<'tcx> {
254253
// Regions that pre-dated the LUB computation stay as they are.
@@ -344,8 +343,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
344343
snapshot: &CombinedSnapshot<'a, 'tcx>,
345344
debruijn: ty::DebruijnIndex,
346345
new_vars: &[ty::RegionVid],
347-
a_map: &LazyBTreeMap<ty::BoundRegion,
348-
ty::Region<'tcx>>,
346+
a_map: &BTreeMap<ty::BoundRegion, ty::Region<'tcx>>,
349347
a_vars: &[ty::RegionVid],
350348
b_vars: &[ty::RegionVid],
351349
r0: ty::Region<'tcx>)
@@ -414,7 +412,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
414412

415413
fn rev_lookup<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
416414
span: Span,
417-
a_map: &LazyBTreeMap<ty::BoundRegion, ty::Region<'tcx>>,
415+
a_map: &BTreeMap<ty::BoundRegion, ty::Region<'tcx>>,
418416
r: ty::Region<'tcx>) -> ty::Region<'tcx>
419417
{
420418
for (a_br, a_r) in a_map {
@@ -437,7 +435,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
437435
}
438436

439437
fn var_ids<'a, 'gcx, 'tcx>(fields: &CombineFields<'a, 'gcx, 'tcx>,
440-
map: &LazyBTreeMap<ty::BoundRegion, ty::Region<'tcx>>)
438+
map: &BTreeMap<ty::BoundRegion, ty::Region<'tcx>>)
441439
-> Vec<ty::RegionVid> {
442440
map.iter()
443441
.map(|(_, &r)| match *r {

src/librustc/infer/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ use ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric};
2828
use ty::fold::TypeFoldable;
2929
use ty::relate::RelateResult;
3030
use traits::{self, ObligationCause, PredicateObligations};
31-
use rustc_data_structures::lazy_btree_map::LazyBTreeMap;
3231
use rustc_data_structures::unify as ut;
3332
use std::cell::{Cell, RefCell, Ref, RefMut};
33+
use std::collections::BTreeMap;
3434
use std::fmt;
3535
use syntax::ast;
3636
use errors::DiagnosticBuilder;
@@ -198,7 +198,7 @@ pub struct InferCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
198198

199199
/// A map returned by `skolemize_late_bound_regions()` indicating the skolemized
200200
/// region that each late-bound region was replaced with.
201-
pub type SkolemizationMap<'tcx> = LazyBTreeMap<ty::BoundRegion, ty::Region<'tcx>>;
201+
pub type SkolemizationMap<'tcx> = BTreeMap<ty::BoundRegion, ty::Region<'tcx>>;
202202

203203
/// See `error_reporting` module for more details
204204
#[derive(Clone, Debug)]
@@ -1236,7 +1236,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
12361236
span: Span,
12371237
lbrct: LateBoundRegionConversionTime,
12381238
value: &ty::Binder<T>)
1239-
-> (T, LazyBTreeMap<ty::BoundRegion, ty::Region<'tcx>>)
1239+
-> (T, BTreeMap<ty::BoundRegion, ty::Region<'tcx>>)
12401240
where T : TypeFoldable<'tcx>
12411241
{
12421242
self.tcx.replace_late_bound_regions(

src/librustc/ty/fold.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use middle::const_val::ConstVal;
4343
use hir::def_id::DefId;
4444
use ty::{self, Binder, Ty, TyCtxt, TypeFlags};
4545

46-
use rustc_data_structures::lazy_btree_map::LazyBTreeMap;
46+
use std::collections::BTreeMap;
4747
use std::fmt;
4848
use util::nodemap::FxHashSet;
4949

@@ -328,7 +328,7 @@ struct RegionReplacer<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
328328
tcx: TyCtxt<'a, 'gcx, 'tcx>,
329329
current_depth: u32,
330330
fld_r: &'a mut (dyn FnMut(ty::BoundRegion) -> ty::Region<'tcx> + 'a),
331-
map: LazyBTreeMap<ty::BoundRegion, ty::Region<'tcx>>
331+
map: BTreeMap<ty::BoundRegion, ty::Region<'tcx>>
332332
}
333333

334334
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
@@ -343,7 +343,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
343343
pub fn replace_late_bound_regions<T,F>(self,
344344
value: &Binder<T>,
345345
mut f: F)
346-
-> (T, LazyBTreeMap<ty::BoundRegion, ty::Region<'tcx>>)
346+
-> (T, BTreeMap<ty::BoundRegion, ty::Region<'tcx>>)
347347
where F : FnMut(ty::BoundRegion) -> ty::Region<'tcx>,
348348
T : TypeFoldable<'tcx>,
349349
{
@@ -456,7 +456,7 @@ impl<'a, 'gcx, 'tcx> RegionReplacer<'a, 'gcx, 'tcx> {
456456
tcx,
457457
current_depth: 1,
458458
fld_r,
459-
map: LazyBTreeMap::default()
459+
map: BTreeMap::default()
460460
}
461461
}
462462
}

src/librustc_data_structures/lazy_btree_map.rs

-108
This file was deleted.

src/librustc_data_structures/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ pub mod bitvec;
6161
pub mod graph;
6262
pub mod indexed_set;
6363
pub mod indexed_vec;
64-
pub mod lazy_btree_map;
6564
pub mod obligation_forest;
6665
pub mod sip128;
6766
pub mod snapshot_map;

0 commit comments

Comments
 (0)