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

Allow AsTraitPaths in arithmetic generics #5794

Open
jfecher opened this issue Aug 22, 2024 · 0 comments
Open

Allow AsTraitPaths in arithmetic generics #5794

jfecher opened this issue Aug 22, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@jfecher
Copy link
Contributor

jfecher commented Aug 22, 2024

Problem

As mentioned in #5739, AsTraitPaths (<T as Trait>::Type) currently aren't allowed in arithmetic generics.

Happy Case

We should allow these in arithmetic generics to allow for code like:

impl<A, B> Serialize for (A, B) where A: Serialize, B: Serialize {
    let Size = <A as Serialize>::Size + <B as Serialize>::Size;
    ...
}

Once we allow for implicit associated types as well.

Workaround

These generics can be made explicit instead:

impl<A, B, let AS: u32, let BS: u32> Serialize for (A, B) where A: Serialize<Size = AS>, B: Serialize<Size = BS> {
    let Size = AS + BS;
    ...
}

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@jfecher jfecher added the enhancement New feature or request label Aug 22, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant