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 @@ -655,7 +655,8 @@ impl<'tcx> Cx<'tcx> {
655655 promoted : None ,
656656 } ,
657657 tcx. type_of ( anon_const. def_id ) . instantiate_identity ( ) ,
658- ) ;
658+ )
659+ . normalize ( tcx, self . param_env ) ;
659660 let span = tcx. def_span ( anon_const. def_id ) ;
660661
661662 InlineAsmOperand :: Const { value, span }
@@ -671,7 +672,8 @@ impl<'tcx> Cx<'tcx> {
671672 promoted : None ,
672673 } ,
673674 tcx. type_of ( anon_const. def_id ) . instantiate_identity ( ) ,
674- ) ;
675+ )
676+ . normalize ( tcx, self . param_env ) ;
675677 let span = tcx. def_span ( anon_const. def_id ) ;
676678
677679 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