@@ -94,7 +94,7 @@ pub enum Categorization<'tcx> {
9494 StaticItem ,
9595 Upvar ( Upvar ) , // upvar referenced by closure env
9696 Local ( ast:: NodeId ) , // local variable
97- Deref ( cmt < ' tcx > , usize , PointerKind < ' tcx > ) , // deref of a ptr
97+ Deref ( cmt < ' tcx > , PointerKind < ' tcx > ) , // deref of a ptr
9898 Interior ( cmt < ' tcx > , InteriorKind ) , // something interior: field, tuple, etc
9999 Downcast ( cmt < ' tcx > , DefId ) , // selects a particular enum variant (*1)
100100
@@ -229,8 +229,8 @@ impl<'tcx> cmt_<'tcx> {
229229
230230 pub fn immutability_blame ( & self ) -> Option < ImmutabilityBlame < ' tcx > > {
231231 match self . cat {
232- Categorization :: Deref ( ref base_cmt, _ , BorrowedPtr ( ty:: ImmBorrow , _) ) |
233- Categorization :: Deref ( ref base_cmt, _ , Implicit ( ty:: ImmBorrow , _) ) => {
232+ Categorization :: Deref ( ref base_cmt, BorrowedPtr ( ty:: ImmBorrow , _) ) |
233+ Categorization :: Deref ( ref base_cmt, Implicit ( ty:: ImmBorrow , _) ) => {
234234 // try to figure out where the immutable reference came from
235235 match base_cmt. cat {
236236 Categorization :: Local ( node_id) =>
@@ -255,13 +255,13 @@ impl<'tcx> cmt_<'tcx> {
255255 }
256256 Categorization :: Rvalue ( ..) |
257257 Categorization :: Upvar ( ..) |
258- Categorization :: Deref ( .. , UnsafePtr ( ..) ) => {
258+ Categorization :: Deref ( _ , UnsafePtr ( ..) ) => {
259259 // This should not be reachable up to inference limitations.
260260 None
261261 }
262262 Categorization :: Interior ( ref base_cmt, _) |
263263 Categorization :: Downcast ( ref base_cmt, _) |
264- Categorization :: Deref ( ref base_cmt, _, _ ) => {
264+ Categorization :: Deref ( ref base_cmt, _) => {
265265 base_cmt. immutability_blame ( )
266266 }
267267 Categorization :: StaticItem => {
@@ -569,7 +569,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
569569 // is an rvalue. That is what we will be
570570 // dereferencing.
571571 let base_cmt = self . cat_rvalue_node ( expr. id ( ) , expr. span ( ) , ret_ty) ;
572- Ok ( self . cat_deref_common ( expr, base_cmt, 1 , elem_ty, true ) )
572+ Ok ( self . cat_deref_common ( expr, base_cmt, elem_ty, true ) )
573573 }
574574 None => {
575575 self . cat_index ( expr, self . cat_expr ( & base) ?, InteriorOffsetKind :: Index )
@@ -763,7 +763,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
763763 cmt_ {
764764 id : id,
765765 span : span,
766- cat : Categorization :: Deref ( Rc :: new ( cmt_result) , 0 , ptr) ,
766+ cat : Categorization :: Deref ( Rc :: new ( cmt_result) , ptr) ,
767767 mutbl : MutabilityCategory :: from_borrow_kind ( upvar_borrow. kind ) ,
768768 ty : var_ty,
769769 note : NoteUpvarRef ( upvar_id)
@@ -823,7 +823,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
823823 let ret = cmt_ {
824824 id : id,
825825 span : span,
826- cat : Categorization :: Deref ( Rc :: new ( cmt_result) , 0 , env_ptr) ,
826+ cat : Categorization :: Deref ( Rc :: new ( cmt_result) , env_ptr) ,
827827 mutbl : deref_mutbl,
828828 ty : var_ty,
829829 note : NoteClosureEnv ( upvar_id)
@@ -957,7 +957,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
957957 let base_cmt_ty = base_cmt. ty ;
958958 match base_cmt_ty. builtin_deref ( true , ty:: NoPreference ) {
959959 Some ( mt) => {
960- let ret = self . cat_deref_common ( node, base_cmt, deref_cnt , mt. ty , false ) ;
960+ let ret = self . cat_deref_common ( node, base_cmt, mt. ty , false ) ;
961961 debug ! ( "cat_deref ret {:?}" , ret) ;
962962 Ok ( ret)
963963 }
@@ -972,7 +972,6 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
972972 fn cat_deref_common < N : ast_node > ( & self ,
973973 node : & N ,
974974 base_cmt : cmt < ' tcx > ,
975- deref_cnt : usize ,
976975 deref_ty : Ty < ' tcx > ,
977976 implicit : bool )
978977 -> cmt < ' tcx >
@@ -991,7 +990,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
991990 span : node. span ( ) ,
992991 // For unique ptrs, we inherit mutability from the owning reference.
993992 mutbl : MutabilityCategory :: from_pointer_kind ( base_cmt. mutbl , ptr) ,
994- cat : Categorization :: Deref ( base_cmt, deref_cnt , ptr) ,
993+ cat : Categorization :: Deref ( base_cmt, ptr) ,
995994 ty : deref_ty,
996995 note : NoteNone
997996 } ) ;
@@ -1300,15 +1299,15 @@ impl<'tcx> cmt_<'tcx> {
13001299 Categorization :: Rvalue ( ..) |
13011300 Categorization :: StaticItem |
13021301 Categorization :: Local ( ..) |
1303- Categorization :: Deref ( .. , UnsafePtr ( ..) ) |
1304- Categorization :: Deref ( .. , BorrowedPtr ( ..) ) |
1305- Categorization :: Deref ( .. , Implicit ( ..) ) |
1302+ Categorization :: Deref ( _ , UnsafePtr ( ..) ) |
1303+ Categorization :: Deref ( _ , BorrowedPtr ( ..) ) |
1304+ Categorization :: Deref ( _ , Implicit ( ..) ) |
13061305 Categorization :: Upvar ( ..) => {
13071306 Rc :: new ( ( * self ) . clone ( ) )
13081307 }
13091308 Categorization :: Downcast ( ref b, _) |
13101309 Categorization :: Interior ( ref b, _) |
1311- Categorization :: Deref ( ref b, _ , Unique ) => {
1310+ Categorization :: Deref ( ref b, Unique ) => {
13121311 b. guarantor ( )
13131312 }
13141313 }
@@ -1321,11 +1320,11 @@ impl<'tcx> cmt_<'tcx> {
13211320 // aliased and eventually recused.
13221321
13231322 match self . cat {
1324- Categorization :: Deref ( ref b, _ , BorrowedPtr ( ty:: MutBorrow , _) ) |
1325- Categorization :: Deref ( ref b, _ , Implicit ( ty:: MutBorrow , _) ) |
1326- Categorization :: Deref ( ref b, _ , BorrowedPtr ( ty:: UniqueImmBorrow , _) ) |
1327- Categorization :: Deref ( ref b, _ , Implicit ( ty:: UniqueImmBorrow , _) ) |
1328- Categorization :: Deref ( ref b, _ , Unique ) |
1323+ Categorization :: Deref ( ref b, BorrowedPtr ( ty:: MutBorrow , _) ) |
1324+ Categorization :: Deref ( ref b, Implicit ( ty:: MutBorrow , _) ) |
1325+ Categorization :: Deref ( ref b, BorrowedPtr ( ty:: UniqueImmBorrow , _) ) |
1326+ Categorization :: Deref ( ref b, Implicit ( ty:: UniqueImmBorrow , _) ) |
1327+ Categorization :: Deref ( ref b, Unique ) |
13291328 Categorization :: Downcast ( ref b, _) |
13301329 Categorization :: Interior ( ref b, _) => {
13311330 // Aliasability depends on base cmt
@@ -1335,7 +1334,7 @@ impl<'tcx> cmt_<'tcx> {
13351334 Categorization :: Rvalue ( ..) |
13361335 Categorization :: Local ( ..) |
13371336 Categorization :: Upvar ( ..) |
1338- Categorization :: Deref ( .. , UnsafePtr ( ..) ) => { // yes, it's aliasable, but...
1337+ Categorization :: Deref ( _ , UnsafePtr ( ..) ) => { // yes, it's aliasable, but...
13391338 NonAliasable
13401339 }
13411340
@@ -1347,8 +1346,8 @@ impl<'tcx> cmt_<'tcx> {
13471346 }
13481347 }
13491348
1350- Categorization :: Deref ( _, _ , BorrowedPtr ( ty:: ImmBorrow , _) ) |
1351- Categorization :: Deref ( _, _ , Implicit ( ty:: ImmBorrow , _) ) => {
1349+ Categorization :: Deref ( _, BorrowedPtr ( ty:: ImmBorrow , _) ) |
1350+ Categorization :: Deref ( _, Implicit ( ty:: ImmBorrow , _) ) => {
13521351 FreelyAliasable ( AliasableBorrowed )
13531352 }
13541353 }
@@ -1360,9 +1359,9 @@ impl<'tcx> cmt_<'tcx> {
13601359 match self . note {
13611360 NoteClosureEnv ( ..) | NoteUpvarRef ( ..) => {
13621361 Some ( match self . cat {
1363- Categorization :: Deref ( ref inner, .. ) => {
1362+ Categorization :: Deref ( ref inner, _ ) => {
13641363 match inner. cat {
1365- Categorization :: Deref ( ref inner, .. ) => inner. clone ( ) ,
1364+ Categorization :: Deref ( ref inner, _ ) => inner. clone ( ) ,
13661365 Categorization :: Upvar ( ..) => inner. clone ( ) ,
13671366 _ => bug ! ( )
13681367 }
@@ -1390,7 +1389,7 @@ impl<'tcx> cmt_<'tcx> {
13901389 "local variable" . to_string ( )
13911390 }
13921391 }
1393- Categorization :: Deref ( .. , pk) => {
1392+ Categorization :: Deref ( _ , pk) => {
13941393 let upvar = self . upvar ( ) ;
13951394 match upvar. as_ref ( ) . map ( |i| & i. cat ) {
13961395 Some ( & Categorization :: Upvar ( ref var) ) => {
@@ -1467,8 +1466,8 @@ impl<'tcx> fmt::Debug for Categorization<'tcx> {
14671466 Categorization :: Upvar ( upvar) => {
14681467 write ! ( f, "upvar({:?})" , upvar)
14691468 }
1470- Categorization :: Deref ( ref cmt, derefs , ptr) => {
1471- write ! ( f, "{:?}-{:?}{} ->" , cmt. cat, ptr, derefs )
1469+ Categorization :: Deref ( ref cmt, ptr) => {
1470+ write ! ( f, "{:?}-{:?}->" , cmt. cat, ptr)
14721471 }
14731472 Categorization :: Interior ( ref cmt, interior) => {
14741473 write ! ( f, "{:?}.{:?}" , cmt. cat, interior)
0 commit comments