Skip to content

Commit

Permalink
Unrolled build for rust-lang#130895
Browse files Browse the repository at this point in the history
Rollup 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.
  • Loading branch information
rust-timer authored Sep 30, 2024
2 parents b529e27 + ac2e318 commit 41670ea
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 41670ea

Please sign in to comment.