2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2014-02-17 11:53:12 +13:00
|
|
|
// Ensure assigning an owned or managed variable to itself works. In particular,
|
|
|
|
// that we do not glue_drop before we glue_take (#3290).
|
|
|
|
|
2015-01-08 02:25:56 +01:00
|
|
|
#![feature(box_syntax)]
|
|
|
|
|
2014-02-17 11:53:12 +13:00
|
|
|
use std::rc::Rc;
|
|
|
|
|
|
|
|
pub fn main() {
|
2015-02-17 21:41:32 +01:00
|
|
|
let mut x: Box<_> = box 3;
|
2014-02-17 11:53:12 +13:00
|
|
|
x = x;
|
2015-06-07 21:00:38 +03:00
|
|
|
assert_eq!(*x, 3);
|
2014-02-17 11:53:12 +13:00
|
|
|
|
2015-01-25 22:05:03 +01:00
|
|
|
let mut x = Rc::new(3);
|
2014-02-17 11:53:12 +13:00
|
|
|
x = x;
|
2015-06-07 21:00:38 +03:00
|
|
|
assert_eq!(*x, 3);
|
2014-02-17 11:53:12 +13:00
|
|
|
}
|