-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(frontend)!: Restrict numeric generic types to unsigned ints up to…
… `u32` (#5581) # Description ## Problem\* Resolves #5571 The issue references expanding the supported type-level integers, however, after a team discussion we decided to simply restrict the supported numeric generics. If other kinds of numeric generics become highly requested we can then re-assess whether we want to expand support for type level constants. ## Summary\* A new parser combinator for numeric generics was introduced to differentiate with the existing `type_expression` combinator. This is due to usage of `or_not` in the `generic_type_args` parser. Due to the `or_not` combinator the expression error was being ignored. Thus, the new numeric generic expression combinator returns an optional expression along with its parsed type. ## Additional Context This program: ```rust fn big<let N: u64>() -> u64 { N } fn main() { let _ = big::<18446744073709551615>(); } ``` gives the following error: <img width="972" alt="Screenshot 2024-07-23 at 12 18 00 PM" src="https://github.com/user-attachments/assets/fbbaf78a-ab86-4250-9008-ba4d2751409d"> The previous errors were very unclear: <img width="725" alt="Screenshot 2024-07-22 at 5 59 04 PM" src="https://github.com/user-attachments/assets/c532de18-0240-4a4a-acbc-f0be72b5b2db"> ## Documentation\* Check one: - [ ] No documentation needed. - [ ] Documentation included in this PR. - [X] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [X] I have tested the changes locally. - [X] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --------- Co-authored-by: jfecher <[email protected]>
- Loading branch information
Showing
5 changed files
with
46 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters