Skip to content

Stability annotation on defaulted generics fails #79499

Open
@TimDiekmann

Description

@TimDiekmann

I'm adding <A: AllocRef = Global> to string types. Strings don't have a generic parameter, so the defaulted generic parameter is the first parameter:

pub struct String<#[unstable(feature = "allocator_api", issue = "32838")] A: AllocRef = Global> {}

However, the compiler complains, that this annotation is "useless":

error: This stability annotation is useless
   --> library/alloc/src/string.rs:280:75
    |
280 | pub struct String<#[unstable(feature = "allocator_api", issue = "32838")] A: AllocRef = Global> {
    |                                                                           ^

Was this simply not added by #77118 or is this a false positive in general?

cc @varkor @Avi-D-coder

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-allocatorsArea: Custom and system allocatorsA-stabilityArea: `#[stable]`, `#[unstable]` etc.C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions