Skip to content

Commit b782d8f

Browse files
committed
---
yaml --- r: 147626 b: refs/heads/try2 c: 9988970 h: refs/heads/master v: v3
1 parent b773132 commit b782d8f

File tree

2 files changed

+23
-29
lines changed

2 files changed

+23
-29
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 35c8fecb329b9a432d43e20fb91442d66d8f339a
8+
refs/heads/try2: 9988970e81ab877f8cba0bf0d0cc6df7aed52fb7
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/resolve.rs

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ enum NamespaceResult {
113113
UnboundResult,
114114
/// Means that resolve has determined that the name is bound in the Module
115115
/// argument, and specified by the NameBindings argument.
116-
BoundResult(@Module, @mut NameBindings)
116+
BoundResult(@Module, @NameBindings)
117117
}
118118

119119
impl NamespaceResult {
@@ -328,13 +328,11 @@ impl ImportDirective {
328328
/// The item that an import resolves to.
329329
struct Target {
330330
target_module: @Module,
331-
bindings: @mut NameBindings,
331+
bindings: @NameBindings,
332332
}
333333

334334
impl Target {
335-
fn new(target_module: @Module,
336-
bindings: @mut NameBindings)
337-
-> Target {
335+
fn new(target_module: @Module, bindings: @NameBindings) -> Target {
338336
Target {
339337
target_module: target_module,
340338
bindings: bindings
@@ -420,7 +418,7 @@ struct Module {
420418
kind: Cell<ModuleKind>,
421419
is_public: bool,
422420

423-
children: @mut HashMap<Name, @mut NameBindings>,
421+
children: @mut HashMap<Name, @NameBindings>,
424422
imports: @mut ~[@ImportDirective],
425423

426424
// The external module children of this node that were declared with
@@ -520,7 +518,7 @@ enum TraitReferenceType {
520518

521519
impl NameBindings {
522520
/// Creates a new module in this set of name bindings.
523-
fn define_module(&mut self,
521+
fn define_module(&self,
524522
parent_link: ParentLink,
525523
def_id: Option<DefId>,
526524
kind: ModuleKind,
@@ -551,7 +549,7 @@ impl NameBindings {
551549
}
552550

553551
/// Sets the kind of the module, creating a new one if necessary.
554-
fn set_module_kind(&mut self,
552+
fn set_module_kind(&self,
555553
parent_link: ParentLink,
556554
def_id: Option<DefId>,
557555
kind: ModuleKind,
@@ -591,7 +589,7 @@ impl NameBindings {
591589
}
592590

593591
/// Records a type definition.
594-
fn define_type(&mut self, def: Def, sp: Span, is_public: bool) {
592+
fn define_type(&self, def: Def, sp: Span, is_public: bool) {
595593
// Merges the type with the existing type def or creates a new one.
596594
match self.type_def.get() {
597595
None => {
@@ -614,7 +612,7 @@ impl NameBindings {
614612
}
615613

616614
/// Records a value definition.
617-
fn define_value(&mut self, def: Def, sp: Span, is_public: bool) {
615+
fn define_value(&self, def: Def, sp: Span, is_public: bool) {
618616
self.value_def.set(Some(ValueNsDef {
619617
def: def,
620618
value_span: Some(sp),
@@ -635,7 +633,7 @@ impl NameBindings {
635633
* Returns the module node. Fails if this node does not have a module
636634
* definition.
637635
*/
638-
fn get_module(&mut self) -> @Module {
636+
fn get_module(&self) -> @Module {
639637
match self.get_module_if_available() {
640638
None => {
641639
fail!("get_module called on a node with no module \
@@ -774,7 +772,7 @@ fn namespace_error_to_str(ns: NamespaceError) -> &'static str {
774772
fn Resolver(session: Session,
775773
lang_items: LanguageItems,
776774
crate_span: Span) -> Resolver {
777-
let graph_root = @mut NameBindings();
775+
let graph_root = @NameBindings();
778776

779777
graph_root.define_module(NoParentLink,
780778
Some(DefId { crate: 0, node: 0 }),
@@ -834,7 +832,7 @@ struct Resolver {
834832

835833
intr: @ident_interner,
836834

837-
graph_root: @mut NameBindings,
835+
graph_root: @NameBindings,
838836

839837
method_map: @mut HashMap<Name, HashSet<DefId>>,
840838
structs: HashSet<DefId>,
@@ -985,7 +983,7 @@ impl Resolver {
985983
duplicate_checking_mode: DuplicateCheckingMode,
986984
// For printing errors
987985
sp: Span)
988-
-> (@mut NameBindings, ReducedGraphParent) {
986+
-> (@NameBindings, ReducedGraphParent) {
989987
// If this is the immediate descendant of a module, then we add the
990988
// child name directly. Otherwise, we create or reuse an anonymous
991989
// module and add the child to that.
@@ -1001,7 +999,7 @@ impl Resolver {
1001999
let new_parent = ModuleReducedGraphParent(module_);
10021000
match module_.children.find(&name.name) {
10031001
None => {
1004-
let child = @mut NameBindings();
1002+
let child = @NameBindings();
10051003
module_.children.insert(name.name, child);
10061004
return (child, new_parent);
10071005
}
@@ -1591,7 +1589,7 @@ impl Resolver {
15911589
fn handle_external_def(&mut self,
15921590
def: Def,
15931591
vis: visibility,
1594-
child_name_bindings: @mut NameBindings,
1592+
child_name_bindings: @NameBindings,
15951593
final_ident: &str,
15961594
ident: Ident,
15971595
new_parent: ReducedGraphParent) {
@@ -2215,8 +2213,7 @@ impl Resolver {
22152213
return resolution_result;
22162214
}
22172215

2218-
fn create_name_bindings_from_module(module: @Module)
2219-
-> NameBindings {
2216+
fn create_name_bindings_from_module(module: @Module) -> NameBindings {
22202217
NameBindings {
22212218
type_def: RefCell::new(Some(TypeNsDef {
22222219
is_public: false,
@@ -2372,7 +2369,7 @@ impl Resolver {
23722369
None => {} // Continue.
23732370
Some(module) => {
23742371
let name_bindings =
2375-
@mut Resolver::create_name_bindings_from_module(
2372+
@Resolver::create_name_bindings_from_module(
23762373
module);
23772374
type_result = BoundResult(containing_module,
23782375
name_bindings);
@@ -2535,8 +2532,7 @@ impl Resolver {
25352532
}
25362533
}
25372534

2538-
let merge_import_resolution = |name,
2539-
name_bindings: @mut NameBindings| {
2535+
let merge_import_resolution = |name, name_bindings: @NameBindings| {
25402536
let dest_import_resolution;
25412537
match module_.import_resolutions.find(&name) {
25422538
None => {
@@ -2585,7 +2581,7 @@ impl Resolver {
25852581
containing_module.external_module_children.borrow();
25862582
for (&name, module) in external_module_children.get().iter() {
25872583
let name_bindings =
2588-
@mut Resolver::create_name_bindings_from_module(*module);
2584+
@Resolver::create_name_bindings_from_module(*module);
25892585
merge_import_resolution(name, name_bindings);
25902586
}
25912587
}
@@ -2889,8 +2885,7 @@ impl Resolver {
28892885
None => {}
28902886
Some(module) => {
28912887
let name_bindings =
2892-
@mut Resolver::create_name_bindings_from_module(
2893-
module);
2888+
@Resolver::create_name_bindings_from_module(module);
28942889
debug!("lower name bindings succeeded");
28952890
return Success((Target::new(module_, name_bindings), false));
28962891
}
@@ -2975,7 +2970,7 @@ impl Resolver {
29752970
module_, name, TypeNS, DontSearchThroughModules);
29762971
match resolve_result {
29772972
Success((target, _)) => {
2978-
let bindings = &mut *target.bindings;
2973+
let bindings = &*target.bindings;
29792974
match bindings.type_def.get() {
29802975
Some(type_def) => {
29812976
match type_def.module_def {
@@ -3166,8 +3161,7 @@ impl Resolver {
31663161
None => {}
31673162
Some(module) => {
31683163
let name_bindings =
3169-
@mut Resolver::create_name_bindings_from_module(
3170-
module);
3164+
@Resolver::create_name_bindings_from_module(module);
31713165
return Success((Target::new(module_, name_bindings), false));
31723166
}
31733167
}
@@ -3290,7 +3284,7 @@ impl Resolver {
32903284
fn add_exports_of_namebindings(&mut self,
32913285
exports2: &mut ~[Export2],
32923286
name: Name,
3293-
namebindings: @mut NameBindings,
3287+
namebindings: @NameBindings,
32943288
ns: Namespace,
32953289
reexport: bool) {
32963290
match namebindings.def_for_namespace(ns) {

0 commit comments

Comments
 (0)