Skip to content

Commit ccaf0b4

Browse files
committed
Remove a fixme
pcwalton says this is right, and it looks right to me too. Closes #4731
1 parent 1535a29 commit ccaf0b4

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

src/librustc/middle/check_match.rs

-1
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,6 @@ fn specialize(cx: &MatchCheckCtxt,
673673

674674
DefFn(..) |
675675
DefStruct(..) => {
676-
// FIXME #4731: Is this right? --pcw
677676
let new_args;
678677
match args {
679678
Some(args) => new_args = args,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
struct Foo {
12+
x: int,
13+
y: int,
14+
}
15+
16+
pub fn main() {
17+
let a = Foo { x: 1, y: 2 };
18+
match a {
19+
Foo { x: x, y: y } => (),
20+
Foo { .. } => () //~ ERROR unreachable pattern
21+
}
22+
23+
}

src/test/run-pass/struct-pattern-matching.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -18,4 +18,8 @@ pub fn main() {
1818
match a {
1919
Foo { x: x, y: y } => println!("yes, {}, {}", x, y)
2020
}
21+
22+
match a {
23+
Foo { .. } => ()
24+
}
2125
}

0 commit comments

Comments
 (0)