forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
6 changed files
with
22 additions
and
96 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.