Change rustc pretty-printing to print [T, ..n] instead of [T, .. n]
This commit is contained in:
parent
073a1abff2
commit
f56c67ba86
8 changed files with 10 additions and 10 deletions
|
@ -427,7 +427,7 @@ pub fn ty_to_string(cx: &ctxt, typ: t) -> String {
|
|||
ty_vec(t, sz) => {
|
||||
match sz {
|
||||
Some(n) => {
|
||||
format!("[{}, .. {}]", ty_to_string(cx, t), n)
|
||||
format!("[{}, ..{}]", ty_to_string(cx, t), n)
|
||||
}
|
||||
None => format!("[{}]", ty_to_string(cx, t)),
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ pub fn main() {
|
|||
let f1 = Fat { ptr: [1, 2, 3] };
|
||||
let f2: &Fat<[int, ..3]> = &f1;
|
||||
let f3: &Fat<[uint]> = f2;
|
||||
//~^ ERROR mismatched types: expected `&Fat<[uint]>`, found `&Fat<[int, .. 3]>`
|
||||
//~^ ERROR mismatched types: expected `&Fat<[uint]>`, found `&Fat<[int, ..3]>`
|
||||
|
||||
// With a trait.
|
||||
let f1 = Fat { ptr: Foo };
|
||||
|
|
|
@ -18,5 +18,5 @@ pub fn main() {
|
|||
// With a vec of ints.
|
||||
let f1: &Fat<[int]> = &Fat { ptr: [1, 2, 3] };
|
||||
let f2: &Fat<[int, ..3]> = f1;
|
||||
//~^ ERROR mismatched types: expected `&Fat<[int, .. 3]>`, found `&Fat<[int]>`
|
||||
//~^ ERROR mismatched types: expected `&Fat<[int, ..3]>`, found `&Fat<[int]>`
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ fn main() {
|
|||
let x = [1,2];
|
||||
let y = match x {
|
||||
[] => None,
|
||||
//~^ ERROR expected `[<generic integer #0>, .. 2]`, found a fixed vector pattern of size 0
|
||||
//~^ ERROR expected `[<generic integer #0>, ..2]`, found a fixed vector pattern of size 0
|
||||
[a,_] => Some(a)
|
||||
};
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@ struct X {
|
|||
fn main() {
|
||||
let x = X { a: [0] };
|
||||
let _f = &x.a as *mut u8;
|
||||
//~^ ERROR mismatched types: expected `*mut u8`, found `&[u8, .. 1]`
|
||||
//~^ ERROR mismatched types: expected `*mut u8`, found `&[u8, ..1]`
|
||||
|
||||
let local = [0u8];
|
||||
let _v = &local as *mut u8;
|
||||
//~^ ERROR mismatched types: expected `*mut u8`, found `&[u8, .. 1]`
|
||||
//~^ ERROR mismatched types: expected `*mut u8`, found `&[u8, ..1]`
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
fn main() {
|
||||
let _foo = &[1u, 2] as [uint];
|
||||
//~^ ERROR cast to unsized type: `&[uint, .. 2]` as `[uint]`
|
||||
//~^ ERROR cast to unsized type: `&[uint, ..2]` as `[uint]`
|
||||
//~^^ NOTE consider using an implicit coercion to `&[uint]` instead
|
||||
let _bar = box 1u as std::fmt::Show;
|
||||
//~^ ERROR cast to unsized type: `Box<uint>` as `core::fmt::Show`
|
||||
|
@ -19,6 +19,6 @@ fn main() {
|
|||
//~^ ERROR cast to unsized type: `uint` as `core::fmt::Show`
|
||||
//~^^ NOTE consider using a box or reference as appropriate
|
||||
let _quux = [1u, 2] as [uint];
|
||||
//~^ ERROR cast to unsized type: `[uint, .. 2]` as `[uint]`
|
||||
//~^ ERROR cast to unsized type: `[uint, ..2]` as `[uint]`
|
||||
//~^^ NOTE consider using a box or reference as appropriate
|
||||
}
|
||||
|
|
|
@ -22,5 +22,5 @@ impl<A> vec_monad<A> for Vec<A> {
|
|||
}
|
||||
fn main() {
|
||||
["hi"].bind(|x| [x] );
|
||||
//~^ ERROR type `[&str, .. 1]` does not implement any method in scope named `bind`
|
||||
//~^ ERROR type `[&str, ..1]` does not implement any method in scope named `bind`
|
||||
}
|
||||
|
|
|
@ -13,6 +13,6 @@ fn bar(int_param: int) {}
|
|||
fn main() {
|
||||
let foo: [u8, ..4] = [1u8, ..4u];
|
||||
bar(foo);
|
||||
//~^ ERROR mismatched types: expected `int`, found `[u8, .. 4]`
|
||||
//~^ ERROR mismatched types: expected `int`, found `[u8, ..4]`
|
||||
// (expected int, found vector)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue