about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorbeetrees <b@beetr.ee>2025-04-03 01:08:41 +0100
committerbeetrees <b@beetr.ee>2025-04-03 01:08:41 +0100
commit62fcb9d585723f0ab6646ba0e7dbaa72867bf8a8 (patch)
tree0ed1745788a2b64f6f4a826eb4c2f7d33bc26f39 /compiler
parentd5b4c2e4f19b6d7037371cdaecc3cc2c701c68df (diff)
downloadrust-62fcb9d585723f0ab6646ba0e7dbaa72867bf8a8.tar.gz
rust-62fcb9d585723f0ab6646ba0e7dbaa72867bf8a8.zip
Fix the `f16`/`f128` feature gate on integer literals
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_ast_passes/src/feature_gate.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs
index ea60e083c4c..5745a52df71 100644
--- a/compiler/rustc_ast_passes/src/feature_gate.rs
+++ b/compiler/rustc_ast_passes/src/feature_gate.rs
@@ -332,17 +332,19 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
             ast::ExprKind::TryBlock(_) => {
                 gate!(&self, try_blocks, e.span, "`try` expression is experimental");
             }
-            ast::ExprKind::Lit(token::Lit { kind: token::LitKind::Float, suffix, .. }) => {
-                match suffix {
-                    Some(sym::f16) => {
-                        gate!(&self, f16, e.span, "the type `f16` is unstable")
-                    }
-                    Some(sym::f128) => {
-                        gate!(&self, f128, e.span, "the type `f128` is unstable")
-                    }
-                    _ => (),
+            ast::ExprKind::Lit(token::Lit {
+                kind: token::LitKind::Float | token::LitKind::Integer,
+                suffix,
+                ..
+            }) => match suffix {
+                Some(sym::f16) => {
+                    gate!(&self, f16, e.span, "the type `f16` is unstable")
                 }
-            }
+                Some(sym::f128) => {
+                    gate!(&self, f128, e.span, "the type `f128` is unstable")
+                }
+                _ => (),
+            },
             _ => {}
         }
         visit::walk_expr(self, e)