@@ -27,7 +27,7 @@ use rustc::ty::util::IntTypeExt;
2727use rustc:: ty:: subst:: Substs ;
2828use rustc:: traits:: Reveal ;
2929use rustc:: util:: common:: ErrorReported ;
30- use rustc:: util:: nodemap:: NodeMap ;
30+ use rustc:: util:: nodemap:: DefIdMap ;
3131use rustc:: lint;
3232
3333use graphviz:: IntoCow ;
@@ -413,7 +413,7 @@ pub fn eval_const_expr_checked<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
413413 eval_const_expr_partial ( tcx, e, ExprTypeChecked , None )
414414}
415415
416- pub type FnArgMap < ' a > = Option < & ' a NodeMap < ConstVal > > ;
416+ pub type FnArgMap < ' a > = Option < & ' a DefIdMap < ConstVal > > ;
417417
418418#[ derive( Clone , Debug ) ]
419419pub struct ConstEvalErr {
@@ -835,9 +835,8 @@ pub fn eval_const_expr_partial<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
835835 ConstVal :: Struct ( e. id )
836836 }
837837 Def :: Local ( def_id) => {
838- let id = tcx. map . as_local_node_id ( def_id) . unwrap ( ) ;
839- debug ! ( "Def::Local({:?}): {:?}" , id, fn_args) ;
840- if let Some ( val) = fn_args. and_then ( |args| args. get ( & id) ) {
838+ debug ! ( "Def::Local({:?}): {:?}" , def_id, fn_args) ;
839+ if let Some ( val) = fn_args. and_then ( |args| args. get ( & def_id) ) {
841840 val. clone ( )
842841 } else {
843842 signal ! ( e, NonConstPath ) ;
@@ -863,7 +862,7 @@ pub fn eval_const_expr_partial<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
863862 let result = result. as_ref ( ) . expect ( "const fn has no result expression" ) ;
864863 assert_eq ! ( decl. inputs. len( ) , args. len( ) ) ;
865864
866- let mut call_args = NodeMap ( ) ;
865+ let mut call_args = DefIdMap ( ) ;
867866 for ( arg, arg_expr) in decl. inputs . iter ( ) . zip ( args. iter ( ) ) {
868867 let arg_hint = ty_hint. erase_hint ( ) ;
869868 let arg_val = eval_const_expr_partial (
@@ -873,7 +872,7 @@ pub fn eval_const_expr_partial<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
873872 fn_args
874873 ) ?;
875874 debug ! ( "const call arg: {:?}" , arg) ;
876- let old = call_args. insert ( arg. pat . id , arg_val) ;
875+ let old = call_args. insert ( tcx . expect_def ( arg. pat . id ) . def_id ( ) , arg_val) ;
877876 assert ! ( old. is_none( ) ) ;
878877 }
879878 debug ! ( "const call({:?})" , call_args) ;
0 commit comments