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 {
pub fn new() -> CguReuseTracker {
let data = TrackerData {
actual_reuse: FxHashMap(),
expected_reuse: FxHashMap(),
actual_reuse: FxHashMap::default(),
expected_reuse: FxHashMap::default(),
};
CguReuseTracker {

View File

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

View File

@ -101,11 +101,11 @@ impl DepGraph {
DepGraph {
data: Some(Lrc::new(DepGraphData {
previous_work_products: prev_work_products,
dep_node_debug: Lock::new(FxHashMap()),
dep_node_debug: Lock::new(FxHashMap::default()),
current: Lock::new(CurrentDepGraph::new()),
previous: prev_graph,
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)),
}
@ -209,7 +209,7 @@ impl DepGraph {
|key| OpenTask::Regular(Lock::new(RegularOpenTask {
node: key,
reads: SmallVec::new(),
read_set: FxHashSet(),
read_set: FxHashSet::default(),
})),
|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 task = OpenTask::Anon(Lock::new(AnonOpenTask {
reads: SmallVec::new(),
read_set: FxHashSet(),
read_set: FxHashSet::default(),
}));
let r = {
@ -937,7 +937,7 @@ impl CurrentDepGraph {
CurrentDepGraph {
nodes: IndexVec::new(),
edges: IndexVec::new(),
node_to_node_index: FxHashMap(),
node_to_node_index: FxHashMap::default(),
anon_id_seed: stable_hasher.finish(),
forbidden_edge,
total_read_count: 0,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -62,7 +62,7 @@ impl<'a, 'gcx, 'tcx> TypeFreshener<'a, 'gcx, 'tcx> {
TypeFreshener {
infcx,
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 =
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 {
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>)
-> ConstraintGraph<'a, 'gcx, 'tcx> {
let mut i = 0;
let mut node_ids = FxHashMap();
let mut node_ids = FxHashMap::default();
{
let mut add_node = |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 Edge = Edge<'tcx>;
fn nodes(&self) -> dot::Nodes<'_, Node> {
let mut set = FxHashSet();
let mut set = FxHashSet::default();
for node in self.node_ids.keys() {
set.insert(*node);
}

View File

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

View File

@ -534,7 +534,7 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> {
lexical_region_resolutions: RefCell::new(None),
selection_cache: traits::SelectionCache::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),
err_count_on_creation: tcx.sess.err_count(),
in_snapshot: Cell::new(false),

View File

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

View File

@ -18,7 +18,7 @@ pub(super) struct TaintSet<'tcx> {
impl<'tcx> TaintSet<'tcx> {
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);
TaintSet {
directions: directions,

View File

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

View File

@ -59,7 +59,7 @@ impl LintLevelSets {
fn process_command_line(&mut self, sess: &Session) {
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);
for &(ref lint_name, level) in &sess.opts.lint_opts {
@ -175,7 +175,7 @@ impl<'a> LintLevelsBuilder<'a> {
sess,
sets,
cur: 0,
id_to_set: FxHashMap(),
id_to_set: FxHashMap::default(),
warn_about_weird_lints: sess.buffered_lints.borrow().is_some(),
}
}
@ -195,7 +195,7 @@ impl<'a> LintLevelsBuilder<'a> {
///
/// Don't forget to call `pop`!
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 sess = self.sess;
let bad_attr = |span| {

View File

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

View File

@ -94,7 +94,7 @@ pub enum Linkage {
pub fn calculate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
let sess = &tcx.sess;
let mut fmts = FxHashMap();
let mut fmts = FxHashMap::default();
for &ty in sess.crate_types.borrow().iter() {
let linkage = calculate_type(tcx, ty);
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
// 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> {
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)); )*

View File

@ -31,8 +31,8 @@ pub struct LibFeatures {
impl LibFeatures {
fn new() -> LibFeatures {
LibFeatures {
stable: FxHashMap(),
unstable: FxHashSet(),
stable: FxHashMap::default(),
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.
fn propagate(&mut self) {
let mut scanned = FxHashSet();
let mut scanned = FxHashSet::default();
while let Some(search_item) = self.worklist.pop() {
if !scanned.insert(search_item) {
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_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);
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,
var_parent: None,
},
terminating_scopes: FxHashSet(),
terminating_scopes: FxHashSet::default(),
};
let body = tcx.hir.body(body_id);

View File

@ -393,9 +393,9 @@ fn resolve_lifetimes<'tcx>(
let named_region_map = krate(tcx);
let mut rl = ResolveLifetimes {
defs: FxHashMap(),
late_bound: FxHashMap(),
object_lifetime_defaults: FxHashMap(),
defs: FxHashMap::default(),
late_bound: FxHashMap::default(),
object_lifetime_defaults: FxHashMap::default(),
};
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);
let mut elision = None;
let mut lifetimes = FxHashMap();
let mut lifetimes = FxHashMap::default();
let mut type_count = 0;
for param in &generics.params {
match param.kind {
@ -2017,7 +2017,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
map: self.map,
outer_index: ty::INNERMOST,
have_bound_regions: false,
lifetimes: FxHashSet(),
lifetimes: FxHashSet::default(),
};
gather.visit_ty(input);
@ -2537,14 +2537,14 @@ fn insert_late_bound_lifetimes(
decl, generics);
let mut constrained_by_input = ConstrainedCollector {
regions: FxHashSet(),
regions: FxHashSet::default(),
};
for arg_ty in &decl.inputs {
constrained_by_input.visit_ty(arg_ty);
}
let mut appears_in_output = AllCollector {
regions: FxHashSet(),
regions: FxHashSet::default(),
};
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
// ignore binders here and scrape up all names we see.
let mut appears_in_where_clause = AllCollector {
regions: FxHashSet(),
regions: FxHashSet::default(),
};
appears_in_where_clause.visit_generics(generics);

View File

@ -401,13 +401,13 @@ impl<'a, 'tcx> Index<'tcx> {
let is_staged_api =
tcx.sess.opts.debugging_opts.force_unstable_if_unmarked ||
tcx.features().staged_api;
let mut staged_api = FxHashMap();
let mut staged_api = FxHashMap::default();
staged_api.insert(LOCAL_CRATE, is_staged_api);
let mut index = Index {
staged_api,
stab_map: FxHashMap(),
depr_map: FxHashMap(),
active_features: FxHashSet(),
stab_map: FxHashMap::default(),
depr_map: FxHashMap::default(),
active_features: FxHashSet::default(),
};
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 mut lang_features = FxHashSet();
let mut lang_features = FxHashSet::default();
for &(feature, span, since) in declared_lang_features {
if let Some(since) = since {
// 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 mut remaining_lib_features = FxHashMap();
let mut remaining_lib_features = FxHashMap::default();
for (feature, span) in declared_lib_features {
if remaining_lib_features.contains_key(&feature) {
// 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> {
pub fn new() -> Self {
AllocMap {
id_to_type: FxHashMap(),
type_interner: FxHashMap(),
id_to_type: FxHashMap::default(),
type_interner: FxHashMap::default(),
next_id: AllocId(0),
}
}

View File

@ -121,7 +121,7 @@ impl<'tcx> CodegenUnit<'tcx> {
pub fn new(name: InternedString) -> CodegenUnit<'tcx> {
CodegenUnit {
name: name,
items: FxHashMap(),
items: FxHashMap::default(),
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 {
CodegenUnitNameBuilder {
tcx,
cache: FxHashMap(),
cache: FxHashMap::default(),
}
}

View File

@ -60,7 +60,7 @@ pub struct 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,
kind: DataTypeKind,

View File

@ -1147,7 +1147,7 @@ pub fn build_session_(
working_dir,
lint_store: RwLock::new(lint::LintStore::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_attributes: OneThread::new(RefCell::new(Vec::new())),
crate_types: Once::new(),
@ -1207,7 +1207,7 @@ pub fn build_session_(
},
has_global_allocator: Once::new(),
has_panic_handler: Once::new(),
driver_lint_caps: FxHashMap(),
driver_lint_caps: FxHashMap::default(),
};
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| {
let mut fresh_preds = FxHashSet();
let mut fresh_preds = FxHashSet::default();
// 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
@ -311,7 +311,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
let mut select = SelectionContext::new(&infcx);
let mut already_visited = FxHashSet();
let mut already_visited = FxHashSet::default();
let mut predicates = VecDeque::new();
predicates.push_back(ty::Binder::bind(ty::TraitPredicate {
trait_ref: ty::TraitRef {
@ -508,8 +508,8 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
&self,
regions: &RegionConstraintData<'cx>,
) -> FxHashMap<ty::RegionVid, ty::Region<'cx>> {
let mut vid_map: FxHashMap<RegionTarget<'cx>, RegionDeps<'cx>> = FxHashMap();
let mut finished_map = FxHashMap();
let mut vid_map: FxHashMap<RegionTarget<'cx>, RegionDeps<'cx>> = FxHashMap::default();
let mut finished_map = FxHashMap::default();
for constraint in regions.constraints.keys() {
match constraint {

View File

@ -1258,7 +1258,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
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 {
if reported_violations.insert(violation.clone()) {
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 {
infcx: self,
var_map: FxHashMap()
var_map: FxHashMap::default()
});
let cleaned_pred = super::project::normalize(

View File

@ -3742,7 +3742,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
}
} else {
// 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()));
}
self.infcx()
@ -3791,24 +3791,24 @@ impl<'tcx> TraitObligation<'tcx> {
impl<'tcx> SelectionCache<'tcx> {
pub fn new() -> SelectionCache<'tcx> {
SelectionCache {
hashmap: Lock::new(FxHashMap()),
hashmap: Lock::new(FxHashMap::default()),
}
}
pub fn clear(&self) {
*self.hashmap.borrow_mut() = FxHashMap()
*self.hashmap.borrow_mut() = FxHashMap::default()
}
}
impl<'tcx> EvaluationCache<'tcx> {
pub fn new() -> EvaluationCache<'tcx> {
EvaluationCache {
hashmap: Lock::new(FxHashMap()),
hashmap: Lock::new(FxHashMap::default()),
}
}
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 {
pub fn new() -> Self {
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> {
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 {

View File

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

View File

@ -753,7 +753,7 @@ impl LateBoundRegionsCollector {
fn new(just_constrained: bool) -> Self {
LateBoundRegionsCollector {
current_index: ty::INNERMOST,
regions: FxHashSet(),
regions: FxHashSet::default(),
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 {
ty.uninhabited_from(&mut FxHashMap(), self)
ty.uninhabited_from(&mut FxHashMap::default(), 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();
// 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>) {
thread_local! {
static CACHE: RefCell<FxHashMap<usize, Fingerprint>> =
RefCell::new(FxHashMap());
RefCell::new(FxHashMap::default());
}
let hash: Fingerprint = CACHE.with(|cache| {

View File

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

View File

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

View File

@ -846,7 +846,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> {
// contains a different, structurally recursive type, maintain a stack
// of seen types and check recursion for each of them (issues #3008, #3779).
let mut seen: Vec<Ty<'_>> = Vec::new();
let mut representable_cache = FxHashMap();
let mut representable_cache = FxHashMap::default();
let r = is_type_structurally_recursive(
tcx, sp, &mut seen, &mut representable_cache, self);
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 {
($map_name:ident, $set_name:ident, $key:ty) => {
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 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>)
where T: TypeFoldable<'tcx>
{
let mut collector = LateBoundRegionNameCollector(FxHashSet());
let mut collector = LateBoundRegionNameCollector(FxHashSet::default());
value.visit_with(&mut collector);
self.used_region_names = Some(collector.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
// and do not need borrowchecking.
return Lrc::new(BorrowCheckResult {
used_mut_nodes: FxHashSet(),
used_mut_nodes: FxHashSet::default(),
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,
owner_def_id,
body,
used_mut_nodes: RefCell::new(FxHashSet()),
used_mut_nodes: RefCell::new(FxHashSet::default()),
signalled_any_error: Cell::new(SignalledError::NoErrorsSeen),
};
@ -235,7 +235,7 @@ pub fn build_borrowck_dataflow_data_for_fn<'a, 'tcx>(
region_scope_tree,
owner_def_id,
body,
used_mut_nodes: RefCell::new(FxHashSet()),
used_mut_nodes: RefCell::new(FxHashSet::default()),
signalled_any_error: Cell::new(SignalledError::NoErrorsSeen),
};

View File

@ -45,7 +45,7 @@ struct UnusedMutCx<'a, 'tcx: 'a> {
impl<'a, 'tcx> UnusedMutCx<'a, 'tcx> {
fn check_unused_mut_pat(&self, pats: &[P<hir::Pat>]) {
let tcx = self.bccx.tcx;
let mut mutables: FxHashMap<_, Vec<_>> = FxHashMap();
let mut mutables: FxHashMap<_, Vec<_>> = FxHashMap::default();
for p in pats {
p.each_binding(|_, hir_id, span, ident| {
// 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>,
cfg: &cfg::CFG)
-> 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
// 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<_, _>>();
let mut ret = FxHashMap();
let mut ret = FxHashMap::default();
for lib in tcx.foreign_modules(cnum).iter() {
let module = def_id_to_native_lib
.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.
let mut group_end = None;
let mut group_start = None;
let mut end_with = FxHashSet();
let mut end_with = FxHashSet::default();
let info = &codegen_results.crate_info;
for &(cnum, _) in deps.iter().rev() {
if let Some(missing) = info.missing_lang_items.get(&cnum) {

View File

@ -882,7 +882,7 @@ pub struct ThinLTOImports {
impl ThinLTOImports {
fn new() -> ThinLTOImports {
ThinLTOImports {
imports: FxHashMap(),
imports: FxHashMap::default(),
}
}
@ -911,7 +911,7 @@ impl ThinLTOImports {
.push(imported_module_name.to_owned());
}
let mut map = ThinLTOImports {
imports: FxHashMap(),
imports: FxHashMap::default(),
};
llvm::LLVMRustGetThinLTOModuleImports(data,
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)
let exported_symbols = {
let mut exported_symbols = FxHashMap();
let mut exported_symbols = FxHashMap::default();
let copy_symbols = |cnum| {
let symbols = tcx.exported_symbols(cnum)

View File

@ -1030,7 +1030,7 @@ fn collect_and_partition_mono_items<'a, 'tcx>(
}).collect();
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 (&mono_item, &linkage) in cgu.items() {
@ -1092,17 +1092,17 @@ impl CrateInfo {
compiler_builtins: None,
profiler_runtime: None,
sanitizer_runtime: None,
is_no_builtins: FxHashSet(),
native_libraries: FxHashMap(),
is_no_builtins: FxHashSet::default(),
native_libraries: FxHashMap::default(),
used_libraries: tcx.native_libraries(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_static: cstore::used_crates(tcx, LinkagePreference::RequireStatic),
used_crate_source: FxHashMap(),
wasm_imports: FxHashMap(),
lang_item_to_crate: FxHashMap(),
missing_lang_items: FxHashMap(),
used_crate_source: FxHashMap::default(),
wasm_imports: FxHashMap::default(),
lang_item_to_crate: FxHashMap::default(),
missing_lang_items: FxHashMap::default(),
};
let lang_items = tcx.lang_items();

View File

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

View File

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

View File

@ -100,11 +100,11 @@ impl<'a, 'tcx> CrateDebugContext<'a, 'tcx> {
llcontext,
llmod,
builder,
created_files: RefCell::new(FxHashMap()),
created_enum_disr_types: RefCell::new(FxHashMap()),
created_files: RefCell::new(FxHashMap::default()),
created_enum_disr_types: RefCell::new(FxHashMap::default()),
type_map: RefCell::new(TypeMap::new()),
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);
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.exported_symbols = |_tcx, _crate| Arc::new(Vec::new());

View File

@ -8,21 +8,6 @@
// option. This file may not be copied, modified, or distributed
// 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::FxHashSet;
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> {
ObligationForest {
nodes: vec![],
done_cache: FxHashSet(),
waiting_cache: FxHashMap(),
done_cache: FxHashSet::default(),
waiting_cache: FxHashMap::default(),
scratch: Some(vec![]),
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
.entry(node.obligation_tree_id)
.or_insert_with(|| FxHashSet())
.or_insert_with(|| FxHashSet::default())
.insert(node.obligation.as_predicate().clone());
}

View File

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

View File

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

View File

@ -382,9 +382,9 @@ impl Handler {
emitter: Lock::new(e),
continue_after_error: LockCell::new(true),
delayed_span_bugs: Lock::new(Vec::new()),
taught_diagnostics: Lock::new(FxHashSet()),
emitted_diagnostic_codes: Lock::new(FxHashSet()),
emitted_diagnostics: Lock::new(FxHashSet()),
taught_diagnostics: Lock::new(FxHashSet::default()),
emitted_diagnostic_codes: Lock::new(FxHashSet::default()),
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
/// the overall count of emitted error diagnostics.
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);
}

View File

@ -343,7 +343,7 @@ fn walk_nodes<'q>(query: &'q DepGraphQuery,
direction: Direction)
-> FxHashSet<&'q DepNode>
{
let mut set = FxHashSet();
let mut set = FxHashSet::default();
for &start in starts {
debug!("walk_nodes: start={:?} outgoing?={:?}", start, direction == OUTGOING);
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 mut dirty_clean_visitor = DirtyCleanVisitor {
tcx,
checked_attrs: FxHashSet(),
checked_attrs: FxHashSet::default(),
};
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 {
// 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
// session directories
let mut session_directories = FxHashSet();
let mut lock_files = FxHashSet();
let mut session_directories = FxHashSet::default();
let mut lock_files = FxHashSet::default();
for dir_entry in try!(crate_directory.read_dir()) {
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))
.collect()
} else {
FxHashMap()
FxHashMap::default()
}
}
@ -924,7 +924,7 @@ fn test_all_except_most_recent() {
assert_eq!(all_except_most_recent(
vec![
]).keys().cloned().collect::<FxHashSet<PathBuf>>(),
FxHashSet()
FxHashSet::default()
);
}
@ -939,7 +939,7 @@ fn test_timestamp_serialization() {
#[test]
fn test_find_source_directory_in_iter() {
let already_visited = FxHashSet();
let already_visited = FxHashSet::default();
// Find newest
assert_eq!(find_source_directory_in_iter(

View File

@ -48,7 +48,7 @@ impl LoadResult<(PreviousDepGraph, WorkProductMap)> {
match self {
LoadResult::Error { message } => {
sess.warn(&message);
(PreviousDepGraph::new(SerializedDepGraph::new()), FxHashMap())
(PreviousDepGraph::new(SerializedDepGraph::new()), FxHashMap::default())
},
LoadResult::DataOutOfDate => {
if let Err(err) = delete_all_session_dir_contents(sess) {
@ -56,7 +56,7 @@ impl LoadResult<(PreviousDepGraph, WorkProductMap)> {
incremental compilation session directory contents `{}`: {}.",
dep_graph_path(sess).display(), err));
}
(PreviousDepGraph::new(SerializedDepGraph::new()), FxHashMap())
(PreviousDepGraph::new(SerializedDepGraph::new()), FxHashMap::default())
}
LoadResult::Ok { data } => data
}
@ -117,7 +117,7 @@ pub fn load_dep_graph(sess: &Session) ->
if sess.opts.incremental.is_none() {
// No incremental compilation.
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 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
// 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) =
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() {
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:
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::FfiPhantom(ty) => {
self.cx.span_lint(IMPROPER_CTYPES,

View File

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

View File

@ -111,7 +111,7 @@ impl CStore {
// corresponding `CrateNum`. This first entry will always remain
// `None`.
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,
}
}

View File

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

View File

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

View File

@ -183,7 +183,7 @@ impl<'a, 'tcx> Collector<'a, 'tcx> {
// Process libs passed on the command line
fn process_command_line(&mut self) {
// 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 {
if let &Some(ref new_name) = new_name {
let any_duplicate = self.libs

View File

@ -151,11 +151,11 @@ impl<'tcx> BorrowSet<'tcx> {
tcx,
mir,
idx_vec: IndexVec::new(),
location_map: FxHashMap(),
activation_map: FxHashMap(),
region_map: FxHashMap(),
local_map: FxHashMap(),
pending_activations: FxHashMap(),
location_map: FxHashMap::default(),
activation_map: FxHashMap::default(),
region_map: FxHashMap::default(),
local_map: FxHashMap::default(),
pending_activations: FxHashMap::default(),
locals_state_at_exit:
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)
}));
let mut visited = FxHashSet();
let mut visited = FxHashSet::default();
let mut result = vec![];
'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,
movable_generator,
locals_are_invalidated_at_exit,
access_place_error_reported: FxHashSet(),
reservation_error_reported: FxHashSet(),
access_place_error_reported: FxHashSet::default(),
reservation_error_reported: FxHashSet::default(),
move_error_reported: BTreeMap::new(),
uninitialized_error_reported: FxHashSet(),
uninitialized_error_reported: FxHashSet::default(),
errors_buffer,
nonlexical_regioncx: regioncx,
used_mut: FxHashSet(),
used_mut: FxHashSet::default(),
used_mut_upvars: SmallVec::new(),
borrow_set,
dominators,

View File

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

View File

@ -128,7 +128,7 @@ pub(crate) fn type_check<'gcx, 'tcx>(
let mut constraints = MirTypeckRegionConstraints {
liveness_constraints: LivenessValues::new(elements),
outlives_constraints: ConstraintSet::default(),
closure_bounds_mapping: FxHashMap(),
closure_bounds_mapping: FxHashMap::default(),
type_tests: Vec::default(),
};
let mut placeholder_indices = PlaceholderIndices::default();
@ -847,7 +847,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
region_bound_pairs,
implicit_region_bound,
borrowck_context,
reported_errors: FxHashSet(),
reported_errors: FxHashSet::default(),
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,
// so don't track them.
let mut fake_borrows = if has_guard && tcx.generate_borrow_of_any_match_input() {
Some(FxHashMap())
Some(FxHashMap::default())
} else {
None
};

View File

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

View File

@ -358,7 +358,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
needs_cleanup: false,
drops: vec![],
cached_generator_drop: None,
cached_exits: FxHashMap(),
cached_exits: FxHashMap::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
// processed, because this avoids the need to look them up again on
// completion.
let mut visited = FxHashMap();
let mut visited = FxHashMap::default();
visited.insert(location.block, location.statement_index);
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() {
let borrow_region = borrow_data.region.to_region_vid();
let location = borrow_set.borrows[borrow_index].reserve_location;

View File

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

View File

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

View File

@ -238,7 +238,7 @@ impl<'tcx> InliningMap<'tcx> {
fn new() -> InliningMap<'tcx> {
InliningMap {
index: FxHashMap(),
index: FxHashMap::default(),
targets: Vec::new(),
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");
let mut visited = MTLock::new(FxHashSet());
let mut visited = MTLock::new(FxHashSet::default());
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>
where I: Iterator<Item = MonoItem<'tcx>>
{
let mut roots = FxHashSet();
let mut codegen_units = FxHashMap();
let mut roots = FxHashSet::default();
let mut codegen_units = FxHashMap::default();
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
// 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();
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 {
match mono_item.instantiation_mode(tcx) {
@ -602,7 +602,7 @@ fn place_inlined_mono_items<'tcx>(initial_partitioning: PreInliningPartitioning<
inlining_map: &InliningMap<'tcx>)
-> PostInliningPartitioning<'tcx> {
let mut new_partitioning = Vec::new();
let mut mono_item_placements = FxHashMap();
let mut mono_item_placements = FxHashMap::default();
let PreInliningPartitioning {
codegen_units: initial_cgus,
@ -614,7 +614,7 @@ fn place_inlined_mono_items<'tcx>(initial_partitioning: PreInliningPartitioning<
for old_codegen_unit in initial_cgus {
// 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() {
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
// 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| {
for accessee in accessees {
accessor_map.entry(*accessee)

View File

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

View File

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

View File

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

View File

@ -1291,7 +1291,7 @@ impl MirPass for QualifyAndPromoteConstants {
fn args_required_const(tcx: TyCtxt, def_id: DefId) -> Option<FxHashSet<usize>> {
let attrs = tcx.get_attrs(def_id);
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()? {
match meta.literal()?.node {
LitKind::Int(a, _) => { ret.insert(a as usize); }

View File

@ -536,7 +536,7 @@ pub fn write_mir_intro<'a, 'gcx, 'tcx>(
writeln!(w, "{{")?;
// 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() {
if let Some(parent) = scope_data.parent_scope {
scope_tree

View File

@ -41,8 +41,8 @@ struct StatCollector<'k> {
pub fn print_hir_stats(krate: &hir::Crate) {
let mut collector = StatCollector {
krate: Some(krate),
data: FxHashMap(),
seen: FxHashSet(),
data: FxHashMap::default(),
seen: FxHashSet::default(),
};
hir_visit::walk_crate(&mut collector, krate);
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) {
let mut collector = StatCollector {
krate: None,
data: FxHashMap(),
seen: FxHashSet(),
data: FxHashMap::default(),
seen: FxHashSet::default(),
};
ast_visit::walk_crate(&mut collector, krate);
collector.print(title);

View File

@ -1732,7 +1732,7 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
in_body: false,
span: krate.span,
empty_tables: &empty_tables,
visited_opaque_tys: FxHashSet()
visited_opaque_tys: FxHashSet::default()
};
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));
// Add each argument to the rib.
let mut bindings_list = FxHashMap();
let mut bindings_list = FxHashMap::default();
for argument in &declaration.inputs {
self.resolve_pattern(&argument.pat, PatternSource::FnParam, &mut bindings_list);
@ -930,7 +930,7 @@ struct Rib<'a> {
impl<'a> Rib<'a> {
fn new(kind: RibKind<'a>) -> Rib<'a> {
Rib {
bindings: FxHashMap(),
bindings: FxHashMap::default(),
kind,
}
}
@ -1053,11 +1053,11 @@ impl<'a> ModuleData<'a> {
parent,
kind,
normal_ancestor_id,
resolutions: RefCell::new(FxHashMap()),
resolutions: RefCell::new(FxHashMap::default()),
legacy_macro_resolutions: RefCell::new(Vec::new()),
macro_resolutions: 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,
glob_importers: RefCell::new(Vec::new()),
globs: RefCell::new(Vec::new()),
@ -1321,7 +1321,7 @@ struct PrimitiveTypeTable {
impl 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("char", Char);
@ -1668,7 +1668,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
no_implicit_prelude: attr::contains_name(&krate.attrs, "no_implicit_prelude"),
..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);
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(),
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);
Resolver {
@ -1708,8 +1708,8 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
prelude: None,
extern_prelude,
has_self: FxHashSet(),
field_names: FxHashMap(),
has_self: FxHashSet::default(),
field_names: FxHashMap::default(),
determined_imports: Vec::new(),
indeterminate_imports: Vec::new(),
@ -1732,21 +1732,21 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
import_map: NodeMap(),
freevars: NodeMap(),
freevars_seen: NodeMap(),
export_map: FxHashMap(),
export_map: FxHashMap::default(),
trait_map: NodeMap(),
module_map,
block_map: NodeMap(),
extern_module_map: FxHashMap(),
binding_parent_modules: FxHashMap(),
extern_module_map: FxHashMap::default(),
binding_parent_modules: FxHashMap::default(),
make_glob_map: make_glob_map == MakeGlobMap::Yes,
glob_map: NodeMap(),
used_imports: FxHashSet(),
used_imports: FxHashSet::default(),
maybe_unused_trait_imports: NodeSet(),
maybe_unused_extern_crates: Vec::new(),
unused_labels: FxHashMap(),
unused_labels: FxHashMap::default(),
privacy_errors: Vec::new(),
ambiguity_errors: Vec::new(),
@ -1762,20 +1762,20 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
}),
crate_loader,
macro_names: FxHashSet(),
builtin_macros: FxHashMap(),
macro_use_prelude: FxHashMap(),
all_macros: FxHashMap(),
macro_map: FxHashMap(),
macro_names: FxHashSet::default(),
builtin_macros: FxHashMap::default(),
macro_use_prelude: FxHashMap::default(),
all_macros: FxHashMap::default(),
macro_map: FxHashMap::default(),
invocations,
macro_defs,
local_macro_def_scopes: FxHashMap(),
name_already_seen: FxHashMap(),
local_macro_def_scopes: FxHashMap::default(),
name_already_seen: FxHashMap::default(),
whitelisted_legacy_custom_derives: Vec::new(),
potentially_unused_imports: Vec::new(),
struct_constructors: DefIdMap(),
found_unresolved_macro: false,
unused_macros: FxHashSet(),
unused_macros: FxHashSet::default(),
current_type_ascription: Vec::new(),
injected_crate: None,
}
@ -2381,7 +2381,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
match type_parameters {
HasTypeParameters(generics, 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 {
match param.kind {
GenericParamKind::Lifetime { .. } => {}
@ -2649,7 +2649,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
walk_list!(self, visit_expr, &local.init);
// 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.
@ -2657,7 +2657,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
// that expands into an or-pattern where one 'x' was from the
// user and one 'x' came from the macro.
fn binding_mode_map(&mut self, pat: &Pat) -> BindingMap {
let mut binding_map = FxHashMap();
let mut binding_map = FxHashMap::default();
pat.walk(&mut |pat| {
if let PatKind::Ident(binding_mode, ident, ref sub_pat) = pat.node {
@ -2682,8 +2682,8 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
return;
}
let mut missing_vars = FxHashMap();
let mut inconsistent_vars = FxHashMap();
let mut missing_vars = FxHashMap::default();
let mut inconsistent_vars = FxHashMap::default();
for (i, p) in pats.iter().enumerate() {
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) {
self.ribs[ValueNS].push(Rib::new(NormalRibKind));
let mut bindings_list = FxHashMap();
let mut bindings_list = FxHashMap::default();
for pattern in &arm.pats {
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.ribs[ValueNS].push(Rib::new(NormalRibKind));
let mut bindings_list = FxHashMap();
let mut bindings_list = FxHashMap::default();
for pat in pats {
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| {
this.visit_expr(subexpression);
this.ribs[ValueNS].push(Rib::new(NormalRibKind));
let mut bindings_list = FxHashMap();
let mut bindings_list = FxHashMap::default();
for pat in pats {
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) => {
self.visit_expr(subexpression);
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);
@ -4235,7 +4235,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
self.ribs[ValueNS].push(Rib::new(rib_kind));
self.label_ribs.push(Rib::new(rib_kind));
// Resolve arguments:
let mut bindings_list = FxHashMap();
let mut bindings_list = FxHashMap::default();
for argument in &fn_decl.inputs {
self.resolve_pattern(&argument.pat, PatternSource::FnParam, &mut bindings_list);
self.visit_ty(&argument.ty);
@ -4380,7 +4380,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
where FilterFn: Fn(Def) -> bool
{
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 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)>
{
let mut result = None;
let mut seen_modules = FxHashSet();
let mut seen_modules = FxHashSet::default();
let mut worklist = vec![(self.graph_root, Vec::new())];
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) {
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 {
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();
let mut errors = false;
let mut seen_spans = FxHashSet();
let mut seen_spans = FxHashSet::default();
let mut error_vec = Vec::new();
let mut prev_root_id: NodeId = NodeId::new(0);
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(),
cur_scope: CRATE_NODE_ID,
// 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)
let (program, arguments) = {
let remap_arg_indices = {
let mut indices = FxHashSet();
let mut indices = FxHashSet::default();
// Args are guaranteed to be valid UTF-8 (checked early)
for (i, e) in env::args().enumerate() {
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)];
// Set used to detect infinite recursion.
let mut ty_set = FxHashSet();
let mut ty_set = FxHashSet::default();
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>) {
let mut outlives = FxHashSet();
let mut dtorck_types = FxHashSet();
let mut outlives = FxHashSet::default();
let mut dtorck_types = FxHashSet::default();
c.outlives.retain(|&val| outlives.replace(val).is_none());
c.dtorck_types

View File

@ -142,7 +142,7 @@ crate fn program_clauses_for_env<'a, 'tcx>(
) -> Clauses<'tcx> {
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);
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 next_round = FxHashSet();
let mut next_round = FxHashSet::default();
while !last_round.is_empty() {
let mut visitor = ClauseVisitor::new(tcx, &mut next_round);
for clause in last_round.drain() {

View File

@ -887,7 +887,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
.collect::<FxHashMap<_, _>>();
// 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 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 mut visitor = InteriorVisitor {
fcx,
types: FxHashMap(),
types: FxHashMap::default(),
region_scope_tree: fcx.tcx.region_scope_tree(def_id),
expr_count: 0,
};

View File

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

View File

@ -396,7 +396,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
return_type,
inherent_candidates: Vec::new(),
extension_candidates: Vec::new(),
impl_dups: FxHashSet(),
impl_dups: FxHashSet::default(),
steps: steps,
static_candidates: Vec::new(),
allow_similar_names: false,
@ -718,7 +718,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
if expr_id == ast::DUMMY_NODE_ID {
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 opt_applicable_traits = self.tcx.in_scope_traits(expr_hir_id);
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>> {
let mut duplicates = FxHashSet();
let mut duplicates = FxHashSet::default();
for trait_info in suggest::all_traits(self.tcx) {
if duplicates.insert(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> {
let mut set = FxHashSet();
let mut set = FxHashSet::default();
let mut names: Vec<_> = self.inherent_candidates
.iter()
.chain(&self.extension_candidates)

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