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-17 00:58:55 +02:00
|
|
|
// Verify that managed pointers scope is treated like ownoed pointers.
|
|
|
|
// regresion test for #11586
|
|
|
|
|
2014-04-14 21:00:31 +05:30
|
|
|
#![feature(managed_boxes)]
|
2013-12-11 23:17:54 -08:00
|
|
|
|
2014-04-17 00:58:55 +02:00
|
|
|
fn foo<'a>(x: &'a @int) -> &'a int {
|
|
|
|
match x {
|
|
|
|
&ref y => {
|
|
|
|
&**y // Do not expect an error here
|
|
|
|
}
|
|
|
|
}
|
2013-01-07 16:57:43 -08:00
|
|
|
}
|
|
|
|
|
2014-04-17 00:58:55 +02:00
|
|
|
fn bar() {
|
|
|
|
let a = 3;
|
|
|
|
let mut y = &a;
|
|
|
|
if true {
|
|
|
|
let x = @3;
|
|
|
|
y = &*x; //~ ERROR `*x` does not live long enough
|
|
|
|
}
|
2013-01-07 16:57:43 -08:00
|
|
|
}
|
2014-04-17 00:58:55 +02:00
|
|
|
|
|
|
|
fn main() {}
|