@@ -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 ;
@@ -414,7 +414,7 @@ pub fn eval_const_expr_checked<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
414
414
eval_const_expr_partial ( tcx, e, ExprTypeChecked , None )
415
415
}
416
416
417
- pub type FnArgMap < ' a > = Option < & ' a NodeMap < ConstVal > > ;
417
+ pub type FnArgMap < ' a > = Option < & ' a DefIdMap < ConstVal > > ;
418
418
419
419
#[ derive( Clone , Debug ) ]
420
420
pub struct ConstEvalErr {
@@ -837,9 +837,8 @@ pub fn eval_const_expr_partial<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
837
837
ConstVal :: Struct ( e. id )
838
838
}
839
839
Def :: Local ( def_id) => {
840
- let id = tcx. map . as_local_node_id ( def_id) . unwrap ( ) ;
841
- debug ! ( "Def::Local({:?}): {:?}" , id, fn_args) ;
842
- if let Some ( val) = fn_args. and_then ( |args| args. get ( & id) ) {
840
+ debug ! ( "Def::Local({:?}): {:?}" , def_id, fn_args) ;
841
+ if let Some ( val) = fn_args. and_then ( |args| args. get ( & def_id) ) {
843
842
val. clone ( )
844
843
} else {
845
844
signal ! ( e, NonConstPath ) ;
@@ -865,7 +864,7 @@ pub fn eval_const_expr_partial<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
865
864
let result = result. as_ref ( ) . expect ( "const fn has no result expression" ) ;
866
865
assert_eq ! ( decl. inputs. len( ) , args. len( ) ) ;
867
866
868
- let mut call_args = NodeMap ( ) ;
867
+ let mut call_args = DefIdMap ( ) ;
869
868
for ( arg, arg_expr) in decl. inputs . iter ( ) . zip ( args. iter ( ) ) {
870
869
let arg_hint = ty_hint. erase_hint ( ) ;
871
870
let arg_val = eval_const_expr_partial (
@@ -875,7 +874,7 @@ pub fn eval_const_expr_partial<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
875
874
fn_args
876
875
) ?;
877
876
debug ! ( "const call arg: {:?}" , arg) ;
878
- let old = call_args. insert ( arg. pat . id , arg_val) ;
877
+ let old = call_args. insert ( tcx . expect_def ( arg. pat . id ) . def_id ( ) , arg_val) ;
879
878
assert ! ( old. is_none( ) ) ;
880
879
}
881
880
debug ! ( "const call({:?})" , call_args) ;
0 commit comments