2012-12-10 19:32:48 -06:00
|
|
|
// Copyright 2012 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.
|
|
|
|
|
2014-04-14 10:30:31 -05:00
|
|
|
#![feature(managed_boxes)]
|
|
|
|
#![allow(dead_assignment)]
|
|
|
|
#![allow(unused_variable)]
|
2013-08-17 10:37:42 -05:00
|
|
|
|
2013-01-26 00:46:32 -06:00
|
|
|
struct A { a: int, b: int }
|
|
|
|
struct Abox { a: @int, b: @int }
|
2010-06-24 15:32:59 -05:00
|
|
|
|
2012-08-01 19:30:05 -05:00
|
|
|
fn ret_int_i() -> int { return 10; }
|
2010-06-24 15:32:59 -05:00
|
|
|
|
2012-08-01 19:30:05 -05:00
|
|
|
fn ret_ext_i() -> @int { return @10; }
|
2010-06-24 15:32:59 -05:00
|
|
|
|
2013-01-26 00:46:32 -06:00
|
|
|
fn ret_int_rec() -> A { return A {a: 10, b: 10}; }
|
2010-06-24 15:32:59 -05:00
|
|
|
|
2013-01-26 00:46:32 -06:00
|
|
|
fn ret_ext_rec() -> @A { return @A {a: 10, b: 10}; }
|
2011-06-15 13:19:50 -05:00
|
|
|
|
2013-01-26 00:46:32 -06:00
|
|
|
fn ret_ext_mem() -> Abox { return Abox {a: @10, b: @10}; }
|
2011-06-15 13:19:50 -05:00
|
|
|
|
2013-01-26 00:46:32 -06:00
|
|
|
fn ret_ext_ext_mem() -> @Abox { return @Abox{a: @10, b: @10}; }
|
2010-06-24 15:32:59 -05:00
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2012-03-22 10:39:41 -05:00
|
|
|
let mut int_i: int;
|
|
|
|
let mut ext_i: @int;
|
2013-01-26 00:46:32 -06:00
|
|
|
let mut int_rec: A;
|
|
|
|
let mut ext_rec: @A;
|
|
|
|
let mut ext_mem: Abox;
|
|
|
|
let mut ext_ext_mem: @Abox;
|
2011-06-15 13:19:50 -05:00
|
|
|
int_i = ret_int_i(); // initializing
|
|
|
|
|
|
|
|
int_i = ret_int_i(); // non-initializing
|
|
|
|
|
|
|
|
int_i = ret_int_i(); // non-initializing
|
|
|
|
|
|
|
|
ext_i = ret_ext_i(); // initializing
|
|
|
|
|
|
|
|
ext_i = ret_ext_i(); // non-initializing
|
|
|
|
|
|
|
|
ext_i = ret_ext_i(); // non-initializing
|
|
|
|
|
2011-07-26 07:49:40 -05:00
|
|
|
int_rec = ret_int_rec(); // initializing
|
2011-06-15 13:19:50 -05:00
|
|
|
|
2011-07-26 07:49:40 -05:00
|
|
|
int_rec = ret_int_rec(); // non-initializing
|
2011-06-15 13:19:50 -05:00
|
|
|
|
2011-07-26 07:49:40 -05:00
|
|
|
int_rec = ret_int_rec(); // non-initializing
|
2011-06-15 13:19:50 -05:00
|
|
|
|
2011-07-26 07:49:40 -05:00
|
|
|
ext_rec = ret_ext_rec(); // initializing
|
2011-06-15 13:19:50 -05:00
|
|
|
|
2011-07-26 07:49:40 -05:00
|
|
|
ext_rec = ret_ext_rec(); // non-initializing
|
2010-06-24 15:32:59 -05:00
|
|
|
|
2011-07-26 07:49:40 -05:00
|
|
|
ext_rec = ret_ext_rec(); // non-initializing
|
2010-06-24 15:32:59 -05:00
|
|
|
|
2011-06-15 13:19:50 -05:00
|
|
|
ext_mem = ret_ext_mem(); // initializing
|
2010-06-24 15:32:59 -05:00
|
|
|
|
2011-06-15 13:19:50 -05:00
|
|
|
ext_mem = ret_ext_mem(); // non-initializing
|
2010-06-24 15:32:59 -05:00
|
|
|
|
2011-06-15 13:19:50 -05:00
|
|
|
ext_mem = ret_ext_mem(); // non-initializing
|
2010-06-24 15:32:59 -05:00
|
|
|
|
2011-06-15 13:19:50 -05:00
|
|
|
ext_ext_mem = ret_ext_ext_mem(); // initializing
|
2010-06-24 15:32:59 -05:00
|
|
|
|
2011-06-15 13:19:50 -05:00
|
|
|
ext_ext_mem = ret_ext_ext_mem(); // non-initializing
|
2010-06-24 15:32:59 -05:00
|
|
|
|
2011-06-15 13:19:50 -05:00
|
|
|
ext_ext_mem = ret_ext_ext_mem(); // non-initializing
|
2010-06-24 15:32:59 -05:00
|
|
|
|
2011-08-19 17:16:48 -05:00
|
|
|
}
|