Skip to content

Commit ee81739

Browse files
committed
Deprecate the FxHashMap() and FxHashSet() constructor function hack
1 parent 74ff7dc commit ee81739

File tree

115 files changed

+318
-333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+318
-333
lines changed

src/librustc/dep_graph/cgu_reuse_tracker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ pub struct CguReuseTracker {
5151
impl CguReuseTracker {
5252
pub fn new() -> CguReuseTracker {
5353
let data = TrackerData {
54-
actual_reuse: FxHashMap(),
55-
expected_reuse: FxHashMap(),
54+
actual_reuse: FxHashMap::default(),
55+
expected_reuse: FxHashMap::default(),
5656
};
5757

5858
CguReuseTracker {

src/librustc/dep_graph/dep_tracking_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<M: DepTrackingMapConfig> DepTrackingMap<M> {
3636
DepTrackingMap {
3737
phantom: PhantomData,
3838
graph,
39-
map: FxHashMap(),
39+
map: FxHashMap::default(),
4040
}
4141
}
4242
}

src/librustc/dep_graph/graph.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ impl DepGraph {
101101
DepGraph {
102102
data: Some(Lrc::new(DepGraphData {
103103
previous_work_products: prev_work_products,
104-
dep_node_debug: Lock::new(FxHashMap()),
104+
dep_node_debug: Lock::new(FxHashMap::default()),
105105
current: Lock::new(CurrentDepGraph::new()),
106106
previous: prev_graph,
107107
colors: Lock::new(DepNodeColorMap::new(prev_graph_node_count)),
108-
loaded_from_cache: Lock::new(FxHashMap()),
108+
loaded_from_cache: Lock::new(FxHashMap::default()),
109109
})),
110110
fingerprints: Lrc::new(Lock::new(fingerprints)),
111111
}
@@ -209,7 +209,7 @@ impl DepGraph {
209209
|key| OpenTask::Regular(Lock::new(RegularOpenTask {
210210
node: key,
211211
reads: SmallVec::new(),
212-
read_set: FxHashSet(),
212+
read_set: FxHashSet::default(),
213213
})),
214214
|data, key, task| data.borrow_mut().complete_task(key, task))
215215
}
@@ -353,7 +353,7 @@ impl DepGraph {
353353
let (result, open_task) = ty::tls::with_context(|icx| {
354354
let task = OpenTask::Anon(Lock::new(AnonOpenTask {
355355
reads: SmallVec::new(),
356-
read_set: FxHashSet(),
356+
read_set: FxHashSet::default(),
357357
}));
358358

359359
let r = {
@@ -937,7 +937,7 @@ impl CurrentDepGraph {
937937
CurrentDepGraph {
938938
nodes: IndexVec::new(),
939939
edges: IndexVec::new(),
940-
node_to_node_index: FxHashMap(),
940+
node_to_node_index: FxHashMap::default(),
941941
anon_id_seed: stable_hasher.finish(),
942942
forbidden_edge,
943943
total_read_count: 0,

src/librustc/dep_graph/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl DepGraphQuery {
2525
edges: &[(DepNode, DepNode)])
2626
-> DepGraphQuery {
2727
let mut graph = Graph::with_capacity(nodes.len(), edges.len());
28-
let mut indices = FxHashMap();
28+
let mut indices = FxHashMap::default();
2929
for node in nodes {
3030
indices.insert(node.clone(), graph.add_node(node.clone()));
3131
}

src/librustc/hir/map/definitions.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,10 @@ impl Definitions {
421421
node_to_def_index: NodeMap(),
422422
def_index_to_node: [vec![], vec![]],
423423
node_to_hir_id: IndexVec::new(),
424-
parent_modules_of_macro_defs: FxHashMap(),
425-
expansions_that_defined: FxHashMap(),
426-
next_disambiguator: FxHashMap(),
427-
def_index_to_span: FxHashMap(),
424+
parent_modules_of_macro_defs: FxHashMap::default(),
425+
expansions_that_defined: FxHashMap::default(),
426+
next_disambiguator: FxHashMap::default(),
427+
def_index_to_span: FxHashMap::default(),
428428
}
429429
}
430430

src/librustc/hir/map/hir_id_validator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<'a, 'hir: 'a> OuterVisitor<'a, 'hir> {
5151
HirIdValidator {
5252
hir_map,
5353
owner_def_index: None,
54-
hir_ids_seen: FxHashMap(),
54+
hir_ids_seen: FxHashMap::default(),
5555
errors: Vec::new(),
5656
}
5757
}

src/librustc/ich/hcx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
370370
// recursing every time.
371371
thread_local! {
372372
static CACHE: RefCell<FxHashMap<hygiene::Mark, u64>> =
373-
RefCell::new(FxHashMap());
373+
RefCell::new(FxHashMap::default());
374374
}
375375

376376
let sub_hash: u64 = CACHE.with(|cache| {

src/librustc/ich/impls_ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ for &'gcx ty::List<T>
3232
hasher: &mut StableHasher<W>) {
3333
thread_local! {
3434
static CACHE: RefCell<FxHashMap<(usize, usize), Fingerprint>> =
35-
RefCell::new(FxHashMap());
35+
RefCell::new(FxHashMap::default());
3636
}
3737

3838
let hash = CACHE.with(|cache| {

src/librustc/infer/freshen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl<'a, 'gcx, 'tcx> TypeFreshener<'a, 'gcx, 'tcx> {
6262
TypeFreshener {
6363
infcx,
6464
freshen_count: 0,
65-
freshen_map: FxHashMap(),
65+
freshen_map: FxHashMap::default(),
6666
}
6767
}
6868

src/librustc/infer/higher_ranked/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
553553
let escaping_types =
554554
self.type_variables.borrow_mut().types_escaping_snapshot(&snapshot.type_snapshot);
555555

556-
let mut escaping_region_vars = FxHashSet();
556+
let mut escaping_region_vars = FxHashSet::default();
557557
for ty in &escaping_types {
558558
self.tcx.collect_regions(ty, &mut escaping_region_vars);
559559
}

src/librustc/infer/lexical_region_resolve/graphviz.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl<'a, 'gcx, 'tcx> ConstraintGraph<'a, 'gcx, 'tcx> {
143143
map: &'a ConstraintMap<'tcx>)
144144
-> ConstraintGraph<'a, 'gcx, 'tcx> {
145145
let mut i = 0;
146-
let mut node_ids = FxHashMap();
146+
let mut node_ids = FxHashMap::default();
147147
{
148148
let mut add_node = |node| {
149149
if let Vacant(e) = node_ids.entry(node) {
@@ -230,7 +230,7 @@ impl<'a, 'gcx, 'tcx> dot::GraphWalk<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
230230
type Node = Node;
231231
type Edge = Edge<'tcx>;
232232
fn nodes(&self) -> dot::Nodes<'_, Node> {
233-
let mut set = FxHashSet();
233+
let mut set = FxHashSet::default();
234234
for node in self.node_ids.keys() {
235235
set.insert(*node);
236236
}

src/librustc/infer/lexical_region_resolve/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
614614
dup_found: bool,
615615
}
616616
let mut state = WalkState {
617-
set: FxHashSet(),
617+
set: FxHashSet::default(),
618618
stack: vec![orig_node_idx],
619619
result: Vec::new(),
620620
dup_found: false,

src/librustc/infer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> {
534534
lexical_region_resolutions: RefCell::new(None),
535535
selection_cache: traits::SelectionCache::new(),
536536
evaluation_cache: traits::EvaluationCache::new(),
537-
reported_trait_errors: RefCell::new(FxHashMap()),
537+
reported_trait_errors: RefCell::new(FxHashMap::default()),
538538
tainted_by_errors_flag: Cell::new(false),
539539
err_count_on_creation: tcx.sess.err_count(),
540540
in_snapshot: Cell::new(false),

src/librustc/infer/region_constraints/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
345345
RegionConstraintCollector {
346346
var_infos: VarInfos::default(),
347347
data: RegionConstraintData::default(),
348-
lubs: FxHashMap(),
349-
glbs: FxHashMap(),
348+
lubs: FxHashMap::default(),
349+
glbs: FxHashMap::default(),
350350
bound_count: 0,
351351
undo_log: Vec::new(),
352352
unification_table: ut::UnificationTable::new(),

src/librustc/infer/region_constraints/taint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub(super) struct TaintSet<'tcx> {
1818

1919
impl<'tcx> TaintSet<'tcx> {
2020
pub(super) fn new(directions: TaintDirections, initial_region: ty::Region<'tcx>) -> Self {
21-
let mut regions = FxHashSet();
21+
let mut regions = FxHashSet::default();
2222
regions.insert(initial_region);
2323
TaintSet {
2424
directions: directions,

src/librustc/lint/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ impl LintStore {
159159
pre_expansion_passes: Some(vec![]),
160160
early_passes: Some(vec![]),
161161
late_passes: Some(vec![]),
162-
by_name: FxHashMap(),
163-
future_incompatible: FxHashMap(),
164-
lint_groups: FxHashMap(),
162+
by_name: FxHashMap::default(),
163+
future_incompatible: FxHashMap::default(),
164+
lint_groups: FxHashMap::default(),
165165
}
166166
}
167167

src/librustc/lint/levels.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl LintLevelSets {
5959

6060
fn process_command_line(&mut self, sess: &Session) {
6161
let store = sess.lint_store.borrow();
62-
let mut specs = FxHashMap();
62+
let mut specs = FxHashMap::default();
6363
self.lint_cap = sess.opts.lint_cap.unwrap_or(Level::Forbid);
6464

6565
for &(ref lint_name, level) in &sess.opts.lint_opts {
@@ -175,7 +175,7 @@ impl<'a> LintLevelsBuilder<'a> {
175175
sess,
176176
sets,
177177
cur: 0,
178-
id_to_set: FxHashMap(),
178+
id_to_set: FxHashMap::default(),
179179
warn_about_weird_lints: sess.buffered_lints.borrow().is_some(),
180180
}
181181
}
@@ -195,7 +195,7 @@ impl<'a> LintLevelsBuilder<'a> {
195195
///
196196
/// Don't forget to call `pop`!
197197
pub fn push(&mut self, attrs: &[ast::Attribute]) -> BuilderPush {
198-
let mut specs = FxHashMap();
198+
let mut specs = FxHashMap::default();
199199
let store = self.sess.lint_store.borrow();
200200
let sess = self.sess;
201201
let bad_attr = |span| {

src/librustc/middle/dead.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
131131
}
132132

133133
fn mark_live_symbols(&mut self) {
134-
let mut scanned = FxHashSet();
134+
let mut scanned = FxHashSet::default();
135135
while let Some(id) = self.worklist.pop() {
136136
if !scanned.insert(id) {
137137
continue
@@ -429,7 +429,7 @@ fn find_live<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
429429
worklist,
430430
tcx,
431431
tables: &ty::TypeckTables::empty(None),
432-
live_symbols: box FxHashSet(),
432+
live_symbols: box FxHashSet::default(),
433433
repr_has_repr_c: false,
434434
in_pat: false,
435435
inherited_pub_visibility: false,

src/librustc/middle/dependency_format.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub enum Linkage {
9494

9595
pub fn calculate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
9696
let sess = &tcx.sess;
97-
let mut fmts = FxHashMap();
97+
let mut fmts = FxHashMap::default();
9898
for &ty in sess.crate_types.borrow().iter() {
9999
let linkage = calculate_type(tcx, ty);
100100
verify_ok(tcx, &linkage);
@@ -170,7 +170,7 @@ fn calculate_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
170170
}
171171
}
172172

173-
let mut formats = FxHashMap();
173+
let mut formats = FxHashMap::default();
174174

175175
// Sweep all crates for found dylibs. Add all dylibs, as well as their
176176
// dependencies, ensuring there are no conflicts. The only valid case for a

src/librustc/middle/lang_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl<'a, 'v, 'tcx> ItemLikeVisitor<'v> for LanguageItemCollector<'a, 'tcx> {
155155

156156
impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> {
157157
fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> LanguageItemCollector<'a, 'tcx> {
158-
let mut item_refs = FxHashMap();
158+
let mut item_refs = FxHashMap::default();
159159

160160
$( item_refs.insert($name, ($variant as usize, $target)); )*
161161

src/librustc/middle/lib_features.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ pub struct LibFeatures {
3131
impl LibFeatures {
3232
fn new() -> LibFeatures {
3333
LibFeatures {
34-
stable: FxHashMap(),
35-
unstable: FxHashSet(),
34+
stable: FxHashMap::default(),
35+
unstable: FxHashSet::default(),
3636
}
3737
}
3838

src/librustc/middle/reachable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
207207

208208
// Step 2: Mark all symbols that the symbols on the worklist touch.
209209
fn propagate(&mut self) {
210-
let mut scanned = FxHashSet();
210+
let mut scanned = FxHashSet::default();
211211
while let Some(search_item) = self.worklist.pop() {
212212
if !scanned.insert(search_item) {
213213
continue

src/librustc/middle/region.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionResolutionVisitor<'a, 'tcx> {
12571257

12581258
let outer_ec = mem::replace(&mut self.expr_and_pat_count, 0);
12591259
let outer_cx = self.cx;
1260-
let outer_ts = mem::replace(&mut self.terminating_scopes, FxHashSet());
1260+
let outer_ts = mem::replace(&mut self.terminating_scopes, FxHashSet::default());
12611261
self.terminating_scopes.insert(body.value.hir_id.local_id);
12621262

12631263
if let Some(root_id) = self.cx.root_id {
@@ -1347,7 +1347,7 @@ fn region_scope_tree<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
13471347
parent: None,
13481348
var_parent: None,
13491349
},
1350-
terminating_scopes: FxHashSet(),
1350+
terminating_scopes: FxHashSet::default(),
13511351
};
13521352

13531353
let body = tcx.hir.body(body_id);

src/librustc/middle/resolve_lifetime.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,9 @@ fn resolve_lifetimes<'tcx>(
393393
let named_region_map = krate(tcx);
394394

395395
let mut rl = ResolveLifetimes {
396-
defs: FxHashMap(),
397-
late_bound: FxHashMap(),
398-
object_lifetime_defaults: FxHashMap(),
396+
defs: FxHashMap::default(),
397+
late_bound: FxHashMap::default(),
398+
object_lifetime_defaults: FxHashMap::default(),
399399
};
400400

401401
for (k, v) in named_region_map.defs {
@@ -692,7 +692,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
692692
debug!("visit_ty: index = {}", index);
693693

694694
let mut elision = None;
695-
let mut lifetimes = FxHashMap();
695+
let mut lifetimes = FxHashMap::default();
696696
let mut type_count = 0;
697697
for param in &generics.params {
698698
match param.kind {
@@ -2017,7 +2017,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
20172017
map: self.map,
20182018
outer_index: ty::INNERMOST,
20192019
have_bound_regions: false,
2020-
lifetimes: FxHashSet(),
2020+
lifetimes: FxHashSet::default(),
20212021
};
20222022
gather.visit_ty(input);
20232023

@@ -2537,14 +2537,14 @@ fn insert_late_bound_lifetimes(
25372537
decl, generics);
25382538

25392539
let mut constrained_by_input = ConstrainedCollector {
2540-
regions: FxHashSet(),
2540+
regions: FxHashSet::default(),
25412541
};
25422542
for arg_ty in &decl.inputs {
25432543
constrained_by_input.visit_ty(arg_ty);
25442544
}
25452545

25462546
let mut appears_in_output = AllCollector {
2547-
regions: FxHashSet(),
2547+
regions: FxHashSet::default(),
25482548
};
25492549
intravisit::walk_fn_ret_ty(&mut appears_in_output, &decl.output);
25502550

@@ -2556,7 +2556,7 @@ fn insert_late_bound_lifetimes(
25562556
// Subtle point: because we disallow nested bindings, we can just
25572557
// ignore binders here and scrape up all names we see.
25582558
let mut appears_in_where_clause = AllCollector {
2559-
regions: FxHashSet(),
2559+
regions: FxHashSet::default(),
25602560
};
25612561
appears_in_where_clause.visit_generics(generics);
25622562

0 commit comments

Comments
 (0)