NaN patterns: indicate that is_NaN is a method
This commit is contained in:
parent
fdd71bece2
commit
f929a49d9c
@ -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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user