diff options
| author | bors <bors@rust-lang.org> | 2014-01-29 05:06:44 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-01-29 05:06:44 -0800 |
| commit | 7b1432f6c0a18f27fc0003bdd8676ba7ec061306 (patch) | |
| tree | 9afd365d985bf0eb33b81c0879d3e286a4e48737 | |
| parent | 1d80a9a0f683a397392e0fea9e8c20b32b374fee (diff) | |
| parent | afd8df6af283ccf74184fbbaadec11cf27bc20c7 (diff) | |
| download | rust-7b1432f6c0a18f27fc0003bdd8676ba7ec061306.tar.gz rust-7b1432f6c0a18f27fc0003bdd8676ba7ec061306.zip | |
auto merge of #11889 : nikomatsakis/rust/issue-3243-stack-alloc-vec, r=nikomatsakis
(Lifetime of stack allocated vectors was not being enforced) Closes #3243.
| -rw-r--r-- | src/test/compile-fail/regions-return-stack-allocated-vec.rs (renamed from src/test/compile-fail/issue-3243.rs) | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/test/compile-fail/issue-3243.rs b/src/test/compile-fail/regions-return-stack-allocated-vec.rs index f235c4bc97c..b5f4fcadf89 100644 --- a/src/test/compile-fail/issue-3243.rs +++ b/src/test/compile-fail/regions-return-stack-allocated-vec.rs @@ -8,14 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// xfail-test -fn function() -> &mut [int] { - let mut x: &'static mut [int] = &[1,2,3]; - x[0] = 12345; - x //~ ERROR bad +// Test that we cannot return a stack allocated slice + +fn function(x: int) -> &'static [int] { + &[x] //~ ERROR mismatched types } fn main() { - let x = function(); - error!("%?", x); + let x = function(1); + let y = x[0]; } |
