2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2015-01-08 02:25:56 +01:00
|
|
|
|
2014-02-01 04:35:36 +08:00
|
|
|
use std::mem::swap;
|
2013-05-06 00:42:54 -04:00
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2021-08-25 02:39:40 +02:00
|
|
|
let mut i: Box<_> = Box::new(100);
|
|
|
|
|
let mut j: Box<_> = Box::new(200);
|
2014-02-01 04:35:36 +08:00
|
|
|
swap(&mut i, &mut j);
|
2021-08-25 02:39:40 +02:00
|
|
|
assert_eq!(i, Box::new(200));
|
|
|
|
|
assert_eq!(j, Box::new(100));
|
2013-02-14 11:47:00 -08:00
|
|
|
}
|