1
Fork 0

Deprecate the FxHashMap() and FxHashSet() constructor function hack

This commit is contained in:
Oliver Scherer 2018-10-16 10:44:26 +02:00
parent 74ff7dcb13
commit ee81739dc1
115 changed files with 318 additions and 333 deletions

View file

@ -51,8 +51,8 @@ pub struct CguReuseTracker {
impl CguReuseTracker { impl CguReuseTracker {
pub fn new() -> CguReuseTracker { pub fn new() -> CguReuseTracker {
let data = TrackerData { let data = TrackerData {
actual_reuse: FxHashMap(), actual_reuse: FxHashMap::default(),
expected_reuse: FxHashMap(), expected_reuse: FxHashMap::default(),
}; };
CguReuseTracker { CguReuseTracker {

View file

@ -36,7 +36,7 @@ impl<M: DepTrackingMapConfig> DepTrackingMap<M> {
DepTrackingMap { DepTrackingMap {
phantom: PhantomData, phantom: PhantomData,
graph, graph,
map: FxHashMap(), map: FxHashMap::default(),
} }
} }
} }

View file

@ -101,11 +101,11 @@ impl DepGraph {
DepGraph { DepGraph {
data: Some(Lrc::new(DepGraphData { data: Some(Lrc::new(DepGraphData {
previous_work_products: prev_work_products, previous_work_products: prev_work_products,
dep_node_debug: Lock::new(FxHashMap()), dep_node_debug: Lock::new(FxHashMap::default()),
current: Lock::new(CurrentDepGraph::new()), current: Lock::new(CurrentDepGraph::new()),
previous: prev_graph, previous: prev_graph,
colors: Lock::new(DepNodeColorMap::new(prev_graph_node_count)), colors: Lock::new(DepNodeColorMap::new(prev_graph_node_count)),
loaded_from_cache: Lock::new(FxHashMap()), loaded_from_cache: Lock::new(FxHashMap::default()),
})), })),
fingerprints: Lrc::new(Lock::new(fingerprints)), fingerprints: Lrc::new(Lock::new(fingerprints)),
} }
@ -209,7 +209,7 @@ impl DepGraph {
|key| OpenTask::Regular(Lock::new(RegularOpenTask { |key| OpenTask::Regular(Lock::new(RegularOpenTask {
node: key, node: key,
reads: SmallVec::new(), reads: SmallVec::new(),
read_set: FxHashSet(), read_set: FxHashSet::default(),
})), })),
|data, key, task| data.borrow_mut().complete_task(key, task)) |data, key, task| data.borrow_mut().complete_task(key, task))
} }
@ -353,7 +353,7 @@ impl DepGraph {
let (result, open_task) = ty::tls::with_context(|icx| { let (result, open_task) = ty::tls::with_context(|icx| {
let task = OpenTask::Anon(Lock::new(AnonOpenTask { let task = OpenTask::Anon(Lock::new(AnonOpenTask {
reads: SmallVec::new(), reads: SmallVec::new(),
read_set: FxHashSet(), read_set: FxHashSet::default(),
})); }));
let r = { let r = {
@ -937,7 +937,7 @@ impl CurrentDepGraph {
CurrentDepGraph { CurrentDepGraph {
nodes: IndexVec::new(), nodes: IndexVec::new(),
edges: IndexVec::new(), edges: IndexVec::new(),
node_to_node_index: FxHashMap(), node_to_node_index: FxHashMap::default(),
anon_id_seed: stable_hasher.finish(), anon_id_seed: stable_hasher.finish(),
forbidden_edge, forbidden_edge,
total_read_count: 0, total_read_count: 0,

View file

@ -25,7 +25,7 @@ impl DepGraphQuery {
edges: &[(DepNode, DepNode)]) edges: &[(DepNode, DepNode)])
-> DepGraphQuery { -> DepGraphQuery {
let mut graph = Graph::with_capacity(nodes.len(), edges.len()); let mut graph = Graph::with_capacity(nodes.len(), edges.len());
let mut indices = FxHashMap(); let mut indices = FxHashMap::default();
for node in nodes { for node in nodes {
indices.insert(node.clone(), graph.add_node(node.clone())); indices.insert(node.clone(), graph.add_node(node.clone()));
} }

View file

@ -421,10 +421,10 @@ impl Definitions {
node_to_def_index: NodeMap(), node_to_def_index: NodeMap(),
def_index_to_node: [vec![], vec![]], def_index_to_node: [vec![], vec![]],
node_to_hir_id: IndexVec::new(), node_to_hir_id: IndexVec::new(),
parent_modules_of_macro_defs: FxHashMap(), parent_modules_of_macro_defs: FxHashMap::default(),
expansions_that_defined: FxHashMap(), expansions_that_defined: FxHashMap::default(),
next_disambiguator: FxHashMap(), next_disambiguator: FxHashMap::default(),
def_index_to_span: FxHashMap(), def_index_to_span: FxHashMap::default(),
} }
} }

View file

@ -51,7 +51,7 @@ impl<'a, 'hir: 'a> OuterVisitor<'a, 'hir> {
HirIdValidator { HirIdValidator {
hir_map, hir_map,
owner_def_index: None, owner_def_index: None,
hir_ids_seen: FxHashMap(), hir_ids_seen: FxHashMap::default(),
errors: Vec::new(), errors: Vec::new(),
} }
} }

View file

@ -370,7 +370,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
// recursing every time. // recursing every time.
thread_local! { thread_local! {
static CACHE: RefCell<FxHashMap<hygiene::Mark, u64>> = static CACHE: RefCell<FxHashMap<hygiene::Mark, u64>> =
RefCell::new(FxHashMap()); RefCell::new(FxHashMap::default());
} }
let sub_hash: u64 = CACHE.with(|cache| { let sub_hash: u64 = CACHE.with(|cache| {

View file

@ -32,7 +32,7 @@ for &'gcx ty::List<T>
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
thread_local! { thread_local! {
static CACHE: RefCell<FxHashMap<(usize, usize), Fingerprint>> = static CACHE: RefCell<FxHashMap<(usize, usize), Fingerprint>> =
RefCell::new(FxHashMap()); RefCell::new(FxHashMap::default());
} }
let hash = CACHE.with(|cache| { let hash = CACHE.with(|cache| {

View file

@ -62,7 +62,7 @@ impl<'a, 'gcx, 'tcx> TypeFreshener<'a, 'gcx, 'tcx> {
TypeFreshener { TypeFreshener {
infcx, infcx,
freshen_count: 0, freshen_count: 0,
freshen_map: FxHashMap(), freshen_map: FxHashMap::default(),
} }
} }

View file

@ -553,7 +553,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
let escaping_types = let escaping_types =
self.type_variables.borrow_mut().types_escaping_snapshot(&snapshot.type_snapshot); self.type_variables.borrow_mut().types_escaping_snapshot(&snapshot.type_snapshot);
let mut escaping_region_vars = FxHashSet(); let mut escaping_region_vars = FxHashSet::default();
for ty in &escaping_types { for ty in &escaping_types {
self.tcx.collect_regions(ty, &mut escaping_region_vars); self.tcx.collect_regions(ty, &mut escaping_region_vars);
} }

View file

@ -143,7 +143,7 @@ impl<'a, 'gcx, 'tcx> ConstraintGraph<'a, 'gcx, 'tcx> {
map: &'a ConstraintMap<'tcx>) map: &'a ConstraintMap<'tcx>)
-> ConstraintGraph<'a, 'gcx, 'tcx> { -> ConstraintGraph<'a, 'gcx, 'tcx> {
let mut i = 0; let mut i = 0;
let mut node_ids = FxHashMap(); let mut node_ids = FxHashMap::default();
{ {
let mut add_node = |node| { let mut add_node = |node| {
if let Vacant(e) = node_ids.entry(node) { if let Vacant(e) = node_ids.entry(node) {
@ -230,7 +230,7 @@ impl<'a, 'gcx, 'tcx> dot::GraphWalk<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
type Node = Node; type Node = Node;
type Edge = Edge<'tcx>; type Edge = Edge<'tcx>;
fn nodes(&self) -> dot::Nodes<'_, Node> { fn nodes(&self) -> dot::Nodes<'_, Node> {
let mut set = FxHashSet(); let mut set = FxHashSet::default();
for node in self.node_ids.keys() { for node in self.node_ids.keys() {
set.insert(*node); set.insert(*node);
} }

View file

@ -614,7 +614,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
dup_found: bool, dup_found: bool,
} }
let mut state = WalkState { let mut state = WalkState {
set: FxHashSet(), set: FxHashSet::default(),
stack: vec![orig_node_idx], stack: vec![orig_node_idx],
result: Vec::new(), result: Vec::new(),
dup_found: false, dup_found: false,

View file

@ -534,7 +534,7 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> {
lexical_region_resolutions: RefCell::new(None), lexical_region_resolutions: RefCell::new(None),
selection_cache: traits::SelectionCache::new(), selection_cache: traits::SelectionCache::new(),
evaluation_cache: traits::EvaluationCache::new(), evaluation_cache: traits::EvaluationCache::new(),
reported_trait_errors: RefCell::new(FxHashMap()), reported_trait_errors: RefCell::new(FxHashMap::default()),
tainted_by_errors_flag: Cell::new(false), tainted_by_errors_flag: Cell::new(false),
err_count_on_creation: tcx.sess.err_count(), err_count_on_creation: tcx.sess.err_count(),
in_snapshot: Cell::new(false), in_snapshot: Cell::new(false),

View file

@ -345,8 +345,8 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
RegionConstraintCollector { RegionConstraintCollector {
var_infos: VarInfos::default(), var_infos: VarInfos::default(),
data: RegionConstraintData::default(), data: RegionConstraintData::default(),
lubs: FxHashMap(), lubs: FxHashMap::default(),
glbs: FxHashMap(), glbs: FxHashMap::default(),
bound_count: 0, bound_count: 0,
undo_log: Vec::new(), undo_log: Vec::new(),
unification_table: ut::UnificationTable::new(), unification_table: ut::UnificationTable::new(),

View file

@ -18,7 +18,7 @@ pub(super) struct TaintSet<'tcx> {
impl<'tcx> TaintSet<'tcx> { impl<'tcx> TaintSet<'tcx> {
pub(super) fn new(directions: TaintDirections, initial_region: ty::Region<'tcx>) -> Self { pub(super) fn new(directions: TaintDirections, initial_region: ty::Region<'tcx>) -> Self {
let mut regions = FxHashSet(); let mut regions = FxHashSet::default();
regions.insert(initial_region); regions.insert(initial_region);
TaintSet { TaintSet {
directions: directions, directions: directions,

View file

@ -159,9 +159,9 @@ impl LintStore {
pre_expansion_passes: Some(vec![]), pre_expansion_passes: Some(vec![]),
early_passes: Some(vec![]), early_passes: Some(vec![]),
late_passes: Some(vec![]), late_passes: Some(vec![]),
by_name: FxHashMap(), by_name: FxHashMap::default(),
future_incompatible: FxHashMap(), future_incompatible: FxHashMap::default(),
lint_groups: FxHashMap(), lint_groups: FxHashMap::default(),
} }
} }

View file

@ -59,7 +59,7 @@ impl LintLevelSets {
fn process_command_line(&mut self, sess: &Session) { fn process_command_line(&mut self, sess: &Session) {
let store = sess.lint_store.borrow(); let store = sess.lint_store.borrow();
let mut specs = FxHashMap(); let mut specs = FxHashMap::default();
self.lint_cap = sess.opts.lint_cap.unwrap_or(Level::Forbid); self.lint_cap = sess.opts.lint_cap.unwrap_or(Level::Forbid);
for &(ref lint_name, level) in &sess.opts.lint_opts { for &(ref lint_name, level) in &sess.opts.lint_opts {
@ -175,7 +175,7 @@ impl<'a> LintLevelsBuilder<'a> {
sess, sess,
sets, sets,
cur: 0, cur: 0,
id_to_set: FxHashMap(), id_to_set: FxHashMap::default(),
warn_about_weird_lints: sess.buffered_lints.borrow().is_some(), warn_about_weird_lints: sess.buffered_lints.borrow().is_some(),
} }
} }
@ -195,7 +195,7 @@ impl<'a> LintLevelsBuilder<'a> {
/// ///
/// Don't forget to call `pop`! /// Don't forget to call `pop`!
pub fn push(&mut self, attrs: &[ast::Attribute]) -> BuilderPush { pub fn push(&mut self, attrs: &[ast::Attribute]) -> BuilderPush {
let mut specs = FxHashMap(); let mut specs = FxHashMap::default();
let store = self.sess.lint_store.borrow(); let store = self.sess.lint_store.borrow();
let sess = self.sess; let sess = self.sess;
let bad_attr = |span| { let bad_attr = |span| {

View file

@ -131,7 +131,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
} }
fn mark_live_symbols(&mut self) { fn mark_live_symbols(&mut self) {
let mut scanned = FxHashSet(); let mut scanned = FxHashSet::default();
while let Some(id) = self.worklist.pop() { while let Some(id) = self.worklist.pop() {
if !scanned.insert(id) { if !scanned.insert(id) {
continue continue
@ -429,7 +429,7 @@ fn find_live<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
worklist, worklist,
tcx, tcx,
tables: &ty::TypeckTables::empty(None), tables: &ty::TypeckTables::empty(None),
live_symbols: box FxHashSet(), live_symbols: box FxHashSet::default(),
repr_has_repr_c: false, repr_has_repr_c: false,
in_pat: false, in_pat: false,
inherited_pub_visibility: false, inherited_pub_visibility: false,

View file

@ -94,7 +94,7 @@ pub enum Linkage {
pub fn calculate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { pub fn calculate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
let sess = &tcx.sess; let sess = &tcx.sess;
let mut fmts = FxHashMap(); let mut fmts = FxHashMap::default();
for &ty in sess.crate_types.borrow().iter() { for &ty in sess.crate_types.borrow().iter() {
let linkage = calculate_type(tcx, ty); let linkage = calculate_type(tcx, ty);
verify_ok(tcx, &linkage); verify_ok(tcx, &linkage);
@ -170,7 +170,7 @@ fn calculate_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
} }
} }
let mut formats = FxHashMap(); let mut formats = FxHashMap::default();
// Sweep all crates for found dylibs. Add all dylibs, as well as their // Sweep all crates for found dylibs. Add all dylibs, as well as their
// dependencies, ensuring there are no conflicts. The only valid case for a // dependencies, ensuring there are no conflicts. The only valid case for a

View file

@ -155,7 +155,7 @@ impl<'a, 'v, 'tcx> ItemLikeVisitor<'v> for LanguageItemCollector<'a, 'tcx> {
impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> { impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> {
fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> LanguageItemCollector<'a, 'tcx> { fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> LanguageItemCollector<'a, 'tcx> {
let mut item_refs = FxHashMap(); let mut item_refs = FxHashMap::default();
$( item_refs.insert($name, ($variant as usize, $target)); )* $( item_refs.insert($name, ($variant as usize, $target)); )*

View file

@ -31,8 +31,8 @@ pub struct LibFeatures {
impl LibFeatures { impl LibFeatures {
fn new() -> LibFeatures { fn new() -> LibFeatures {
LibFeatures { LibFeatures {
stable: FxHashMap(), stable: FxHashMap::default(),
unstable: FxHashSet(), unstable: FxHashSet::default(),
} }
} }

View file

@ -207,7 +207,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
// Step 2: Mark all symbols that the symbols on the worklist touch. // Step 2: Mark all symbols that the symbols on the worklist touch.
fn propagate(&mut self) { fn propagate(&mut self) {
let mut scanned = FxHashSet(); let mut scanned = FxHashSet::default();
while let Some(search_item) = self.worklist.pop() { while let Some(search_item) = self.worklist.pop() {
if !scanned.insert(search_item) { if !scanned.insert(search_item) {
continue continue

View file

@ -1257,7 +1257,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionResolutionVisitor<'a, 'tcx> {
let outer_ec = mem::replace(&mut self.expr_and_pat_count, 0); let outer_ec = mem::replace(&mut self.expr_and_pat_count, 0);
let outer_cx = self.cx; let outer_cx = self.cx;
let outer_ts = mem::replace(&mut self.terminating_scopes, FxHashSet()); let outer_ts = mem::replace(&mut self.terminating_scopes, FxHashSet::default());
self.terminating_scopes.insert(body.value.hir_id.local_id); self.terminating_scopes.insert(body.value.hir_id.local_id);
if let Some(root_id) = self.cx.root_id { 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)
parent: None, parent: None,
var_parent: None, var_parent: None,
}, },
terminating_scopes: FxHashSet(), terminating_scopes: FxHashSet::default(),
}; };
let body = tcx.hir.body(body_id); let body = tcx.hir.body(body_id);

View file

@ -393,9 +393,9 @@ fn resolve_lifetimes<'tcx>(
let named_region_map = krate(tcx); let named_region_map = krate(tcx);
let mut rl = ResolveLifetimes { let mut rl = ResolveLifetimes {
defs: FxHashMap(), defs: FxHashMap::default(),
late_bound: FxHashMap(), late_bound: FxHashMap::default(),
object_lifetime_defaults: FxHashMap(), object_lifetime_defaults: FxHashMap::default(),
}; };
for (k, v) in named_region_map.defs { for (k, v) in named_region_map.defs {
@ -692,7 +692,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
debug!("visit_ty: index = {}", index); debug!("visit_ty: index = {}", index);
let mut elision = None; let mut elision = None;
let mut lifetimes = FxHashMap(); let mut lifetimes = FxHashMap::default();
let mut type_count = 0; let mut type_count = 0;
for param in &generics.params { for param in &generics.params {
match param.kind { match param.kind {
@ -2017,7 +2017,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
map: self.map, map: self.map,
outer_index: ty::INNERMOST, outer_index: ty::INNERMOST,
have_bound_regions: false, have_bound_regions: false,
lifetimes: FxHashSet(), lifetimes: FxHashSet::default(),
}; };
gather.visit_ty(input); gather.visit_ty(input);
@ -2537,14 +2537,14 @@ fn insert_late_bound_lifetimes(
decl, generics); decl, generics);
let mut constrained_by_input = ConstrainedCollector { let mut constrained_by_input = ConstrainedCollector {
regions: FxHashSet(), regions: FxHashSet::default(),
}; };
for arg_ty in &decl.inputs { for arg_ty in &decl.inputs {
constrained_by_input.visit_ty(arg_ty); constrained_by_input.visit_ty(arg_ty);
} }
let mut appears_in_output = AllCollector { let mut appears_in_output = AllCollector {
regions: FxHashSet(), regions: FxHashSet::default(),
}; };
intravisit::walk_fn_ret_ty(&mut appears_in_output, &decl.output); intravisit::walk_fn_ret_ty(&mut appears_in_output, &decl.output);
@ -2556,7 +2556,7 @@ fn insert_late_bound_lifetimes(
// Subtle point: because we disallow nested bindings, we can just // Subtle point: because we disallow nested bindings, we can just
// ignore binders here and scrape up all names we see. // ignore binders here and scrape up all names we see.
let mut appears_in_where_clause = AllCollector { let mut appears_in_where_clause = AllCollector {
regions: FxHashSet(), regions: FxHashSet::default(),
}; };
appears_in_where_clause.visit_generics(generics); appears_in_where_clause.visit_generics(generics);

View file

@ -401,13 +401,13 @@ impl<'a, 'tcx> Index<'tcx> {
let is_staged_api = let is_staged_api =
tcx.sess.opts.debugging_opts.force_unstable_if_unmarked || tcx.sess.opts.debugging_opts.force_unstable_if_unmarked ||
tcx.features().staged_api; tcx.features().staged_api;
let mut staged_api = FxHashMap(); let mut staged_api = FxHashMap::default();
staged_api.insert(LOCAL_CRATE, is_staged_api); staged_api.insert(LOCAL_CRATE, is_staged_api);
let mut index = Index { let mut index = Index {
staged_api, staged_api,
stab_map: FxHashMap(), stab_map: FxHashMap::default(),
depr_map: FxHashMap(), depr_map: FxHashMap::default(),
active_features: FxHashSet(), active_features: FxHashSet::default(),
}; };
let ref active_lib_features = tcx.features().declared_lib_features; let ref active_lib_features = tcx.features().declared_lib_features;
@ -814,7 +814,7 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
} }
let declared_lang_features = &tcx.features().declared_lang_features; let declared_lang_features = &tcx.features().declared_lang_features;
let mut lang_features = FxHashSet(); let mut lang_features = FxHashSet::default();
for &(feature, span, since) in declared_lang_features { for &(feature, span, since) in declared_lang_features {
if let Some(since) = since { if let Some(since) = since {
// Warn if the user has enabled an already-stable lang feature. // Warn if the user has enabled an already-stable lang feature.
@ -828,7 +828,7 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
} }
let declared_lib_features = &tcx.features().declared_lib_features; let declared_lib_features = &tcx.features().declared_lib_features;
let mut remaining_lib_features = FxHashMap(); let mut remaining_lib_features = FxHashMap::default();
for (feature, span) in declared_lib_features { for (feature, span) in declared_lib_features {
if remaining_lib_features.contains_key(&feature) { if remaining_lib_features.contains_key(&feature) {
// Warn if the user enables a lib feature multiple times. // Warn if the user enables a lib feature multiple times.

View file

@ -453,8 +453,8 @@ pub struct AllocMap<'tcx, M> {
impl<'tcx, M: fmt::Debug + Eq + Hash + Clone> AllocMap<'tcx, M> { impl<'tcx, M: fmt::Debug + Eq + Hash + Clone> AllocMap<'tcx, M> {
pub fn new() -> Self { pub fn new() -> Self {
AllocMap { AllocMap {
id_to_type: FxHashMap(), id_to_type: FxHashMap::default(),
type_interner: FxHashMap(), type_interner: FxHashMap::default(),
next_id: AllocId(0), next_id: AllocId(0),
} }
} }

View file

@ -121,7 +121,7 @@ impl<'tcx> CodegenUnit<'tcx> {
pub fn new(name: InternedString) -> CodegenUnit<'tcx> { pub fn new(name: InternedString) -> CodegenUnit<'tcx> {
CodegenUnit { CodegenUnit {
name: name, name: name,
items: FxHashMap(), items: FxHashMap::default(),
size_estimate: None, size_estimate: None,
} }
} }
@ -251,7 +251,7 @@ impl<'a, 'gcx: 'tcx, 'tcx: 'a> CodegenUnitNameBuilder<'a, 'gcx, 'tcx> {
pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self { pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self {
CodegenUnitNameBuilder { CodegenUnitNameBuilder {
tcx, tcx,
cache: FxHashMap(), cache: FxHashMap::default(),
} }
} }

View file

@ -60,7 +60,7 @@ pub struct CodeStats {
} }
impl CodeStats { impl CodeStats {
pub fn new() -> Self { CodeStats { type_sizes: FxHashSet() } } pub fn new() -> Self { CodeStats { type_sizes: FxHashSet::default() } }
pub fn record_type_size<S: ToString>(&mut self, pub fn record_type_size<S: ToString>(&mut self,
kind: DataTypeKind, kind: DataTypeKind,

View file

@ -1147,7 +1147,7 @@ pub fn build_session_(
working_dir, working_dir,
lint_store: RwLock::new(lint::LintStore::new()), lint_store: RwLock::new(lint::LintStore::new()),
buffered_lints: Lock::new(Some(lint::LintBuffer::new())), buffered_lints: Lock::new(Some(lint::LintBuffer::new())),
one_time_diagnostics: Lock::new(FxHashSet()), one_time_diagnostics: Lock::new(FxHashSet::default()),
plugin_llvm_passes: OneThread::new(RefCell::new(Vec::new())), plugin_llvm_passes: OneThread::new(RefCell::new(Vec::new())),
plugin_attributes: OneThread::new(RefCell::new(Vec::new())), plugin_attributes: OneThread::new(RefCell::new(Vec::new())),
crate_types: Once::new(), crate_types: Once::new(),
@ -1207,7 +1207,7 @@ pub fn build_session_(
}, },
has_global_allocator: Once::new(), has_global_allocator: Once::new(),
has_panic_handler: Once::new(), has_panic_handler: Once::new(),
driver_lint_caps: FxHashMap(), driver_lint_caps: FxHashMap::default(),
}; };
validate_commandline_args_with_session_available(&sess); validate_commandline_args_with_session_available(&sess);

View file

@ -131,7 +131,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
} }
return tcx.infer_ctxt().enter(|mut infcx| { return tcx.infer_ctxt().enter(|mut infcx| {
let mut fresh_preds = FxHashSet(); let mut fresh_preds = FxHashSet::default();
// Due to the way projections are handled by SelectionContext, we need to run // Due to the way projections are handled by SelectionContext, we need to run
// evaluate_predicates twice: once on the original param env, and once on the result of // evaluate_predicates twice: once on the original param env, and once on the result of
@ -311,7 +311,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
let mut select = SelectionContext::new(&infcx); let mut select = SelectionContext::new(&infcx);
let mut already_visited = FxHashSet(); let mut already_visited = FxHashSet::default();
let mut predicates = VecDeque::new(); let mut predicates = VecDeque::new();
predicates.push_back(ty::Binder::bind(ty::TraitPredicate { predicates.push_back(ty::Binder::bind(ty::TraitPredicate {
trait_ref: ty::TraitRef { trait_ref: ty::TraitRef {
@ -508,8 +508,8 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
&self, &self,
regions: &RegionConstraintData<'cx>, regions: &RegionConstraintData<'cx>,
) -> FxHashMap<ty::RegionVid, ty::Region<'cx>> { ) -> FxHashMap<ty::RegionVid, ty::Region<'cx>> {
let mut vid_map: FxHashMap<RegionTarget<'cx>, RegionDeps<'cx>> = FxHashMap(); let mut vid_map: FxHashMap<RegionTarget<'cx>, RegionDeps<'cx>> = FxHashMap::default();
let mut finished_map = FxHashMap(); let mut finished_map = FxHashMap::default();
for constraint in regions.constraints.keys() { for constraint in regions.constraints.keys() {
match constraint { match constraint {

View file

@ -1258,7 +1258,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
trait_str); trait_str);
err.span_label(span, format!("the trait `{}` cannot be made into an object", trait_str)); err.span_label(span, format!("the trait `{}` cannot be made into an object", trait_str));
let mut reported_violations = FxHashSet(); let mut reported_violations = FxHashSet::default();
for violation in violations { for violation in violations {
if reported_violations.insert(violation.clone()) { if reported_violations.insert(violation.clone()) {
err.note(&violation.error_msg()); err.note(&violation.error_msg());
@ -1404,7 +1404,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
let cleaned_pred = pred.fold_with(&mut ParamToVarFolder { let cleaned_pred = pred.fold_with(&mut ParamToVarFolder {
infcx: self, infcx: self,
var_map: FxHashMap() var_map: FxHashMap::default()
}); });
let cleaned_pred = super::project::normalize( let cleaned_pred = super::project::normalize(

View file

@ -3742,7 +3742,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
} }
} else { } else {
// Three or more elements. Use a general deduplication process. // Three or more elements. Use a general deduplication process.
let mut seen = FxHashSet(); let mut seen = FxHashSet::default();
predicates.retain(|i| seen.insert(i.clone())); predicates.retain(|i| seen.insert(i.clone()));
} }
self.infcx() self.infcx()
@ -3791,24 +3791,24 @@ impl<'tcx> TraitObligation<'tcx> {
impl<'tcx> SelectionCache<'tcx> { impl<'tcx> SelectionCache<'tcx> {
pub fn new() -> SelectionCache<'tcx> { pub fn new() -> SelectionCache<'tcx> {
SelectionCache { SelectionCache {
hashmap: Lock::new(FxHashMap()), hashmap: Lock::new(FxHashMap::default()),
} }
} }
pub fn clear(&self) { pub fn clear(&self) {
*self.hashmap.borrow_mut() = FxHashMap() *self.hashmap.borrow_mut() = FxHashMap::default()
} }
} }
impl<'tcx> EvaluationCache<'tcx> { impl<'tcx> EvaluationCache<'tcx> {
pub fn new() -> EvaluationCache<'tcx> { pub fn new() -> EvaluationCache<'tcx> {
EvaluationCache { EvaluationCache {
hashmap: Lock::new(FxHashMap()), hashmap: Lock::new(FxHashMap::default()),
} }
} }
pub fn clear(&self) { pub fn clear(&self) {
*self.hashmap.borrow_mut() = FxHashMap() *self.hashmap.borrow_mut() = FxHashMap::default()
} }
} }

View file

@ -291,7 +291,7 @@ pub struct SpecializesCache {
impl SpecializesCache { impl SpecializesCache {
pub fn new() -> Self { pub fn new() -> Self {
SpecializesCache { SpecializesCache {
map: FxHashMap() map: FxHashMap::default()
} }
} }

View file

@ -59,7 +59,7 @@ struct PredicateSet<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
impl<'a, 'gcx, 'tcx> PredicateSet<'a, 'gcx, 'tcx> { impl<'a, 'gcx, 'tcx> PredicateSet<'a, 'gcx, 'tcx> {
fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> PredicateSet<'a, 'gcx, 'tcx> { fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> PredicateSet<'a, 'gcx, 'tcx> {
PredicateSet { tcx: tcx, set: FxHashSet() } PredicateSet { tcx: tcx, set: FxHashSet::default() }
} }
fn insert(&mut self, pred: &ty::Predicate<'tcx>) -> bool { fn insert(&mut self, pred: &ty::Predicate<'tcx>) -> bool {

View file

@ -462,7 +462,7 @@ impl<'tcx> TypeckTables<'tcx> {
adjustments: ItemLocalMap(), adjustments: ItemLocalMap(),
pat_binding_modes: ItemLocalMap(), pat_binding_modes: ItemLocalMap(),
pat_adjustments: ItemLocalMap(), pat_adjustments: ItemLocalMap(),
upvar_capture_map: FxHashMap(), upvar_capture_map: FxHashMap::default(),
closure_kind_origins: ItemLocalMap(), closure_kind_origins: ItemLocalMap(),
liberated_fn_sigs: ItemLocalMap(), liberated_fn_sigs: ItemLocalMap(),
fru_field_types: ItemLocalMap(), fru_field_types: ItemLocalMap(),
@ -470,7 +470,7 @@ impl<'tcx> TypeckTables<'tcx> {
used_trait_imports: Lrc::new(DefIdSet()), used_trait_imports: Lrc::new(DefIdSet()),
tainted_by_errors: false, tainted_by_errors: false,
free_region_map: FreeRegionMap::new(), free_region_map: FreeRegionMap::new(),
concrete_existential_types: FxHashMap(), concrete_existential_types: FxHashMap::default(),
} }
} }
@ -1190,7 +1190,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
None None
}; };
let mut trait_map: FxHashMap<_, Lrc<FxHashMap<_, _>>> = FxHashMap(); let mut trait_map: FxHashMap<_, Lrc<FxHashMap<_, _>>> = FxHashMap::default();
for (k, v) in resolutions.trait_map { for (k, v) in resolutions.trait_map {
let hir_id = hir.node_to_hir_id(k); let hir_id = hir.node_to_hir_id(k);
let map = trait_map.entry(hir_id.owner).or_default(); let map = trait_map.entry(hir_id.owner).or_default();
@ -1231,14 +1231,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
extern_providers, extern_providers,
on_disk_query_result_cache, on_disk_query_result_cache,
), ),
rcache: Lock::new(FxHashMap()), rcache: Lock::new(FxHashMap::default()),
selection_cache: traits::SelectionCache::new(), selection_cache: traits::SelectionCache::new(),
evaluation_cache: traits::EvaluationCache::new(), evaluation_cache: traits::EvaluationCache::new(),
crate_name: Symbol::intern(crate_name), crate_name: Symbol::intern(crate_name),
data_layout, data_layout,
layout_interner: Lock::new(FxHashSet()), layout_interner: Lock::new(FxHashSet::default()),
stability_interner: Lock::new(FxHashSet()), stability_interner: Lock::new(FxHashSet::default()),
allocation_interner: Lock::new(FxHashSet()), allocation_interner: Lock::new(FxHashSet::default()),
alloc_map: Lock::new(interpret::AllocMap::new()), alloc_map: Lock::new(interpret::AllocMap::new()),
tx_to_llvm_workers: Lock::new(tx), tx_to_llvm_workers: Lock::new(tx),
output_filenames: Arc::new(output_filenames.clone()), output_filenames: Arc::new(output_filenames.clone()),

View file

@ -753,7 +753,7 @@ impl LateBoundRegionsCollector {
fn new(just_constrained: bool) -> Self { fn new(just_constrained: bool) -> Self {
LateBoundRegionsCollector { LateBoundRegionsCollector {
current_index: ty::INNERMOST, current_index: ty::INNERMOST,
regions: FxHashSet(), regions: FxHashSet::default(),
just_constrained, just_constrained,
} }
} }

View file

@ -113,7 +113,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
} }
fn ty_inhabitedness_forest(self, ty: Ty<'tcx>) -> DefIdForest { fn ty_inhabitedness_forest(self, ty: Ty<'tcx>) -> DefIdForest {
ty.uninhabited_from(&mut FxHashMap(), self) ty.uninhabited_from(&mut FxHashMap::default(), self)
} }
pub fn is_enum_variant_uninhabited_from(self, pub fn is_enum_variant_uninhabited_from(self,
@ -140,7 +140,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
let adt_kind = self.adt_def(adt_def_id).adt_kind(); let adt_kind = self.adt_def(adt_def_id).adt_kind();
// Compute inhabitedness forest: // Compute inhabitedness forest:
variant.uninhabited_from(&mut FxHashMap(), self, substs, adt_kind) variant.uninhabited_from(&mut FxHashMap::default(), self, substs, adt_kind)
} }
} }

View file

@ -1842,7 +1842,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for AdtDef {
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
thread_local! { thread_local! {
static CACHE: RefCell<FxHashMap<usize, Fingerprint>> = static CACHE: RefCell<FxHashMap<usize, Fingerprint>> =
RefCell::new(FxHashMap()); RefCell::new(FxHashMap::default());
} }
let hash: Fingerprint = CACHE.with(|cache| { let hash: Fingerprint = CACHE.with(|cache| {

View file

@ -136,14 +136,14 @@ impl<'sess> OnDiskCache<'sess> {
OnDiskCache { OnDiskCache {
serialized_data: data, serialized_data: data,
file_index_to_stable_id: footer.file_index_to_stable_id, file_index_to_stable_id: footer.file_index_to_stable_id,
file_index_to_file: Lock::new(FxHashMap()), file_index_to_file: Lock::new(FxHashMap::default()),
prev_cnums: footer.prev_cnums, prev_cnums: footer.prev_cnums,
cnum_map: Once::new(), cnum_map: Once::new(),
source_map: sess.source_map(), source_map: sess.source_map(),
current_diagnostics: Lock::new(FxHashMap()), current_diagnostics: Lock::new(FxHashMap::default()),
query_result_index: footer.query_result_index.into_iter().collect(), query_result_index: footer.query_result_index.into_iter().collect(),
prev_diagnostics_index: footer.diagnostics_index.into_iter().collect(), prev_diagnostics_index: footer.diagnostics_index.into_iter().collect(),
synthetic_expansion_infos: Lock::new(FxHashMap()), synthetic_expansion_infos: Lock::new(FxHashMap::default()),
alloc_decoding_state: AllocDecodingState::new(footer.interpret_alloc_index), alloc_decoding_state: AllocDecodingState::new(footer.interpret_alloc_index),
} }
} }
@ -151,15 +151,15 @@ impl<'sess> OnDiskCache<'sess> {
pub fn new_empty(source_map: &'sess SourceMap) -> OnDiskCache<'sess> { pub fn new_empty(source_map: &'sess SourceMap) -> OnDiskCache<'sess> {
OnDiskCache { OnDiskCache {
serialized_data: Vec::new(), serialized_data: Vec::new(),
file_index_to_stable_id: FxHashMap(), file_index_to_stable_id: FxHashMap::default(),
file_index_to_file: Lock::new(FxHashMap()), file_index_to_file: Lock::new(FxHashMap::default()),
prev_cnums: vec![], prev_cnums: vec![],
cnum_map: Once::new(), cnum_map: Once::new(),
source_map, source_map,
current_diagnostics: Lock::new(FxHashMap()), current_diagnostics: Lock::new(FxHashMap::default()),
query_result_index: FxHashMap(), query_result_index: FxHashMap::default(),
prev_diagnostics_index: FxHashMap(), prev_diagnostics_index: FxHashMap::default(),
synthetic_expansion_infos: Lock::new(FxHashMap()), synthetic_expansion_infos: Lock::new(FxHashMap::default()),
alloc_decoding_state: AllocDecodingState::new(Vec::new()), alloc_decoding_state: AllocDecodingState::new(Vec::new()),
} }
} }
@ -174,8 +174,8 @@ impl<'sess> OnDiskCache<'sess> {
tcx.dep_graph.with_ignore(|| { tcx.dep_graph.with_ignore(|| {
// Allocate SourceFileIndices // Allocate SourceFileIndices
let (file_to_file_index, file_index_to_stable_id) = { let (file_to_file_index, file_index_to_stable_id) = {
let mut file_to_file_index = FxHashMap(); let mut file_to_file_index = FxHashMap::default();
let mut file_index_to_stable_id = FxHashMap(); let mut file_index_to_stable_id = FxHashMap::default();
for (index, file) in tcx.sess.source_map().files().iter().enumerate() { for (index, file) in tcx.sess.source_map().files().iter().enumerate() {
let index = SourceFileIndex(index as u32); let index = SourceFileIndex(index as u32);
@ -190,10 +190,10 @@ impl<'sess> OnDiskCache<'sess> {
let mut encoder = CacheEncoder { let mut encoder = CacheEncoder {
tcx, tcx,
encoder, encoder,
type_shorthands: FxHashMap(), type_shorthands: FxHashMap::default(),
predicate_shorthands: FxHashMap(), predicate_shorthands: FxHashMap::default(),
expn_info_shorthands: FxHashMap(), expn_info_shorthands: FxHashMap::default(),
interpret_allocs: FxHashMap(), interpret_allocs: FxHashMap::default(),
interpret_allocs_inverse: Vec::new(), interpret_allocs_inverse: Vec::new(),
source_map: CachingSourceMapView::new(tcx.sess.source_map()), source_map: CachingSourceMapView::new(tcx.sess.source_map()),
file_to_file_index, file_to_file_index,

View file

@ -58,8 +58,8 @@ impl<T> QueryValue<T> {
impl<'tcx, M: QueryConfig<'tcx>> QueryCache<'tcx, M> { impl<'tcx, M: QueryConfig<'tcx>> QueryCache<'tcx, M> {
pub(super) fn new() -> QueryCache<'tcx, M> { pub(super) fn new() -> QueryCache<'tcx, M> {
QueryCache { QueryCache {
results: FxHashMap(), results: FxHashMap::default(),
active: FxHashMap(), active: FxHashMap::default(),
} }
} }
} }

View file

@ -846,7 +846,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> {
// contains a different, structurally recursive type, maintain a stack // contains a different, structurally recursive type, maintain a stack
// of seen types and check recursion for each of them (issues #3008, #3779). // of seen types and check recursion for each of them (issues #3008, #3779).
let mut seen: Vec<Ty<'_>> = Vec::new(); let mut seen: Vec<Ty<'_>> = Vec::new();
let mut representable_cache = FxHashMap(); let mut representable_cache = FxHashMap::default();
let r = is_type_structurally_recursive( let r = is_type_structurally_recursive(
tcx, sp, &mut seen, &mut representable_cache, self); tcx, sp, &mut seen, &mut representable_cache, self);
debug!("is_type_representable: {:?} is {:?}", self, r); debug!("is_type_representable: {:?} is {:?}", self, r);

View file

@ -22,9 +22,9 @@ pub use rustc_data_structures::fx::FxHashSet;
macro_rules! define_id_collections { macro_rules! define_id_collections {
($map_name:ident, $set_name:ident, $key:ty) => { ($map_name:ident, $set_name:ident, $key:ty) => {
pub type $map_name<T> = FxHashMap<$key, T>; pub type $map_name<T> = FxHashMap<$key, T>;
pub fn $map_name<T>() -> $map_name<T> { FxHashMap() } pub fn $map_name<T>() -> $map_name<T> { FxHashMap::default() }
pub type $set_name = FxHashSet<$key>; pub type $set_name = FxHashSet<$key>;
pub fn $set_name() -> $set_name { FxHashSet() } pub fn $set_name() -> $set_name { FxHashSet::default() }
} }
} }

View file

@ -182,7 +182,7 @@ impl PrintContext {
fn prepare_late_bound_region_info<'tcx, T>(&mut self, value: &ty::Binder<T>) fn prepare_late_bound_region_info<'tcx, T>(&mut self, value: &ty::Binder<T>)
where T: TypeFoldable<'tcx> where T: TypeFoldable<'tcx>
{ {
let mut collector = LateBoundRegionNameCollector(FxHashSet()); let mut collector = LateBoundRegionNameCollector(FxHashSet::default());
value.visit_with(&mut collector); value.visit_with(&mut collector);
self.used_region_names = Some(collector.0); self.used_region_names = Some(collector.0);
self.region_index = 0; self.region_index = 0;

View file

@ -103,7 +103,7 @@ fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId)
// tuple structs/variants) do not have an associated body // tuple structs/variants) do not have an associated body
// and do not need borrowchecking. // and do not need borrowchecking.
return Lrc::new(BorrowCheckResult { return Lrc::new(BorrowCheckResult {
used_mut_nodes: FxHashSet(), used_mut_nodes: FxHashSet::default(),
signalled_any_error: SignalledError::NoErrorsSeen, signalled_any_error: SignalledError::NoErrorsSeen,
}) })
} }
@ -120,7 +120,7 @@ fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId)
region_scope_tree, region_scope_tree,
owner_def_id, owner_def_id,
body, body,
used_mut_nodes: RefCell::new(FxHashSet()), used_mut_nodes: RefCell::new(FxHashSet::default()),
signalled_any_error: Cell::new(SignalledError::NoErrorsSeen), signalled_any_error: Cell::new(SignalledError::NoErrorsSeen),
}; };
@ -235,7 +235,7 @@ pub fn build_borrowck_dataflow_data_for_fn<'a, 'tcx>(
region_scope_tree, region_scope_tree,
owner_def_id, owner_def_id,
body, body,
used_mut_nodes: RefCell::new(FxHashSet()), used_mut_nodes: RefCell::new(FxHashSet::default()),
signalled_any_error: Cell::new(SignalledError::NoErrorsSeen), signalled_any_error: Cell::new(SignalledError::NoErrorsSeen),
}; };

View file

@ -45,7 +45,7 @@ struct UnusedMutCx<'a, 'tcx: 'a> {
impl<'a, 'tcx> UnusedMutCx<'a, 'tcx> { impl<'a, 'tcx> UnusedMutCx<'a, 'tcx> {
fn check_unused_mut_pat(&self, pats: &[P<hir::Pat>]) { fn check_unused_mut_pat(&self, pats: &[P<hir::Pat>]) {
let tcx = self.bccx.tcx; let tcx = self.bccx.tcx;
let mut mutables: FxHashMap<_, Vec<_>> = FxHashMap(); let mut mutables: FxHashMap<_, Vec<_>> = FxHashMap::default();
for p in pats { for p in pats {
p.each_binding(|_, hir_id, span, ident| { p.each_binding(|_, hir_id, span, ident| {
// Skip anything that looks like `_foo` // Skip anything that looks like `_foo`

View file

@ -169,7 +169,7 @@ impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O
fn build_local_id_to_index(body: Option<&hir::Body>, fn build_local_id_to_index(body: Option<&hir::Body>,
cfg: &cfg::CFG) cfg: &cfg::CFG)
-> FxHashMap<hir::ItemLocalId, Vec<CFGIndex>> { -> FxHashMap<hir::ItemLocalId, Vec<CFGIndex>> {
let mut index = FxHashMap(); let mut index = FxHashMap::default();
// FIXME(#15020) Would it be better to fold formals from decl // FIXME(#15020) Would it be better to fold formals from decl
// into cfg itself? i.e. introduce a fn-based flow-graph in // into cfg itself? i.e. introduce a fn-based flow-graph in

View file

@ -297,7 +297,7 @@ pub fn provide_extern(providers: &mut Providers) {
} }
).collect::<FxHashMap<_, _>>(); ).collect::<FxHashMap<_, _>>();
let mut ret = FxHashMap(); let mut ret = FxHashMap::default();
for lib in tcx.foreign_modules(cnum).iter() { for lib in tcx.foreign_modules(cnum).iter() {
let module = def_id_to_native_lib let module = def_id_to_native_lib
.get(&lib.def_id) .get(&lib.def_id)

View file

@ -1313,7 +1313,7 @@ fn add_upstream_rust_crates(cmd: &mut dyn Linker,
// for the current implementation of the standard library. // for the current implementation of the standard library.
let mut group_end = None; let mut group_end = None;
let mut group_start = None; let mut group_start = None;
let mut end_with = FxHashSet(); let mut end_with = FxHashSet::default();
let info = &codegen_results.crate_info; let info = &codegen_results.crate_info;
for &(cnum, _) in deps.iter().rev() { for &(cnum, _) in deps.iter().rev() {
if let Some(missing) = info.missing_lang_items.get(&cnum) { if let Some(missing) = info.missing_lang_items.get(&cnum) {

View file

@ -882,7 +882,7 @@ pub struct ThinLTOImports {
impl ThinLTOImports { impl ThinLTOImports {
fn new() -> ThinLTOImports { fn new() -> ThinLTOImports {
ThinLTOImports { ThinLTOImports {
imports: FxHashMap(), imports: FxHashMap::default(),
} }
} }
@ -911,7 +911,7 @@ impl ThinLTOImports {
.push(imported_module_name.to_owned()); .push(imported_module_name.to_owned());
} }
let mut map = ThinLTOImports { let mut map = ThinLTOImports {
imports: FxHashMap(), imports: FxHashMap::default(),
}; };
llvm::LLVMRustGetThinLTOModuleImports(data, llvm::LLVMRustGetThinLTOModuleImports(data,
imported_module_callback, imported_module_callback,

View file

@ -1540,7 +1540,7 @@ fn start_executing_work(tcx: TyCtxt,
// Compute the set of symbols we need to retain when doing LTO (if we need to) // Compute the set of symbols we need to retain when doing LTO (if we need to)
let exported_symbols = { let exported_symbols = {
let mut exported_symbols = FxHashMap(); let mut exported_symbols = FxHashMap::default();
let copy_symbols = |cnum| { let copy_symbols = |cnum| {
let symbols = tcx.exported_symbols(cnum) let symbols = tcx.exported_symbols(cnum)

View file

@ -1030,7 +1030,7 @@ fn collect_and_partition_mono_items<'a, 'tcx>(
}).collect(); }).collect();
if tcx.sess.opts.debugging_opts.print_mono_items.is_some() { if tcx.sess.opts.debugging_opts.print_mono_items.is_some() {
let mut item_to_cgus: FxHashMap<_, Vec<_>> = FxHashMap(); let mut item_to_cgus: FxHashMap<_, Vec<_>> = FxHashMap::default();
for cgu in &codegen_units { for cgu in &codegen_units {
for (&mono_item, &linkage) in cgu.items() { for (&mono_item, &linkage) in cgu.items() {
@ -1092,17 +1092,17 @@ impl CrateInfo {
compiler_builtins: None, compiler_builtins: None,
profiler_runtime: None, profiler_runtime: None,
sanitizer_runtime: None, sanitizer_runtime: None,
is_no_builtins: FxHashSet(), is_no_builtins: FxHashSet::default(),
native_libraries: FxHashMap(), native_libraries: FxHashMap::default(),
used_libraries: tcx.native_libraries(LOCAL_CRATE), used_libraries: tcx.native_libraries(LOCAL_CRATE),
link_args: tcx.link_args(LOCAL_CRATE), link_args: tcx.link_args(LOCAL_CRATE),
crate_name: FxHashMap(), crate_name: FxHashMap::default(),
used_crates_dynamic: cstore::used_crates(tcx, LinkagePreference::RequireDynamic), used_crates_dynamic: cstore::used_crates(tcx, LinkagePreference::RequireDynamic),
used_crates_static: cstore::used_crates(tcx, LinkagePreference::RequireStatic), used_crates_static: cstore::used_crates(tcx, LinkagePreference::RequireStatic),
used_crate_source: FxHashMap(), used_crate_source: FxHashMap::default(),
wasm_imports: FxHashMap(), wasm_imports: FxHashMap::default(),
lang_item_to_crate: FxHashMap(), lang_item_to_crate: FxHashMap::default(),
missing_lang_items: FxHashMap(), missing_lang_items: FxHashMap::default(),
}; };
let lang_items = tcx.lang_items(); let lang_items = tcx.lang_items();

View file

@ -295,22 +295,22 @@ impl<'a, 'tcx> CodegenCx<'a, 'tcx> {
llcx, llcx,
stats: RefCell::new(Stats::default()), stats: RefCell::new(Stats::default()),
codegen_unit, codegen_unit,
instances: RefCell::new(FxHashMap()), instances: RefCell::new(FxHashMap::default()),
vtables: RefCell::new(FxHashMap()), vtables: RefCell::new(FxHashMap::default()),
const_cstr_cache: RefCell::new(FxHashMap()), const_cstr_cache: RefCell::new(FxHashMap::default()),
const_unsized: RefCell::new(FxHashMap()), const_unsized: RefCell::new(FxHashMap::default()),
const_globals: RefCell::new(FxHashMap()), const_globals: RefCell::new(FxHashMap::default()),
statics_to_rauw: RefCell::new(Vec::new()), statics_to_rauw: RefCell::new(Vec::new()),
used_statics: RefCell::new(Vec::new()), used_statics: RefCell::new(Vec::new()),
lltypes: RefCell::new(FxHashMap()), lltypes: RefCell::new(FxHashMap::default()),
scalar_lltypes: RefCell::new(FxHashMap()), scalar_lltypes: RefCell::new(FxHashMap::default()),
pointee_infos: RefCell::new(FxHashMap()), pointee_infos: RefCell::new(FxHashMap::default()),
isize_ty, isize_ty,
dbg_cx, dbg_cx,
eh_personality: Cell::new(None), eh_personality: Cell::new(None),
eh_unwind_resume: Cell::new(None), eh_unwind_resume: Cell::new(None),
rust_try_fn: Cell::new(None), rust_try_fn: Cell::new(None),
intrinsics: RefCell::new(FxHashMap()), intrinsics: RefCell::new(FxHashMap::default()),
local_gen_sym_counter: Cell::new(0), local_gen_sym_counter: Cell::new(0),
} }
} }

View file

@ -111,9 +111,9 @@ impl TypeMap<'ll, 'tcx> {
pub fn new() -> Self { pub fn new() -> Self {
TypeMap { TypeMap {
unique_id_interner: Interner::new(), unique_id_interner: Interner::new(),
type_to_metadata: FxHashMap(), type_to_metadata: FxHashMap::default(),
unique_id_to_metadata: FxHashMap(), unique_id_to_metadata: FxHashMap::default(),
type_to_unique_id: FxHashMap(), type_to_unique_id: FxHashMap::default(),
} }
} }

View file

@ -100,11 +100,11 @@ impl<'a, 'tcx> CrateDebugContext<'a, 'tcx> {
llcontext, llcontext,
llmod, llmod,
builder, builder,
created_files: RefCell::new(FxHashMap()), created_files: RefCell::new(FxHashMap::default()),
created_enum_disr_types: RefCell::new(FxHashMap()), created_enum_disr_types: RefCell::new(FxHashMap::default()),
type_map: RefCell::new(TypeMap::new()), type_map: RefCell::new(TypeMap::new()),
namespace_map: RefCell::new(DefIdMap()), namespace_map: RefCell::new(DefIdMap()),
composite_types_completed: RefCell::new(FxHashSet()), composite_types_completed: RefCell::new(FxHashSet::default()),
} }
} }
} }

View file

@ -132,7 +132,7 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
::symbol_names::provide(providers); ::symbol_names::provide(providers);
providers.target_features_whitelist = |_tcx, _cnum| { providers.target_features_whitelist = |_tcx, _cnum| {
Lrc::new(FxHashMap()) // Just a dummy Lrc::new(FxHashMap::default()) // Just a dummy
}; };
providers.is_reachable_non_generic = |_tcx, _defid| true; providers.is_reachable_non_generic = |_tcx, _defid| true;
providers.exported_symbols = |_tcx, _crate| Arc::new(Vec::new()); providers.exported_symbols = |_tcx, _crate| Arc::new(Vec::new());

View file

@ -8,21 +8,6 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::collections::{HashMap, HashSet};
use std::default::Default;
use std::hash::Hash;
pub use rustc_hash::FxHashMap; pub use rustc_hash::FxHashMap;
pub use rustc_hash::FxHashSet; pub use rustc_hash::FxHashSet;
pub use rustc_hash::FxHasher; pub use rustc_hash::FxHasher;
#[allow(non_snake_case)]
pub fn FxHashMap<K: Hash + Eq, V>() -> FxHashMap<K, V> {
HashMap::default()
}
#[allow(non_snake_case)]
pub fn FxHashSet<V: Hash + Eq>() -> FxHashSet<V> {
HashSet::default()
}

View file

@ -187,11 +187,11 @@ impl<O: ForestObligation> ObligationForest<O> {
pub fn new() -> ObligationForest<O> { pub fn new() -> ObligationForest<O> {
ObligationForest { ObligationForest {
nodes: vec![], nodes: vec![],
done_cache: FxHashSet(), done_cache: FxHashSet::default(),
waiting_cache: FxHashMap(), waiting_cache: FxHashMap::default(),
scratch: Some(vec![]), scratch: Some(vec![]),
obligation_tree_id_generator: (0..).map(|i| ObligationTreeId(i)), obligation_tree_id_generator: (0..).map(|i| ObligationTreeId(i)),
error_cache: FxHashMap(), error_cache: FxHashMap::default(),
} }
} }
@ -303,7 +303,7 @@ impl<O: ForestObligation> ObligationForest<O> {
self.error_cache self.error_cache
.entry(node.obligation_tree_id) .entry(node.obligation_tree_id)
.or_insert_with(|| FxHashSet()) .or_insert_with(|| FxHashSet::default())
.insert(node.obligation.as_predicate().clone()); .insert(node.obligation.as_predicate().clone());
} }

View file

@ -40,7 +40,7 @@ impl<K, V> SnapshotMap<K, V>
{ {
pub fn new() -> Self { pub fn new() -> Self {
SnapshotMap { SnapshotMap {
map: FxHashMap(), map: FxHashMap::default(),
undo_log: vec![], undo_log: vec![],
} }
} }

View file

@ -55,7 +55,7 @@ impl<T: Clone + Debug + Eq + Hash> TransitiveRelation<T> {
pub fn new() -> TransitiveRelation<T> { pub fn new() -> TransitiveRelation<T> {
TransitiveRelation { TransitiveRelation {
elements: vec![], elements: vec![],
map: FxHashMap(), map: FxHashMap::default(),
edges: vec![], edges: vec![],
closure: Lock::new(None), closure: Lock::new(None),
} }

View file

@ -382,9 +382,9 @@ impl Handler {
emitter: Lock::new(e), emitter: Lock::new(e),
continue_after_error: LockCell::new(true), continue_after_error: LockCell::new(true),
delayed_span_bugs: Lock::new(Vec::new()), delayed_span_bugs: Lock::new(Vec::new()),
taught_diagnostics: Lock::new(FxHashSet()), taught_diagnostics: Lock::new(FxHashSet::default()),
emitted_diagnostic_codes: Lock::new(FxHashSet()), emitted_diagnostic_codes: Lock::new(FxHashSet::default()),
emitted_diagnostics: Lock::new(FxHashSet()), emitted_diagnostics: Lock::new(FxHashSet::default()),
} }
} }
@ -398,7 +398,7 @@ impl Handler {
/// tools that want to reuse a `Parser` cleaning the previously emitted diagnostics as well as /// tools that want to reuse a `Parser` cleaning the previously emitted diagnostics as well as
/// the overall count of emitted error diagnostics. /// the overall count of emitted error diagnostics.
pub fn reset_err_count(&self) { pub fn reset_err_count(&self) {
*self.emitted_diagnostics.borrow_mut() = FxHashSet(); *self.emitted_diagnostics.borrow_mut() = FxHashSet::default();
self.err_count.store(0, SeqCst); self.err_count.store(0, SeqCst);
} }

View file

@ -343,7 +343,7 @@ fn walk_nodes<'q>(query: &'q DepGraphQuery,
direction: Direction) direction: Direction)
-> FxHashSet<&'q DepNode> -> FxHashSet<&'q DepNode>
{ {
let mut set = FxHashSet(); let mut set = FxHashSet::default();
for &start in starts { for &start in starts {
debug!("walk_nodes: start={:?} outgoing?={:?}", start, direction == OUTGOING); debug!("walk_nodes: start={:?} outgoing?={:?}", start, direction == OUTGOING);
if set.insert(start) { if set.insert(start) {

View file

@ -226,7 +226,7 @@ pub fn check_dirty_clean_annotations<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
let krate = tcx.hir.krate(); let krate = tcx.hir.krate();
let mut dirty_clean_visitor = DirtyCleanVisitor { let mut dirty_clean_visitor = DirtyCleanVisitor {
tcx, tcx,
checked_attrs: FxHashSet(), checked_attrs: FxHashSet::default(),
}; };
krate.visit_all_item_likes(&mut dirty_clean_visitor); krate.visit_all_item_likes(&mut dirty_clean_visitor);

View file

@ -219,7 +219,7 @@ pub fn prepare_session_directory(sess: &Session,
} }
}; };
let mut source_directories_already_tried = FxHashSet(); let mut source_directories_already_tried = FxHashSet::default();
loop { loop {
// Generate a session directory of the form: // Generate a session directory of the form:
@ -656,8 +656,8 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> {
// First do a pass over the crate directory, collecting lock files and // First do a pass over the crate directory, collecting lock files and
// session directories // session directories
let mut session_directories = FxHashSet(); let mut session_directories = FxHashSet::default();
let mut lock_files = FxHashSet(); let mut lock_files = FxHashSet::default();
for dir_entry in try!(crate_directory.read_dir()) { for dir_entry in try!(crate_directory.read_dir()) {
let dir_entry = match dir_entry { let dir_entry = match dir_entry {
@ -875,7 +875,7 @@ fn all_except_most_recent(deletion_candidates: Vec<(SystemTime, PathBuf, Option<
.map(|(_, path, lock)| (path, lock)) .map(|(_, path, lock)| (path, lock))
.collect() .collect()
} else { } else {
FxHashMap() FxHashMap::default()
} }
} }
@ -924,7 +924,7 @@ fn test_all_except_most_recent() {
assert_eq!(all_except_most_recent( assert_eq!(all_except_most_recent(
vec![ vec![
]).keys().cloned().collect::<FxHashSet<PathBuf>>(), ]).keys().cloned().collect::<FxHashSet<PathBuf>>(),
FxHashSet() FxHashSet::default()
); );
} }
@ -939,7 +939,7 @@ fn test_timestamp_serialization() {
#[test] #[test]
fn test_find_source_directory_in_iter() { fn test_find_source_directory_in_iter() {
let already_visited = FxHashSet(); let already_visited = FxHashSet::default();
// Find newest // Find newest
assert_eq!(find_source_directory_in_iter( assert_eq!(find_source_directory_in_iter(

View file

@ -48,7 +48,7 @@ impl LoadResult<(PreviousDepGraph, WorkProductMap)> {
match self { match self {
LoadResult::Error { message } => { LoadResult::Error { message } => {
sess.warn(&message); sess.warn(&message);
(PreviousDepGraph::new(SerializedDepGraph::new()), FxHashMap()) (PreviousDepGraph::new(SerializedDepGraph::new()), FxHashMap::default())
}, },
LoadResult::DataOutOfDate => { LoadResult::DataOutOfDate => {
if let Err(err) = delete_all_session_dir_contents(sess) { if let Err(err) = delete_all_session_dir_contents(sess) {
@ -56,7 +56,7 @@ impl LoadResult<(PreviousDepGraph, WorkProductMap)> {
incremental compilation session directory contents `{}`: {}.", incremental compilation session directory contents `{}`: {}.",
dep_graph_path(sess).display(), err)); dep_graph_path(sess).display(), err));
} }
(PreviousDepGraph::new(SerializedDepGraph::new()), FxHashMap()) (PreviousDepGraph::new(SerializedDepGraph::new()), FxHashMap::default())
} }
LoadResult::Ok { data } => data LoadResult::Ok { data } => data
} }
@ -117,7 +117,7 @@ pub fn load_dep_graph(sess: &Session) ->
if sess.opts.incremental.is_none() { if sess.opts.incremental.is_none() {
// No incremental compilation. // No incremental compilation.
return MaybeAsync::Sync(LoadResult::Ok { return MaybeAsync::Sync(LoadResult::Ok {
data: (PreviousDepGraph::new(SerializedDepGraph::new()), FxHashMap()) data: (PreviousDepGraph::new(SerializedDepGraph::new()), FxHashMap::default())
}); });
} }
@ -127,7 +127,7 @@ pub fn load_dep_graph(sess: &Session) ->
let report_incremental_info = sess.opts.debugging_opts.incremental_info; let report_incremental_info = sess.opts.debugging_opts.incremental_info;
let expected_hash = sess.opts.dep_tracking_hash(); let expected_hash = sess.opts.dep_tracking_hash();
let mut prev_work_products = FxHashMap(); let mut prev_work_products = FxHashMap::default();
// If we are only building with -Zquery-dep-graph but without an actual // If we are only building with -Zquery-dep-graph but without an actual
// incr. comp. session directory, we skip this. Otherwise we'd fail // incr. comp. session directory, we skip this. Otherwise we'd fail

View file

@ -162,7 +162,7 @@ fn encode_dep_graph(tcx: TyCtxt,
let (total_edge_reads, total_duplicate_edge_reads) = let (total_edge_reads, total_duplicate_edge_reads) =
tcx.dep_graph.edge_deduplication_data(); tcx.dep_graph.edge_deduplication_data();
let mut counts: FxHashMap<_, Stat> = FxHashMap(); let mut counts: FxHashMap<_, Stat> = FxHashMap::default();
for (i, &node) in serialized_graph.nodes.iter_enumerated() { for (i, &node) in serialized_graph.nodes.iter_enumerated() {
let stat = counts.entry(node.kind).or_insert(Stat { let stat = counts.entry(node.kind).or_insert(Stat {

View file

@ -734,7 +734,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
// any generic types right now: // any generic types right now:
let ty = self.cx.tcx.normalize_erasing_regions(ParamEnv::reveal_all(), ty); let ty = self.cx.tcx.normalize_erasing_regions(ParamEnv::reveal_all(), ty);
match self.check_type_for_ffi(&mut FxHashSet(), ty) { match self.check_type_for_ffi(&mut FxHashSet::default(), ty) {
FfiResult::FfiSafe => {} FfiResult::FfiSafe => {}
FfiResult::FfiPhantom(ty) => { FfiResult::FfiPhantom(ty) => {
self.cx.span_lint(IMPROPER_CTYPES, self.cx.span_lint(IMPROPER_CTYPES,

View file

@ -1133,7 +1133,7 @@ impl<'a> CrateLoader<'a> {
path_len, path_len,
direct: true, direct: true,
}, },
&mut FxHashSet(), &mut FxHashSet::default(),
); );
self.cstore.add_extern_mod_stmt_cnum(item.id, cnum); self.cstore.add_extern_mod_stmt_cnum(item.id, cnum);
cnum cnum
@ -1160,7 +1160,7 @@ impl<'a> CrateLoader<'a> {
path_len: usize::max_value(), path_len: usize::max_value(),
direct: true, direct: true,
}, },
&mut FxHashSet(), &mut FxHashSet::default(),
); );
cnum cnum
@ -1184,7 +1184,7 @@ impl<'a> CrateLoader<'a> {
path_len: usize::max_value(), path_len: usize::max_value(),
direct: true, direct: true,
}, },
&mut FxHashSet(), &mut FxHashSet::default(),
); );
Some(cnum) Some(cnum)

View file

@ -111,7 +111,7 @@ impl CStore {
// corresponding `CrateNum`. This first entry will always remain // corresponding `CrateNum`. This first entry will always remain
// `None`. // `None`.
metas: RwLock::new(IndexVec::from_elem_n(None, 1)), metas: RwLock::new(IndexVec::from_elem_n(None, 1)),
extern_mod_crate_map: Lock::new(FxHashMap()), extern_mod_crate_map: Lock::new(FxHashMap::default()),
metadata_loader, metadata_loader,
} }
} }

View file

@ -1494,7 +1494,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
let tcx = self.tcx; let tcx = self.tcx;
let mut visitor = ImplVisitor { let mut visitor = ImplVisitor {
tcx, tcx,
impls: FxHashMap(), impls: FxHashMap::default(),
}; };
tcx.hir.krate().visit_all_item_likes(&mut visitor); tcx.hir.krate().visit_all_item_likes(&mut visitor);

View file

@ -459,7 +459,7 @@ impl<'a> Context<'a> {
let mut candidates: FxHashMap< let mut candidates: FxHashMap<
_, _,
(FxHashMap<_, _>, FxHashMap<_, _>, FxHashMap<_, _>), (FxHashMap<_, _>, FxHashMap<_, _>, FxHashMap<_, _>),
> = FxHashMap(); > = FxHashMap::default();
let mut staticlibs = vec![]; let mut staticlibs = vec![];
// First, find all possible candidate rlibs and dylibs purely based on // First, find all possible candidate rlibs and dylibs purely based on
@ -528,7 +528,7 @@ impl<'a> Context<'a> {
// A Library candidate is created if the metadata for the set of // A Library candidate is created if the metadata for the set of
// libraries corresponds to the crate id and hash criteria that this // libraries corresponds to the crate id and hash criteria that this
// search is being performed for. // search is being performed for.
let mut libraries = FxHashMap(); let mut libraries = FxHashMap::default();
for (_hash, (rlibs, rmetas, dylibs)) in candidates { for (_hash, (rlibs, rmetas, dylibs)) in candidates {
let mut slot = None; let mut slot = None;
let rlib = self.extract_one(rlibs, CrateFlavor::Rlib, &mut slot); let rlib = self.extract_one(rlibs, CrateFlavor::Rlib, &mut slot);
@ -771,9 +771,9 @@ impl<'a> Context<'a> {
// rlibs/dylibs. // rlibs/dylibs.
let sess = self.sess; let sess = self.sess;
let dylibname = self.dylibname(); let dylibname = self.dylibname();
let mut rlibs = FxHashMap(); let mut rlibs = FxHashMap::default();
let mut rmetas = FxHashMap(); let mut rmetas = FxHashMap::default();
let mut dylibs = FxHashMap(); let mut dylibs = FxHashMap::default();
{ {
let locs = locs.map(|l| PathBuf::from(l)).filter(|loc| { let locs = locs.map(|l| PathBuf::from(l)).filter(|loc| {
if !loc.exists() { if !loc.exists() {

View file

@ -183,7 +183,7 @@ impl<'a, 'tcx> Collector<'a, 'tcx> {
// Process libs passed on the command line // Process libs passed on the command line
fn process_command_line(&mut self) { fn process_command_line(&mut self) {
// First, check for errors // First, check for errors
let mut renames = FxHashSet(); let mut renames = FxHashSet::default();
for &(ref name, ref new_name, _) in &self.tcx.sess.opts.libs { for &(ref name, ref new_name, _) in &self.tcx.sess.opts.libs {
if let &Some(ref new_name) = new_name { if let &Some(ref new_name) = new_name {
let any_duplicate = self.libs let any_duplicate = self.libs

View file

@ -151,11 +151,11 @@ impl<'tcx> BorrowSet<'tcx> {
tcx, tcx,
mir, mir,
idx_vec: IndexVec::new(), idx_vec: IndexVec::new(),
location_map: FxHashMap(), location_map: FxHashMap::default(),
activation_map: FxHashMap(), activation_map: FxHashMap::default(),
region_map: FxHashMap(), region_map: FxHashMap::default(),
local_map: FxHashMap(), local_map: FxHashMap::default(),
pending_activations: FxHashMap(), pending_activations: FxHashMap::default(),
locals_state_at_exit: locals_state_at_exit:
LocalsStateAtExit::build(locals_are_invalidated_at_exit, mir, move_data), LocalsStateAtExit::build(locals_are_invalidated_at_exit, mir, move_data),
}; };

View file

@ -838,7 +838,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
(predecessor, is_back_edge) (predecessor, is_back_edge)
})); }));
let mut visited = FxHashSet(); let mut visited = FxHashSet::default();
let mut result = vec![]; let mut result = vec![];
'dfs: while let Some((location, is_back_edge)) = stack.pop() { 'dfs: while let Some((location, is_back_edge)) = stack.pop() {

View file

@ -252,13 +252,13 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
location_table, location_table,
movable_generator, movable_generator,
locals_are_invalidated_at_exit, locals_are_invalidated_at_exit,
access_place_error_reported: FxHashSet(), access_place_error_reported: FxHashSet::default(),
reservation_error_reported: FxHashSet(), reservation_error_reported: FxHashSet::default(),
move_error_reported: BTreeMap::new(), move_error_reported: BTreeMap::new(),
uninitialized_error_reported: FxHashSet(), uninitialized_error_reported: FxHashSet::default(),
errors_buffer, errors_buffer,
nonlexical_regioncx: regioncx, nonlexical_regioncx: regioncx,
used_mut: FxHashSet(), used_mut: FxHashSet::default(),
used_mut_upvars: SmallVec::new(), used_mut_upvars: SmallVec::new(),
borrow_set, borrow_set,
dominators, dominators,

View file

@ -48,7 +48,7 @@ struct UseFinder<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
impl<'cx, 'gcx, 'tcx> UseFinder<'cx, 'gcx, 'tcx> { impl<'cx, 'gcx, 'tcx> UseFinder<'cx, 'gcx, 'tcx> {
fn find(&mut self) -> Option<Cause> { fn find(&mut self) -> Option<Cause> {
let mut queue = VecDeque::new(); let mut queue = VecDeque::new();
let mut visited = FxHashSet(); let mut visited = FxHashSet::default();
queue.push_back(self.start_point); queue.push_back(self.start_point);
while let Some(p) = queue.pop_front() { while let Some(p) = queue.pop_front() {

View file

@ -128,7 +128,7 @@ pub(crate) fn type_check<'gcx, 'tcx>(
let mut constraints = MirTypeckRegionConstraints { let mut constraints = MirTypeckRegionConstraints {
liveness_constraints: LivenessValues::new(elements), liveness_constraints: LivenessValues::new(elements),
outlives_constraints: ConstraintSet::default(), outlives_constraints: ConstraintSet::default(),
closure_bounds_mapping: FxHashMap(), closure_bounds_mapping: FxHashMap::default(),
type_tests: Vec::default(), type_tests: Vec::default(),
}; };
let mut placeholder_indices = PlaceholderIndices::default(); let mut placeholder_indices = PlaceholderIndices::default();
@ -847,7 +847,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
region_bound_pairs, region_bound_pairs,
implicit_region_bound, implicit_region_bound,
borrowck_context, borrowck_context,
reported_errors: FxHashSet(), reported_errors: FxHashSet::default(),
universal_region_relations, universal_region_relations,
} }
} }

View file

@ -178,7 +178,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
// If there are no match guards then we don't need any fake borrows, // If there are no match guards then we don't need any fake borrows,
// so don't track them. // so don't track them.
let mut fake_borrows = if has_guard && tcx.generate_borrow_of_any_match_input() { let mut fake_borrows = if has_guard && tcx.generate_borrow_of_any_match_input() {
Some(FxHashMap()) Some(FxHashMap::default())
} else { } else {
None None
}; };

View file

@ -55,7 +55,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
// these maps are empty to start; cases are // these maps are empty to start; cases are
// added below in add_cases_to_switch // added below in add_cases_to_switch
options: vec![], options: vec![],
indices: FxHashMap(), indices: FxHashMap::default(),
} }
} }
} }

View file

@ -358,7 +358,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
needs_cleanup: false, needs_cleanup: false,
drops: vec![], drops: vec![],
cached_generator_drop: None, cached_generator_drop: None,
cached_exits: FxHashMap(), cached_exits: FxHashMap::default(),
cached_unwind: CachedBlock::default(), cached_unwind: CachedBlock::default(),
}); });
} }

View file

@ -77,7 +77,7 @@ fn precompute_borrows_out_of_scope<'tcx>(
// `visited` once they are added to `stack`, before they are actually // `visited` once they are added to `stack`, before they are actually
// processed, because this avoids the need to look them up again on // processed, because this avoids the need to look them up again on
// completion. // completion.
let mut visited = FxHashMap(); let mut visited = FxHashMap::default();
visited.insert(location.block, location.statement_index); visited.insert(location.block, location.statement_index);
let mut stack = vec![]; let mut stack = vec![];
@ -162,7 +162,7 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> {
} }
}); });
let mut borrows_out_of_scope_at_location = FxHashMap(); let mut borrows_out_of_scope_at_location = FxHashMap::default();
for (borrow_index, borrow_data) in borrow_set.borrows.iter_enumerated() { for (borrow_index, borrow_data) in borrow_set.borrows.iter_enumerated() {
let borrow_region = borrow_data.region.to_region_vid(); let borrow_region = borrow_data.region.to_region_vid();
let location = borrow_set.borrows[borrow_index].reserve_location; let location = borrow_set.borrows[borrow_index].reserve_location;

View file

@ -53,7 +53,7 @@ impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> {
v, v,
) )
}).collect(), }).collect(),
projections: FxHashMap(), projections: FxHashMap::default(),
}, },
move_paths, move_paths,
path_map, path_map,

View file

@ -89,7 +89,7 @@ pub struct RefTracking<'tcx, Tag> {
impl<'tcx, Tag: Copy+Eq+Hash> RefTracking<'tcx, Tag> { impl<'tcx, Tag: Copy+Eq+Hash> RefTracking<'tcx, Tag> {
pub fn new(op: OpTy<'tcx, Tag>) -> Self { pub fn new(op: OpTy<'tcx, Tag>) -> Self {
let mut ref_tracking = RefTracking { let mut ref_tracking = RefTracking {
seen: FxHashSet(), seen: FxHashSet::default(),
todo: vec![(op, Vec::new())], todo: vec![(op, Vec::new())],
}; };
ref_tracking.seen.insert(op); ref_tracking.seen.insert(op);

View file

@ -238,7 +238,7 @@ impl<'tcx> InliningMap<'tcx> {
fn new() -> InliningMap<'tcx> { fn new() -> InliningMap<'tcx> {
InliningMap { InliningMap {
index: FxHashMap(), index: FxHashMap::default(),
targets: Vec::new(), targets: Vec::new(),
inlines: GrowableBitSet::with_capacity(1024), inlines: GrowableBitSet::with_capacity(1024),
} }
@ -305,7 +305,7 @@ pub fn collect_crate_mono_items<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
debug!("Building mono item graph, beginning at roots"); debug!("Building mono item graph, beginning at roots");
let mut visited = MTLock::new(FxHashSet()); let mut visited = MTLock::new(FxHashSet::default());
let mut inlining_map = MTLock::new(InliningMap::new()); let mut inlining_map = MTLock::new(InliningMap::new());
{ {

View file

@ -301,10 +301,10 @@ fn place_root_mono_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
-> PreInliningPartitioning<'tcx> -> PreInliningPartitioning<'tcx>
where I: Iterator<Item = MonoItem<'tcx>> where I: Iterator<Item = MonoItem<'tcx>>
{ {
let mut roots = FxHashSet(); let mut roots = FxHashSet::default();
let mut codegen_units = FxHashMap(); let mut codegen_units = FxHashMap::default();
let is_incremental_build = tcx.sess.opts.incremental.is_some(); let is_incremental_build = tcx.sess.opts.incremental.is_some();
let mut internalization_candidates = FxHashSet(); let mut internalization_candidates = FxHashSet::default();
// Determine if monomorphizations instantiated in this crate will be made // Determine if monomorphizations instantiated in this crate will be made
// available to downstream crates. This depends on whether we are in // available to downstream crates. This depends on whether we are in
@ -314,7 +314,7 @@ fn place_root_mono_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
tcx.local_crate_exports_generics(); tcx.local_crate_exports_generics();
let cgu_name_builder = &mut CodegenUnitNameBuilder::new(tcx); let cgu_name_builder = &mut CodegenUnitNameBuilder::new(tcx);
let cgu_name_cache = &mut FxHashMap(); let cgu_name_cache = &mut FxHashMap::default();
for mono_item in mono_items { for mono_item in mono_items {
match mono_item.instantiation_mode(tcx) { match mono_item.instantiation_mode(tcx) {
@ -602,7 +602,7 @@ fn place_inlined_mono_items<'tcx>(initial_partitioning: PreInliningPartitioning<
inlining_map: &InliningMap<'tcx>) inlining_map: &InliningMap<'tcx>)
-> PostInliningPartitioning<'tcx> { -> PostInliningPartitioning<'tcx> {
let mut new_partitioning = Vec::new(); let mut new_partitioning = Vec::new();
let mut mono_item_placements = FxHashMap(); let mut mono_item_placements = FxHashMap::default();
let PreInliningPartitioning { let PreInliningPartitioning {
codegen_units: initial_cgus, codegen_units: initial_cgus,
@ -614,7 +614,7 @@ fn place_inlined_mono_items<'tcx>(initial_partitioning: PreInliningPartitioning<
for old_codegen_unit in initial_cgus { for old_codegen_unit in initial_cgus {
// Collect all items that need to be available in this codegen unit // Collect all items that need to be available in this codegen unit
let mut reachable = FxHashSet(); let mut reachable = FxHashSet::default();
for root in old_codegen_unit.items().keys() { for root in old_codegen_unit.items().keys() {
follow_inlining(*root, inlining_map, &mut reachable); follow_inlining(*root, inlining_map, &mut reachable);
} }
@ -703,7 +703,7 @@ fn internalize_symbols<'a, 'tcx>(_tcx: TyCtxt<'a, 'tcx, 'tcx>,
// Build a map from every monomorphization to all the monomorphizations that // Build a map from every monomorphization to all the monomorphizations that
// reference it. // reference it.
let mut accessor_map: FxHashMap<MonoItem<'tcx>, Vec<MonoItem<'tcx>>> = FxHashMap(); let mut accessor_map: FxHashMap<MonoItem<'tcx>, Vec<MonoItem<'tcx>>> = FxHashMap::default();
inlining_map.iter_accesses(|accessor, accessees| { inlining_map.iter_accesses(|accessor, accessees| {
for accessee in accessees { for accessee in accessees {
accessor_map.entry(*accessee) accessor_map.entry(*accessee)

View file

@ -57,7 +57,7 @@ impl<'a, 'gcx, 'tcx> UnsafetyChecker<'a, 'tcx> {
}, },
tcx, tcx,
param_env, param_env,
used_unsafe: FxHashSet(), used_unsafe: FxHashSet::default(),
inherited_blocks: vec![], inherited_blocks: vec![],
} }
} }

View file

@ -57,7 +57,7 @@ impl MirPass for CleanEndRegions {
if !tcx.emit_end_regions() { return; } if !tcx.emit_end_regions() { return; }
let mut gather = GatherBorrowedRegions { let mut gather = GatherBorrowedRegions {
seen_regions: FxHashSet() seen_regions: FxHashSet::default()
}; };
gather.visit_mir(mir); gather.visit_mir(mir);
@ -154,7 +154,7 @@ impl MirPass for CleanFakeReadsAndBorrows {
_source: MirSource, _source: MirSource,
mir: &mut Mir<'tcx>) { mir: &mut Mir<'tcx>) {
let mut delete_reads = DeleteAndRecordFakeReads { let mut delete_reads = DeleteAndRecordFakeReads {
fake_borrow_temporaries: FxHashSet(), fake_borrow_temporaries: FxHashSet::default(),
}; };
delete_reads.visit_mir(mir); delete_reads.visit_mir(mir);
let mut delete_borrows = DeleteFakeBorrows { let mut delete_borrows = DeleteFakeBorrows {

View file

@ -75,7 +75,7 @@ impl MirPass for ElaborateDrops {
env: &env, env: &env,
flow_inits, flow_inits,
flow_uninits, flow_uninits,
drop_flags: FxHashMap(), drop_flags: FxHashMap::default(),
patch: MirPatch::new(mir), patch: MirPatch::new(mir),
}.elaborate() }.elaborate()
}; };

View file

@ -1291,7 +1291,7 @@ impl MirPass for QualifyAndPromoteConstants {
fn args_required_const(tcx: TyCtxt, def_id: DefId) -> Option<FxHashSet<usize>> { fn args_required_const(tcx: TyCtxt, def_id: DefId) -> Option<FxHashSet<usize>> {
let attrs = tcx.get_attrs(def_id); let attrs = tcx.get_attrs(def_id);
let attr = attrs.iter().find(|a| a.check_name("rustc_args_required_const"))?; let attr = attrs.iter().find(|a| a.check_name("rustc_args_required_const"))?;
let mut ret = FxHashSet(); let mut ret = FxHashSet::default();
for meta in attr.meta_item_list()? { for meta in attr.meta_item_list()? {
match meta.literal()?.node { match meta.literal()?.node {
LitKind::Int(a, _) => { ret.insert(a as usize); } LitKind::Int(a, _) => { ret.insert(a as usize); }

View file

@ -536,7 +536,7 @@ pub fn write_mir_intro<'a, 'gcx, 'tcx>(
writeln!(w, "{{")?; writeln!(w, "{{")?;
// construct a scope tree and write it out // construct a scope tree and write it out
let mut scope_tree: FxHashMap<SourceScope, Vec<SourceScope>> = FxHashMap(); let mut scope_tree: FxHashMap<SourceScope, Vec<SourceScope>> = FxHashMap::default();
for (index, scope_data) in mir.source_scopes.iter().enumerate() { for (index, scope_data) in mir.source_scopes.iter().enumerate() {
if let Some(parent) = scope_data.parent_scope { if let Some(parent) = scope_data.parent_scope {
scope_tree scope_tree

View file

@ -41,8 +41,8 @@ struct StatCollector<'k> {
pub fn print_hir_stats(krate: &hir::Crate) { pub fn print_hir_stats(krate: &hir::Crate) {
let mut collector = StatCollector { let mut collector = StatCollector {
krate: Some(krate), krate: Some(krate),
data: FxHashMap(), data: FxHashMap::default(),
seen: FxHashSet(), seen: FxHashSet::default(),
}; };
hir_visit::walk_crate(&mut collector, krate); hir_visit::walk_crate(&mut collector, krate);
collector.print("HIR STATS"); collector.print("HIR STATS");
@ -51,8 +51,8 @@ pub fn print_hir_stats(krate: &hir::Crate) {
pub fn print_ast_stats<'v>(krate: &'v ast::Crate, title: &str) { pub fn print_ast_stats<'v>(krate: &'v ast::Crate, title: &str) {
let mut collector = StatCollector { let mut collector = StatCollector {
krate: None, krate: None,
data: FxHashMap(), data: FxHashMap::default(),
seen: FxHashSet(), seen: FxHashSet::default(),
}; };
ast_visit::walk_crate(&mut collector, krate); ast_visit::walk_crate(&mut collector, krate);
collector.print(title); collector.print(title);

View file

@ -1732,7 +1732,7 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
in_body: false, in_body: false,
span: krate.span, span: krate.span,
empty_tables: &empty_tables, empty_tables: &empty_tables,
visited_opaque_tys: FxHashSet() visited_opaque_tys: FxHashSet::default()
}; };
intravisit::walk_crate(&mut visitor, krate); intravisit::walk_crate(&mut visitor, krate);

View file

@ -780,7 +780,7 @@ impl<'a, 'tcx, 'cl> Visitor<'tcx> for Resolver<'a, 'cl> {
self.label_ribs.push(Rib::new(rib_kind)); self.label_ribs.push(Rib::new(rib_kind));
// Add each argument to the rib. // Add each argument to the rib.
let mut bindings_list = FxHashMap(); let mut bindings_list = FxHashMap::default();
for argument in &declaration.inputs { for argument in &declaration.inputs {
self.resolve_pattern(&argument.pat, PatternSource::FnParam, &mut bindings_list); self.resolve_pattern(&argument.pat, PatternSource::FnParam, &mut bindings_list);
@ -930,7 +930,7 @@ struct Rib<'a> {
impl<'a> Rib<'a> { impl<'a> Rib<'a> {
fn new(kind: RibKind<'a>) -> Rib<'a> { fn new(kind: RibKind<'a>) -> Rib<'a> {
Rib { Rib {
bindings: FxHashMap(), bindings: FxHashMap::default(),
kind, kind,
} }
} }
@ -1053,11 +1053,11 @@ impl<'a> ModuleData<'a> {
parent, parent,
kind, kind,
normal_ancestor_id, normal_ancestor_id,
resolutions: RefCell::new(FxHashMap()), resolutions: RefCell::new(FxHashMap::default()),
legacy_macro_resolutions: RefCell::new(Vec::new()), legacy_macro_resolutions: RefCell::new(Vec::new()),
macro_resolutions: RefCell::new(Vec::new()), macro_resolutions: RefCell::new(Vec::new()),
builtin_attrs: RefCell::new(Vec::new()), builtin_attrs: RefCell::new(Vec::new()),
unresolved_invocations: RefCell::new(FxHashSet()), unresolved_invocations: RefCell::new(FxHashSet::default()),
no_implicit_prelude: false, no_implicit_prelude: false,
glob_importers: RefCell::new(Vec::new()), glob_importers: RefCell::new(Vec::new()),
globs: RefCell::new(Vec::new()), globs: RefCell::new(Vec::new()),
@ -1321,7 +1321,7 @@ struct PrimitiveTypeTable {
impl PrimitiveTypeTable { impl PrimitiveTypeTable {
fn new() -> PrimitiveTypeTable { fn new() -> PrimitiveTypeTable {
let mut table = PrimitiveTypeTable { primitive_types: FxHashMap() }; let mut table = PrimitiveTypeTable { primitive_types: FxHashMap::default() };
table.intern("bool", Bool); table.intern("bool", Bool);
table.intern("char", Char); table.intern("char", Char);
@ -1668,7 +1668,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
no_implicit_prelude: attr::contains_name(&krate.attrs, "no_implicit_prelude"), no_implicit_prelude: attr::contains_name(&krate.attrs, "no_implicit_prelude"),
..ModuleData::new(None, root_module_kind, root_def_id, Mark::root(), krate.span) ..ModuleData::new(None, root_module_kind, root_def_id, Mark::root(), krate.span)
}); });
let mut module_map = FxHashMap(); let mut module_map = FxHashMap::default();
module_map.insert(DefId::local(CRATE_DEF_INDEX), graph_root); module_map.insert(DefId::local(CRATE_DEF_INDEX), graph_root);
let mut definitions = Definitions::new(); let mut definitions = Definitions::new();
@ -1688,11 +1688,11 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
} }
} }
let mut invocations = FxHashMap(); let mut invocations = FxHashMap::default();
invocations.insert(Mark::root(), invocations.insert(Mark::root(),
arenas.alloc_invocation_data(InvocationData::root(graph_root))); arenas.alloc_invocation_data(InvocationData::root(graph_root)));
let mut macro_defs = FxHashMap(); let mut macro_defs = FxHashMap::default();
macro_defs.insert(Mark::root(), root_def_id); macro_defs.insert(Mark::root(), root_def_id);
Resolver { Resolver {
@ -1708,8 +1708,8 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
prelude: None, prelude: None,
extern_prelude, extern_prelude,
has_self: FxHashSet(), has_self: FxHashSet::default(),
field_names: FxHashMap(), field_names: FxHashMap::default(),
determined_imports: Vec::new(), determined_imports: Vec::new(),
indeterminate_imports: Vec::new(), indeterminate_imports: Vec::new(),
@ -1732,21 +1732,21 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
import_map: NodeMap(), import_map: NodeMap(),
freevars: NodeMap(), freevars: NodeMap(),
freevars_seen: NodeMap(), freevars_seen: NodeMap(),
export_map: FxHashMap(), export_map: FxHashMap::default(),
trait_map: NodeMap(), trait_map: NodeMap(),
module_map, module_map,
block_map: NodeMap(), block_map: NodeMap(),
extern_module_map: FxHashMap(), extern_module_map: FxHashMap::default(),
binding_parent_modules: FxHashMap(), binding_parent_modules: FxHashMap::default(),
make_glob_map: make_glob_map == MakeGlobMap::Yes, make_glob_map: make_glob_map == MakeGlobMap::Yes,
glob_map: NodeMap(), glob_map: NodeMap(),
used_imports: FxHashSet(), used_imports: FxHashSet::default(),
maybe_unused_trait_imports: NodeSet(), maybe_unused_trait_imports: NodeSet(),
maybe_unused_extern_crates: Vec::new(), maybe_unused_extern_crates: Vec::new(),
unused_labels: FxHashMap(), unused_labels: FxHashMap::default(),
privacy_errors: Vec::new(), privacy_errors: Vec::new(),
ambiguity_errors: Vec::new(), ambiguity_errors: Vec::new(),
@ -1762,20 +1762,20 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
}), }),
crate_loader, crate_loader,
macro_names: FxHashSet(), macro_names: FxHashSet::default(),
builtin_macros: FxHashMap(), builtin_macros: FxHashMap::default(),
macro_use_prelude: FxHashMap(), macro_use_prelude: FxHashMap::default(),
all_macros: FxHashMap(), all_macros: FxHashMap::default(),
macro_map: FxHashMap(), macro_map: FxHashMap::default(),
invocations, invocations,
macro_defs, macro_defs,
local_macro_def_scopes: FxHashMap(), local_macro_def_scopes: FxHashMap::default(),
name_already_seen: FxHashMap(), name_already_seen: FxHashMap::default(),
whitelisted_legacy_custom_derives: Vec::new(), whitelisted_legacy_custom_derives: Vec::new(),
potentially_unused_imports: Vec::new(), potentially_unused_imports: Vec::new(),
struct_constructors: DefIdMap(), struct_constructors: DefIdMap(),
found_unresolved_macro: false, found_unresolved_macro: false,
unused_macros: FxHashSet(), unused_macros: FxHashSet::default(),
current_type_ascription: Vec::new(), current_type_ascription: Vec::new(),
injected_crate: None, injected_crate: None,
} }
@ -2381,7 +2381,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
match type_parameters { match type_parameters {
HasTypeParameters(generics, rib_kind) => { HasTypeParameters(generics, rib_kind) => {
let mut function_type_rib = Rib::new(rib_kind); let mut function_type_rib = Rib::new(rib_kind);
let mut seen_bindings = FxHashMap(); let mut seen_bindings = FxHashMap::default();
for param in &generics.params { for param in &generics.params {
match param.kind { match param.kind {
GenericParamKind::Lifetime { .. } => {} GenericParamKind::Lifetime { .. } => {}
@ -2649,7 +2649,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
walk_list!(self, visit_expr, &local.init); walk_list!(self, visit_expr, &local.init);
// Resolve the pattern. // Resolve the pattern.
self.resolve_pattern(&local.pat, PatternSource::Let, &mut FxHashMap()); self.resolve_pattern(&local.pat, PatternSource::Let, &mut FxHashMap::default());
} }
// build a map from pattern identifiers to binding-info's. // build a map from pattern identifiers to binding-info's.
@ -2657,7 +2657,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
// that expands into an or-pattern where one 'x' was from the // that expands into an or-pattern where one 'x' was from the
// user and one 'x' came from the macro. // user and one 'x' came from the macro.
fn binding_mode_map(&mut self, pat: &Pat) -> BindingMap { fn binding_mode_map(&mut self, pat: &Pat) -> BindingMap {
let mut binding_map = FxHashMap(); let mut binding_map = FxHashMap::default();
pat.walk(&mut |pat| { pat.walk(&mut |pat| {
if let PatKind::Ident(binding_mode, ident, ref sub_pat) = pat.node { if let PatKind::Ident(binding_mode, ident, ref sub_pat) = pat.node {
@ -2682,8 +2682,8 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
return; return;
} }
let mut missing_vars = FxHashMap(); let mut missing_vars = FxHashMap::default();
let mut inconsistent_vars = FxHashMap(); let mut inconsistent_vars = FxHashMap::default();
for (i, p) in pats.iter().enumerate() { for (i, p) in pats.iter().enumerate() {
let map_i = self.binding_mode_map(&p); let map_i = self.binding_mode_map(&p);
@ -2747,7 +2747,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
fn resolve_arm(&mut self, arm: &Arm) { fn resolve_arm(&mut self, arm: &Arm) {
self.ribs[ValueNS].push(Rib::new(NormalRibKind)); self.ribs[ValueNS].push(Rib::new(NormalRibKind));
let mut bindings_list = FxHashMap(); let mut bindings_list = FxHashMap::default();
for pattern in &arm.pats { for pattern in &arm.pats {
self.resolve_pattern(&pattern, PatternSource::Match, &mut bindings_list); self.resolve_pattern(&pattern, PatternSource::Match, &mut bindings_list);
} }
@ -4143,7 +4143,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
self.visit_expr(subexpression); self.visit_expr(subexpression);
self.ribs[ValueNS].push(Rib::new(NormalRibKind)); self.ribs[ValueNS].push(Rib::new(NormalRibKind));
let mut bindings_list = FxHashMap(); let mut bindings_list = FxHashMap::default();
for pat in pats { for pat in pats {
self.resolve_pattern(pat, PatternSource::IfLet, &mut bindings_list); self.resolve_pattern(pat, PatternSource::IfLet, &mut bindings_list);
} }
@ -4168,7 +4168,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
self.with_resolved_label(label, expr.id, |this| { self.with_resolved_label(label, expr.id, |this| {
this.visit_expr(subexpression); this.visit_expr(subexpression);
this.ribs[ValueNS].push(Rib::new(NormalRibKind)); this.ribs[ValueNS].push(Rib::new(NormalRibKind));
let mut bindings_list = FxHashMap(); let mut bindings_list = FxHashMap::default();
for pat in pats { for pat in pats {
this.resolve_pattern(pat, PatternSource::WhileLet, &mut bindings_list); this.resolve_pattern(pat, PatternSource::WhileLet, &mut bindings_list);
} }
@ -4182,7 +4182,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
ExprKind::ForLoop(ref pattern, ref subexpression, ref block, label) => { ExprKind::ForLoop(ref pattern, ref subexpression, ref block, label) => {
self.visit_expr(subexpression); self.visit_expr(subexpression);
self.ribs[ValueNS].push(Rib::new(NormalRibKind)); self.ribs[ValueNS].push(Rib::new(NormalRibKind));
self.resolve_pattern(pattern, PatternSource::For, &mut FxHashMap()); self.resolve_pattern(pattern, PatternSource::For, &mut FxHashMap::default());
self.resolve_labeled_block(label, expr.id, block); self.resolve_labeled_block(label, expr.id, block);
@ -4235,7 +4235,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
self.ribs[ValueNS].push(Rib::new(rib_kind)); self.ribs[ValueNS].push(Rib::new(rib_kind));
self.label_ribs.push(Rib::new(rib_kind)); self.label_ribs.push(Rib::new(rib_kind));
// Resolve arguments: // Resolve arguments:
let mut bindings_list = FxHashMap(); let mut bindings_list = FxHashMap::default();
for argument in &fn_decl.inputs { for argument in &fn_decl.inputs {
self.resolve_pattern(&argument.pat, PatternSource::FnParam, &mut bindings_list); self.resolve_pattern(&argument.pat, PatternSource::FnParam, &mut bindings_list);
self.visit_ty(&argument.ty); self.visit_ty(&argument.ty);
@ -4380,7 +4380,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
where FilterFn: Fn(Def) -> bool where FilterFn: Fn(Def) -> bool
{ {
let mut candidates = Vec::new(); let mut candidates = Vec::new();
let mut seen_modules = FxHashSet(); let mut seen_modules = FxHashSet::default();
let not_local_module = crate_name != keywords::Crate.ident(); let not_local_module = crate_name != keywords::Crate.ident();
let mut worklist = vec![(start_module, Vec::<ast::PathSegment>::new(), not_local_module)]; let mut worklist = vec![(start_module, Vec::<ast::PathSegment>::new(), not_local_module)];
@ -4499,7 +4499,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
-> Option<(Module<'a>, ImportSuggestion)> -> Option<(Module<'a>, ImportSuggestion)>
{ {
let mut result = None; let mut result = None;
let mut seen_modules = FxHashSet(); let mut seen_modules = FxHashSet::default();
let mut worklist = vec![(self.graph_root, Vec::new())]; let mut worklist = vec![(self.graph_root, Vec::new())];
while let Some((in_module, path_segments)) = worklist.pop() { while let Some((in_module, path_segments)) = worklist.pop() {
@ -4673,7 +4673,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
fn report_errors(&mut self, krate: &Crate) { fn report_errors(&mut self, krate: &Crate) {
self.report_with_use_injections(krate); self.report_with_use_injections(krate);
let mut reported_spans = FxHashSet(); let mut reported_spans = FxHashSet::default();
for &(span_use, span_def) in &self.macro_expanded_macro_export_errors { for &(span_use, span_def) in &self.macro_expanded_macro_export_errors {
let msg = "macro-expanded `macro_export` macros from the current crate \ let msg = "macro-expanded `macro_export` macros from the current crate \

View file

@ -652,7 +652,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
> = BTreeMap::new(); > = BTreeMap::new();
let mut errors = false; let mut errors = false;
let mut seen_spans = FxHashSet(); let mut seen_spans = FxHashSet::default();
let mut error_vec = Vec::new(); let mut error_vec = Vec::new();
let mut prev_root_id: NodeId = NodeId::new(0); let mut prev_root_id: NodeId = NodeId::new(0);
for i in 0 .. self.determined_imports.len() { for i in 0 .. self.determined_imports.len() {

View file

@ -110,7 +110,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
span: span_utils.clone(), span: span_utils.clone(),
cur_scope: CRATE_NODE_ID, cur_scope: CRATE_NODE_ID,
// mac_defs: FxHashSet::default(), // mac_defs: FxHashSet::default(),
macro_calls: FxHashSet(), macro_calls: FxHashSet::default(),
} }
} }
@ -176,7 +176,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
// (and don't include remapping args anymore) // (and don't include remapping args anymore)
let (program, arguments) = { let (program, arguments) = {
let remap_arg_indices = { let remap_arg_indices = {
let mut indices = FxHashSet(); let mut indices = FxHashSet::default();
// Args are guaranteed to be valid UTF-8 (checked early) // Args are guaranteed to be valid UTF-8 (checked early)
for (i, e) in env::args().enumerate() { for (i, e) in env::args().enumerate() {
if e.starts_with("--remap-path-prefix=") { if e.starts_with("--remap-path-prefix=") {

View file

@ -86,7 +86,7 @@ fn dropck_outlives<'tcx>(
let mut ty_stack = vec![(for_ty, 0)]; let mut ty_stack = vec![(for_ty, 0)];
// Set used to detect infinite recursion. // Set used to detect infinite recursion.
let mut ty_set = FxHashSet(); let mut ty_set = FxHashSet::default();
let fulfill_cx = &mut FulfillmentContext::new(); let fulfill_cx = &mut FulfillmentContext::new();
@ -321,8 +321,8 @@ crate fn adt_dtorck_constraint<'a, 'tcx>(
} }
fn dedup_dtorck_constraint<'tcx>(c: &mut DtorckConstraint<'tcx>) { fn dedup_dtorck_constraint<'tcx>(c: &mut DtorckConstraint<'tcx>) {
let mut outlives = FxHashSet(); let mut outlives = FxHashSet::default();
let mut dtorck_types = FxHashSet(); let mut dtorck_types = FxHashSet::default();
c.outlives.retain(|&val| outlives.replace(val).is_none()); c.outlives.retain(|&val| outlives.replace(val).is_none());
c.dtorck_types c.dtorck_types

View file

@ -142,7 +142,7 @@ crate fn program_clauses_for_env<'a, 'tcx>(
) -> Clauses<'tcx> { ) -> Clauses<'tcx> {
debug!("program_clauses_for_env(environment={:?})", environment); debug!("program_clauses_for_env(environment={:?})", environment);
let mut last_round = FxHashSet(); let mut last_round = FxHashSet::default();
{ {
let mut visitor = ClauseVisitor::new(tcx, &mut last_round); let mut visitor = ClauseVisitor::new(tcx, &mut last_round);
for &clause in environment.clauses { for &clause in environment.clauses {
@ -151,7 +151,7 @@ crate fn program_clauses_for_env<'a, 'tcx>(
} }
let mut closure = last_round.clone(); let mut closure = last_round.clone();
let mut next_round = FxHashSet(); let mut next_round = FxHashSet::default();
while !last_round.is_empty() { while !last_round.is_empty() {
let mut visitor = ClauseVisitor::new(tcx, &mut next_round); let mut visitor = ClauseVisitor::new(tcx, &mut next_round);
for clause in last_round.drain() { for clause in last_round.drain() {

View file

@ -887,7 +887,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
.collect::<FxHashMap<_, _>>(); .collect::<FxHashMap<_, _>>();
// Keep track of which fields have already appeared in the pattern. // Keep track of which fields have already appeared in the pattern.
let mut used_fields = FxHashMap(); let mut used_fields = FxHashMap::default();
let mut no_field_errors = true; let mut no_field_errors = true;
let mut inexistent_fields = vec![]; let mut inexistent_fields = vec![];

View file

@ -89,7 +89,7 @@ pub fn resolve_interior<'a, 'gcx, 'tcx>(fcx: &'a FnCtxt<'a, 'gcx, 'tcx>,
let body = fcx.tcx.hir.body(body_id); let body = fcx.tcx.hir.body(body_id);
let mut visitor = InteriorVisitor { let mut visitor = InteriorVisitor {
fcx, fcx,
types: FxHashMap(), types: FxHashMap::default(),
region_scope_tree: fcx.tcx.region_scope_tree(def_id), region_scope_tree: fcx.tcx.region_scope_tree(def_id),
expr_count: 0, expr_count: 0,
}; };

View file

@ -416,7 +416,7 @@ pub fn check_platform_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
return return
} }
let mut structural_to_nomimal = FxHashMap(); let mut structural_to_nomimal = FxHashMap::default();
let sig = tcx.fn_sig(def_id); let sig = tcx.fn_sig(def_id);
let sig = sig.no_late_bound_regions().unwrap(); let sig = sig.no_late_bound_regions().unwrap();

View file

@ -396,7 +396,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
return_type, return_type,
inherent_candidates: Vec::new(), inherent_candidates: Vec::new(),
extension_candidates: Vec::new(), extension_candidates: Vec::new(),
impl_dups: FxHashSet(), impl_dups: FxHashSet::default(),
steps: steps, steps: steps,
static_candidates: Vec::new(), static_candidates: Vec::new(),
allow_similar_names: false, allow_similar_names: false,
@ -718,7 +718,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
if expr_id == ast::DUMMY_NODE_ID { if expr_id == ast::DUMMY_NODE_ID {
return Ok(()) return Ok(())
} }
let mut duplicates = FxHashSet(); let mut duplicates = FxHashSet::default();
let expr_hir_id = self.tcx.hir.node_to_hir_id(expr_id); let expr_hir_id = self.tcx.hir.node_to_hir_id(expr_id);
let opt_applicable_traits = self.tcx.in_scope_traits(expr_hir_id); let opt_applicable_traits = self.tcx.in_scope_traits(expr_hir_id);
if let Some(applicable_traits) = opt_applicable_traits { if let Some(applicable_traits) = opt_applicable_traits {
@ -735,7 +735,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
} }
fn assemble_extension_candidates_for_all_traits(&mut self) -> Result<(), MethodError<'tcx>> { fn assemble_extension_candidates_for_all_traits(&mut self) -> Result<(), MethodError<'tcx>> {
let mut duplicates = FxHashSet(); let mut duplicates = FxHashSet::default();
for trait_info in suggest::all_traits(self.tcx) { for trait_info in suggest::all_traits(self.tcx) {
if duplicates.insert(trait_info.def_id) { if duplicates.insert(trait_info.def_id) {
self.assemble_extension_candidates_for_trait(None, trait_info.def_id)?; self.assemble_extension_candidates_for_trait(None, trait_info.def_id)?;
@ -800,7 +800,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
} }
fn candidate_method_names(&self) -> Vec<ast::Ident> { fn candidate_method_names(&self) -> Vec<ast::Ident> {
let mut set = FxHashSet(); let mut set = FxHashSet::default();
let mut names: Vec<_> = self.inherent_candidates let mut names: Vec<_> = self.inherent_candidates
.iter() .iter()
.chain(&self.extension_candidates) .chain(&self.extension_candidates)

Some files were not shown because too many files have changed in this diff Show more