summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/control-flow/feature-gate-const-if-match.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
commita4b7ed7a42c716ab9f05e351f003d589124fd55d (patch)
treeb620cd3f223850b28716e474e80c58059dca5dd4 /src/test/ui/consts/control-flow/feature-gate-const-if-match.rs
parentAdding upstream version 1.67.1+dfsg1. (diff)
downloadrustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz
rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/consts/control-flow/feature-gate-const-if-match.rs')
-rw-r--r--src/test/ui/consts/control-flow/feature-gate-const-if-match.rs96
1 files changed, 0 insertions, 96 deletions
diff --git a/src/test/ui/consts/control-flow/feature-gate-const-if-match.rs b/src/test/ui/consts/control-flow/feature-gate-const-if-match.rs
deleted file mode 100644
index cb66bc753..000000000
--- a/src/test/ui/consts/control-flow/feature-gate-const-if-match.rs
+++ /dev/null
@@ -1,96 +0,0 @@
-// check-pass
-
-const _: i32 = if true { 5 } else { 6 };
-
-const _: i32 = if let Some(true) = Some(false) { 0 } else { 1 };
-
-const _: i32 = match 1 {
- 2 => 3,
- 4 => 5,
- _ => 0,
-};
-
-static FOO: i32 = {
- let x = if true { 0 } else { 1 };
- let x = match x {
- 0 => 1,
- _ => 0,
- };
- if let Some(x) = Some(x) { x } else { 1 }
-};
-
-static mut BAR: i32 = {
- let x = if true { 0 } else { 1 };
- let x = match x {
- 0 => 1,
- _ => 0,
- };
- if let Some(x) = Some(x) { x } else { 1 }
-};
-
-const fn if_() -> i32 {
- if true { 5 } else { 6 }
-}
-
-const fn if_let(a: Option<bool>) -> i32 {
- if let Some(true) = a { 0 } else { 1 }
-}
-
-const fn match_(i: i32) -> i32 {
- match i {
- i if i > 10 => i,
- 1 => 2,
- _ => 0,
- }
-}
-
-pub trait Foo {
- const IF: i32 = if true { 5 } else { 6 };
- const IF_LET: i32 = if let Some(true) = None { 5 } else { 6 };
- const MATCH: i32 = match 0 {
- 1 => 2,
- _ => 0,
- };
-}
-
-impl Foo for () {
- const IF: i32 = if true { 5 } else { 6 };
- const IF_LET: i32 = if let Some(true) = None { 5 } else { 6 };
- const MATCH: i32 = match 0 {
- 1 => 2,
- _ => 0,
- };
-}
-
-fn non_const_outside() {
- const fn const_inside(y: bool) -> i32 {
- let x = if y { 0 } else { 1 };
- let x = match x {
- 0 => 1,
- _ => 0,
- };
- if let Some(x) = Some(x) { x } else { 1 }
- }
-}
-
-const fn const_outside() {
- fn non_const_inside(y: bool) -> i32 {
- let x = if y { 0 } else { 1 };
- let x = match x {
- 0 => 1,
- _ => 0,
- };
- if let Some(x) = Some(x) { x } else { 1 }
- }
-}
-
-fn main() {
- let _ = [0; {
- let x = if false { 0 } else { 1 };
- let x = match x {
- 0 => 1,
- _ => 0,
- };
- if let Some(x) = Some(x) { x } else { 1 }
- }];
-}