-
Notifications
You must be signed in to change notification settings - Fork 244
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
Trait bound struct implementations #3954
Comments
Thunkar
added a commit
to AztecProtocol/aztec-packages
that referenced
this issue
Jan 12, 2024
Closes #2787 Unfortunately key type with a `ToField` trait binding is only defined in the `.at` method, due to this blocker: noir-lang/noir#3954
AztecBot
pushed a commit
that referenced
this issue
Jan 12, 2024
Closes AztecProtocol/aztec-packages#2787 Unfortunately key type with a `ToField` trait binding is only defined in the `.at` method, due to this blocker: #3954
AztecBot
pushed a commit
to AztecProtocol/aztec-nr
that referenced
this issue
Jan 18, 2024
Closes AztecProtocol/aztec-packages#2787 Unfortunately key type with a `ToField` trait binding is only defined in the `.at` method, due to this blocker: noir-lang/noir#3954
michaelelliot
pushed a commit
to Swoir/noir_rs
that referenced
this issue
Feb 28, 2024
Closes AztecProtocol#2787 Unfortunately key type with a `ToField` trait binding is only defined in the `.at` method, due to this blocker: noir-lang/noir#3954
superstar0402
added a commit
to superstar0402/aztec-nr
that referenced
this issue
Aug 16, 2024
Closes AztecProtocol/aztec-packages#2787 Unfortunately key type with a `ToField` trait binding is only defined in the `.at` method, due to this blocker: noir-lang/noir#3954
It seems the second code snippet complies fine. Maybe this started working once we started checking trait where clauses. But please reopen if this is not the case! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
While trying to make Aztec's Map use a trait for keys, we want to bind that the key type implements the trait ToField.
In Rust, you could do something like this:
Where you'd trait bind your impl so a map could never be created with a key type that cannot be converted to usize.
In noir, trait binding impls is not working:
Happy Case
Trait binding impls is possible
Alternatives Considered
You can always make the specific function that needs the IntoField generic but then you'd be able to use a map with different key types, which sounds like a footgun for users.
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: