diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /src/test/ui/macros/macro-pat.rs | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/macros/macro-pat.rs')
-rw-r--r-- | src/test/ui/macros/macro-pat.rs | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/src/test/ui/macros/macro-pat.rs b/src/test/ui/macros/macro-pat.rs deleted file mode 100644 index baf816e53..000000000 --- a/src/test/ui/macros/macro-pat.rs +++ /dev/null @@ -1,65 +0,0 @@ -// run-pass - -macro_rules! mypat { - () => ( - Some('y') - ) -} - -macro_rules! char_x { - () => ( - 'x' - ) -} - -macro_rules! some { - ($x:pat) => ( - Some($x) - ) -} - -macro_rules! indirect { - () => ( - some!(char_x!()) - ) -} - -macro_rules! ident_pat { - ($x:ident) => ( - $x - ) -} - -fn f(c: Option<char>) -> usize { - match c { - Some('x') => 1, - mypat!() => 2, - _ => 3, - } -} - -pub fn main() { - assert_eq!(1, f(Some('x'))); - assert_eq!(2, f(Some('y'))); - assert_eq!(3, f(None)); - - assert_eq!(1, match Some('x') { - Some(char_x!()) => 1, - _ => 2, - }); - - assert_eq!(1, match Some('x') { - some!(char_x!()) => 1, - _ => 2, - }); - - assert_eq!(1, match Some('x') { - indirect!() => 1, - _ => 2, - }); - - assert_eq!(3, { - let ident_pat!(x) = 2; - x+1 - }); -} |