4848//! result of `*x'`, effectively, where `x'` is a `Categorization::Upvar` reference
4949//! tied to `x`. The type of `x'` will be a borrowed pointer.
5050
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+
6060use syntax_pos:: Span ;
6161
6262use rustc_data_structures:: fx:: FxIndexMap ;
@@ -105,7 +105,7 @@ impl<'tcx> Place<'tcx> {
105105 /// The types are in the reverse order that they are applied. So if
106106 /// `x: &*const u32` and the `Place` is `**x`, then the types returned are
107107 ///`*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 > > + ' _ {
109109 self . projections . iter ( ) . rev ( ) . filter_map ( |proj| if let Projection :: Deref ( deref_ty) = * proj {
110110 Some ( deref_ty)
111111 } else {
@@ -114,7 +114,7 @@ impl<'tcx> Place<'tcx> {
114114 }
115115}
116116
117- pub trait HirNode {
117+ crate trait HirNode {
118118 fn hir_id ( & self ) -> hir:: HirId ;
119119 fn span ( & self ) -> Span ;
120120}
@@ -130,19 +130,19 @@ impl HirNode for hir::Pat {
130130}
131131
132132#[ 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 > ,
135135 infcx : & ' a InferCtxt < ' a , ' tcx > ,
136136 param_env : ty:: ParamEnv < ' tcx > ,
137137 body_owner : DefId ,
138138 upvars : Option < & ' tcx FxIndexMap < hir:: HirId , hir:: Upvar > > ,
139139}
140140
141- pub type McResult < T > = Result < T , ( ) > ;
141+ crate type McResult < T > = Result < T , ( ) > ;
142142
143143impl < ' a , ' tcx > MemCategorizationContext < ' a , ' tcx > {
144144 /// Creates a `MemCategorizationContext`.
145- pub fn new (
145+ crate fn new (
146146 infcx : & ' a InferCtxt < ' a , ' tcx > ,
147147 param_env : ty:: ParamEnv < ' tcx > ,
148148 body_owner : DefId ,
@@ -276,7 +276,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
276276 Ok ( ret_ty)
277277 }
278278
279- pub fn cat_expr ( & self , expr : & hir:: Expr ) -> McResult < Place < ' tcx > > {
279+ crate fn cat_expr ( & self , expr : & hir:: Expr ) -> McResult < Place < ' tcx > > {
280280 // This recursion helper avoids going through *too many*
281281 // adjustments, since *only* non-overloaded deref recurses.
282282 fn helper < ' a , ' tcx > (
@@ -295,7 +295,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
295295 helper ( self , expr, self . tables . expr_adjustments ( expr) )
296296 }
297297
298- pub fn cat_expr_adjusted ( & self , expr : & hir:: Expr ,
298+ crate fn cat_expr_adjusted ( & self , expr : & hir:: Expr ,
299299 previous : Place < ' tcx > ,
300300 adjustment : & adjustment:: Adjustment < ' tcx > )
301301 -> McResult < Place < ' tcx > > {
@@ -334,7 +334,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
334334 }
335335 }
336336
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 > > {
338338 debug ! ( "cat_expr: id={} expr={:?}" , expr. hir_id, expr) ;
339339
340340 let expr_ty = self . expr_ty ( expr) ?;
@@ -475,7 +475,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
475475 Ok ( ret)
476476 }
477477
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 > {
479479 debug ! ( "cat_rvalue hir_id={:?}, expr_ty={:?}, span={:?}" , hir_id, expr_ty, span) ;
480480 let ret = Place {
481481 hir_id,
@@ -562,7 +562,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
562562 Ok ( ret)
563563 }
564564
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 < ( ) >
566566 where F : FnMut ( & Place < ' tcx > , & hir:: Pat ) ,
567567 {
568568 self . cat_pattern_ ( place, pat, & mut op)
0 commit comments