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