about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2014-04-02 17:23:52 -0400
committerAlex Crichton <alex@alexcrichton.com>2014-04-03 13:43:35 -0700
commit898669c4e203ae91e2048fb6c0f8591c867bccc6 (patch)
tree00dd1385c83fb35dff75055f477bcc795732d6f8 /src/test
parent1ac8b34ccd02965886d3ca0bd83115c7f7b73729 (diff)
downloadrust-898669c4e203ae91e2048fb6c0f8591c867bccc6.tar.gz
rust-898669c4e203ae91e2048fb6c0f8591c867bccc6.zip
fix Option<~ZeroSizeType>
1778b6361627c5894bf75ffecf427573af02d390 provided the guarantee of no
`exchange_free` calls for ~ZeroSizeType, so a sentinel can now be used
without overhead.

Closes #11998
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/empty-allocation-non-null.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/run-pass/empty-allocation-non-null.rs b/src/test/run-pass/empty-allocation-non-null.rs
new file mode 100644
index 00000000000..9695296ec15
--- /dev/null
+++ b/src/test/run-pass/empty-allocation-non-null.rs
@@ -0,0 +1,19 @@
+// Copyright 2014 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.
+
+pub fn main() {
+    assert!(Some(~()).is_some());
+
+    struct Foo;
+    assert!(Some(~Foo).is_some());
+
+    let xs: ~[()] = ~[];
+    assert!(Some(xs).is_some());
+}