NaN patterns: indicate that is_NaN is a method

This commit is contained in:
Etienne Millon 2013-07-25 16:40:59 +02:00
parent fdd71bece2
commit f929a49d9c
2 changed files with 3 additions and 3 deletions

View File

@ -119,7 +119,7 @@ pub fn check_arms(cx: &MatchCheckCtxt, arms: &[arm]) {
for walk_pat(*pat) |p| { for walk_pat(*pat) |p| {
if pat_matches_nan(p) { if pat_matches_nan(p) {
cx.tcx.sess.span_warn(p.span, "unmatchable NaN in pattern, \ 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");
} }
} }

View File

@ -8,12 +8,12 @@ fn main() {
NaN => {}, 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] { match [x, 1.0] {
[NaN, _] => {}, [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 // At least one error is needed so that compilation fails