File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed
compiler/rustc_mir_build/src/thir/cx Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -657,7 +657,8 @@ impl<'tcx> Cx<'tcx> {
657657 promoted : None ,
658658 } ,
659659 tcx. type_of ( anon_const. def_id ) . instantiate_identity ( ) ,
660- ) ;
660+ )
661+ . normalize ( tcx, self . param_env ) ;
661662 let span = tcx. def_span ( anon_const. def_id ) ;
662663
663664 InlineAsmOperand :: Const { value, span }
@@ -673,7 +674,8 @@ impl<'tcx> Cx<'tcx> {
673674 promoted : None ,
674675 } ,
675676 tcx. type_of ( anon_const. def_id ) . instantiate_identity ( ) ,
676- ) ;
677+ )
678+ . normalize ( tcx, self . param_env ) ;
677679 let span = tcx. def_span ( anon_const. def_id ) ;
678680
679681 InlineAsmOperand :: SymFn { value, span }
Original file line number Diff line number Diff line change 1+ #![ feature( asm_const) ]
2+
3+ // Test to make sure that we emit const errors eagerly for inline asm
4+
5+ use std:: arch:: asm;
6+
7+ fn test < T > ( ) {
8+ unsafe { asm ! ( "/* {} */" , const 1 / 0 ) ; }
9+ //~^ ERROR evaluation of
10+ }
11+
12+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0080]: evaluation of `test::<T>::{constant#0}` failed
2+ --> $DIR/const-error.rs:8:37
3+ |
4+ LL | unsafe { asm!("/* {} */", const 1 / 0); }
5+ | ^^^^^ attempt to divide `1_i32` by zero
6+
7+ error: aborting due to previous error
8+
9+ For more information about this error, try `rustc --explain E0080`.
You can’t perform that action at this time.
0 commit comments