-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Includes related tests and documentation pages. Michael Goulet: Don't issue feature error in resolver for f16/f128 unless finalize Co-authored-by: Michael Goulet <michael@errs.io>
- Loading branch information
1 parent
dc65095
commit e782d27
Showing
11 changed files
with
252 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# `f128` | ||
|
||
The tracking issue for this feature is: [#116909] | ||
|
||
[#116909]: https://github.com/rust-lang/rust/issues/116909 | ||
|
||
--- | ||
|
||
Enable the `f128` type for IEEE 128-bit floating numbers (quad precision). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# `f16` | ||
|
||
The tracking issue for this feature is: [#116909] | ||
|
||
[#116909]: https://github.com/rust-lang/rust/issues/116909 | ||
|
||
--- | ||
|
||
Enable the `f16` type for IEEE 16-bit floating numbers (half precision). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#![allow(unused)] | ||
|
||
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 | ||
foo(1.23); | ||
} | ||
|
||
fn foo(a: f128) {} //~ ERROR the type `f128` is unstable | ||
|
||
struct Bar { | ||
a: f128, //~ ERROR the type `f128` is unstable | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
error[E0658]: the type `f128` is unstable | ||
--> $DIR/feature-gate-f128.rs:3:10 | ||
| | ||
LL | const A: f128 = 10.0; | ||
| ^^^^ | ||
| | ||
= 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[E0658]: the type `f128` is unstable | ||
--> $DIR/feature-gate-f128.rs:6:12 | ||
| | ||
LL | let a: f128 = 100.0; | ||
| ^^^^ | ||
| | ||
= 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[E0658]: the type `f128` is unstable | ||
--> $DIR/feature-gate-f128.rs:11:11 | ||
| | ||
LL | fn foo(a: f128) {} | ||
| ^^^^ | ||
| | ||
= 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[E0658]: the type `f128` is unstable | ||
--> $DIR/feature-gate-f128.rs:14:8 | ||
| | ||
LL | a: f128, | ||
| ^^^^ | ||
| | ||
= 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[E0658]: the type `f128` is unstable | ||
--> $DIR/feature-gate-f128.rs:7:13 | ||
| | ||
LL | let b = 0.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 5 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#![allow(unused)] | ||
|
||
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 | ||
foo(1.23); | ||
} | ||
|
||
fn foo(a: f16) {} //~ ERROR the type `f16` is unstable | ||
|
||
struct Bar { | ||
a: f16, //~ ERROR the type `f16` is unstable | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
error[E0658]: the type `f16` is unstable | ||
--> $DIR/feature-gate-f16.rs:3:10 | ||
| | ||
LL | const A: f16 = 10.0; | ||
| ^^^ | ||
| | ||
= 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[E0658]: the type `f16` is unstable | ||
--> $DIR/feature-gate-f16.rs:6:12 | ||
| | ||
LL | let a: f16 = 100.0; | ||
| ^^^ | ||
| | ||
= 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[E0658]: the type `f16` is unstable | ||
--> $DIR/feature-gate-f16.rs:11:11 | ||
| | ||
LL | fn foo(a: f16) {} | ||
| ^^^ | ||
| | ||
= 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[E0658]: the type `f16` is unstable | ||
--> $DIR/feature-gate-f16.rs:14:8 | ||
| | ||
LL | a: f16, | ||
| ^^^ | ||
| | ||
= 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[E0658]: the type `f16` is unstable | ||
--> $DIR/feature-gate-f16.rs:7:13 | ||
| | ||
LL | let b = 0.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 5 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//@ compile-flags: --crate-type=lib | ||
//@ check-pass | ||
|
||
// Verify that gates for the `f16` and `f128` features do not apply to user types | ||
|
||
mod binary16 { | ||
#[allow(non_camel_case_types)] | ||
pub struct f16(u16); | ||
} | ||
|
||
mod binary128 { | ||
#[allow(non_camel_case_types)] | ||
pub struct f128(u128); | ||
} | ||
|
||
pub use binary128::f128; | ||
pub use binary16::f16; | ||
|
||
mod private16 { | ||
use crate::f16; | ||
|
||
pub trait SealedHalf {} | ||
impl SealedHalf for f16 {} | ||
} | ||
|
||
mod private128 { | ||
use crate::f128; | ||
|
||
pub trait SealedQuad {} | ||
impl SealedQuad for f128 {} | ||
} |