Skip to content

ambiguous multi-segment paths and min_generic_const_exprs will break derives #55

Open
@lcnr

Description

@lcnr

What is this

This is a design document for const generics. Any discussions about its content should be on zulip. The conclusions of these discussions should then be edited back into this issue. Please do not post any comments directly in this issue.

Content

trait Trait {
    const Assoc: usize;
}

#[derive(Clone)]
struct SomeType<const N: usize>;

#[derive(Clone)]
struct Foo<T: Trait> {
    value: SomeType<T::Assoc>,
}

The derive(Clone) cannot distinguish whether T::Assoc is a type or const argument. For type arguments it adds a where T::Assoc: Clone bound to the generated impl. This will therefore likely have to fail wiht an error as the derive tries to emit a T::Assoc: Clone bound which is not valid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-design-docsCategory: This is part of our design documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions