forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make type-check-4 asm tests about non-const expressions
- Loading branch information
Showing
6 changed files
with
20 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,9 @@ | ||
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:8: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.