Fix the f16
/f128
feature gate on integer literals
This commit is contained in:
parent
d5b4c2e4f1
commit
62fcb9d585
7 changed files with 66 additions and 22 deletions
|
@ -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)
|
||||
|
|
|
@ -19,7 +19,7 @@ LL | let a: f128 = 100.0;
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the type `f128` is unstable
|
||||
--> $DIR/feature-gate-f128.rs:15:11
|
||||
--> $DIR/feature-gate-f128.rs:16:11
|
||||
|
|
||||
LL | fn foo(a: f128) {}
|
||||
| ^^^^
|
||||
|
@ -29,7 +29,7 @@ LL | fn foo(a: f128) {}
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the type `f128` is unstable
|
||||
--> $DIR/feature-gate-f128.rs:18:8
|
||||
--> $DIR/feature-gate-f128.rs:19:8
|
||||
|
|
||||
LL | a: f128,
|
||||
| ^^^^
|
||||
|
@ -48,6 +48,16 @@ LL | let b = 0.0f128;
|
|||
= help: add `#![feature(f128)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error[E0658]: the type `f128` is unstable
|
||||
--> $DIR/feature-gate-f128.rs:12:13
|
||||
|
|
||||
LL | let c = 0f128;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
|
||||
= help: add `#![feature(f128)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
|
@ -19,7 +19,7 @@ LL | let a: f128 = 100.0;
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the type `f128` is unstable
|
||||
--> $DIR/feature-gate-f128.rs:15:11
|
||||
--> $DIR/feature-gate-f128.rs:16:11
|
||||
|
|
||||
LL | fn foo(a: f128) {}
|
||||
| ^^^^
|
||||
|
@ -29,7 +29,7 @@ LL | fn foo(a: f128) {}
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the type `f128` is unstable
|
||||
--> $DIR/feature-gate-f128.rs:18:8
|
||||
--> $DIR/feature-gate-f128.rs:19:8
|
||||
|
|
||||
LL | a: f128,
|
||||
| ^^^^
|
||||
|
@ -48,6 +48,16 @@ LL | let b = 0.0f128;
|
|||
= help: add `#![feature(f128)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error[E0658]: the type `f128` is unstable
|
||||
--> $DIR/feature-gate-f128.rs:12:13
|
||||
|
|
||||
LL | let c = 0f128;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
|
||||
= help: add `#![feature(f128)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
|
@ -9,6 +9,7 @@ const A: f128 = 10.0; //~ ERROR the type `f128` is unstable
|
|||
pub fn main() {
|
||||
let a: f128 = 100.0; //~ ERROR the type `f128` is unstable
|
||||
let b = 0.0f128; //~ ERROR the type `f128` is unstable
|
||||
let c = 0f128; //~ ERROR the type `f128` is unstable
|
||||
foo(1.23);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ LL | let a: f16 = 100.0;
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the type `f16` is unstable
|
||||
--> $DIR/feature-gate-f16.rs:15:11
|
||||
--> $DIR/feature-gate-f16.rs:16:11
|
||||
|
|
||||
LL | fn foo(a: f16) {}
|
||||
| ^^^
|
||||
|
@ -29,7 +29,7 @@ LL | fn foo(a: f16) {}
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the type `f16` is unstable
|
||||
--> $DIR/feature-gate-f16.rs:18:8
|
||||
--> $DIR/feature-gate-f16.rs:19:8
|
||||
|
|
||||
LL | a: f16,
|
||||
| ^^^
|
||||
|
@ -48,6 +48,16 @@ LL | let b = 0.0f16;
|
|||
= help: add `#![feature(f16)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error[E0658]: the type `f16` is unstable
|
||||
--> $DIR/feature-gate-f16.rs:12:13
|
||||
|
|
||||
LL | let c = 0f16;
|
||||
| ^^^^
|
||||
|
|
||||
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
|
||||
= help: add `#![feature(f16)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
|
@ -19,7 +19,7 @@ LL | let a: f16 = 100.0;
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the type `f16` is unstable
|
||||
--> $DIR/feature-gate-f16.rs:15:11
|
||||
--> $DIR/feature-gate-f16.rs:16:11
|
||||
|
|
||||
LL | fn foo(a: f16) {}
|
||||
| ^^^
|
||||
|
@ -29,7 +29,7 @@ LL | fn foo(a: f16) {}
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: the type `f16` is unstable
|
||||
--> $DIR/feature-gate-f16.rs:18:8
|
||||
--> $DIR/feature-gate-f16.rs:19:8
|
||||
|
|
||||
LL | a: f16,
|
||||
| ^^^
|
||||
|
@ -48,6 +48,16 @@ LL | let b = 0.0f16;
|
|||
= help: add `#![feature(f16)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error[E0658]: the type `f16` is unstable
|
||||
--> $DIR/feature-gate-f16.rs:12:13
|
||||
|
|
||||
LL | let c = 0f16;
|
||||
| ^^^^
|
||||
|
|
||||
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
|
||||
= help: add `#![feature(f16)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
|
@ -9,6 +9,7 @@ const A: f16 = 10.0; //~ ERROR the type `f16` is unstable
|
|||
pub fn main() {
|
||||
let a: f16 = 100.0; //~ ERROR the type `f16` is unstable
|
||||
let b = 0.0f16; //~ ERROR the type `f16` is unstable
|
||||
let c = 0f16; //~ ERROR the type `f16` is unstable
|
||||
foo(1.23);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue