1
Fork 0

Rollup merge of #132439 - tgross35:f16-f128-nan-lint, r=jieyouxu

Add `f16` and `f128` to `invalid_nan_comparison`

Currently `f32_nan` and `f64_nan` are used to provide the `invalid_nan_comparison` lint. Since we have `f16_nan` and `f128_nan`, hook these up so the new float types get the same lints.
This commit is contained in:
Guillaume Gomez 2024-11-02 03:08:52 +08:00 committed by GitHub
commit 2896483320
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 299 additions and 30 deletions

View file

@ -204,7 +204,10 @@ fn lint_nan<'tcx>(
return false;
};
matches!(cx.tcx.get_diagnostic_name(def_id), Some(sym::f32_nan | sym::f64_nan))
matches!(
cx.tcx.get_diagnostic_name(def_id),
Some(sym::f16_nan | sym::f32_nan | sym::f64_nan | sym::f128_nan)
)
}
_ => false,
}