-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move const fn floating point test out of
min_const_fn
- Loading branch information
1 parent
b428f28
commit 4cac90c
Showing
5 changed files
with
94 additions
and
62 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
src/test/ui/consts/const_fn_floating_point_arithmetic.gated.stderr
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,8 @@ | ||
error: fatal error triggered by #[rustc_error] | ||
--> $DIR/const_fn_floating_point_arithmetic.rs:20:1 | ||
| | ||
LL | fn main() {} | ||
| ^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
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,20 @@ | ||
// gate-test-const_fn_floating_point_arithmetic | ||
|
||
// revisions: stock gated | ||
|
||
#![feature(rustc_attrs)] | ||
#![cfg_attr(gated, feature(const_fn_floating_point_arithmetic))] | ||
|
||
const fn add(f: f32) -> f32 { f + 2.0 } | ||
//[stock]~^ floating point arithmetic | ||
const fn sub(f: f32) -> f32 { 2.0 - f } | ||
//[stock]~^ floating point arithmetic | ||
const fn mul(f: f32, g: f32) -> f32 { f * g } | ||
//[stock]~^ floating point arithmetic | ||
const fn div(f: f32, g: f32) -> f32 { f / g } | ||
//[stock]~^ floating point arithmetic | ||
const fn neg(f: f32) -> f32 { -f } | ||
//[stock]~^ floating point arithmetic | ||
|
||
#[rustc_error] | ||
fn main() {} //[gated]~ fatal error triggered by #[rustc_error] |
48 changes: 48 additions & 0 deletions
48
src/test/ui/consts/const_fn_floating_point_arithmetic.stock.stderr
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,48 @@ | ||
error[E0658]: floating point arithmetic is not allowed in constant functions | ||
--> $DIR/const_fn_floating_point_arithmetic.rs:8:31 | ||
| | ||
LL | const fn add(f: f32) -> f32 { f + 2.0 } | ||
| ^^^^^^^ | ||
| | ||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information | ||
= help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable | ||
|
||
error[E0658]: floating point arithmetic is not allowed in constant functions | ||
--> $DIR/const_fn_floating_point_arithmetic.rs:10:31 | ||
| | ||
LL | const fn sub(f: f32) -> f32 { 2.0 - f } | ||
| ^^^^^^^ | ||
| | ||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information | ||
= help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable | ||
|
||
error[E0658]: floating point arithmetic is not allowed in constant functions | ||
--> $DIR/const_fn_floating_point_arithmetic.rs:12:39 | ||
| | ||
LL | const fn mul(f: f32, g: f32) -> f32 { f * g } | ||
| ^^^^^ | ||
| | ||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information | ||
= help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable | ||
|
||
error[E0658]: floating point arithmetic is not allowed in constant functions | ||
--> $DIR/const_fn_floating_point_arithmetic.rs:14:39 | ||
| | ||
LL | const fn div(f: f32, g: f32) -> f32 { f / g } | ||
| ^^^^^ | ||
| | ||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information | ||
= help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable | ||
|
||
error[E0658]: floating point arithmetic is not allowed in constant functions | ||
--> $DIR/const_fn_floating_point_arithmetic.rs:16:31 | ||
| | ||
LL | const fn neg(f: f32) -> f32 { -f } | ||
| ^^ | ||
| | ||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information | ||
= help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable | ||
|
||
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
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