@@ -649,9 +649,10 @@ impl AstConv for FnCtxt {
649
649
650
650
pub impl FnCtxt {
651
651
fn infcx ( & self ) -> @mut infer:: InferCtxt { self . inh . infcx }
652
- fn search_in_scope_regions ( & self ,
653
- br : ty:: bound_region )
654
- -> Result < ty:: Region , ~str > {
652
+ fn search_in_scope_regions (
653
+ & self ,
654
+ br : ty:: bound_region ) -> Result < ty:: Region , ~str >
655
+ {
655
656
let in_scope_regions = self . in_scope_regions ;
656
657
match in_scope_regions. find ( br) {
657
658
Some ( r) => result:: Ok ( r) ,
@@ -683,9 +684,9 @@ impl region_scope for FnCtxt {
683
684
}
684
685
685
686
pub impl FnCtxt {
686
- fn tag ( @ mut self ) -> ~str { fmt ! ( "%x" , ptr:: addr_of( & ( * self ) ) as uint) }
687
+ fn tag ( & self ) -> ~str { fmt ! ( "%x" , ptr:: addr_of( & ( * self ) ) as uint) }
687
688
688
- fn local_ty ( @ mut self , span : span , nid : ast:: node_id ) -> ty:: t {
689
+ fn local_ty ( & self , span : span , nid : ast:: node_id ) -> ty:: t {
689
690
match self . inh . locals . find ( & nid) {
690
691
Some ( t) => t,
691
692
None => {
@@ -696,7 +697,7 @@ pub impl FnCtxt {
696
697
}
697
698
}
698
699
699
- fn expr_to_str ( @ mut self , expr : @ast:: expr ) -> ~str {
700
+ fn expr_to_str ( & self , expr : @ast:: expr ) -> ~str {
700
701
fmt ! ( "expr(%?:%s)" , expr. id,
701
702
pprust:: expr_to_str( expr, self . tcx( ) . sess. intr( ) ) )
702
703
}
@@ -706,13 +707,13 @@ pub impl FnCtxt {
706
707
}
707
708
708
709
#[ inline( always) ]
709
- fn write_ty ( @ mut self , node_id : ast:: node_id , ty : ty:: t ) {
710
+ fn write_ty ( & self , node_id : ast:: node_id , ty : ty:: t ) {
710
711
debug ! ( "write_ty(%d, %s) in fcx %s" ,
711
712
node_id, ppaux:: ty_to_str( self . tcx( ) , ty) , self . tag( ) ) ;
712
713
self . inh . node_types . insert ( node_id, ty) ;
713
714
}
714
715
715
- fn write_substs ( @ mut self , node_id : ast:: node_id , +substs : ty:: substs ) {
716
+ fn write_substs ( & self , node_id : ast:: node_id , +substs : ty:: substs ) {
716
717
if !ty:: substs_is_noop ( & substs) {
717
718
debug ! ( "write_substs(%d, %s) in fcx %s" ,
718
719
node_id,
@@ -722,7 +723,7 @@ pub impl FnCtxt {
722
723
}
723
724
}
724
725
725
- fn write_ty_substs ( @ mut self ,
726
+ fn write_ty_substs ( & self ,
726
727
node_id : ast:: node_id ,
727
728
ty : ty:: t ,
728
729
+substs : ty:: substs ) {
@@ -731,7 +732,7 @@ pub impl FnCtxt {
731
732
self . write_substs ( node_id, substs) ;
732
733
}
733
734
734
- fn write_autoderef_adjustment ( @ mut self ,
735
+ fn write_autoderef_adjustment ( & self ,
735
736
node_id : ast:: node_id ,
736
737
derefs : uint ) {
737
738
if derefs == 0 { return ; }
@@ -743,33 +744,33 @@ pub impl FnCtxt {
743
744
) ;
744
745
}
745
746
746
- fn write_adjustment ( @ mut self ,
747
+ fn write_adjustment ( & self ,
747
748
node_id : ast:: node_id ,
748
749
adj : @ty:: AutoAdjustment ) {
749
750
debug ! ( "write_adjustment(node_id=%?, adj=%?)" , node_id, adj) ;
750
751
self . inh . adjustments . insert ( node_id, adj) ;
751
752
}
752
753
753
- fn write_nil ( @ mut self , node_id : ast:: node_id ) {
754
+ fn write_nil ( & self , node_id : ast:: node_id ) {
754
755
self . write_ty ( node_id, ty:: mk_nil ( self . tcx ( ) ) ) ;
755
756
}
756
- fn write_bot ( @ mut self , node_id : ast:: node_id ) {
757
+ fn write_bot ( & self , node_id : ast:: node_id ) {
757
758
self . write_ty ( node_id, ty:: mk_bot ( self . tcx ( ) ) ) ;
758
759
}
759
760
760
- fn to_ty ( @ mut self , ast_t : @ast:: Ty ) -> ty:: t {
761
+ fn to_ty ( & self , ast_t : @ast:: Ty ) -> ty:: t {
761
762
ast_ty_to_ty ( self , self , ast_t)
762
763
}
763
764
764
- fn expr_to_str ( @ mut self , expr : @ast:: expr ) -> ~str {
765
+ fn expr_to_str ( & self , expr : @ast:: expr ) -> ~str {
765
766
expr_repr ( self . tcx ( ) , expr)
766
767
}
767
768
768
- fn pat_to_str ( @ mut self , pat : @ast:: pat ) -> ~str {
769
+ fn pat_to_str ( & self , pat : @ast:: pat ) -> ~str {
769
770
pat_repr ( self . tcx ( ) , pat)
770
771
}
771
772
772
- fn expr_ty ( @ mut self , ex : @ast:: expr ) -> ty:: t {
773
+ fn expr_ty ( & self , ex : @ast:: expr ) -> ty:: t {
773
774
match self . inh . node_types . find ( & ex. id ) {
774
775
Some ( t) => t,
775
776
None => {
@@ -779,7 +780,7 @@ pub impl FnCtxt {
779
780
}
780
781
}
781
782
}
782
- fn node_ty ( @ mut self , id : ast:: node_id ) -> ty:: t {
783
+ fn node_ty ( & self , id : ast:: node_id ) -> ty:: t {
783
784
match self . inh . node_types . find ( & id) {
784
785
Some ( t) => t,
785
786
None => {
@@ -792,7 +793,7 @@ pub impl FnCtxt {
792
793
}
793
794
}
794
795
}
795
- fn node_ty_substs ( @ mut self , id : ast:: node_id ) -> ty:: substs {
796
+ fn node_ty_substs ( & self , id : ast:: node_id ) -> ty:: substs {
796
797
match self . inh . node_type_substs . find ( & id) {
797
798
Some ( ref ts) => ( /*bad*/ copy * ts) ,
798
799
None => {
@@ -805,12 +806,12 @@ pub impl FnCtxt {
805
806
}
806
807
}
807
808
}
808
- fn opt_node_ty_substs ( @ mut self , id : ast:: node_id ) -> Option < ty:: substs > {
809
+ fn opt_node_ty_substs ( & self , id : ast:: node_id ) -> Option < ty:: substs > {
809
810
self . inh . node_type_substs . find ( & id)
810
811
}
811
812
812
813
813
- fn mk_subty ( @ mut self ,
814
+ fn mk_subty ( & self ,
814
815
a_is_expected : bool ,
815
816
span : span ,
816
817
sub : ty:: t ,
@@ -819,14 +820,14 @@ pub impl FnCtxt {
819
820
infer:: mk_subty ( self . infcx ( ) , a_is_expected, span, sub, sup)
820
821
}
821
822
822
- fn can_mk_subty ( @ mut self ,
823
+ fn can_mk_subty ( & self ,
823
824
sub : ty:: t ,
824
825
sup : ty:: t )
825
826
-> Result < ( ) , ty:: type_err > {
826
827
infer:: can_mk_subty ( self . infcx ( ) , sub, sup)
827
828
}
828
829
829
- fn mk_assignty ( @ mut self , expr : @ast:: expr , sub : ty:: t , sup : ty:: t )
830
+ fn mk_assignty ( & self , expr : @ast:: expr , sub : ty:: t , sup : ty:: t )
830
831
-> Result < ( ) , ty:: type_err > {
831
832
match infer:: mk_coercety ( self . infcx ( ) , false , expr. span , sub, sup) {
832
833
Ok ( None ) => result:: Ok ( ( ) ) ,
@@ -838,14 +839,14 @@ pub impl FnCtxt {
838
839
}
839
840
}
840
841
841
- fn can_mk_assignty ( @ mut self ,
842
+ fn can_mk_assignty ( & self ,
842
843
sub : ty:: t ,
843
844
sup : ty:: t )
844
845
-> Result < ( ) , ty:: type_err > {
845
846
infer:: can_mk_coercety ( self . infcx ( ) , sub, sup)
846
847
}
847
848
848
- fn mk_eqty ( @ mut self ,
849
+ fn mk_eqty ( & self ,
849
850
a_is_expected : bool ,
850
851
span : span ,
851
852
sub : ty:: t ,
@@ -854,7 +855,7 @@ pub impl FnCtxt {
854
855
infer:: mk_eqty ( self . infcx ( ) , a_is_expected, span, sub, sup)
855
856
}
856
857
857
- fn mk_subr ( @ mut self ,
858
+ fn mk_subr ( & self ,
858
859
a_is_expected : bool ,
859
860
span : span ,
860
861
sub : ty:: Region ,
@@ -863,7 +864,7 @@ pub impl FnCtxt {
863
864
infer:: mk_subr ( self . infcx ( ) , a_is_expected, span, sub, sup)
864
865
}
865
866
866
- fn require_unsafe ( @ mut self , sp : span , op : ~str ) {
867
+ fn require_unsafe ( & self , sp : span , op : ~str ) {
867
868
match self . purity {
868
869
ast:: unsafe_fn => { /*ok*/ }
869
870
_ => {
@@ -873,15 +874,16 @@ pub impl FnCtxt {
873
874
}
874
875
}
875
876
}
876
- fn with_region_lb < R > ( @mut self , lb : ast:: node_id , f : fn ( ) -> R ) -> R {
877
+
878
+ fn with_region_lb < R > ( @mut self , lb : ast:: node_id , f : & fn ( ) -> R ) -> R {
877
879
let old_region_lb = self . region_lb ;
878
880
self . region_lb = lb;
879
881
let v = f ( ) ;
880
882
self . region_lb = old_region_lb;
881
883
v
882
884
}
883
885
884
- fn region_var_if_parameterized ( @ mut self ,
886
+ fn region_var_if_parameterized ( & self ,
885
887
rp : Option < ty:: region_variance > ,
886
888
span : span ,
887
889
lower_bound : ty:: Region )
@@ -890,15 +892,15 @@ pub impl FnCtxt {
890
892
|_rp| self . infcx ( ) . next_region_var_with_lb ( span, lower_bound) )
891
893
}
892
894
893
- fn type_error_message ( @ mut self ,
895
+ fn type_error_message ( & self ,
894
896
sp : span ,
895
897
mk_msg : & fn ( ~str ) -> ~str ,
896
898
actual_ty : ty:: t ,
897
899
err : Option < & ty:: type_err > ) {
898
900
self . infcx ( ) . type_error_message ( sp, mk_msg, actual_ty, err) ;
899
901
}
900
902
901
- fn report_mismatched_return_types ( @ mut self ,
903
+ fn report_mismatched_return_types ( & self ,
902
904
sp : span ,
903
905
e : ty:: t ,
904
906
a : ty:: t ,
@@ -919,12 +921,12 @@ pub impl FnCtxt {
919
921
}
920
922
}
921
923
922
- fn report_mismatched_types ( @ mut self ,
924
+ fn report_mismatched_types ( & self ,
923
925
sp : span ,
924
926
e : ty:: t ,
925
927
a : ty:: t ,
926
928
err : & ty:: type_err ) {
927
- self . infcx ( ) . report_mismatched_types ( sp, e, a, err)
929
+ self . infcx ( ) . report_mismatched_types ( sp, e, a, err)
928
930
}
929
931
}
930
932
0 commit comments