Skip to content

Commit

Permalink
NaN patterns: indicate that is_NaN is a method
Browse files Browse the repository at this point in the history
  • Loading branch information
emillon committed Jul 25, 2013
1 parent fdd71be commit f929a49
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/librustc/middle/check_match.rs
Expand Up @@ -119,7 +119,7 @@ pub fn check_arms(cx: &MatchCheckCtxt, arms: &[arm]) {
for walk_pat(*pat) |p| {
if pat_matches_nan(p) {
cx.tcx.sess.span_warn(p.span, "unmatchable NaN in pattern, \
use is_NaN() in a guard instead");
use the is_NaN method in a guard instead");
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/issue-6804.rs
Expand Up @@ -8,12 +8,12 @@ fn main() {
NaN => {},
_ => {},
};
//~^^^ WARNING unmatchable NaN in pattern, use is_NaN() in a guard instead
//~^^^ WARNING unmatchable NaN in pattern, use the is_NaN method in a guard instead
match [x, 1.0] {
[NaN, _] => {},
_ => {},
};
//~^^^ WARNING unmatchable NaN in pattern, use is_NaN() in a guard instead
//~^^^ WARNING unmatchable NaN in pattern, use the is_NaN method in a guard instead
}

// At least one error is needed so that compilation fails
Expand Down

5 comments on commit f929a49

@bors
Copy link
Contributor

@bors bors commented on f929a49 Jul 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from cmr
at emillon@f929a49

@bors
Copy link
Contributor

@bors bors commented on f929a49 Jul 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging emillon/rust/issue-6804 = f929a49 into auto

@bors
Copy link
Contributor

@bors bors commented on f929a49 Jul 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emillon/rust/issue-6804 = f929a49 merged ok, testing candidate = b1f5b1b

@bors
Copy link
Contributor

@bors bors commented on f929a49 Jul 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = b1f5b1b

Please sign in to comment.