- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Closed
Copy link
Labels
C-bugCategory: This is a bug.Category: This is a bug.
Description
I tried this code:
// Doesn't compile: Unused parameter
// pub struct Nothing<ANY>
// {
//     nothing: ()
// }
// Use of N not enforced
pub struct JustNum<const N: usize> {
    nothing: ()
}
// Use of N not enforced
pub struct Generic<ANY, const N: usize>
{
    any: ANY
}
// Use of N not enforced
impl<const N: usize> JustNum<{ N }> {
    fn new() -> Self {
        Self { nothing: () } 
    }
}
// Does not compile: Extra "M" 
// impl<const N: usize, const M: usize> JustNum<{ N }, { M }> {
//     fn new() -> Self {
//         Self { nothing: () } 
//     }
// }I expected to see this happen:
For the following definition:
pub struct JustNum<const N: usize> {
    nothing: ()
}I expect a compiler error, due to the unused const-generic argument
Instead, this happened:
No error was emitted
Meta
This occurs in the current beta and nightly:
I'm not sure if const generic arguments are required to be used, but I could see this as an "odd" way to tag extra parameters on without them being bound to the actual impls.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.