Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lcnr opened this issue Jul 18, 2024 · 0 comments
Open
Labels
C-design-docs Category: This is part of our design documentation

Comments

@lcnr
Copy link
Contributor

lcnr commented Jul 18, 2024

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.

@lcnr lcnr added the C-design-docs Category: This is part of our design documentation label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-design-docs Category: This is part of our design documentation
Projects
None yet
Development

No branches or pull requests

1 participant