about summary refs log tree commit diff
path: root/tests/ui/borrowck/string-literal-match-patterns-11869.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/string-literal-match-patterns-11869.rs')
-rw-r--r--tests/ui/borrowck/string-literal-match-patterns-11869.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/borrowck/string-literal-match-patterns-11869.rs b/tests/ui/borrowck/string-literal-match-patterns-11869.rs
new file mode 100644
index 00000000000..4c159e457cf
--- /dev/null
+++ b/tests/ui/borrowck/string-literal-match-patterns-11869.rs
@@ -0,0 +1,18 @@
+//! Regression test for https://github.com/rust-lang/rust/issues/11869
+
+//@ check-pass
+#![allow(dead_code)]
+
+struct A {
+    a: String
+}
+
+fn borrow<'a>(binding: &'a A) -> &'a str {
+    match &*binding.a {
+        "in" => "in_",
+        "ref" => "ref_",
+        ident => ident
+    }
+}
+
+fn main() {}