mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
make sure we still eagerly emit errors
This commit is contained in:
parent
a992defc8b
commit
82f23d56b7
@ -652,7 +652,8 @@ impl<'tcx> Cx<'tcx> {
|
||||
promoted: None,
|
||||
},
|
||||
tcx.type_of(anon_const.def_id).instantiate_identity(),
|
||||
);
|
||||
)
|
||||
.normalize(tcx, self.param_env);
|
||||
let span = tcx.def_span(anon_const.def_id);
|
||||
|
||||
InlineAsmOperand::Const { value, span }
|
||||
@ -668,7 +669,8 @@ impl<'tcx> Cx<'tcx> {
|
||||
promoted: None,
|
||||
},
|
||||
tcx.type_of(anon_const.def_id).instantiate_identity(),
|
||||
);
|
||||
)
|
||||
.normalize(tcx, self.param_env);
|
||||
let span = tcx.def_span(anon_const.def_id);
|
||||
|
||||
InlineAsmOperand::SymFn { value, span }
|
||||
|
15
tests/ui/asm/const-error.rs
Normal file
15
tests/ui/asm/const-error.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// only-x86_64
|
||||
// needs-asm-support
|
||||
|
||||
#![feature(asm_const)]
|
||||
|
||||
// Test to make sure that we emit const errors eagerly for inline asm
|
||||
|
||||
use std::arch::asm;
|
||||
|
||||
fn test<T>() {
|
||||
unsafe { asm!("/* {} */", const 1 / 0); }
|
||||
//~^ ERROR evaluation of
|
||||
}
|
||||
|
||||
fn main() {}
|
9
tests/ui/asm/const-error.stderr
Normal file
9
tests/ui/asm/const-error.stderr
Normal file
@ -0,0 +1,9 @@
|
||||
error[E0080]: evaluation of `test::<T>::{constant#0}` failed
|
||||
--> $DIR/const-error.rs:11:37
|
||||
|
|
||||
LL | unsafe { asm!("/* {} */", const 1 / 0); }
|
||||
| ^^^^^ attempt to divide `1_i32` by zero
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
Loading…
Reference in New Issue
Block a user