1010
1111//! Computes the restrictions that result from a borrow.
1212
13- pub use self :: RestrictionResult :: * ;
14-
1513use borrowck:: * ;
1614use rustc:: middle:: expr_use_visitor as euv;
1715use rustc:: middle:: mem_categorization as mc;
@@ -69,19 +67,19 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> {
6967 // are inherently non-aliasable, they can only be
7068 // accessed later through the borrow itself and hence
7169 // must inherently comply with its terms.
72- Safe
70+ RestrictionResult :: Safe
7371 }
7472
7573 Categorization :: Local ( local_id) => {
7674 // R-Variable, locally declared
7775 let lp = new_lp ( LpVar ( local_id) ) ;
78- SafeIf ( lp. clone ( ) , vec ! [ lp] )
76+ RestrictionResult :: SafeIf ( lp. clone ( ) , vec ! [ lp] )
7977 }
8078
8179 Categorization :: Upvar ( mc:: Upvar { id, .. } ) => {
8280 // R-Variable, captured into closure
8381 let lp = new_lp ( LpUpvar ( id) ) ;
84- SafeIf ( lp. clone ( ) , vec ! [ lp] )
82+ RestrictionResult :: SafeIf ( lp. clone ( ) , vec ! [ lp] )
8583 }
8684
8785 Categorization :: Downcast ( cmt_base, _) => {
@@ -106,7 +104,7 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> {
106104 }
107105
108106 Categorization :: StaticItem => {
109- Safe
107+ RestrictionResult :: Safe
110108 }
111109
112110 Categorization :: Deref ( cmt_base, _, pk) => {
@@ -133,11 +131,11 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> {
133131 cmt : cmt_base,
134132 code : err_borrowed_pointer_too_short (
135133 self . loan_region , lt) } ) ;
136- return Safe ;
134+ return RestrictionResult :: Safe ;
137135 }
138136
139137 match bk {
140- ty:: ImmBorrow => Safe ,
138+ ty:: ImmBorrow => RestrictionResult :: Safe ,
141139 ty:: MutBorrow | ty:: UniqueImmBorrow => {
142140 // R-Deref-Mut-Borrowed
143141 //
@@ -150,7 +148,7 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> {
150148 }
151149 }
152150 // Borrowck is not relevant for raw pointers
153- mc:: UnsafePtr ( ..) => Safe
151+ mc:: UnsafePtr ( ..) => RestrictionResult :: Safe
154152 }
155153 }
156154 }
@@ -161,12 +159,12 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> {
161159 cmt : & mc:: cmt < ' tcx > ,
162160 elem : LoanPathElem ) -> RestrictionResult < ' tcx > {
163161 match result {
164- Safe => Safe ,
165- SafeIf ( base_lp, mut base_vec) => {
162+ RestrictionResult :: Safe => RestrictionResult :: Safe ,
163+ RestrictionResult :: SafeIf ( base_lp, mut base_vec) => {
166164 let v = LpExtend ( base_lp, cmt. mutbl , elem) ;
167165 let lp = Rc :: new ( LoanPath :: new ( v, cmt. ty ) ) ;
168166 base_vec. push ( lp. clone ( ) ) ;
169- SafeIf ( lp, base_vec)
167+ RestrictionResult :: SafeIf ( lp, base_vec)
170168 }
171169 }
172170 }
0 commit comments