]> git.lizzy.rs Git - rust.git/blob - tests/ui/regions/regions-return-stack-allocated-vec.rs
internally change regions to be covariant
[rust.git] / tests / ui / regions / regions-return-stack-allocated-vec.rs
1 // Test that we cannot return a stack allocated slice
2
3 fn function(x: isize) -> &'static [isize] {
4     &[x] //~ ERROR cannot return reference to temporary value
5 }
6
7 fn main() {
8     let x = function(1);
9     let y = x[0];
10 }