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