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