Skip to content

Commit 98a5e2f

Browse files
committed
---
yaml --- r: 166770 b: refs/heads/master c: e83272b h: refs/heads/master v: v3
1 parent b0c60c5 commit 98a5e2f

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 466135bfef4d110213a9aeb46f8199fa89a5f267
2+
refs/heads/master: e83272b62883f97b8717a8150d894e89d7ae18d6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 023dfb0c898d851dee6ace2f8339b73b5287136b
55
refs/heads/try: f5d619caf9f32458680fae55526b99582ca682dd

trunk/src/test/run-pass/enum-null-pointer-opt.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111

1212
use std::mem::size_of;
13+
use std::ptr::NonZero;
14+
use std::rc::Rc;
15+
use std::sync::Arc;
1316

1417
trait Trait {}
1518

@@ -51,4 +54,16 @@ fn main() {
5154
// and fixed-size arrays
5255
assert_eq!(size_of::<[Box<int>, ..1]>(), size_of::<Option<[Box<int>, ..1]>>());
5356

57+
// Should apply to NonZero
58+
assert_eq!(size_of::<NonZero<uint>>(), size_of::<Option<NonZero<uint>>>());
59+
assert_eq!(size_of::<NonZero<*mut i8>>(), size_of::<Option<NonZero<*mut i8>>>());
60+
61+
// Should apply to types that use NonZero internally
62+
assert_eq!(size_of::<Vec<int>>(), size_of::<Option<Vec<int>>>());
63+
assert_eq!(size_of::<Arc<int>>(), size_of::<Option<Arc<int>>>());
64+
assert_eq!(size_of::<Rc<int>>(), size_of::<Option<Rc<int>>>());
65+
66+
// Should apply to types that have NonZero transitively
67+
assert_eq!(size_of::<String>(), size_of::<Option<String>>());
68+
5469
}

0 commit comments

Comments
 (0)