@@ -17,7 +17,8 @@ use self::EvalHint::*;
17
17
use front:: map as ast_map;
18
18
use front:: map:: blocks:: FnLikeNode ;
19
19
use middle:: cstore:: { self , CrateStore , InlinedItem } ;
20
- use middle:: { def, infer, subst, traits} ;
20
+ use middle:: { infer, subst, traits} ;
21
+ use middle:: def:: Def ;
21
22
use middle:: subst:: Subst ;
22
23
use middle:: def_id:: DefId ;
23
24
use 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>
331
332
entry. insert ( def) ;
332
333
}
333
334
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 {
337
338
id : expr. id ,
338
339
node : hir:: PatLit ( P ( expr. clone ( ) ) ) ,
339
340
span : span,
@@ -364,12 +365,12 @@ pub fn const_expr_to_pat(tcx: &ty::ctxt, expr: &Expr, span: Span) -> P<hir::Pat>
364
365
hir:: ExprPath ( _, ref path) => {
365
366
let opt_def = tcx. def_map . borrow ( ) . get ( & expr. id ) . map ( |d| d. full_def ( ) ) ;
366
367
match opt_def {
367
- Some ( def :: DefStruct ( ..) ) =>
368
+ Some ( Def :: Struct ( ..) ) =>
368
369
hir:: PatStruct ( path. clone ( ) , hir:: HirVec :: new ( ) , false ) ,
369
- Some ( def :: DefVariant ( ..) ) =>
370
+ Some ( Def :: Variant ( ..) ) =>
370
371
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) ) => {
373
374
let expr = lookup_const_by_id ( tcx, def_id, Some ( expr. id ) , None ) . unwrap ( ) ;
374
375
return const_expr_to_pat ( tcx, expr, span) ;
375
376
} ,
@@ -1002,7 +1003,7 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
1002
1003
None
1003
1004
} ;
1004
1005
let ( const_expr, const_ty) = match opt_def {
1005
- Some ( def :: DefConst ( def_id) ) => {
1006
+ Some ( Def :: Const ( def_id) ) => {
1006
1007
if let Some ( node_id) = tcx. map . as_local_node_id ( def_id) {
1007
1008
match tcx. map . find ( node_id) {
1008
1009
Some ( ast_map:: NodeItem ( it) ) => match it. node {
@@ -1017,7 +1018,7 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
1017
1018
( lookup_const_by_id ( tcx, def_id, Some ( e. id ) , None ) , None )
1018
1019
}
1019
1020
}
1020
- Some ( def :: DefAssociatedConst ( def_id) ) => {
1021
+ Some ( Def :: AssociatedConst ( def_id) ) => {
1021
1022
if let Some ( node_id) = tcx. map . as_local_node_id ( def_id) {
1022
1023
match tcx. impl_or_trait_item ( def_id) . container ( ) {
1023
1024
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>,
1052
1053
( lookup_const_by_id ( tcx, def_id, Some ( e. id ) , None ) , None )
1053
1054
}
1054
1055
}
1055
- Some ( def :: DefVariant ( enum_def, variant_def) ) => {
1056
+ Some ( Def :: Variant ( enum_def, variant_def) ) => {
1056
1057
( lookup_variant_by_id ( tcx, enum_def, variant_def) , None )
1057
1058
}
1058
- Some ( def :: DefStruct ( ..) ) => {
1059
+ Some ( Def :: Struct ( ..) ) => {
1059
1060
return Ok ( ConstVal :: Struct ( e. id ) )
1060
1061
}
1061
- Some ( def :: DefLocal ( _, id) ) => {
1062
- debug ! ( "DefLocal ({:?}): {:?}" , id, fn_args) ;
1062
+ Some ( Def :: Local ( _, id) ) => {
1063
+ debug ! ( "Def::Local ({:?}): {:?}" , id, fn_args) ;
1063
1064
if let Some ( val) = fn_args. and_then ( |args| args. get ( & id) ) {
1064
1065
return Ok ( val. clone ( ) ) ;
1065
1066
} else {
1066
1067
( None , None )
1067
1068
}
1068
1069
} ,
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) ) ,
1070
1071
_ => ( None , None )
1071
1072
} ;
1072
1073
let const_expr = match const_expr {
0 commit comments