summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/deref-patterns/string.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mir-opt/deref-patterns/string.rs')
-rw-r--r--tests/mir-opt/deref-patterns/string.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/mir-opt/deref-patterns/string.rs b/tests/mir-opt/deref-patterns/string.rs
new file mode 100644
index 000000000..3a99c44aa
--- /dev/null
+++ b/tests/mir-opt/deref-patterns/string.rs
@@ -0,0 +1,12 @@
+// compile-flags: -Z mir-opt-level=0 -C panic=abort
+
+#![feature(string_deref_patterns)]
+#![crate_type = "lib"]
+
+// EMIT_MIR string.foo.PreCodegen.after.mir
+pub fn foo(s: Option<String>) -> i32 {
+ match s {
+ Some("a") => 1234,
+ s => 4321,
+ }
+}