Skip to content

Commit 2300791

Browse files
committed
Add run-make test for --pretty typed
This test shows all the ways that a fixed-length vector can break --pretty typed.
1 parent ca24abd commit 2300791

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-include ../tools.mk
2+
3+
all:
4+
$(RUSTC) -o $(TMPDIR)/input.typed.rs --pretty=typed input.rs
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![crate_type="lib"]
12+
13+
// #4264 fixed-length vector types
14+
15+
pub fn foo(_: [int, ..3]) {}
16+
17+
pub fn bar() {
18+
static FOO: uint = 5u - 4u;
19+
let _: [(), ..FOO] = [()];
20+
21+
let _ : [(), ..1u] = [()];
22+
23+
let _ = &([1i,2,3]) as *const _ as *const [int, ..3u];
24+
25+
format!("test");
26+
}
27+
28+
pub type Foo = [int, ..3u];
29+
30+
pub struct Bar {
31+
pub x: [int, ..3u]
32+
}
33+
34+
pub struct TupleBar([int, ..4u]);
35+
36+
pub enum Baz {
37+
BazVariant([int, ..5u])
38+
}
39+
40+
pub fn id<T>(x: T) -> T { x }
41+
42+
pub fn use_id() {
43+
let _ = id::<[int, ..3u]>([1,2,3]);
44+
}

0 commit comments

Comments
 (0)