2014-02-16 16:53:12 -06:00
|
|
|
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
// Ensure assigning an owned or managed variable to itself works. In particular,
|
|
|
|
// that we do not glue_drop before we glue_take (#3290).
|
|
|
|
|
2015-03-22 15:13:15 -05:00
|
|
|
|
2015-01-07 19:25:56 -06:00
|
|
|
#![allow(unknown_features)]
|
|
|
|
#![feature(box_syntax)]
|
|
|
|
|
2014-02-16 16:53:12 -06:00
|
|
|
use std::rc::Rc;
|
|
|
|
|
|
|
|
pub fn main() {
|
2015-02-17 14:41:32 -06:00
|
|
|
let mut x: Box<_> = box 3;
|
2014-02-16 16:53:12 -06:00
|
|
|
x = x;
|
2015-06-07 13:00:38 -05:00
|
|
|
assert_eq!(*x, 3);
|
2014-02-16 16:53:12 -06:00
|
|
|
|
2015-01-25 15:05:03 -06:00
|
|
|
let mut x = Rc::new(3);
|
2014-02-16 16:53:12 -06:00
|
|
|
x = x;
|
2015-06-07 13:00:38 -05:00
|
|
|
assert_eq!(*x, 3);
|
2014-02-16 16:53:12 -06:00
|
|
|
}
|