rust/src/test/ui/issue-17441.rs

24 lines
938 B
Rust
Raw Normal View History

2014-09-27 12:22:32 -07:00
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
let _foo = &[1_usize, 2] as [usize];
2014-12-05 18:12:25 -08:00
//~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]`
let _bar = Box::new(1_usize) as std::fmt::Debug;
2017-01-21 17:40:31 +03:00
//~^ ERROR cast to unsized type: `std::boxed::Box<usize>` as `std::fmt::Debug`
let _baz = 1_usize as std::fmt::Debug;
2016-03-20 11:24:08 +00:00
//~^ ERROR cast to unsized type: `usize` as `std::fmt::Debug`
let _quux = [1_usize, 2] as [usize];
2014-12-05 18:12:25 -08:00
//~^ ERROR cast to unsized type: `[usize; 2]` as `[usize]`
2014-09-27 12:22:32 -07:00
}