Skip to content

Commit a6bf984

Browse files
committed
---
yaml --- r: 277814 b: refs/heads/try c: a988c9a h: refs/heads/master
1 parent c717aaa commit a6bf984

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: 8c2fa93e81d25862362a3ebc91180ed77f38b9a1
4+
refs/heads/try: a988c9a839e340c6f82a808d7edede8d0af82d95
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_resolve/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ pub struct Resolver<'a, 'tcx: 'a> {
10091009
// The idents for the primitive types.
10101010
primitive_type_table: PrimitiveTypeTable,
10111011

1012-
def_map: RefCell<DefMap>,
1012+
def_map: DefMap,
10131013
freevars: FreevarMap,
10141014
freevars_seen: NodeMap<NodeMap<usize>>,
10151015
export_map: ExportMap,
@@ -1133,7 +1133,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
11331133

11341134
primitive_type_table: PrimitiveTypeTable::new(),
11351135

1136-
def_map: RefCell::new(NodeMap()),
1136+
def_map: NodeMap(),
11371137
freevars: NodeMap(),
11381138
freevars_seen: NodeMap(),
11391139
export_map: NodeMap(),
@@ -2001,14 +2001,16 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
20012001
// user and one 'x' came from the macro.
20022002
fn binding_mode_map(&mut self, pat: &Pat) -> BindingMap {
20032003
let mut result = HashMap::new();
2004-
pat_bindings(&self.def_map, pat, |binding_mode, _id, sp, path1| {
2004+
let def_map = RefCell::new(::std::mem::replace(&mut self.def_map, NodeMap()));
2005+
pat_bindings(&def_map, pat, |binding_mode, _id, sp, path1| {
20052006
let name = path1.node;
20062007
result.insert(name,
20072008
BindingInfo {
20082009
span: sp,
20092010
binding_mode: binding_mode,
20102011
});
20112012
});
2013+
self.def_map = def_map.into_inner();
20122014
return result;
20132015
}
20142016

@@ -2799,7 +2801,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
27992801

28002802
if let Some(node_id) = self.current_self_type.as_ref().and_then(extract_node_id) {
28012803
// Look for a field with the same name in the current self_type.
2802-
match self.def_map.borrow().get(&node_id).map(|d| d.full_def()) {
2804+
match self.def_map.get(&node_id).map(|d| d.full_def()) {
28032805
Some(Def::Enum(did)) |
28042806
Some(Def::TyAlias(did)) |
28052807
Some(Def::Struct(did)) |
@@ -3273,7 +3275,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
32733275

32743276
fn record_def(&mut self, node_id: NodeId, resolution: PathResolution) {
32753277
debug!("(recording def) recording {:?} for {}", resolution, node_id);
3276-
if let Some(prev_res) = self.def_map.borrow_mut().insert(node_id, resolution) {
3278+
if let Some(prev_res) = self.def_map.insert(node_id, resolution) {
32773279
let span = self.ast_map.opt_span(node_id).unwrap_or(codemap::DUMMY_SP);
32783280
span_bug!(span,
32793281
"path resolved multiple times ({:?} before, {:?} now)",
@@ -3314,7 +3316,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
33143316
Success(module) => {
33153317
let def = module.def.unwrap();
33163318
let path_resolution = PathResolution { base_def: def, depth: 0 };
3317-
self.def_map.borrow_mut().insert(id, path_resolution);
3319+
self.def_map.insert(id, path_resolution);
33183320
ty::Visibility::Restricted(self.ast_map.as_local_node_id(def.def_id()).unwrap())
33193321
}
33203322
Failed(Some((span, msg))) => {
@@ -3568,7 +3570,7 @@ pub fn resolve_crate<'a, 'tcx>(session: &'a Session,
35683570
resolver.report_privacy_errors();
35693571

35703572
CrateMap {
3571-
def_map: resolver.def_map,
3573+
def_map: RefCell::new(resolver.def_map),
35723574
freevars: resolver.freevars,
35733575
maybe_unused_trait_imports: resolver.maybe_unused_trait_imports,
35743576
export_map: resolver.export_map,

branches/try/src/librustc_resolve/resolve_imports.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
608608
None => value_result.success().and_then(NameBinding::def).unwrap(),
609609
};
610610
let path_resolution = PathResolution { base_def: def, depth: 0 };
611-
self.resolver.def_map.borrow_mut().insert(directive.id, path_resolution);
611+
self.resolver.def_map.insert(directive.id, path_resolution);
612612

613613
debug!("(resolving single import) successfully resolved import");
614614
return Success(());
@@ -653,11 +653,8 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
653653

654654
// Record the destination of this import
655655
if let Some(did) = target_module.def_id() {
656-
self.resolver.def_map.borrow_mut().insert(directive.id,
657-
PathResolution {
658-
base_def: Def::Mod(did),
659-
depth: 0,
660-
});
656+
let resolution = PathResolution { base_def: Def::Mod(did), depth: 0 };
657+
self.resolver.def_map.insert(directive.id, resolution);
661658
}
662659

663660
debug!("(resolving glob import) successfully resolved import");

0 commit comments

Comments
 (0)