@@ -27,7 +27,7 @@ use rustc::ty::util::IntTypeExt;
27
27
use rustc:: ty:: subst:: Substs ;
28
28
use rustc:: traits:: Reveal ;
29
29
use rustc:: util:: common:: ErrorReported ;
30
- use rustc:: util:: nodemap:: NodeMap ;
30
+ use rustc:: util:: nodemap:: DefIdMap ;
31
31
use rustc:: lint;
32
32
33
33
use graphviz:: IntoCow ;
@@ -413,7 +413,7 @@ pub fn eval_const_expr_checked<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
413
413
eval_const_expr_partial ( tcx, e, ExprTypeChecked , None )
414
414
}
415
415
416
- pub type FnArgMap < ' a > = Option < & ' a NodeMap < ConstVal > > ;
416
+ pub type FnArgMap < ' a > = Option < & ' a DefIdMap < ConstVal > > ;
417
417
418
418
#[ derive( Clone , Debug ) ]
419
419
pub struct ConstEvalErr {
@@ -835,9 +835,8 @@ pub fn eval_const_expr_partial<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
835
835
ConstVal :: Struct ( e. id )
836
836
}
837
837
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) ) {
841
840
val. clone ( )
842
841
} else {
843
842
signal ! ( e, NonConstPath ) ;
@@ -863,7 +862,7 @@ pub fn eval_const_expr_partial<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
863
862
let result = result. as_ref ( ) . expect ( "const fn has no result expression" ) ;
864
863
assert_eq ! ( decl. inputs. len( ) , args. len( ) ) ;
865
864
866
- let mut call_args = NodeMap ( ) ;
865
+ let mut call_args = DefIdMap ( ) ;
867
866
for ( arg, arg_expr) in decl. inputs . iter ( ) . zip ( args. iter ( ) ) {
868
867
let arg_hint = ty_hint. erase_hint ( ) ;
869
868
let arg_val = eval_const_expr_partial (
@@ -873,7 +872,7 @@ pub fn eval_const_expr_partial<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
873
872
fn_args
874
873
) ?;
875
874
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) ;
877
876
assert ! ( old. is_none( ) ) ;
878
877
}
879
878
debug ! ( "const call({:?})" , call_args) ;
0 commit comments