diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-03-01 14:20:23 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:19:01 +0100 |
commit | d344a64be5b8f985acdccf644e0959a0564a54d5 (patch) | |
tree | 7ac3508fa8ccaf9ade4f04ad4c575c40f47105cf | |
parent | d34922c496430cfbfa855f59d45f15de852c2316 (diff) | |
download | gcc-d344a64be5b8f985acdccf644e0959a0564a54d5.zip gcc-d344a64be5b8f985acdccf644e0959a0564a54d5.tar.gz gcc-d344a64be5b8f985acdccf644e0959a0564a54d5.tar.bz2 |
gccrs: testsuite: Add a test for if let syntax
Add a new test to check the if let expression syntax parsing.
gcc/testsuite/ChangeLog:
* rust/compile/if_let_expr.rs: New test.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
-rw-r--r-- | gcc/testsuite/rust/compile/if_let_expr.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/if_let_expr.rs b/gcc/testsuite/rust/compile/if_let_expr.rs new file mode 100644 index 0000000..31e301f --- /dev/null +++ b/gcc/testsuite/rust/compile/if_let_expr.rs @@ -0,0 +1,19 @@ +// { dg-options "-fsyntax-only" } + +pub enum Option<T> { + None, + Some(T), +} + +fn main() { + let x = Option::Some(3); + let a = if let Option::Some(1) = x { + 1 + } else if x == Option::Some(2) { + 2 + } else if let Option::Some(y) = x { + y + } else { + -1 + }; +} |