-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
The following code
struct G<T, const N: Vec<T>>(T);
fn main() {}
currently yields
error[E0770]: the type of const parameters must not depend on other generic parameters
--> src/lib.rs:1:26
|
1 | struct G<T, const N: Vec<T>>(T);
| ^ the type must not depend on the parameter `T`
|
= note: type parameters may not be used in the type of const parameters
error: `Vec<{type error}, {type error}>` is forbidden as the type of a const generic parameter
--> src/lib.rs:1:22
|
1 | struct G<T, const N: Vec<T>>(T);
| ^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
Ideally, we would replace the {type error}
with _
or prevent the second error from being be emitted (this can be achieved by bailing out early if the relevant type .references_errors()
).
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.