4fc0452ace
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
21 lines
524 B
Rust
21 lines
524 B
Rust
fn main() {
|
|
let x: ~[(int, int)] = ~[];
|
|
match x {
|
|
[a, (2, 3), _] => (),
|
|
[(1, 2), (2, 3), b] => (), //~ ERROR unreachable pattern
|
|
_ => ()
|
|
}
|
|
|
|
match ~[~"foo", ~"bar", ~"baz"] {
|
|
[a, _, _, ..] => { println!("{}", a); }
|
|
[~"foo", ~"bar", ~"baz", ~"foo", ~"bar"] => { } //~ ERROR unreachable pattern
|
|
_ => { }
|
|
}
|
|
|
|
match ~['a', 'b', 'c'] {
|
|
['a', 'b', 'c', .._tail] => {}
|
|
['a', 'b', 'c'] => {} //~ ERROR unreachable pattern
|
|
_ => {}
|
|
}
|
|
}
|