Skip to content

Commit

Permalink
Rollup merge of #130895 - RalfJung:asm-tests, r=nnethercote
Browse files Browse the repository at this point in the history
make type-check-4 asm tests about non-const expressions

These tests recently got changed in #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](0d88631) of these tests -- not sure if you still remember what they were intended to test.
  • Loading branch information
matthiaskrgr authored Sep 30, 2024
2 parents 0245b0c + ac2e318 commit fd2785f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 96 deletions.
27 changes: 0 additions & 27 deletions tests/ui/asm/aarch64/type-check-4.rs

This file was deleted.

21 changes: 0 additions & 21 deletions tests/ui/asm/aarch64/type-check-4.stderr

This file was deleted.

11 changes: 11 additions & 0 deletions tests/ui/asm/non-const.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ needs-asm-support

use std::arch::global_asm;

fn main() {}

// Constants must be... constant
fn non_const_fn(x: i32) -> i32 { x }

global_asm!("/* {} */", const non_const_fn(0));
//~^ERROR: cannot call non-const fn
11 changes: 11 additions & 0 deletions tests/ui/asm/non-const.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0015]: cannot call non-const fn `non_const_fn` in constants
--> $DIR/non-const.rs:10:31
|
LL | global_asm!("/* {} */", const non_const_fn(0));
| ^^^^^^^^^^^^^^^
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0015`.
27 changes: 0 additions & 27 deletions tests/ui/asm/x86_64/type-check-4.rs

This file was deleted.

21 changes: 0 additions & 21 deletions tests/ui/asm/x86_64/type-check-4.stderr

This file was deleted.

0 comments on commit fd2785f

Please sign in to comment.