diff options
| author | Trevor Gross <tmgross@umich.edu> | 2024-10-31 21:24:31 -0500 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2024-10-31 21:26:36 -0500 |
| commit | 3afbe4f9c72ebd153e767b96a4efe422c91d6903 (patch) | |
| tree | 44dea1f0434b64054386e1ffeab48ef9013900bb /compiler/rustc_lint/src | |
| parent | 24254efb432739965c50c43c86b2eabbb947a31c (diff) | |
| download | rust-3afbe4f9c72ebd153e767b96a4efe422c91d6903.tar.gz rust-3afbe4f9c72ebd153e767b96a4efe422c91d6903.zip | |
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.
Diffstat (limited to 'compiler/rustc_lint/src')
| -rw-r--r-- | compiler/rustc_lint/src/types.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 88878a018e7..48dd8e38a03 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -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, } |
