@@ -17,7 +17,8 @@ use self::EvalHint::*;
1717use front:: map as ast_map;
1818use front:: map:: blocks:: FnLikeNode ;
1919use middle:: cstore:: { self , CrateStore , InlinedItem } ;
20- use middle:: { def, infer, subst, traits} ;
20+ use middle:: { infer, subst, traits} ;
21+ use middle:: def:: Def ;
2122use middle:: subst:: Subst ;
2223use middle:: def_id:: DefId ;
2324use middle:: pat_util:: def_to_path;
@@ -331,9 +332,9 @@ pub fn const_expr_to_pat(tcx: &ty::ctxt, expr: &Expr, span: Span) -> P<hir::Pat>
331332 entry. insert ( def) ;
332333 }
333334 let path = match def. full_def ( ) {
334- def :: DefStruct ( def_id) => def_to_path ( tcx, def_id) ,
335- def :: DefVariant ( _, variant_did) => def_to_path ( tcx, variant_did) ,
336- def :: DefFn ( ..) => return P ( hir:: Pat {
335+ Def :: Struct ( def_id) => def_to_path ( tcx, def_id) ,
336+ Def :: Variant ( _, variant_did) => def_to_path ( tcx, variant_did) ,
337+ Def :: Fn ( ..) => return P ( hir:: Pat {
337338 id : expr. id ,
338339 node : hir:: PatLit ( P ( expr. clone ( ) ) ) ,
339340 span : span,
@@ -364,12 +365,12 @@ pub fn const_expr_to_pat(tcx: &ty::ctxt, expr: &Expr, span: Span) -> P<hir::Pat>
364365 hir:: ExprPath ( _, ref path) => {
365366 let opt_def = tcx. def_map . borrow ( ) . get ( & expr. id ) . map ( |d| d. full_def ( ) ) ;
366367 match opt_def {
367- Some ( def :: DefStruct ( ..) ) =>
368+ Some ( Def :: Struct ( ..) ) =>
368369 hir:: PatStruct ( path. clone ( ) , hir:: HirVec :: new ( ) , false ) ,
369- Some ( def :: DefVariant ( ..) ) =>
370+ Some ( Def :: Variant ( ..) ) =>
370371 hir:: PatEnum ( path. clone ( ) , None ) ,
371- Some ( def :: DefConst ( def_id) ) |
372- Some ( def :: DefAssociatedConst ( def_id) ) => {
372+ Some ( Def :: Const ( def_id) ) |
373+ Some ( Def :: AssociatedConst ( def_id) ) => {
373374 let expr = lookup_const_by_id ( tcx, def_id, Some ( expr. id ) , None ) . unwrap ( ) ;
374375 return const_expr_to_pat ( tcx, expr, span) ;
375376 } ,
@@ -1002,7 +1003,7 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
10021003 None
10031004 } ;
10041005 let ( const_expr, const_ty) = match opt_def {
1005- Some ( def :: DefConst ( def_id) ) => {
1006+ Some ( Def :: Const ( def_id) ) => {
10061007 if let Some ( node_id) = tcx. map . as_local_node_id ( def_id) {
10071008 match tcx. map . find ( node_id) {
10081009 Some ( ast_map:: NodeItem ( it) ) => match it. node {
@@ -1017,7 +1018,7 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
10171018 ( lookup_const_by_id ( tcx, def_id, Some ( e. id ) , None ) , None )
10181019 }
10191020 }
1020- Some ( def :: DefAssociatedConst ( def_id) ) => {
1021+ Some ( Def :: AssociatedConst ( def_id) ) => {
10211022 if let Some ( node_id) = tcx. map . as_local_node_id ( def_id) {
10221023 match tcx. impl_or_trait_item ( def_id) . container ( ) {
10231024 ty:: TraitContainer ( trait_id) => match tcx. map . find ( node_id) {
@@ -1052,21 +1053,21 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
10521053 ( lookup_const_by_id ( tcx, def_id, Some ( e. id ) , None ) , None )
10531054 }
10541055 }
1055- Some ( def :: DefVariant ( enum_def, variant_def) ) => {
1056+ Some ( Def :: Variant ( enum_def, variant_def) ) => {
10561057 ( lookup_variant_by_id ( tcx, enum_def, variant_def) , None )
10571058 }
1058- Some ( def :: DefStruct ( ..) ) => {
1059+ Some ( Def :: Struct ( ..) ) => {
10591060 return Ok ( ConstVal :: Struct ( e. id ) )
10601061 }
1061- Some ( def :: DefLocal ( _, id) ) => {
1062- debug ! ( "DefLocal ({:?}): {:?}" , id, fn_args) ;
1062+ Some ( Def :: Local ( _, id) ) => {
1063+ debug ! ( "Def::Local ({:?}): {:?}" , id, fn_args) ;
10631064 if let Some ( val) = fn_args. and_then ( |args| args. get ( & id) ) {
10641065 return Ok ( val. clone ( ) ) ;
10651066 } else {
10661067 ( None , None )
10671068 }
10681069 } ,
1069- Some ( def :: DefMethod ( id) ) | Some ( def :: DefFn ( id) ) => return Ok ( Function ( id) ) ,
1070+ Some ( Def :: Method ( id) ) | Some ( Def :: Fn ( id) ) => return Ok ( Function ( id) ) ,
10701071 _ => ( None , None )
10711072 } ;
10721073 let const_expr = match const_expr {
0 commit comments