Auto merge of #52591 - eddyb:functional-snakes, r=oli-obk
rustc: remove {FxHash,Node,DefId,HirId,ItemLocal}{Map,Set} "constructor" fns. These are cruft left over from a time when `Foo::default()` didn't "just work".
This commit is contained in:
commit
289ad6e992
|
@ -659,6 +659,14 @@ dependencies = [
|
||||||
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ena"
|
||||||
|
version = "0.10.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "env_logger"
|
name = "env_logger"
|
||||||
version = "0.5.12"
|
version = "0.5.12"
|
||||||
|
@ -2196,7 +2204,7 @@ name = "rustc_data_structures"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ena 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ena 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"graphviz 0.0.0",
|
"graphviz 0.0.0",
|
||||||
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -3261,6 +3269,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
|
"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
|
||||||
"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
|
"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
|
||||||
"checksum elasticlunr-rs 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4837d77a1e157489a3933b743fd774ae75074e0e390b2b7f071530048a0d87ee"
|
"checksum elasticlunr-rs 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4837d77a1e157489a3933b743fd774ae75074e0e390b2b7f071530048a0d87ee"
|
||||||
|
"checksum ena 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25b4e5febb25f08c49f1b07dc33a182729a6b21edfb562b5aef95f78e0dbe5bb"
|
||||||
"checksum ena 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "88dc8393b3c7352f94092497f6b52019643e493b6b890eb417cdb7c46117e621"
|
"checksum ena 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "88dc8393b3c7352f94092497f6b52019643e493b6b890eb417cdb7c46117e621"
|
||||||
"checksum env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)" = "f4d7e69c283751083d53d01eac767407343b8b69c4bd70058e08adc2637cb257"
|
"checksum env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)" = "f4d7e69c283751083d53d01eac767407343b8b69c4bd70058e08adc2637cb257"
|
||||||
"checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e"
|
"checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e"
|
||||||
|
|
|
@ -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(Default::default()),
|
dep_node_debug: Default::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(Default::default()),
|
loaded_from_cache: Default::default(),
|
||||||
})),
|
})),
|
||||||
fingerprints: Lrc::new(Lock::new(fingerprints)),
|
fingerprints: Lrc::new(Lock::new(fingerprints)),
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,9 +244,9 @@ pub fn lower_crate(
|
||||||
loop_scopes: Vec::new(),
|
loop_scopes: Vec::new(),
|
||||||
is_in_loop_condition: false,
|
is_in_loop_condition: false,
|
||||||
anonymous_lifetime_mode: AnonymousLifetimeMode::PassThrough,
|
anonymous_lifetime_mode: AnonymousLifetimeMode::PassThrough,
|
||||||
type_def_lifetime_params: DefIdMap(),
|
type_def_lifetime_params: Default::default(),
|
||||||
current_hir_id_owner: vec![(CRATE_DEF_INDEX, 0)],
|
current_hir_id_owner: vec![(CRATE_DEF_INDEX, 0)],
|
||||||
item_local_id_counters: NodeMap(),
|
item_local_id_counters: Default::default(),
|
||||||
node_id_to_hir_id: IndexVec::new(),
|
node_id_to_hir_id: IndexVec::new(),
|
||||||
is_generator: false,
|
is_generator: false,
|
||||||
is_in_trait_impl: false,
|
is_in_trait_impl: false,
|
||||||
|
@ -1168,7 +1168,7 @@ impl<'a> LoweringContext<'a> {
|
||||||
hir::TyKind::BareFn(P(hir::BareFnTy {
|
hir::TyKind::BareFn(P(hir::BareFnTy {
|
||||||
generic_params: this.lower_generic_params(
|
generic_params: this.lower_generic_params(
|
||||||
&f.generic_params,
|
&f.generic_params,
|
||||||
&NodeMap(),
|
&NodeMap::default(),
|
||||||
ImplTraitContext::disallowed(),
|
ImplTraitContext::disallowed(),
|
||||||
),
|
),
|
||||||
unsafety: this.lower_unsafety(f.unsafety),
|
unsafety: this.lower_unsafety(f.unsafety),
|
||||||
|
@ -2467,7 +2467,7 @@ impl<'a> LoweringContext<'a> {
|
||||||
// FIXME: This could probably be done with less rightward drift. Also looks like two control
|
// FIXME: This could probably be done with less rightward drift. Also looks like two control
|
||||||
// paths where report_error is called are also the only paths that advance to after
|
// paths where report_error is called are also the only paths that advance to after
|
||||||
// the match statement, so the error reporting could probably just be moved there.
|
// the match statement, so the error reporting could probably just be moved there.
|
||||||
let mut add_bounds: NodeMap<Vec<_>> = NodeMap();
|
let mut add_bounds: NodeMap<Vec<_>> = Default::default();
|
||||||
for pred in &generics.where_clause.predicates {
|
for pred in &generics.where_clause.predicates {
|
||||||
if let WherePredicate::BoundPredicate(ref bound_pred) = *pred {
|
if let WherePredicate::BoundPredicate(ref bound_pred) = *pred {
|
||||||
'next_bound: for bound in &bound_pred.bounds {
|
'next_bound: for bound in &bound_pred.bounds {
|
||||||
|
@ -2552,7 +2552,7 @@ impl<'a> LoweringContext<'a> {
|
||||||
hir::WherePredicate::BoundPredicate(hir::WhereBoundPredicate {
|
hir::WherePredicate::BoundPredicate(hir::WhereBoundPredicate {
|
||||||
bound_generic_params: this.lower_generic_params(
|
bound_generic_params: this.lower_generic_params(
|
||||||
bound_generic_params,
|
bound_generic_params,
|
||||||
&NodeMap(),
|
&NodeMap::default(),
|
||||||
ImplTraitContext::disallowed(),
|
ImplTraitContext::disallowed(),
|
||||||
),
|
),
|
||||||
bounded_ty: this.lower_ty(bounded_ty, ImplTraitContext::disallowed()),
|
bounded_ty: this.lower_ty(bounded_ty, ImplTraitContext::disallowed()),
|
||||||
|
@ -2636,8 +2636,11 @@ impl<'a> LoweringContext<'a> {
|
||||||
p: &PolyTraitRef,
|
p: &PolyTraitRef,
|
||||||
mut itctx: ImplTraitContext<'_>,
|
mut itctx: ImplTraitContext<'_>,
|
||||||
) -> hir::PolyTraitRef {
|
) -> hir::PolyTraitRef {
|
||||||
let bound_generic_params =
|
let bound_generic_params = self.lower_generic_params(
|
||||||
self.lower_generic_params(&p.bound_generic_params, &NodeMap(), itctx.reborrow());
|
&p.bound_generic_params,
|
||||||
|
&NodeMap::default(),
|
||||||
|
itctx.reborrow(),
|
||||||
|
);
|
||||||
let trait_ref = self.with_parent_impl_lifetime_defs(
|
let trait_ref = self.with_parent_impl_lifetime_defs(
|
||||||
&bound_generic_params,
|
&bound_generic_params,
|
||||||
|this| this.lower_trait_ref(&p.trait_ref, itctx),
|
|this| this.lower_trait_ref(&p.trait_ref, itctx),
|
||||||
|
|
|
@ -36,6 +36,7 @@ use util::nodemap::NodeMap;
|
||||||
/// Internally the DefPathTable holds a tree of DefKeys, where each DefKey
|
/// Internally the DefPathTable holds a tree of DefKeys, where each DefKey
|
||||||
/// stores the DefIndex of its parent.
|
/// stores the DefIndex of its parent.
|
||||||
/// There is one DefPathTable for each crate.
|
/// There is one DefPathTable for each crate.
|
||||||
|
#[derive(Default)]
|
||||||
pub struct DefPathTable {
|
pub struct DefPathTable {
|
||||||
index_to_key: [Vec<DefKey>; 2],
|
index_to_key: [Vec<DefKey>; 2],
|
||||||
def_path_hashes: [Vec<DefPathHash>; 2],
|
def_path_hashes: [Vec<DefPathHash>; 2],
|
||||||
|
@ -153,7 +154,7 @@ impl Decodable for DefPathTable {
|
||||||
/// The definition table containing node definitions.
|
/// The definition table containing node definitions.
|
||||||
/// It holds the DefPathTable for local DefIds/DefPaths and it also stores a
|
/// It holds the DefPathTable for local DefIds/DefPaths and it also stores a
|
||||||
/// mapping from NodeIds to local DefIds.
|
/// mapping from NodeIds to local DefIds.
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Default)]
|
||||||
pub struct Definitions {
|
pub struct Definitions {
|
||||||
table: DefPathTable,
|
table: DefPathTable,
|
||||||
node_to_def_index: NodeMap<DefIndex>,
|
node_to_def_index: NodeMap<DefIndex>,
|
||||||
|
@ -412,20 +413,8 @@ impl Definitions {
|
||||||
/// ascending order.
|
/// ascending order.
|
||||||
///
|
///
|
||||||
/// FIXME: there is probably a better place to put this comment.
|
/// FIXME: there is probably a better place to put this comment.
|
||||||
pub fn new() -> Definitions {
|
pub fn new() -> Self {
|
||||||
Definitions {
|
Self::default()
|
||||||
table: DefPathTable {
|
|
||||||
index_to_key: [vec![], vec![]],
|
|
||||||
def_path_hashes: [vec![], vec![]],
|
|
||||||
},
|
|
||||||
node_to_def_index: NodeMap(),
|
|
||||||
def_index_to_node: [vec![], vec![]],
|
|
||||||
node_to_hir_id: IndexVec::new(),
|
|
||||||
parent_modules_of_macro_defs: Default::default(),
|
|
||||||
expansions_that_defined: Default::default(),
|
|
||||||
next_disambiguator: Default::default(),
|
|
||||||
def_index_to_span: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn def_path_table(&self) -> &DefPathTable {
|
pub fn def_path_table(&self) -> &DefPathTable {
|
||||||
|
|
|
@ -369,8 +369,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
|
||||||
// times, we cache a stable hash of it and hash that instead of
|
// times, we cache a stable hash of it and hash that instead of
|
||||||
// recursing every time.
|
// recursing every time.
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static CACHE: RefCell<FxHashMap<hygiene::Mark, u64>> =
|
static CACHE: RefCell<FxHashMap<hygiene::Mark, u64>> = Default::default();
|
||||||
RefCell::new(Default::default());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let sub_hash: u64 = CACHE.with(|cache| {
|
let sub_hash: u64 = CACHE.with(|cache| {
|
||||||
|
|
|
@ -121,7 +121,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||||
parent_def_id,
|
parent_def_id,
|
||||||
body_id,
|
body_id,
|
||||||
param_env,
|
param_env,
|
||||||
opaque_types: DefIdMap(),
|
opaque_types: Default::default(),
|
||||||
obligations: vec![],
|
obligations: vec![],
|
||||||
};
|
};
|
||||||
let value = instantiator.instantiate_opaque_types_in_map(value);
|
let value = instantiator.instantiate_opaque_types_in_map(value);
|
||||||
|
|
|
@ -29,6 +29,7 @@ use std::{cmp, fmt, mem, u32};
|
||||||
|
|
||||||
mod taint;
|
mod taint;
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct RegionConstraintCollector<'tcx> {
|
pub struct RegionConstraintCollector<'tcx> {
|
||||||
/// For each `RegionVid`, the corresponding `RegionVariableOrigin`.
|
/// For each `RegionVid`, the corresponding `RegionVariableOrigin`.
|
||||||
var_infos: IndexVec<RegionVid, RegionVariableInfo>,
|
var_infos: IndexVec<RegionVid, RegionVariableInfo>,
|
||||||
|
@ -341,17 +342,8 @@ impl TaintDirections {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> RegionConstraintCollector<'tcx> {
|
impl<'tcx> RegionConstraintCollector<'tcx> {
|
||||||
pub fn new() -> RegionConstraintCollector<'tcx> {
|
pub fn new() -> Self {
|
||||||
RegionConstraintCollector {
|
Self::default()
|
||||||
var_infos: VarInfos::default(),
|
|
||||||
data: RegionConstraintData::default(),
|
|
||||||
lubs: Default::default(),
|
|
||||||
glbs: Default::default(),
|
|
||||||
bound_count: 0,
|
|
||||||
undo_log: Vec::new(),
|
|
||||||
unification_table: ut::UnificationTable::new(),
|
|
||||||
any_unifications: false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn num_region_vars(&self) -> usize {
|
pub fn num_region_vars(&self) -> usize {
|
||||||
|
|
|
@ -1233,7 +1233,7 @@ pub fn check_ast_crate(
|
||||||
let (passes, buffered) = if pre_expansion {
|
let (passes, buffered) = if pre_expansion {
|
||||||
(
|
(
|
||||||
sess.lint_store.borrow_mut().pre_expansion_passes.take(),
|
sess.lint_store.borrow_mut().pre_expansion_passes.take(),
|
||||||
LintBuffer::new(),
|
LintBuffer::default(),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
(
|
(
|
||||||
|
|
|
@ -490,15 +490,12 @@ mod levels;
|
||||||
|
|
||||||
pub use self::levels::{LintLevelSets, LintLevelMap};
|
pub use self::levels::{LintLevelSets, LintLevelMap};
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct LintBuffer {
|
pub struct LintBuffer {
|
||||||
map: NodeMap<Vec<BufferedEarlyLint>>,
|
map: NodeMap<Vec<BufferedEarlyLint>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LintBuffer {
|
impl LintBuffer {
|
||||||
pub fn new() -> LintBuffer {
|
|
||||||
LintBuffer { map: NodeMap() }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn add_lint(&mut self,
|
pub fn add_lint(&mut self,
|
||||||
lint: &'static Lint,
|
lint: &'static Lint,
|
||||||
id: ast::NodeId,
|
id: ast::NodeId,
|
||||||
|
|
|
@ -18,9 +18,15 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
|
||||||
#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable)]
|
#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable)]
|
||||||
pub enum SignalledError { SawSomeError, NoErrorsSeen }
|
pub enum SignalledError { SawSomeError, NoErrorsSeen }
|
||||||
|
|
||||||
|
impl Default for SignalledError {
|
||||||
|
fn default() -> SignalledError {
|
||||||
|
SignalledError::NoErrorsSeen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl_stable_hash_for!(enum self::SignalledError { SawSomeError, NoErrorsSeen });
|
impl_stable_hash_for!(enum self::SignalledError { SawSomeError, NoErrorsSeen });
|
||||||
|
|
||||||
#[derive(Debug, RustcEncodable, RustcDecodable)]
|
#[derive(Debug, Default, RustcEncodable, RustcDecodable)]
|
||||||
pub struct BorrowCheckResult {
|
pub struct BorrowCheckResult {
|
||||||
pub used_mut_nodes: FxHashSet<HirId>,
|
pub used_mut_nodes: FxHashSet<HirId>,
|
||||||
pub signalled_any_error: SignalledError,
|
pub signalled_any_error: SignalledError,
|
||||||
|
|
|
@ -272,9 +272,9 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> {
|
||||||
tcx,
|
tcx,
|
||||||
num_live_nodes: 0,
|
num_live_nodes: 0,
|
||||||
num_vars: 0,
|
num_vars: 0,
|
||||||
live_node_map: HirIdMap(),
|
live_node_map: HirIdMap::default(),
|
||||||
variable_map: HirIdMap(),
|
variable_map: HirIdMap::default(),
|
||||||
capture_info_map: NodeMap(),
|
capture_info_map: Default::default(),
|
||||||
var_kinds: Vec::new(),
|
var_kinds: Vec::new(),
|
||||||
lnks: Vec::new(),
|
lnks: Vec::new(),
|
||||||
}
|
}
|
||||||
|
@ -397,7 +397,7 @@ fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'a, 'tcx>,
|
||||||
fn add_from_pat<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, pat: &P<hir::Pat>) {
|
fn add_from_pat<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, pat: &P<hir::Pat>) {
|
||||||
// For struct patterns, take note of which fields used shorthand
|
// For struct patterns, take note of which fields used shorthand
|
||||||
// (`x` rather than `x: x`).
|
// (`x` rather than `x: x`).
|
||||||
let mut shorthand_field_ids = HirIdSet();
|
let mut shorthand_field_ids = HirIdSet::default();
|
||||||
let mut pats = VecDeque::new();
|
let mut pats = VecDeque::new();
|
||||||
pats.push_back(pat);
|
pats.push_back(pat);
|
||||||
while let Some(pat) = pats.pop_front() {
|
while let Some(pat) = pats.pop_front() {
|
||||||
|
@ -691,8 +691,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
||||||
s: specials,
|
s: specials,
|
||||||
successors: vec![invalid_node(); num_live_nodes],
|
successors: vec![invalid_node(); num_live_nodes],
|
||||||
rwu_table: RWUTable::new(num_live_nodes * num_vars),
|
rwu_table: RWUTable::new(num_live_nodes * num_vars),
|
||||||
break_ln: NodeMap(),
|
break_ln: Default::default(),
|
||||||
cont_ln: NodeMap(),
|
cont_ln: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -408,7 +408,7 @@ fn reachable_set<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) ->
|
||||||
let mut reachable_context = ReachableContext {
|
let mut reachable_context = ReachableContext {
|
||||||
tcx,
|
tcx,
|
||||||
tables: &ty::TypeckTables::empty(None),
|
tables: &ty::TypeckTables::empty(None),
|
||||||
reachable_symbols: NodeSet(),
|
reachable_symbols: Default::default(),
|
||||||
worklist: Vec::new(),
|
worklist: Vec::new(),
|
||||||
any_library,
|
any_library,
|
||||||
};
|
};
|
||||||
|
|
|
@ -425,8 +425,8 @@ fn resolve_lifetimes<'tcx>(
|
||||||
fn krate<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> NamedRegionMap {
|
fn krate<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> NamedRegionMap {
|
||||||
let krate = tcx.hir.krate();
|
let krate = tcx.hir.krate();
|
||||||
let mut map = NamedRegionMap {
|
let mut map = NamedRegionMap {
|
||||||
defs: NodeMap(),
|
defs: Default::default(),
|
||||||
late_bound: NodeSet(),
|
late_bound: Default::default(),
|
||||||
object_lifetime_defaults: compute_object_lifetime_defaults(tcx),
|
object_lifetime_defaults: compute_object_lifetime_defaults(tcx),
|
||||||
};
|
};
|
||||||
{
|
{
|
||||||
|
@ -437,8 +437,8 @@ fn krate<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> NamedRegionMap {
|
||||||
trait_ref_hack: false,
|
trait_ref_hack: false,
|
||||||
is_in_fn_syntax: false,
|
is_in_fn_syntax: false,
|
||||||
labels_in_fn: vec![],
|
labels_in_fn: vec![],
|
||||||
xcrate_object_lifetime_defaults: DefIdMap(),
|
xcrate_object_lifetime_defaults: Default::default(),
|
||||||
lifetime_uses: &mut DefIdMap(),
|
lifetime_uses: &mut Default::default(),
|
||||||
};
|
};
|
||||||
for (_, item) in &krate.items {
|
for (_, item) in &krate.items {
|
||||||
visitor.visit_item(item);
|
visitor.visit_item(item);
|
||||||
|
@ -1278,7 +1278,7 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) {
|
||||||
fn compute_object_lifetime_defaults(
|
fn compute_object_lifetime_defaults(
|
||||||
tcx: TyCtxt<'_, '_, '_>,
|
tcx: TyCtxt<'_, '_, '_>,
|
||||||
) -> NodeMap<Vec<ObjectLifetimeDefault>> {
|
) -> NodeMap<Vec<ObjectLifetimeDefault>> {
|
||||||
let mut map = NodeMap();
|
let mut map = NodeMap::default();
|
||||||
for item in tcx.hir.krate().items.values() {
|
for item in tcx.hir.krate().items.values() {
|
||||||
match item.node {
|
match item.node {
|
||||||
hir::ItemKind::Struct(_, ref generics)
|
hir::ItemKind::Struct(_, ref generics)
|
||||||
|
@ -1432,7 +1432,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
} = self;
|
} = self;
|
||||||
let labels_in_fn = replace(&mut self.labels_in_fn, vec![]);
|
let labels_in_fn = replace(&mut self.labels_in_fn, vec![]);
|
||||||
let xcrate_object_lifetime_defaults =
|
let xcrate_object_lifetime_defaults =
|
||||||
replace(&mut self.xcrate_object_lifetime_defaults, DefIdMap());
|
replace(&mut self.xcrate_object_lifetime_defaults, DefIdMap::default());
|
||||||
let mut this = LifetimeContext {
|
let mut this = LifetimeContext {
|
||||||
tcx: *tcx,
|
tcx: *tcx,
|
||||||
map: map,
|
map: map,
|
||||||
|
@ -2741,9 +2741,7 @@ fn insert_late_bound_lifetimes(
|
||||||
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::default();
|
||||||
regions: Default::default(),
|
|
||||||
};
|
|
||||||
intravisit::walk_fn_ret_ty(&mut appears_in_output, &decl.output);
|
intravisit::walk_fn_ret_ty(&mut appears_in_output, &decl.output);
|
||||||
|
|
||||||
debug!(
|
debug!(
|
||||||
|
@ -2755,9 +2753,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::default();
|
||||||
regions: Default::default(),
|
|
||||||
};
|
|
||||||
appears_in_where_clause.visit_generics(generics);
|
appears_in_where_clause.visit_generics(generics);
|
||||||
|
|
||||||
for param in &generics.params {
|
for param in &generics.params {
|
||||||
|
@ -2854,6 +2850,7 @@ fn insert_late_bound_lifetimes(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
struct AllCollector {
|
struct AllCollector {
|
||||||
regions: FxHashSet<hir::LifetimeName>,
|
regions: FxHashSet<hir::LifetimeName>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1149,7 +1149,7 @@ pub fn build_session_(
|
||||||
local_crate_source_file,
|
local_crate_source_file,
|
||||||
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(Default::default())),
|
||||||
one_time_diagnostics: Default::default(),
|
one_time_diagnostics: Default::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())),
|
||||||
|
|
|
@ -446,22 +446,22 @@ impl<'tcx> TypeckTables<'tcx> {
|
||||||
pub fn empty(local_id_root: Option<DefId>) -> TypeckTables<'tcx> {
|
pub fn empty(local_id_root: Option<DefId>) -> TypeckTables<'tcx> {
|
||||||
TypeckTables {
|
TypeckTables {
|
||||||
local_id_root,
|
local_id_root,
|
||||||
type_dependent_defs: ItemLocalMap(),
|
type_dependent_defs: Default::default(),
|
||||||
field_indices: ItemLocalMap(),
|
field_indices: Default::default(),
|
||||||
user_provided_tys: ItemLocalMap(),
|
user_provided_tys: Default::default(),
|
||||||
user_provided_sigs: Default::default(),
|
user_provided_sigs: Default::default(),
|
||||||
node_types: ItemLocalMap(),
|
node_types: Default::default(),
|
||||||
node_substs: ItemLocalMap(),
|
node_substs: Default::default(),
|
||||||
user_substs: ItemLocalMap(),
|
user_substs: Default::default(),
|
||||||
adjustments: ItemLocalMap(),
|
adjustments: Default::default(),
|
||||||
pat_binding_modes: ItemLocalMap(),
|
pat_binding_modes: Default::default(),
|
||||||
pat_adjustments: ItemLocalMap(),
|
pat_adjustments: Default::default(),
|
||||||
upvar_capture_map: Default::default(),
|
upvar_capture_map: Default::default(),
|
||||||
closure_kind_origins: ItemLocalMap(),
|
closure_kind_origins: Default::default(),
|
||||||
liberated_fn_sigs: ItemLocalMap(),
|
liberated_fn_sigs: Default::default(),
|
||||||
fru_field_types: ItemLocalMap(),
|
fru_field_types: Default::default(),
|
||||||
cast_kinds: ItemLocalMap(),
|
cast_kinds: Default::default(),
|
||||||
used_trait_imports: Lrc::new(DefIdSet()),
|
used_trait_imports: Lrc::new(Default::default()),
|
||||||
tainted_by_errors: false,
|
tainted_by_errors: false,
|
||||||
free_region_map: Default::default(),
|
free_region_map: Default::default(),
|
||||||
concrete_existential_types: Default::default(),
|
concrete_existential_types: Default::default(),
|
||||||
|
|
|
@ -3183,7 +3183,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
|
||||||
/// rather, you should request the vector for a specific type via
|
/// rather, you should request the vector for a specific type via
|
||||||
/// `tcx.inherent_impls(def_id)` so as to minimize your dependencies
|
/// `tcx.inherent_impls(def_id)` so as to minimize your dependencies
|
||||||
/// (constructing this map requires touching the entire crate).
|
/// (constructing this map requires touching the entire crate).
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, Default)]
|
||||||
pub struct CrateInherentImpls {
|
pub struct CrateInherentImpls {
|
||||||
pub inherent_impls: DefIdMap<Lrc<Vec<DefId>>>,
|
pub inherent_impls: DefIdMap<Lrc<Vec<DefId>>>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
//! An efficient hash map for node IDs
|
//! An efficient hash map for node IDs
|
||||||
|
|
||||||
#![allow(non_snake_case)]
|
|
||||||
|
|
||||||
use hir::def_id::DefId;
|
use hir::def_id::DefId;
|
||||||
use hir::{HirId, ItemLocalId};
|
use hir::{HirId, ItemLocalId};
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
|
@ -22,9 +20,7 @@ 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> { Default::default() }
|
|
||||||
pub type $set_name = FxHashSet<$key>;
|
pub type $set_name = FxHashSet<$key>;
|
||||||
pub fn $set_name() -> $set_name { Default::default() }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ impl<'a, 'tcx> CrateDebugContext<'a, 'tcx> {
|
||||||
created_files: Default::default(),
|
created_files: Default::default(),
|
||||||
created_enum_disr_types: Default::default(),
|
created_enum_disr_types: Default::default(),
|
||||||
type_map: Default::default(),
|
type_map: Default::default(),
|
||||||
namespace_map: RefCell::new(DefIdMap()),
|
namespace_map: RefCell::new(Default::default()),
|
||||||
composite_types_completed: Default::default(),
|
composite_types_completed: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
assert_eq!(cnum, LOCAL_CRATE);
|
assert_eq!(cnum, LOCAL_CRATE);
|
||||||
|
|
||||||
if !tcx.sess.opts.output_types.should_codegen() {
|
if !tcx.sess.opts.output_types.should_codegen() {
|
||||||
return Lrc::new(DefIdMap())
|
return Default::default();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if this crate is a "special runtime crate". These
|
// Check to see if this crate is a "special runtime crate". These
|
||||||
|
@ -299,7 +299,7 @@ fn upstream_monomorphizations_provider<'a, 'tcx>(
|
||||||
|
|
||||||
let cnums = tcx.all_crate_nums(LOCAL_CRATE);
|
let cnums = tcx.all_crate_nums(LOCAL_CRATE);
|
||||||
|
|
||||||
let mut instances: DefIdMap<FxHashMap<_, _>> = DefIdMap();
|
let mut instances: DefIdMap<FxHashMap<_, _>> = Default::default();
|
||||||
|
|
||||||
let cnum_stable_ids: IndexVec<CrateNum, Fingerprint> = {
|
let cnum_stable_ids: IndexVec<CrateNum, Fingerprint> = {
|
||||||
let mut cnum_stable_ids = IndexVec::from_elem_n(Fingerprint::ZERO,
|
let mut cnum_stable_ids = IndexVec::from_elem_n(Fingerprint::ZERO,
|
||||||
|
|
|
@ -9,7 +9,7 @@ path = "lib.rs"
|
||||||
crate-type = ["dylib"]
|
crate-type = ["dylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ena = "0.9.3"
|
ena = "0.10.1"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }
|
rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }
|
||||||
serialize = { path = "../libserialize" }
|
serialize = { path = "../libserialize" }
|
||||||
|
|
|
@ -8,6 +8,4 @@
|
||||||
// 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.
|
||||||
|
|
||||||
pub use rustc_hash::FxHashMap;
|
pub use rustc_hash::{FxHasher, FxHashMap, FxHashSet};
|
||||||
pub use rustc_hash::FxHashSet;
|
|
||||||
pub use rustc_hash::FxHasher;
|
|
||||||
|
|
|
@ -23,6 +23,18 @@ pub struct SnapshotMap<K, V>
|
||||||
undo_log: Vec<UndoLog<K, V>>,
|
undo_log: Vec<UndoLog<K, V>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HACK(eddyb) manual impl avoids `Default` bounds on `K` and `V`.
|
||||||
|
impl<K, V> Default for SnapshotMap<K, V>
|
||||||
|
where K: Hash + Clone + Eq
|
||||||
|
{
|
||||||
|
fn default() -> Self {
|
||||||
|
SnapshotMap {
|
||||||
|
map: Default::default(),
|
||||||
|
undo_log: Default::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Snapshot {
|
pub struct Snapshot {
|
||||||
len: usize,
|
len: usize,
|
||||||
}
|
}
|
||||||
|
@ -35,17 +47,6 @@ enum UndoLog<K, V> {
|
||||||
Noop,
|
Noop,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K, V> Default for SnapshotMap<K, V>
|
|
||||||
where K: Hash + Clone + Eq
|
|
||||||
{
|
|
||||||
fn default() -> Self {
|
|
||||||
SnapshotMap {
|
|
||||||
map: FxHashMap::default(),
|
|
||||||
undo_log: vec![],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<K, V> SnapshotMap<K, V>
|
impl<K, V> SnapshotMap<K, V>
|
||||||
where K: Hash + Clone + Eq
|
where K: Hash + Clone + Eq
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,6 +42,18 @@ pub struct TransitiveRelation<T: Clone + Debug + Eq + Hash> {
|
||||||
closure: Lock<Option<BitMatrix<usize, usize>>>,
|
closure: Lock<Option<BitMatrix<usize, usize>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HACK(eddyb) manual impl avoids `Default` bound on `T`.
|
||||||
|
impl<T: Clone + Debug + Eq + Hash> Default for TransitiveRelation<T> {
|
||||||
|
fn default() -> Self {
|
||||||
|
TransitiveRelation {
|
||||||
|
elements: Default::default(),
|
||||||
|
map: Default::default(),
|
||||||
|
edges: Default::default(),
|
||||||
|
closure: Default::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Debug)]
|
||||||
struct Index(usize);
|
struct Index(usize);
|
||||||
|
|
||||||
|
@ -51,17 +63,6 @@ struct Edge {
|
||||||
target: Index,
|
target: Index,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Clone + Debug + Eq + Hash> Default for TransitiveRelation<T> {
|
|
||||||
fn default() -> TransitiveRelation<T> {
|
|
||||||
TransitiveRelation {
|
|
||||||
elements: vec![],
|
|
||||||
map: FxHashMap::default(),
|
|
||||||
edges: vec![],
|
|
||||||
closure: Lock::new(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: Clone + Debug + Eq + Hash> TransitiveRelation<T> {
|
impl<T: Clone + Debug + Eq + Hash> TransitiveRelation<T> {
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
self.edges.is_empty()
|
self.edges.is_empty()
|
||||||
|
|
|
@ -603,7 +603,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDebugImplementations {
|
||||||
};
|
};
|
||||||
|
|
||||||
if self.impling_types.is_none() {
|
if self.impling_types.is_none() {
|
||||||
let mut impls = NodeSet();
|
let mut impls = NodeSet::default();
|
||||||
cx.tcx.for_each_impl(debug, |d| {
|
cx.tcx.for_each_impl(debug, |d| {
|
||||||
if let Some(ty_def) = cx.tcx.type_of(d).ty_adt_def() {
|
if let Some(ty_def) = cx.tcx.type_of(d).ty_adt_def() {
|
||||||
if let Some(node_id) = cx.tcx.hir.as_local_node_id(ty_def.did) {
|
if let Some(node_id) = cx.tcx.hir.as_local_node_id(ty_def.did) {
|
||||||
|
|
|
@ -316,7 +316,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) {
|
||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
|
|
||||||
assert_eq!(cnum, LOCAL_CRATE);
|
assert_eq!(cnum, LOCAL_CRATE);
|
||||||
let mut visible_parent_map: DefIdMap<DefId> = DefIdMap();
|
let mut visible_parent_map: DefIdMap<DefId> = Default::default();
|
||||||
|
|
||||||
// Issue 46112: We want the map to prefer the shortest
|
// Issue 46112: We want the map to prefer the shortest
|
||||||
// paths when reporting the path to an item. Therefore we
|
// paths when reporting the path to an item. Therefore we
|
||||||
|
|
|
@ -829,7 +829,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
upvar_decls,
|
upvar_decls,
|
||||||
var_indices: NodeMap(),
|
var_indices: Default::default(),
|
||||||
unit_temp: None,
|
unit_temp: None,
|
||||||
cached_resume_block: None,
|
cached_resume_block: None,
|
||||||
cached_return_block: None,
|
cached_return_block: None,
|
||||||
|
|
|
@ -314,7 +314,7 @@ pub fn collect_crate_mono_items<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
|
|
||||||
time(tcx.sess, "collecting mono items", || {
|
time(tcx.sess, "collecting mono items", || {
|
||||||
par_iter(roots).for_each(|root| {
|
par_iter(roots).for_each(|root| {
|
||||||
let mut recursion_depths = DefIdMap();
|
let mut recursion_depths = DefIdMap::default();
|
||||||
collect_items_rec(tcx,
|
collect_items_rec(tcx,
|
||||||
root,
|
root,
|
||||||
visited,
|
visited,
|
||||||
|
|
|
@ -72,7 +72,7 @@ fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, krate: CrateNum)
|
||||||
-> Lrc<DefIdSet> {
|
-> Lrc<DefIdSet> {
|
||||||
assert_eq!(krate, LOCAL_CRATE);
|
assert_eq!(krate, LOCAL_CRATE);
|
||||||
|
|
||||||
let mut set = DefIdSet();
|
let mut set = DefIdSet::default();
|
||||||
|
|
||||||
// All body-owners have MIR associated with them.
|
// All body-owners have MIR associated with them.
|
||||||
set.extend(tcx.body_owners());
|
set.extend(tcx.body_owners());
|
||||||
|
|
|
@ -84,10 +84,10 @@ fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
tables: &ty::TypeckTables::empty(None),
|
tables: &ty::TypeckTables::empty(None),
|
||||||
in_fn: false,
|
in_fn: false,
|
||||||
in_static: false,
|
in_static: false,
|
||||||
mut_rvalue_borrows: NodeSet(),
|
mut_rvalue_borrows: Default::default(),
|
||||||
param_env: ty::ParamEnv::empty(),
|
param_env: ty::ParamEnv::empty(),
|
||||||
identity_substs: Substs::empty(),
|
identity_substs: Substs::empty(),
|
||||||
result: ItemLocalSet(),
|
result: ItemLocalSet::default(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// `def_id` should be a `Body` owner
|
// `def_id` should be a `Body` owner
|
||||||
|
|
|
@ -1761,7 +1761,7 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
tcx,
|
tcx,
|
||||||
access_levels: &visitor.access_levels,
|
access_levels: &visitor.access_levels,
|
||||||
in_variant: false,
|
in_variant: false,
|
||||||
old_error_set: NodeSet(),
|
old_error_set: Default::default(),
|
||||||
};
|
};
|
||||||
intravisit::walk_crate(&mut visitor, krate);
|
intravisit::walk_crate(&mut visitor, krate);
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ pub fn check_crate(resolver: &mut Resolver, krate: &ast::Crate) {
|
||||||
|
|
||||||
let mut visitor = UnusedImportCheckVisitor {
|
let mut visitor = UnusedImportCheckVisitor {
|
||||||
resolver,
|
resolver,
|
||||||
unused_imports: NodeMap(),
|
unused_imports: Default::default(),
|
||||||
base_id: ast::DUMMY_NODE_ID,
|
base_id: ast::DUMMY_NODE_ID,
|
||||||
item_span: DUMMY_SP,
|
item_span: DUMMY_SP,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1861,22 +1861,22 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
|
||||||
|
|
||||||
primitive_type_table: PrimitiveTypeTable::new(),
|
primitive_type_table: PrimitiveTypeTable::new(),
|
||||||
|
|
||||||
def_map: NodeMap(),
|
def_map: Default::default(),
|
||||||
import_map: NodeMap(),
|
import_map: Default::default(),
|
||||||
freevars: NodeMap(),
|
freevars: Default::default(),
|
||||||
freevars_seen: NodeMap(),
|
freevars_seen: Default::default(),
|
||||||
export_map: FxHashMap::default(),
|
export_map: FxHashMap::default(),
|
||||||
trait_map: NodeMap(),
|
trait_map: Default::default(),
|
||||||
module_map,
|
module_map,
|
||||||
block_map: NodeMap(),
|
block_map: Default::default(),
|
||||||
extern_module_map: FxHashMap::default(),
|
extern_module_map: FxHashMap::default(),
|
||||||
binding_parent_modules: FxHashMap::default(),
|
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: Default::default(),
|
||||||
|
|
||||||
used_imports: FxHashSet::default(),
|
used_imports: FxHashSet::default(),
|
||||||
maybe_unused_trait_imports: NodeSet(),
|
maybe_unused_trait_imports: Default::default(),
|
||||||
maybe_unused_extern_crates: Vec::new(),
|
maybe_unused_extern_crates: Vec::new(),
|
||||||
|
|
||||||
unused_labels: FxHashMap::default(),
|
unused_labels: FxHashMap::default(),
|
||||||
|
@ -1906,7 +1906,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
|
||||||
name_already_seen: FxHashMap::default(),
|
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: Default::default(),
|
||||||
found_unresolved_macro: false,
|
found_unresolved_macro: false,
|
||||||
unused_macros: FxHashSet::default(),
|
unused_macros: FxHashSet::default(),
|
||||||
current_type_ascription: Vec::new(),
|
current_type_ascription: Vec::new(),
|
||||||
|
|
|
@ -643,11 +643,11 @@ impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> {
|
||||||
},
|
},
|
||||||
infcx,
|
infcx,
|
||||||
fulfillment_cx: RefCell::new(TraitEngine::new(tcx)),
|
fulfillment_cx: RefCell::new(TraitEngine::new(tcx)),
|
||||||
locals: RefCell::new(NodeMap()),
|
locals: RefCell::new(Default::default()),
|
||||||
deferred_call_resolutions: RefCell::new(DefIdMap()),
|
deferred_call_resolutions: RefCell::new(Default::default()),
|
||||||
deferred_cast_checks: RefCell::new(Vec::new()),
|
deferred_cast_checks: RefCell::new(Vec::new()),
|
||||||
deferred_generator_interiors: RefCell::new(Vec::new()),
|
deferred_generator_interiors: RefCell::new(Vec::new()),
|
||||||
opaque_types: RefCell::new(DefIdMap()),
|
opaque_types: RefCell::new(Default::default()),
|
||||||
implicit_region_bound,
|
implicit_region_bound,
|
||||||
body_id,
|
body_id,
|
||||||
}
|
}
|
||||||
|
@ -1986,7 +1986,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
||||||
has_errors: Cell::new(false),
|
has_errors: Cell::new(false),
|
||||||
enclosing_breakables: RefCell::new(EnclosingBreakables {
|
enclosing_breakables: RefCell::new(EnclosingBreakables {
|
||||||
stack: Vec::new(),
|
stack: Vec::new(),
|
||||||
by_id: NodeMap(),
|
by_id: Default::default(),
|
||||||
}),
|
}),
|
||||||
inh,
|
inh,
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
||||||
|
|
||||||
let used_trait_imports = mem::replace(
|
let used_trait_imports = mem::replace(
|
||||||
&mut self.tables.borrow_mut().used_trait_imports,
|
&mut self.tables.borrow_mut().used_trait_imports,
|
||||||
Lrc::new(DefIdSet()),
|
Lrc::new(DefIdSet::default()),
|
||||||
);
|
);
|
||||||
debug!(
|
debug!(
|
||||||
"used_trait_imports({:?}) = {:?}",
|
"used_trait_imports({:?}) = {:?}",
|
||||||
|
|
|
@ -24,7 +24,7 @@ use rustc::util::nodemap::DefIdSet;
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
|
|
||||||
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
||||||
let mut used_trait_imports = DefIdSet();
|
let mut used_trait_imports = DefIdSet::default();
|
||||||
for &body_id in tcx.hir.krate().bodies.keys() {
|
for &body_id in tcx.hir.krate().bodies.keys() {
|
||||||
let item_def_id = tcx.hir.body_owner_def_id(body_id);
|
let item_def_id = tcx.hir.body_owner_def_id(body_id);
|
||||||
let imports = tcx.used_trait_imports(item_def_id);
|
let imports = tcx.used_trait_imports(item_def_id);
|
||||||
|
|
|
@ -22,7 +22,6 @@ use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
||||||
use rustc::hir;
|
use rustc::hir;
|
||||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||||
use rustc::ty::{self, CrateInherentImpls, TyCtxt};
|
use rustc::ty::{self, CrateInherentImpls, TyCtxt};
|
||||||
use rustc::util::nodemap::DefIdMap;
|
|
||||||
|
|
||||||
use rustc_data_structures::sync::Lrc;
|
use rustc_data_structures::sync::Lrc;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
|
@ -37,9 +36,7 @@ pub fn crate_inherent_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
let krate = tcx.hir.krate();
|
let krate = tcx.hir.krate();
|
||||||
let mut collect = InherentCollect {
|
let mut collect = InherentCollect {
|
||||||
tcx,
|
tcx,
|
||||||
impls_map: CrateInherentImpls {
|
impls_map: Default::default(),
|
||||||
inherent_impls: DefIdMap()
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
krate.visit_all_item_likes(&mut collect);
|
krate.visit_all_item_likes(&mut collect);
|
||||||
Lrc::new(collect.impls_map)
|
Lrc::new(collect.impls_map)
|
||||||
|
|
|
@ -81,7 +81,7 @@ pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>
|
||||||
let mut terms_cx = TermsContext {
|
let mut terms_cx = TermsContext {
|
||||||
tcx,
|
tcx,
|
||||||
arena,
|
arena,
|
||||||
inferred_starts: NodeMap(),
|
inferred_starts: Default::default(),
|
||||||
inferred_terms: vec![],
|
inferred_terms: vec![],
|
||||||
|
|
||||||
lang_items: lang_items(tcx),
|
lang_items: lang_items(tcx),
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub const STRIP_HIDDEN: Pass =
|
||||||
|
|
||||||
/// Strip items marked `#[doc(hidden)]`
|
/// Strip items marked `#[doc(hidden)]`
|
||||||
pub fn strip_hidden(krate: clean::Crate, _: &DocContext) -> clean::Crate {
|
pub fn strip_hidden(krate: clean::Crate, _: &DocContext) -> clean::Crate {
|
||||||
let mut retained = DefIdSet();
|
let mut retained = DefIdSet::default();
|
||||||
|
|
||||||
// strip all #[doc(hidden)] items
|
// strip all #[doc(hidden)] items
|
||||||
let krate = {
|
let krate = {
|
||||||
|
|
|
@ -24,7 +24,7 @@ pub const STRIP_PRIVATE: Pass =
|
||||||
/// crate, specified by the `xcrate` flag.
|
/// crate, specified by the `xcrate` flag.
|
||||||
pub fn strip_private(mut krate: clean::Crate, cx: &DocContext) -> clean::Crate {
|
pub fn strip_private(mut krate: clean::Crate, cx: &DocContext) -> clean::Crate {
|
||||||
// This stripper collects all *retained* nodes.
|
// This stripper collects all *retained* nodes.
|
||||||
let mut retained = DefIdSet();
|
let mut retained = DefIdSet::default();
|
||||||
let access_levels = cx.renderinfo.borrow().access_levels.clone();
|
let access_levels = cx.renderinfo.borrow().access_levels.clone();
|
||||||
|
|
||||||
// strip all private items
|
// strip all private items
|
||||||
|
|
Loading…
Reference in New Issue