2014-01-28 16:38:07 -05:00
|
|
|
// Test that we cannot return a stack allocated slice
|
|
|
|
|
2015-01-08 21:54:35 +11:00
|
|
|
fn function(x: isize) -> &'static [isize] {
|
2019-04-22 08:40:08 +01:00
|
|
|
&[x] //~ ERROR cannot return reference to temporary value
|
2012-12-06 18:32:13 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2014-01-28 16:38:07 -05:00
|
|
|
let x = function(1);
|
|
|
|
let y = x[0];
|
2013-02-14 11:47:00 -08:00
|
|
|
}
|