48
48
//! result of `*x'`, effectively, where `x'` is a `Categorization::Upvar` reference
49
49
//! tied to `x`. The type of `x'` will be a borrowed pointer.
50
50
51
- use crate :: hir:: def_id :: DefId ;
52
- use crate :: infer :: InferCtxt ;
53
- use crate :: hir:: def :: { Res , DefKind } ;
54
- use crate :: ty :: adjustment ;
55
- use crate :: ty :: { self , Ty , TyCtxt } ;
56
- use crate :: ty:: fold :: TypeFoldable ;
57
-
58
- use crate :: hir :: PatKind ;
59
- use crate :: hir ;
51
+ use rustc :: hir;
52
+ use rustc :: hir :: PatKind ;
53
+ use rustc :: hir:: def_id :: DefId ;
54
+ use rustc :: hir :: def :: { Res , DefKind } ;
55
+ use rustc :: infer :: InferCtxt ;
56
+ use rustc :: ty:: adjustment ;
57
+ use rustc :: ty :: { self , Ty , TyCtxt } ;
58
+ use rustc :: ty :: fold :: TypeFoldable ;
59
+
60
60
use syntax_pos:: Span ;
61
61
62
62
use rustc_data_structures:: fx:: FxIndexMap ;
@@ -105,7 +105,7 @@ impl<'tcx> Place<'tcx> {
105
105
/// The types are in the reverse order that they are applied. So if
106
106
/// `x: &*const u32` and the `Place` is `**x`, then the types returned are
107
107
///`*const u32` then `&*const u32`.
108
- pub fn deref_tys ( & self ) -> impl Iterator < Item =Ty < ' tcx > > + ' _ {
108
+ crate fn deref_tys ( & self ) -> impl Iterator < Item =Ty < ' tcx > > + ' _ {
109
109
self . projections . iter ( ) . rev ( ) . filter_map ( |proj| if let Projection :: Deref ( deref_ty) = * proj {
110
110
Some ( deref_ty)
111
111
} else {
@@ -114,7 +114,7 @@ impl<'tcx> Place<'tcx> {
114
114
}
115
115
}
116
116
117
- pub trait HirNode {
117
+ crate trait HirNode {
118
118
fn hir_id ( & self ) -> hir:: HirId ;
119
119
fn span ( & self ) -> Span ;
120
120
}
@@ -130,19 +130,19 @@ impl HirNode for hir::Pat {
130
130
}
131
131
132
132
#[ derive( Clone ) ]
133
- pub struct MemCategorizationContext < ' a , ' tcx > {
134
- pub tables : & ' a ty:: TypeckTables < ' tcx > ,
133
+ crate struct MemCategorizationContext < ' a , ' tcx > {
134
+ crate tables : & ' a ty:: TypeckTables < ' tcx > ,
135
135
infcx : & ' a InferCtxt < ' a , ' tcx > ,
136
136
param_env : ty:: ParamEnv < ' tcx > ,
137
137
body_owner : DefId ,
138
138
upvars : Option < & ' tcx FxIndexMap < hir:: HirId , hir:: Upvar > > ,
139
139
}
140
140
141
- pub type McResult < T > = Result < T , ( ) > ;
141
+ crate type McResult < T > = Result < T , ( ) > ;
142
142
143
143
impl < ' a , ' tcx > MemCategorizationContext < ' a , ' tcx > {
144
144
/// Creates a `MemCategorizationContext`.
145
- pub fn new (
145
+ crate fn new (
146
146
infcx : & ' a InferCtxt < ' a , ' tcx > ,
147
147
param_env : ty:: ParamEnv < ' tcx > ,
148
148
body_owner : DefId ,
@@ -276,7 +276,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
276
276
Ok ( ret_ty)
277
277
}
278
278
279
- pub fn cat_expr ( & self , expr : & hir:: Expr ) -> McResult < Place < ' tcx > > {
279
+ crate fn cat_expr ( & self , expr : & hir:: Expr ) -> McResult < Place < ' tcx > > {
280
280
// This recursion helper avoids going through *too many*
281
281
// adjustments, since *only* non-overloaded deref recurses.
282
282
fn helper < ' a , ' tcx > (
@@ -295,7 +295,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
295
295
helper ( self , expr, self . tables . expr_adjustments ( expr) )
296
296
}
297
297
298
- pub fn cat_expr_adjusted ( & self , expr : & hir:: Expr ,
298
+ crate fn cat_expr_adjusted ( & self , expr : & hir:: Expr ,
299
299
previous : Place < ' tcx > ,
300
300
adjustment : & adjustment:: Adjustment < ' tcx > )
301
301
-> McResult < Place < ' tcx > > {
@@ -334,7 +334,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
334
334
}
335
335
}
336
336
337
- pub fn cat_expr_unadjusted ( & self , expr : & hir:: Expr ) -> McResult < Place < ' tcx > > {
337
+ crate fn cat_expr_unadjusted ( & self , expr : & hir:: Expr ) -> McResult < Place < ' tcx > > {
338
338
debug ! ( "cat_expr: id={} expr={:?}" , expr. hir_id, expr) ;
339
339
340
340
let expr_ty = self . expr_ty ( expr) ?;
@@ -475,7 +475,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
475
475
Ok ( ret)
476
476
}
477
477
478
- pub fn cat_rvalue ( & self , hir_id : hir:: HirId , span : Span , expr_ty : Ty < ' tcx > ) -> Place < ' tcx > {
478
+ crate fn cat_rvalue ( & self , hir_id : hir:: HirId , span : Span , expr_ty : Ty < ' tcx > ) -> Place < ' tcx > {
479
479
debug ! ( "cat_rvalue hir_id={:?}, expr_ty={:?}, span={:?}" , hir_id, expr_ty, span) ;
480
480
let ret = Place {
481
481
hir_id,
@@ -562,7 +562,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
562
562
Ok ( ret)
563
563
}
564
564
565
- pub fn cat_pattern < F > ( & self , place : Place < ' tcx > , pat : & hir:: Pat , mut op : F ) -> McResult < ( ) >
565
+ crate fn cat_pattern < F > ( & self , place : Place < ' tcx > , pat : & hir:: Pat , mut op : F ) -> McResult < ( ) >
566
566
where F : FnMut ( & Place < ' tcx > , & hir:: Pat ) ,
567
567
{
568
568
self . cat_pattern_ ( place, pat, & mut op)
0 commit comments