Skip to content

Commit cfe8e39

Browse files
committed
Auto merge of rust-lang#130895 - RalfJung:asm-tests, r=nnethercote
make type-check-4 asm tests about non-const expressions These tests recently got changed in rust-lang#129759. I asked the PR author to make the tests read from a `static mut` (rather than just making them "pass"), but I now think that was a mistake: previously the tests failed because the const was not a valid const expression, after the PR they failed because the const failed to evaluate. So this PR restores the tests to "fail because the const is not a valid const expression". That can be done in a target-independent way so I unified the x86 and aarch64 tests into one. Cc `@oli-obk` as the original [author](rust-lang@0d88631) of these tests -- not sure if you still remember what they were intended to test.
2 parents 0245b0c + 758ab4d commit cfe8e39

File tree

6 files changed

+20
-96
lines changed

6 files changed

+20
-96
lines changed

Diff for: tests/ui/asm/aarch64/type-check-4.rs

-27
This file was deleted.

Diff for: tests/ui/asm/aarch64/type-check-4.stderr

-21
This file was deleted.

Diff for: tests/ui/asm/non-const.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use std::arch::global_asm;
2+
3+
fn main() {}
4+
5+
// Constants must be... constant
6+
fn non_const_fn(x: i32) -> i32 { x }
7+
8+
global_asm!("/* {} */", const non_const_fn(0));
9+
//~^ERROR: cannot call non-const fn

Diff for: tests/ui/asm/non-const.stderr

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0015]: cannot call non-const fn `non_const_fn` in constants
2+
--> $DIR/non-const.rs:8:31
3+
|
4+
LL | global_asm!("/* {} */", const non_const_fn(0));
5+
| ^^^^^^^^^^^^^^^
6+
|
7+
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
8+
9+
error: aborting due to 1 previous error
10+
11+
For more information about this error, try `rustc --explain E0015`.

Diff for: tests/ui/asm/x86_64/type-check-4.rs

-27
This file was deleted.

Diff for: tests/ui/asm/x86_64/type-check-4.stderr

-21
This file was deleted.

0 commit comments

Comments
 (0)