Skip to content

Commit a8a558a

Browse files
committed
---
yaml --- r: 123655 b: refs/heads/try c: f48cc74 h: refs/heads/master i: 123653: 1bd8f35 123651: 2c2be88 123647: 92b8802 v: v3
1 parent 3e3c421 commit a8a558a

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: da4e4e4e0a7778a85748aa4a303b13f603e96b4b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 8ddd286ea4ba4384a0dc9eae393ed515460a986e
5-
refs/heads/try: 31570cb22e8ab60233956368bad710f987a64b06
5+
refs/heads/try: f48cc740017bac1214030300435dfa95dbaa220b
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
12+
use std::gc::Gc;
13+
use std::mem::size_of;
14+
15+
trait Trait {}
16+
17+
fn main() {
18+
// Closures - || / proc()
19+
assert_eq!(size_of::<proc()>(), size_of::<Option<proc()>>());
20+
assert_eq!(size_of::<||>(), size_of::<Option<||>>());
21+
22+
// Functions
23+
assert_eq!(size_of::<fn(int)>(), size_of::<Option<fn(int)>>());
24+
assert_eq!(size_of::<extern "C" fn(int)>(), size_of::<Option<extern "C" fn(int)>>());
25+
26+
// Slices - &str / &[T] / &mut [T]
27+
assert_eq!(size_of::<&str>(), size_of::<Option<&str>>());
28+
assert_eq!(size_of::<&[int]>(), size_of::<Option<&[int]>>());
29+
assert_eq!(size_of::<&mut [int]>(), size_of::<Option<&mut [int]>>());
30+
31+
// Traits - Box<Trait> / &Trait / &mut Trait
32+
assert_eq!(size_of::<Box<Trait>>(), size_of::<Option<Box<Trait>>>());
33+
assert_eq!(size_of::<&Trait>(), size_of::<Option<&Trait>>());
34+
assert_eq!(size_of::<&mut Trait>(), size_of::<Option<&mut Trait>>());
35+
36+
// Pointers - Box<T> / Gc<T>
37+
assert_eq!(size_of::<Box<int>>(), size_of::<Option<Box<int>>>());
38+
assert_eq!(size_of::<Gc<int>>(), size_of::<Option<Gc<int>>>());
39+
40+
}

0 commit comments

Comments
 (0)