summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_codegen_cranelift/example/subslice-patterns-const-eval.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /compiler/rustc_codegen_cranelift/example/subslice-patterns-const-eval.rs
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_codegen_cranelift/example/subslice-patterns-const-eval.rs')
-rw-r--r--compiler/rustc_codegen_cranelift/example/subslice-patterns-const-eval.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_cranelift/example/subslice-patterns-const-eval.rs b/compiler/rustc_codegen_cranelift/example/subslice-patterns-const-eval.rs
index 2cb84786f..3c8789166 100644
--- a/compiler/rustc_codegen_cranelift/example/subslice-patterns-const-eval.rs
+++ b/compiler/rustc_codegen_cranelift/example/subslice-patterns-const-eval.rs
@@ -19,7 +19,9 @@ macro_rules! n {
// This macro has an unused variable so that it can be repeated base on the
// number of times a repeated variable (`$e` in `z`) occurs.
macro_rules! zed {
- ($e:expr) => { Z }
+ ($e:expr) => {
+ Z
+ };
}
macro_rules! z {
@@ -32,12 +34,14 @@ macro_rules! z {
macro_rules! compare_evaluation {
($e:expr, $t:ty $(,)?) => {{
const CONST_EVAL: $t = $e;
- const fn const_eval() -> $t { $e }
+ const fn const_eval() -> $t {
+ $e
+ }
static CONST_EVAL2: $t = const_eval();
let runtime_eval = $e;
assert_eq!(CONST_EVAL, runtime_eval);
assert_eq!(CONST_EVAL2, runtime_eval);
- }}
+ }};
}
// Repeat `$test`, substituting the given macro variables with the given
@@ -65,6 +69,7 @@ macro_rules! repeat {
}
}
+#[rustfmt::skip]
fn main() {
repeat! {
($arr $Ty); n, N; z, Z: