diff options
Diffstat (limited to 'tests/ui/borrowck/string-borrowing-pattern-matching-11869.rs')
| -rw-r--r-- | tests/ui/borrowck/string-borrowing-pattern-matching-11869.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/borrowck/string-borrowing-pattern-matching-11869.rs b/tests/ui/borrowck/string-borrowing-pattern-matching-11869.rs new file mode 100644 index 00000000000..fe3d1bf6e8a --- /dev/null +++ b/tests/ui/borrowck/string-borrowing-pattern-matching-11869.rs @@ -0,0 +1,17 @@ +// 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() {} |
