@@ -22,7 +22,7 @@ use middle::def::Def;
2222use middle:: subst:: Subst ;
2323use middle:: def_id:: DefId ;
2424use middle:: pat_util:: def_to_path;
25- use middle:: ty:: { self , Ty } ;
25+ use middle:: ty:: { self , Ty , TyCtxt } ;
2626use middle:: astconv_util:: ast_ty_to_prim_ty;
2727use util:: num:: ToPrimitive ;
2828use util:: nodemap:: NodeMap ;
@@ -46,7 +46,7 @@ use std::mem::transmute;
4646use std:: { i8, i16, i32, i64, u8, u16, u32, u64} ;
4747use std:: rc:: Rc ;
4848
49- fn lookup_variant_by_id < ' a > ( tcx : & ' a ty :: ctxt ,
49+ fn lookup_variant_by_id < ' a > ( tcx : & ' a TyCtxt ,
5050 enum_def : DefId ,
5151 variant_def : DefId )
5252 -> Option < & ' a Expr > {
@@ -84,7 +84,7 @@ fn lookup_variant_by_id<'a>(tcx: &'a ty::ctxt,
8484/// `maybe_ref_id` and `param_substs` are optional and are used for
8585/// finding substitutions in associated constants. This generally
8686/// happens in late/trans const evaluation.
87- pub fn lookup_const_by_id < ' a , ' tcx : ' a > ( tcx : & ' a ty :: ctxt < ' tcx > ,
87+ pub fn lookup_const_by_id < ' a , ' tcx : ' a > ( tcx : & ' a TyCtxt < ' tcx > ,
8888 def_id : DefId ,
8989 maybe_ref_id : Option < ast:: NodeId > ,
9090 param_substs : Option < & ' tcx subst:: Substs < ' tcx > > )
@@ -189,7 +189,7 @@ pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
189189 }
190190}
191191
192- fn inline_const_fn_from_external_crate ( tcx : & ty :: ctxt , def_id : DefId )
192+ fn inline_const_fn_from_external_crate ( tcx : & TyCtxt , def_id : DefId )
193193 -> Option < ast:: NodeId > {
194194 match tcx. extern_const_fns . borrow ( ) . get ( & def_id) {
195195 Some ( & ast:: DUMMY_NODE_ID ) => return None ,
@@ -212,7 +212,7 @@ fn inline_const_fn_from_external_crate(tcx: &ty::ctxt, def_id: DefId)
212212 fn_id
213213}
214214
215- pub fn lookup_const_fn_by_id < ' tcx > ( tcx : & ty :: ctxt < ' tcx > , def_id : DefId )
215+ pub fn lookup_const_fn_by_id < ' tcx > ( tcx : & TyCtxt < ' tcx > , def_id : DefId )
216216 -> Option < FnLikeNode < ' tcx > >
217217{
218218 let fn_id = if let Some ( node_id) = tcx. map . as_local_node_id ( def_id) {
@@ -322,7 +322,7 @@ impl ConstVal {
322322 }
323323}
324324
325- pub fn const_expr_to_pat ( tcx : & ty :: ctxt , expr : & Expr , span : Span ) -> P < hir:: Pat > {
325+ pub fn const_expr_to_pat ( tcx : & TyCtxt , expr : & Expr , span : Span ) -> P < hir:: Pat > {
326326 let pat = match expr. node {
327327 hir:: ExprTup ( ref exprs) =>
328328 PatKind :: Tup ( exprs. iter ( ) . map ( |expr| const_expr_to_pat ( tcx, & expr, span) ) . collect ( ) ) ,
@@ -382,7 +382,7 @@ pub fn const_expr_to_pat(tcx: &ty::ctxt, expr: &Expr, span: Span) -> P<hir::Pat>
382382 P ( hir:: Pat { id : expr. id , node : pat, span : span } )
383383}
384384
385- pub fn eval_const_expr ( tcx : & ty :: ctxt , e : & Expr ) -> ConstVal {
385+ pub fn eval_const_expr ( tcx : & TyCtxt , e : & Expr ) -> ConstVal {
386386 match eval_const_expr_partial ( tcx, e, ExprTypeChecked , None ) {
387387 Ok ( r) => r,
388388 Err ( s) => tcx. sess . span_fatal ( s. span , & s. description ( ) )
@@ -542,7 +542,7 @@ pub enum IntTy { I8, I16, I32, I64 }
542542pub enum UintTy { U8 , U16 , U32 , U64 }
543543
544544impl IntTy {
545- pub fn from ( tcx : & ty :: ctxt , t : ast:: IntTy ) -> IntTy {
545+ pub fn from ( tcx : & TyCtxt , t : ast:: IntTy ) -> IntTy {
546546 let t = if let ast:: IntTy :: Is = t {
547547 tcx. sess . target . int_type
548548 } else {
@@ -559,7 +559,7 @@ impl IntTy {
559559}
560560
561561impl UintTy {
562- pub fn from ( tcx : & ty :: ctxt , t : ast:: UintTy ) -> UintTy {
562+ pub fn from ( tcx : & TyCtxt , t : ast:: UintTy ) -> UintTy {
563563 let t = if let ast:: UintTy :: Us = t {
564564 tcx. sess . target . uint_type
565565 } else {
@@ -810,7 +810,7 @@ pub_fn_checked_op!{ const_uint_checked_shr_via_int(a: u64, b: i64,.. UintTy) {
810810/// guaranteed to be evaluatable. `ty_hint` is usually ExprTypeChecked,
811811/// but a few places need to evaluate constants during type-checking, like
812812/// computing the length of an array. (See also the FIXME above EvalHint.)
813- pub fn eval_const_expr_partial < ' tcx > ( tcx : & ty :: ctxt < ' tcx > ,
813+ pub fn eval_const_expr_partial < ' tcx > ( tcx : & TyCtxt < ' tcx > ,
814814 e : & Expr ,
815815 ty_hint : EvalHint < ' tcx > ,
816816 fn_args : FnArgMap ) -> EvalResult {
@@ -1222,7 +1222,7 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
12221222 Ok ( result)
12231223}
12241224
1225- fn impl_or_trait_container ( tcx : & ty :: ctxt , def_id : DefId ) -> ty:: ImplOrTraitItemContainer {
1225+ fn impl_or_trait_container ( tcx : & TyCtxt , def_id : DefId ) -> ty:: ImplOrTraitItemContainer {
12261226 // This is intended to be equivalent to tcx.impl_or_trait_item(def_id).container()
12271227 // for local def_id, but it can be called before tcx.impl_or_trait_items is complete.
12281228 if let Some ( node_id) = tcx. map . as_local_node_id ( def_id) {
@@ -1239,7 +1239,7 @@ fn impl_or_trait_container(tcx: &ty::ctxt, def_id: DefId) -> ty::ImplOrTraitItem
12391239 panic ! ( "{:?} is not local" , def_id) ;
12401240}
12411241
1242- fn resolve_trait_associated_const < ' a , ' tcx : ' a > ( tcx : & ' a ty :: ctxt < ' tcx > ,
1242+ fn resolve_trait_associated_const < ' a , ' tcx : ' a > ( tcx : & ' a TyCtxt < ' tcx > ,
12431243 ti : & ' tcx hir:: TraitItem ,
12441244 trait_id : DefId ,
12451245 rcvr_substs : subst:: Substs < ' tcx > )
@@ -1289,7 +1289,7 @@ fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
12891289 }
12901290}
12911291
1292- fn cast_const < ' tcx > ( tcx : & ty :: ctxt < ' tcx > , val : ConstVal , ty : Ty ) -> CastResult {
1292+ fn cast_const < ' tcx > ( tcx : & TyCtxt < ' tcx > , val : ConstVal , ty : Ty ) -> CastResult {
12931293 macro_rules! convert_val {
12941294 ( $intermediate_ty: ty, $const_type: ident, $target_ty: ty) => {
12951295 match val {
@@ -1385,7 +1385,7 @@ pub fn compare_const_vals(a: &ConstVal, b: &ConstVal) -> Option<Ordering> {
13851385 } )
13861386}
13871387
1388- pub fn compare_lit_exprs < ' tcx > ( tcx : & ty :: ctxt < ' tcx > ,
1388+ pub fn compare_lit_exprs < ' tcx > ( tcx : & TyCtxt < ' tcx > ,
13891389 a : & Expr ,
13901390 b : & Expr ) -> Option < Ordering > {
13911391 let a = match eval_const_expr_partial ( tcx, a, ExprTypeChecked , None ) {
0 commit comments