-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong diagnostic: Type
must be annotated #[derive(PartialEq, Eq)]
to be used as the type of a const parameter
#80471
Comments
The real problem is that @rustbot label D-incorrect T-compiler requires-nightly |
@SNCPlay42 but why it compiles without the const parameter? playground |
Const generic parameters require that |
@SNCPlay42 interesting, that makes sense. Thank you. |
Type
must be annotated #[derive(PartialEq, Eq)]
to be used as the type of a const parameterType
must be annotated #[derive(PartialEq, Eq)]
to be used as the type of a const parameter
the error now mentions that #![feature(adt_const_params)]
#[derive(PartialEq, Eq)]
enum Nat {
Z,
S(Box<Nat>)
}
fn foo<const N: Nat>() {} |
I don't think this is fixed yet. We mention the Box, but where the Box comes from is still pretty opaque -- we should likely point at or say something about the enum variant. Saying that |
…Simulacrum Add a test for rust-lang#80471 Tests rust-lang#80471, but doesn't close it, see rust-lang#80471 (comment).
…Simulacrum Add a test for rust-lang#80471 Tests rust-lang#80471, but doesn't close it, see rust-lang#80471 (comment).
…askrgr Rollup of 9 pull requests Successful merges: - rust-lang#97917 (Implement ExitCodeExt for Windows) - rust-lang#98844 (Reword comments and rename HIR visiting methods.) - rust-lang#98979 (interpret: use AllocRange in UninitByteAccess) - rust-lang#98986 (Fix missing word in comment) - rust-lang#98994 (replace process exit with more detailed exit in src/bootstrap/*.rs) - rust-lang#98995 (Add a test for rust-lang#80471) - rust-lang#99002 (suggest adding a derive for #[default] applied to variants) - rust-lang#99004 (Add a test for rust-lang#70408) - rust-lang#99017 (Replace boolean argument for print_where_clause with an enum to make code more clear) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Current output:
|
Current output with the feature enabled:
|
I tried this code:
And got this error:
The code without the const parameter compiles, though:
Meta
rustc +nightly --version --verbose
:The text was updated successfully, but these errors were encountered: