1
Fork 0

Fix the f16/f128 feature gate on integer literals

This commit is contained in:
beetrees 2025-04-03 01:08:41 +01:00
parent d5b4c2e4f1
commit 62fcb9d585
No known key found for this signature in database
GPG key ID: 8791BD754191EBD6
7 changed files with 66 additions and 22 deletions

View file

@ -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)