rust/src/test/ui/dst/dst-rvalue.rs

15 lines
381 B
Rust
Raw Normal View History

2014-09-02 03:55:07 +00:00
// Check that dynamically sized rvalues are forbidden
2015-01-08 02:53:58 +00:00
#![feature(box_syntax)]
2014-09-02 03:55:07 +00:00
pub fn main() {
let _x: Box<str> = box *"hello world";
//~^ ERROR E0161
//~^^ ERROR cannot move out of borrowed content
2014-09-02 03:55:07 +00:00
let array: &[isize] = &[1, 2, 3];
let _x: Box<[isize]> = box *array;
2014-09-02 03:55:07 +00:00
//~^ ERROR E0161
//~^^ ERROR cannot move out of type `[isize]`, a non-copy slice
2014-09-02 03:55:07 +00:00
}