rollup merge of #16889 : P1start/array-not-vector
This commit is contained in:
commit
fc6eb9a911
@ -3789,7 +3789,8 @@ pub fn ty_sort_string(cx: &ctxt, t: t) -> String {
|
||||
ty_enum(id, _) => format!("enum {}", item_path_str(cx, id)),
|
||||
ty_box(_) => "Gc-ptr".to_string(),
|
||||
ty_uniq(_) => "box".to_string(),
|
||||
ty_vec(_, _) => "vector".to_string(),
|
||||
ty_vec(_, Some(_)) => "array".to_string(),
|
||||
ty_vec(_, None) => "unsized array".to_string(),
|
||||
ty_ptr(_) => "*-ptr".to_string(),
|
||||
ty_rptr(_, _) => "&-ptr".to_string(),
|
||||
ty_bare_fn(_) => "extern fn".to_string(),
|
||||
|
16
src/test/compile-fail/array-not-vector.rs
Normal file
16
src/test/compile-fail/array-not-vector.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// 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 _x: int = [1i, 2, 3]; //~ ERROR expected int, found array
|
||||
|
||||
let x: &[int] = &[1, 2, 3];
|
||||
let _y: &int = x; //~ ERROR expected int, found unsized array
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user