2012-12-10 19:32:48 -06:00
|
|
|
// Copyright 2012 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.
|
|
|
|
|
2012-01-19 20:31:08 -06:00
|
|
|
enum t { a, b, }
|
2010-12-02 16:50:00 -06:00
|
|
|
|
2012-02-15 02:40:42 -06:00
|
|
|
fn main() {
|
|
|
|
let x = a;
|
2012-08-06 14:34:08 -05:00
|
|
|
match x { b => { } } //~ ERROR non-exhaustive patterns
|
|
|
|
match true { //~ ERROR non-exhaustive patterns
|
2012-08-03 21:59:04 -05:00
|
|
|
true => {}
|
2012-02-15 02:40:42 -06:00
|
|
|
}
|
2012-08-20 14:23:37 -05:00
|
|
|
match @Some(10) { //~ ERROR non-exhaustive patterns
|
|
|
|
@None => {}
|
2012-02-15 02:40:42 -06:00
|
|
|
}
|
2012-08-06 14:34:08 -05:00
|
|
|
match (2, 3, 4) { //~ ERROR non-exhaustive patterns
|
2012-08-03 21:59:04 -05:00
|
|
|
(_, _, 4) => {}
|
2012-02-15 02:40:42 -06:00
|
|
|
}
|
2012-08-06 14:34:08 -05:00
|
|
|
match (a, a) { //~ ERROR non-exhaustive patterns
|
2012-08-03 21:59:04 -05:00
|
|
|
(a, b) => {}
|
|
|
|
(b, a) => {}
|
2012-04-24 04:13:25 -05:00
|
|
|
}
|
2012-08-06 14:34:08 -05:00
|
|
|
match a { //~ ERROR b not covered
|
2012-08-03 21:59:04 -05:00
|
|
|
a => {}
|
2012-05-03 10:35:12 -05:00
|
|
|
}
|
2012-04-24 04:13:25 -05:00
|
|
|
// This is exhaustive, though the algorithm got it wrong at one point
|
2012-08-06 14:34:08 -05:00
|
|
|
match (a, b) {
|
2012-08-03 21:59:04 -05:00
|
|
|
(a, _) => {}
|
|
|
|
(_, a) => {}
|
|
|
|
(b, b) => {}
|
2012-04-24 04:13:25 -05:00
|
|
|
}
|
2012-02-15 02:40:42 -06:00
|
|
|
}
|