fix Option<~ZeroSizeType>

1778b63616 provided the guarantee of no
`exchange_free` calls for ~ZeroSizeType, so a sentinel can now be used
without overhead.

Closes #11998
This commit is contained in:
Daniel Micay 2014-04-02 17:23:52 -04:00 committed by Alex Crichton
parent 1ac8b34ccd
commit 898669c4e2
3 changed files with 44 additions and 9 deletions

View file

@ -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());
}