2014-02-05 16:33:10 -06:00
|
|
|
// Copyright 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.
|
|
|
|
|
2014-04-14 21:00:31 +05:30
|
|
|
#![feature(managed_boxes)]
|
2013-12-11 23:17:54 -08:00
|
|
|
|
2013-12-09 23:16:18 -08:00
|
|
|
struct Foo<'a> {
|
|
|
|
x: &'a int
|
2013-01-07 16:57:43 -08:00
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2014-04-17 00:58:55 +02:00
|
|
|
let f = Foo { x: @3 }; //~ ERROR borrowed value does not live long enough
|
2013-05-18 22:02:45 -04:00
|
|
|
assert_eq!(*f.x, 3);
|
2013-01-07 16:57:43 -08:00
|
|
|
}
|