about summary refs log tree commit diff
path: root/compiler/rustc_lint/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-11-02 03:08:52 +0800
committerGitHub <noreply@github.com>2024-11-02 03:08:52 +0800
commit2896483320b605502e2775255f093ff19640e12e (patch)
treeedcf404bfcf95b7db4ee462239c896404435ca41 /compiler/rustc_lint/src
parentc794207eae2725c2ad41bb7e90ee21b05bfc47ff (diff)
parent3afbe4f9c72ebd153e767b96a4efe422c91d6903 (diff)
downloadrust-2896483320b605502e2775255f093ff19640e12e.tar.gz
rust-2896483320b605502e2775255f093ff19640e12e.zip
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.
Diffstat (limited to 'compiler/rustc_lint/src')
-rw-r--r--compiler/rustc_lint/src/types.rs5
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,
         }