forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#98907 - compiler-errors:plz-no-float, r=oli…
…-obk Deny float const params even when `adt_const_params` is enabled Supersedes rust-lang#98825 Fixes rust-lang#98813 r? ``@oli-obk``
- Loading branch information
Showing
7 changed files
with
135 additions
and
66 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
11 changes: 11 additions & 0 deletions
11
src/test/ui/const-generics/float-generic.adt_const_params.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,11 @@ | ||
error[E0741]: `f32` is forbidden as the type of a const generic parameter | ||
--> $DIR/float-generic.rs:5:17 | ||
| | ||
LL | fn foo<const F: f32>() {} | ||
| ^^^ | ||
| | ||
= note: floats do not derive `Eq` or `Ord`, which are required for const parameters | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0741`. |
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,12 @@ | ||
// revisions: simple adt_const_params | ||
#![cfg_attr(adt_const_params, feature(adt_const_params))] | ||
#![cfg_attr(adt_const_params, allow(incomplete_features))] | ||
|
||
fn foo<const F: f32>() {} | ||
//~^ ERROR `f32` is forbidden as the type of a const generic parameter | ||
|
||
const C: f32 = 1.0; | ||
|
||
fn main() { | ||
foo::<C>(); | ||
} |
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,11 @@ | ||
error: `f32` is forbidden as the type of a const generic parameter | ||
--> $DIR/float-generic.rs:5:17 | ||
| | ||
LL | fn foo<const F: f32>() {} | ||
| ^^^ | ||
| | ||
= note: the only supported types are integers, `bool` and `char` | ||
= help: more complex types are supported with `#![feature(adt_const_params)]` | ||
|
||
error: aborting due to previous error | ||
|