Skip to content

Commit cda3490

Browse files
committed
Auto merge of #21269 - alexcrichton:issue-6936, r=pnkfelix
This commit modifies resolve to prevent conflicts with typedef names in the same method that conflits are prevented with enum names. This is a breaking change due to the differing semantics in resolve, and any errors generated on behalf of this change require that a conflicting typedef, module, or structure to be renamed so they do not conflict. [breaking-change] Closes #6936
2 parents 43f2c19 + 3121c04 commit cda3490

Some content is hidden

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

41 files changed

+341
-308
lines changed

src/librustc/lint/builtin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ pub struct RawPointerDerive {
575575
impl RawPointerDerive {
576576
pub fn new() -> RawPointerDerive {
577577
RawPointerDerive {
578-
checked_raw_pointers: NodeSet::new(),
578+
checked_raw_pointers: NodeSet(),
579579
}
580580
}
581581
}
@@ -1323,7 +1323,7 @@ impl UnusedMut {
13231323
// collect all mutable pattern and group their NodeIDs by their Identifier to
13241324
// avoid false warnings in match arms with multiple patterns
13251325

1326-
let mut mutables = FnvHashMap::new();
1326+
let mut mutables = FnvHashMap();
13271327
for p in pats.iter() {
13281328
pat_util::pat_bindings(&cx.tcx.def_map, &**p, |mode, id, _, path1| {
13291329
let ident = path1.node;

src/librustc/lint/context.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ impl LintStore {
9898
LintStore {
9999
lints: vec!(),
100100
passes: Some(vec!()),
101-
by_name: FnvHashMap::new(),
102-
levels: FnvHashMap::new(),
103-
lint_groups: FnvHashMap::new(),
101+
by_name: FnvHashMap(),
102+
levels: FnvHashMap(),
103+
lint_groups: FnvHashMap(),
104104
}
105105
}
106106

@@ -468,7 +468,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
468468
exported_items: exported_items,
469469
lints: lint_store,
470470
level_stack: vec![],
471-
node_levels: RefCell::new(FnvHashMap::new()),
471+
node_levels: RefCell::new(FnvHashMap()),
472472
}
473473
}
474474

src/librustc/metadata/cstore.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ pub struct CStore {
8484
impl CStore {
8585
pub fn new(intr: Rc<IdentInterner>) -> CStore {
8686
CStore {
87-
metas: RefCell::new(FnvHashMap::new()),
88-
extern_mod_crate_map: RefCell::new(FnvHashMap::new()),
87+
metas: RefCell::new(FnvHashMap()),
88+
extern_mod_crate_map: RefCell::new(FnvHashMap()),
8989
used_crate_sources: RefCell::new(Vec::new()),
9090
used_libraries: RefCell::new(Vec::new()),
9191
used_link_args: RefCell::new(Vec::new()),

src/librustc/metadata/encoder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,7 @@ fn encode_metadata_inner(wr: &mut SeekableMemWriter,
21112111
link_meta: link_meta,
21122112
cstore: cstore,
21132113
encode_inlined_item: RefCell::new(encode_inlined_item),
2114-
type_abbrevs: RefCell::new(FnvHashMap::new()),
2114+
type_abbrevs: RefCell::new(FnvHashMap()),
21152115
reachable: reachable,
21162116
};
21172117

@@ -2216,7 +2216,7 @@ pub fn encoded_ty<'tcx>(tcx: &ty::ctxt<'tcx>, t: Ty<'tcx>) -> String {
22162216
diag: tcx.sess.diagnostic(),
22172217
ds: def_to_string,
22182218
tcx: tcx,
2219-
abbrevs: &RefCell::new(FnvHashMap::new())
2219+
abbrevs: &RefCell::new(FnvHashMap())
22202220
}, t);
22212221
String::from_utf8(wr.unwrap()).unwrap()
22222222
}

src/librustc/middle/cfg/construct.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub fn construct(tcx: &ty::ctxt,
4646
let block_exit;
4747

4848
let mut cfg_builder = CFGBuilder {
49-
exit_map: NodeMap::new(),
49+
exit_map: NodeMap(),
5050
graph: graph,
5151
fn_exit: fn_exit,
5252
tcx: tcx,

src/librustc/middle/check_static.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ struct GlobalChecker {
6464

6565
pub fn check_crate(tcx: &ty::ctxt) {
6666
let mut checker = GlobalChecker {
67-
static_consumptions: NodeSet::new(),
68-
const_borrows: NodeSet::new(),
69-
static_interior_borrows: NodeSet::new(),
70-
static_local_borrows: NodeSet::new(),
67+
static_consumptions: NodeSet(),
68+
const_borrows: NodeSet(),
69+
static_interior_borrows: NodeSet(),
70+
static_local_borrows: NodeSet(),
7171
};
7272
{
7373
let param_env = ty::empty_parameter_environment(tcx);

src/librustc/middle/const_eval.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ConstEvalVisitor<'a, 'tcx> {
286286
pub fn process_crate(tcx: &ty::ctxt) {
287287
visit::walk_crate(&mut ConstEvalVisitor {
288288
tcx: tcx,
289-
ccache: DefIdMap::new(),
289+
ccache: DefIdMap(),
290290
}, tcx.map.krate());
291291
tcx.sess.abort_if_errors();
292292
}

src/librustc/middle/dataflow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O
145145

146146
fn build_nodeid_to_index(decl: Option<&ast::FnDecl>,
147147
cfg: &cfg::CFG) -> NodeMap<CFGIndex> {
148-
let mut index = NodeMap::new();
148+
let mut index = NodeMap();
149149

150150
// FIXME (#6298): Would it be better to fold formals from decl
151151
// into cfg itself? i.e. introduce a fn-based flow-graph in

src/librustc/middle/dependency_format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ fn calculate_type(sess: &session::Session,
137137
config::CrateTypeExecutable | config::CrateTypeDylib => {},
138138
}
139139

140-
let mut formats = FnvHashMap::new();
140+
let mut formats = FnvHashMap();
141141

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

src/librustc/middle/infer/region_inference/graphviz.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<'a, 'tcx> ConstraintGraph<'a, 'tcx> {
133133
name: String,
134134
map: &'a ConstraintMap<'tcx>) -> ConstraintGraph<'a, 'tcx> {
135135
let mut i = 0;
136-
let mut node_ids = FnvHashMap::new();
136+
let mut node_ids = FnvHashMap();
137137
{
138138
let mut add_node = |&mut : node| {
139139
if let Vacant(e) = node_ids.entry(node) {
@@ -188,7 +188,7 @@ fn constraint_to_nodes(c: &Constraint) -> (Node, Node) {
188188

189189
impl<'a, 'tcx> dot::GraphWalk<'a, Node, Edge> for ConstraintGraph<'a, 'tcx> {
190190
fn nodes(&self) -> dot::Nodes<Node> {
191-
let mut set = FnvHashSet::new();
191+
let mut set = FnvHashSet();
192192
for constraint in self.map.keys() {
193193
let (n1, n2) = constraint_to_nodes(constraint);
194194
set.insert(n1);

src/librustc/middle/infer/region_inference/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
236236
tcx: tcx,
237237
var_origins: RefCell::new(Vec::new()),
238238
values: RefCell::new(None),
239-
constraints: RefCell::new(FnvHashMap::new()),
239+
constraints: RefCell::new(FnvHashMap()),
240240
verifys: RefCell::new(Vec::new()),
241-
givens: RefCell::new(FnvHashSet::new()),
242-
lubs: RefCell::new(FnvHashMap::new()),
243-
glbs: RefCell::new(FnvHashMap::new()),
241+
givens: RefCell::new(FnvHashSet()),
242+
lubs: RefCell::new(FnvHashMap()),
243+
glbs: RefCell::new(FnvHashMap()),
244244
skolemization_count: Cell::new(0),
245245
bound_count: Cell::new(0),
246246
undo_log: RefCell::new(Vec::new())
@@ -1200,7 +1200,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
12001200
values: &Vec<VarValue>,
12011201
errors: &mut Vec<RegionResolutionError<'tcx>>)
12021202
{
1203-
let mut reg_reg_dups = FnvHashSet::new();
1203+
let mut reg_reg_dups = FnvHashSet();
12041204
for verify in self.verifys.borrow().iter() {
12051205
match *verify {
12061206
VerifyRegSubReg(ref origin, sub, sup) => {
@@ -1476,7 +1476,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
14761476
dup_found: bool
14771477
}
14781478
let mut state = WalkState {
1479-
set: FnvHashSet::new(),
1479+
set: FnvHashSet(),
14801480
stack: vec!(orig_node_idx),
14811481
result: Vec::new(),
14821482
dup_found: false

src/librustc/middle/lang_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl<'a, 'v> Visitor<'v> for LanguageItemCollector<'a> {
167167

168168
impl<'a> LanguageItemCollector<'a> {
169169
pub fn new(session: &'a Session) -> LanguageItemCollector<'a> {
170-
let mut item_refs = FnvHashMap::new();
170+
let mut item_refs = FnvHashMap();
171171

172172
$( item_refs.insert($name, $variant as uint); )*
173173

src/librustc/middle/liveness.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,9 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> {
277277
tcx: tcx,
278278
num_live_nodes: 0,
279279
num_vars: 0,
280-
live_node_map: NodeMap::new(),
281-
variable_map: NodeMap::new(),
282-
capture_info_map: NodeMap::new(),
280+
live_node_map: NodeMap(),
281+
variable_map: NodeMap(),
282+
capture_info_map: NodeMap(),
283283
var_kinds: Vec::new(),
284284
lnks: Vec::new(),
285285
}
@@ -582,8 +582,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
582582
successors: repeat(invalid_node()).take(num_live_nodes).collect(),
583583
users: repeat(invalid_users()).take(num_live_nodes * num_vars).collect(),
584584
loop_scope: Vec::new(),
585-
break_ln: NodeMap::new(),
586-
cont_ln: NodeMap::new(),
585+
break_ln: NodeMap(),
586+
cont_ln: NodeMap(),
587587
}
588588
}
589589

src/librustc/middle/pat_util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub type PatIdMap = FnvHashMap<ast::Ident, ast::NodeId>;
2121
// This is used because same-named variables in alternative patterns need to
2222
// use the NodeId of their namesake in the first pattern.
2323
pub fn pat_id_map(dm: &DefMap, pat: &ast::Pat) -> PatIdMap {
24-
let mut map = FnvHashMap::new();
24+
let mut map = FnvHashMap();
2525
pat_bindings(dm, pat, |_bm, p_id, _s, path1| {
2626
map.insert(path1.node, p_id);
2727
});

src/librustc/middle/reachable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
169169
});
170170
ReachableContext {
171171
tcx: tcx,
172-
reachable_symbols: NodeSet::new(),
172+
reachable_symbols: NodeSet(),
173173
worklist: Vec::new(),
174174
any_library: any_library,
175175
}

src/librustc/middle/region.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -891,11 +891,11 @@ impl<'a, 'v> Visitor<'v> for RegionResolutionVisitor<'a> {
891891

892892
pub fn resolve_crate(sess: &Session, krate: &ast::Crate) -> RegionMaps {
893893
let maps = RegionMaps {
894-
scope_map: RefCell::new(FnvHashMap::new()),
895-
var_map: RefCell::new(NodeMap::new()),
896-
free_region_map: RefCell::new(FnvHashMap::new()),
897-
rvalue_scopes: RefCell::new(NodeMap::new()),
898-
terminating_scopes: RefCell::new(FnvHashSet::new()),
894+
scope_map: RefCell::new(FnvHashMap()),
895+
var_map: RefCell::new(NodeMap()),
896+
free_region_map: RefCell::new(FnvHashMap()),
897+
rvalue_scopes: RefCell::new(NodeMap()),
898+
terminating_scopes: RefCell::new(FnvHashSet()),
899899
};
900900
{
901901
let mut visitor = RegionResolutionVisitor {

src/librustc/middle/resolve_lifetime.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ type Scope<'a> = &'a ScopeChain<'a>;
7474
static ROOT_SCOPE: ScopeChain<'static> = RootScope;
7575

7676
pub fn krate(sess: &Session, krate: &ast::Crate, def_map: &DefMap) -> NamedRegionMap {
77-
let mut named_region_map = NodeMap::new();
77+
let mut named_region_map = NodeMap();
7878
visit::walk_crate(&mut LifetimeContext {
7979
sess: sess,
8080
named_region_map: &mut named_region_map,

src/librustc/middle/stability.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ impl Index {
141141
pub fn build(krate: &Crate) -> Index {
142142
let mut annotator = Annotator {
143143
index: Index {
144-
local: NodeMap::new(),
145-
extern_cache: DefIdMap::new()
144+
local: NodeMap(),
145+
extern_cache: DefIdMap()
146146
},
147147
parent: None
148148
};

src/librustc/middle/traits/fulfill.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'tcx> FulfillmentContext<'tcx> {
9696
duplicate_set: HashSet::new(),
9797
predicates: Vec::new(),
9898
attempted_mark: 0,
99-
region_obligations: NodeMap::new(),
99+
region_obligations: NodeMap(),
100100
}
101101
}
102102

0 commit comments

Comments
 (0)