diff options
| author | Nadrieril <nadrieril+git@gmail.com> | 2024-03-08 19:17:23 +0100 |
|---|---|---|
| committer | Nadrieril <nadrieril+git@gmail.com> | 2024-03-20 22:30:27 +0100 |
| commit | 120d3570aa467c287814fe3edb9003920d8232aa (patch) | |
| tree | 146ba6ab67200ca66af6ebf6447a7b657030adbf /tests/ui/pattern | |
| parent | a128516cf9de352ae1f9d430ed730363c7ca3c0c (diff) | |
| download | rust-120d3570aa467c287814fe3edb9003920d8232aa.tar.gz rust-120d3570aa467c287814fe3edb9003920d8232aa.zip | |
Add barest-bones deref patterns
Co-authored-by: Deadbeef <ent3rm4n@gmail.com>
Diffstat (limited to 'tests/ui/pattern')
| -rw-r--r-- | tests/ui/pattern/deref-patterns/typeck.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/pattern/deref-patterns/typeck.rs b/tests/ui/pattern/deref-patterns/typeck.rs new file mode 100644 index 00000000000..20577abe485 --- /dev/null +++ b/tests/ui/pattern/deref-patterns/typeck.rs @@ -0,0 +1,31 @@ +//@ check-pass +#![feature(deref_patterns)] +#![allow(incomplete_features)] + +use std::rc::Rc; + +fn main() { + let vec: Vec<u32> = Vec::new(); + match vec { + box [..] => {} + _ => {} + } + match Box::new(true) { + box true => {} + _ => {} + } + match &Box::new(true) { + box true => {} + _ => {} + } + match &Rc::new(0) { + box (1..) => {} + _ => {} + } + // FIXME(deref_patterns): fails to typecheck because `"foo"` has type &str but deref creates a + // place of type `str`. + // match "foo".to_string() { + // box "foo" => {} + // _ => {} + // } +} |
