]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | // run-pass |
0bf4aa26 | 2 | #![allow(unused_variables)] |
b7449926 XL |
3 | #![allow(stable_features)] |
4 | ||
54a0048b SL |
5 | // test that ordinary fat pointer operations work. |
6 | ||
7 | #![feature(braced_empty_structs)] | |
8 | #![feature(rustc_attrs)] | |
9 | ||
10 | use std::sync::atomic; | |
11 | use std::sync::atomic::Ordering::SeqCst; | |
12 | ||
9fa01778 | 13 | static COUNTER: atomic::AtomicUsize = atomic::AtomicUsize::new(0); |
54a0048b SL |
14 | |
15 | struct DropMe { | |
16 | } | |
17 | ||
18 | impl Drop for DropMe { | |
19 | fn drop(&mut self) { | |
20 | COUNTER.fetch_add(1, SeqCst); | |
21 | } | |
22 | } | |
23 | ||
54a0048b SL |
24 | fn fat_ptr_move_then_drop(a: Box<[DropMe]>) { |
25 | let b = a; | |
26 | } | |
27 | ||
28 | fn main() { | |
29 | let a: Box<[DropMe]> = Box::new([DropMe { }]); | |
30 | fat_ptr_move_then_drop(a); | |
31 | assert_eq!(COUNTER.load(SeqCst), 1); | |
32 | } |