diff options
| author | beetrees <b@beetr.ee> | 2025-04-03 01:08:41 +0100 |
|---|---|---|
| committer | beetrees <b@beetr.ee> | 2025-04-03 01:08:41 +0100 |
| commit | 62fcb9d585723f0ab6646ba0e7dbaa72867bf8a8 (patch) | |
| tree | 0ed1745788a2b64f6f4a826eb4c2f7d33bc26f39 /compiler | |
| parent | d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df (diff) | |
| download | rust-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.rs | 22 |
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) |
