Skip to content

Commit 152c065

Browse files
Assign correct span to new illegal ops
1 parent 7954339 commit 152c065

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

src/librustc_mir/transform/check_consts/validation.rs

+2
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,11 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
485485
| FakeReadCause::ForGuardBinding,
486486
_,
487487
) => {
488+
self.super_statement(statement, location);
488489
self.check_op(ops::IfOrMatch);
489490
}
490491
StatementKind::LlvmInlineAsm { .. } => {
492+
self.super_statement(statement, location);
491493
self.check_op(ops::InlineAsm);
492494
}
493495

src/test/ui/consts/inline_asm.stderr

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
error[E0019]: constant contains unimplemented expression type
2-
--> $DIR/inline_asm.rs:3:1
2+
--> $DIR/inline_asm.rs:3:24
33
|
44
LL | const _: () = unsafe { llvm_asm!("nop") };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5+
| ^^^^^^^^^^^^^^^^
6+
|
7+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
68

79
error: aborting due to previous error
810

src/test/ui/consts/miri_unleashed/inline_asm.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
fn main() {}
77

88
// Make sure we catch executing inline assembly.
9-
static TEST_BAD: () = { //~ WARN: skipping const checks
9+
static TEST_BAD: () = {
1010
unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); }
1111
//~^ ERROR could not evaluate static initializer
1212
//~| NOTE in this expansion of llvm_asm!
1313
//~| NOTE inline assembly is not supported
14+
//~| WARN skipping const checks
15+
//~| NOTE in this expansion of llvm_asm!
1416
};

src/test/ui/consts/miri_unleashed/inline_asm.stderr

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
warning: skipping const checks
2-
--> $DIR/inline_asm.rs:9:1
2+
--> $DIR/inline_asm.rs:10:14
3+
|
4+
LL | unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); }
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36
|
4-
LL | / static TEST_BAD: () = {
5-
LL | | unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); }
6-
LL | |
7-
LL | |
8-
LL | |
9-
LL | | };
10-
| |__^
7+
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
118

129
error[E0080]: could not evaluate static initializer
1310
--> $DIR/inline_asm.rs:10:14

0 commit comments

Comments
 (0)