File tree Expand file tree Collapse file tree 3 files changed +28
-2
lines changed
compiler/rustc_mir_build/src/thir/cx Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -652,7 +652,8 @@ impl<'tcx> Cx<'tcx> {
652652 promoted : None ,
653653 } ,
654654 tcx. type_of ( anon_const. def_id ) . instantiate_identity ( ) ,
655- ) ;
655+ )
656+ . normalize ( tcx, self . param_env ) ;
656657 let span = tcx. def_span ( anon_const. def_id ) ;
657658
658659 InlineAsmOperand :: Const { value, span }
@@ -668,7 +669,8 @@ impl<'tcx> Cx<'tcx> {
668669 promoted : None ,
669670 } ,
670671 tcx. type_of ( anon_const. def_id ) . instantiate_identity ( ) ,
671- ) ;
672+ )
673+ . normalize ( tcx, self . param_env ) ;
672674 let span = tcx. def_span ( anon_const. def_id ) ;
673675
674676 InlineAsmOperand :: SymFn { value, span }
Original file line number Diff line number Diff line change 1+ // only-x86_64
2+ // needs-asm-support
3+
4+ #![ feature( asm_const) ]
5+
6+ // Test to make sure that we emit const errors eagerly for inline asm
7+
8+ use std:: arch:: asm;
9+
10+ fn test < T > ( ) {
11+ unsafe { asm ! ( "/* {} */" , const 1 / 0 ) ; }
12+ //~^ ERROR evaluation of
13+ }
14+
15+ 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:11:37
3+ |
4+ LL | unsafe { asm!("/* {} */", const 1 / 0); }
5+ | ^^^^^ attempt to divide `1_i32` by zero
6+
7+ error: aborting due to 1 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