- Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed
Labels
A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-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 errors, and the error contains a suggestion how to fix the error:
#![feature(generic_associated_types)] #![feature(const_generics)] #![feature(const_evaluatable_checked)] trait Funk<const P: usize> { type Item<const N: usize>: Funk<{core::mem::size_of::<Self>()}>; }
The error message states:
error[E0277]: the size for values of type `Self` cannot be known at compilation time --> src/lib.rs:6:59 | 6 | type Item<const N: usize>: Funk<{core::mem::size_of::<Self>()}>; | ^^^^ doesn't have a size known at compile-time | help: consider further restricting `Self` | 5 | trait Funk: Sized<const P: usize> { | ^^^^^^^ error: aborting due to previous error; 3 warnings emitted For more information about this error, try `rustc --explain E0277`. error: could not compile `playground`
Obviously, writing trait Funk: Sized<const P: usize> {
is invalid syntax.
Metadata
Metadata
Assignees
Labels
A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-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.