rust/tests/ui/dst/dst-rvalue.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
248 B
Rust
Raw Normal View History

2014-09-02 03:55:07 +00:00
// Check that dynamically sized rvalues are forbidden
pub fn main() {
let _x: Box<str> = Box::new(*"hello world");
//~^ ERROR E0277
2014-09-02 03:55:07 +00:00
let array: &[isize] = &[1, 2, 3];
let _x: Box<[isize]> = Box::new(*array);
//~^ ERROR E0277
2014-09-02 03:55:07 +00:00
}