File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
compiler/rustc_mir/src/const_eval Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ use crate::interpret::{
77} ;
88
99use rustc_errors:: ErrorReported ;
10- use rustc_hir:: { ConstContext , def:: DefKind } ;
10+ use rustc_hir:: def:: DefKind ;
1111use rustc_middle:: mir;
1212use rustc_middle:: mir:: interpret:: ErrorHandled ;
1313use rustc_middle:: traits:: Reveal ;
@@ -34,9 +34,15 @@ fn eval_body_using_ecx<'mir, 'tcx>(
3434 assert ! (
3535 cid. promoted. is_some( )
3636 || matches!(
37- ecx. tcx. hir( ) . body_const_context( cid. instance. def_id( ) . expect_local( ) ) ,
38- Some ( ConstContext :: Const | ConstContext :: Static ( _) )
39- )
37+ ecx. tcx. def_kind( cid. instance. def_id( ) ) ,
38+ DefKind :: Const
39+ | DefKind :: Static
40+ | DefKind :: ConstParam
41+ | DefKind :: AnonConst
42+ | DefKind :: AssocConst
43+ ) ,
44+ "Unexpected DefKind: {:?}" ,
45+ ecx. tcx. def_kind( cid. instance. def_id( ) )
4046 ) ;
4147 let layout = ecx. layout_of ( body. return_ty ( ) . subst ( tcx, cid. instance . substs ) ) ?;
4248 assert ! ( !layout. is_unsized( ) ) ;
@@ -47,8 +53,6 @@ fn eval_body_using_ecx<'mir, 'tcx>(
4753 let prom = cid. promoted . map_or ( String :: new ( ) , |p| format ! ( "::promoted[{:?}]" , p) ) ;
4854 trace ! ( "eval_body_using_ecx: pushing stack frame for global: {}{}" , name, prom) ;
4955
50-
51-
5256 ecx. push_stack_frame (
5357 cid. instance ,
5458 body,
You can’t perform that action at this time.
0 commit comments