@@ -113,7 +113,7 @@ enum NamespaceResult {
113
113
UnboundResult ,
114
114
/// Means that resolve has determined that the name is bound in the Module
115
115
/// argument, and specified by the NameBindings argument.
116
- BoundResult ( @Module , @mut NameBindings )
116
+ BoundResult ( @Module , @NameBindings )
117
117
}
118
118
119
119
impl NamespaceResult {
@@ -328,13 +328,11 @@ impl ImportDirective {
328
328
/// The item that an import resolves to.
329
329
struct Target {
330
330
target_module : @Module ,
331
- bindings : @mut NameBindings ,
331
+ bindings : @NameBindings ,
332
332
}
333
333
334
334
impl Target {
335
- fn new ( target_module : @Module ,
336
- bindings : @mut NameBindings )
337
- -> Target {
335
+ fn new ( target_module : @Module , bindings : @NameBindings ) -> Target {
338
336
Target {
339
337
target_module : target_module,
340
338
bindings : bindings
@@ -420,7 +418,7 @@ struct Module {
420
418
kind : Cell < ModuleKind > ,
421
419
is_public : bool ,
422
420
423
- children : @mut HashMap < Name , @mut NameBindings > ,
421
+ children : @mut HashMap < Name , @NameBindings > ,
424
422
imports : @mut ~[ @ImportDirective ] ,
425
423
426
424
// The external module children of this node that were declared with
@@ -520,7 +518,7 @@ enum TraitReferenceType {
520
518
521
519
impl NameBindings {
522
520
/// Creates a new module in this set of name bindings.
523
- fn define_module ( & mut self ,
521
+ fn define_module ( & self ,
524
522
parent_link : ParentLink ,
525
523
def_id : Option < DefId > ,
526
524
kind : ModuleKind ,
@@ -551,7 +549,7 @@ impl NameBindings {
551
549
}
552
550
553
551
/// 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 ,
555
553
parent_link : ParentLink ,
556
554
def_id : Option < DefId > ,
557
555
kind : ModuleKind ,
@@ -591,7 +589,7 @@ impl NameBindings {
591
589
}
592
590
593
591
/// 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 ) {
595
593
// Merges the type with the existing type def or creates a new one.
596
594
match self . type_def . get ( ) {
597
595
None => {
@@ -614,7 +612,7 @@ impl NameBindings {
614
612
}
615
613
616
614
/// 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 ) {
618
616
self . value_def . set ( Some ( ValueNsDef {
619
617
def : def,
620
618
value_span : Some ( sp) ,
@@ -635,7 +633,7 @@ impl NameBindings {
635
633
* Returns the module node. Fails if this node does not have a module
636
634
* definition.
637
635
*/
638
- fn get_module ( & mut self ) -> @Module {
636
+ fn get_module ( & self ) -> @Module {
639
637
match self . get_module_if_available ( ) {
640
638
None => {
641
639
fail ! ( "get_module called on a node with no module \
@@ -774,7 +772,7 @@ fn namespace_error_to_str(ns: NamespaceError) -> &'static str {
774
772
fn Resolver ( session : Session ,
775
773
lang_items : LanguageItems ,
776
774
crate_span : Span ) -> Resolver {
777
- let graph_root = @mut NameBindings ( ) ;
775
+ let graph_root = @NameBindings ( ) ;
778
776
779
777
graph_root. define_module ( NoParentLink ,
780
778
Some ( DefId { crate : 0 , node : 0 } ) ,
@@ -834,7 +832,7 @@ struct Resolver {
834
832
835
833
intr : @ident_interner ,
836
834
837
- graph_root : @mut NameBindings ,
835
+ graph_root : @NameBindings ,
838
836
839
837
method_map : @mut HashMap < Name , HashSet < DefId > > ,
840
838
structs : HashSet < DefId > ,
@@ -985,7 +983,7 @@ impl Resolver {
985
983
duplicate_checking_mode : DuplicateCheckingMode ,
986
984
// For printing errors
987
985
sp : Span )
988
- -> ( @mut NameBindings , ReducedGraphParent ) {
986
+ -> ( @NameBindings , ReducedGraphParent ) {
989
987
// If this is the immediate descendant of a module, then we add the
990
988
// child name directly. Otherwise, we create or reuse an anonymous
991
989
// module and add the child to that.
@@ -1001,7 +999,7 @@ impl Resolver {
1001
999
let new_parent = ModuleReducedGraphParent ( module_) ;
1002
1000
match module_. children . find ( & name. name ) {
1003
1001
None => {
1004
- let child = @mut NameBindings ( ) ;
1002
+ let child = @NameBindings ( ) ;
1005
1003
module_. children . insert ( name. name , child) ;
1006
1004
return ( child, new_parent) ;
1007
1005
}
@@ -1591,7 +1589,7 @@ impl Resolver {
1591
1589
fn handle_external_def ( & mut self ,
1592
1590
def : Def ,
1593
1591
vis : visibility ,
1594
- child_name_bindings : @mut NameBindings ,
1592
+ child_name_bindings : @NameBindings ,
1595
1593
final_ident : & str ,
1596
1594
ident : Ident ,
1597
1595
new_parent : ReducedGraphParent ) {
@@ -2215,8 +2213,7 @@ impl Resolver {
2215
2213
return resolution_result;
2216
2214
}
2217
2215
2218
- fn create_name_bindings_from_module ( module : @Module )
2219
- -> NameBindings {
2216
+ fn create_name_bindings_from_module ( module : @Module ) -> NameBindings {
2220
2217
NameBindings {
2221
2218
type_def : RefCell :: new ( Some ( TypeNsDef {
2222
2219
is_public : false ,
@@ -2372,7 +2369,7 @@ impl Resolver {
2372
2369
None => { } // Continue.
2373
2370
Some ( module) => {
2374
2371
let name_bindings =
2375
- @mut Resolver :: create_name_bindings_from_module (
2372
+ @Resolver :: create_name_bindings_from_module (
2376
2373
module) ;
2377
2374
type_result = BoundResult ( containing_module,
2378
2375
name_bindings) ;
@@ -2535,8 +2532,7 @@ impl Resolver {
2535
2532
}
2536
2533
}
2537
2534
2538
- let merge_import_resolution = |name,
2539
- name_bindings : @mut NameBindings | {
2535
+ let merge_import_resolution = |name, name_bindings : @NameBindings | {
2540
2536
let dest_import_resolution;
2541
2537
match module_. import_resolutions . find ( & name) {
2542
2538
None => {
@@ -2585,7 +2581,7 @@ impl Resolver {
2585
2581
containing_module. external_module_children . borrow ( ) ;
2586
2582
for ( & name, module) in external_module_children. get ( ) . iter ( ) {
2587
2583
let name_bindings =
2588
- @mut Resolver :: create_name_bindings_from_module ( * module) ;
2584
+ @Resolver :: create_name_bindings_from_module ( * module) ;
2589
2585
merge_import_resolution ( name, name_bindings) ;
2590
2586
}
2591
2587
}
@@ -2889,8 +2885,7 @@ impl Resolver {
2889
2885
None => { }
2890
2886
Some ( module) => {
2891
2887
let name_bindings =
2892
- @mut Resolver :: create_name_bindings_from_module (
2893
- module) ;
2888
+ @Resolver :: create_name_bindings_from_module ( module) ;
2894
2889
debug ! ( "lower name bindings succeeded" ) ;
2895
2890
return Success ( ( Target :: new ( module_, name_bindings) , false ) ) ;
2896
2891
}
@@ -2975,7 +2970,7 @@ impl Resolver {
2975
2970
module_, name, TypeNS , DontSearchThroughModules ) ;
2976
2971
match resolve_result {
2977
2972
Success ( ( target, _) ) => {
2978
- let bindings = & mut * target. bindings ;
2973
+ let bindings = & * target. bindings ;
2979
2974
match bindings. type_def . get ( ) {
2980
2975
Some ( type_def) => {
2981
2976
match type_def. module_def {
@@ -3166,8 +3161,7 @@ impl Resolver {
3166
3161
None => { }
3167
3162
Some ( module) => {
3168
3163
let name_bindings =
3169
- @mut Resolver :: create_name_bindings_from_module (
3170
- module) ;
3164
+ @Resolver :: create_name_bindings_from_module ( module) ;
3171
3165
return Success ( ( Target :: new ( module_, name_bindings) , false ) ) ;
3172
3166
}
3173
3167
}
@@ -3290,7 +3284,7 @@ impl Resolver {
3290
3284
fn add_exports_of_namebindings ( & mut self ,
3291
3285
exports2 : & mut ~[ Export2 ] ,
3292
3286
name : Name ,
3293
- namebindings : @mut NameBindings ,
3287
+ namebindings : @NameBindings ,
3294
3288
ns : Namespace ,
3295
3289
reexport : bool ) {
3296
3290
match namebindings. def_for_namespace ( ns) {
0 commit comments