about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-03-22 15:52:30 +0000
committerbors <bors@rust-lang.org>2015-03-22 15:52:30 +0000
commitb0aad7dd4fad8d7e2e2f877a511a637258949597 (patch)
treead63ea9d060e8eadefd1b2ab9116d5f105b1d453 /src/test
parentecf8c64e1b1b60f228f0c472c0b0dab4a5b5aa61 (diff)
parenta5eefdef3c6123ec4217d0f21ff78bffe9c5ccbd (diff)
downloadrust-b0aad7dd4fad8d7e2e2f877a511a637258949597.tar.gz
rust-b0aad7dd4fad8d7e2e2f877a511a637258949597.zip
Auto merge of #23361 - petrochenkov:refdst, r=jakub-
After this patch code like `let ref a = *"abcdef"` doesn't cause ICE anymore.
Required for #23121

There are still places in rustc_trans where pointers are always assumed to be thin. In particular, #19064 is not resolved by this patch.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/match-ref-unsized.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/run-pass/match-ref-unsized.rs b/src/test/run-pass/match-ref-unsized.rs
new file mode 100644
index 00000000000..4de028299df
--- /dev/null
+++ b/src/test/run-pass/match-ref-unsized.rs
@@ -0,0 +1,20 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Binding unsized expressions to ref patterns
+
+pub fn main() {
+    let ref a = *"abcdef";
+    assert_eq!(a, "abcdef");
+
+    match *"12345" {
+        ref b => { assert_eq!(b, "12345") }
+    }
+}