Skip to content

fix: support associated_const_equality in parser #12013

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

Merged
merged 2 commits into from
Apr 17, 2022

Conversation

xffxff
Copy link
Contributor

@xffxff xffxff commented Apr 17, 2022

This pr fixes #11965. The parser now allows eq constraints on associated constants.

I've added tests for HasCount<Count = {N}> and HasCount<Count = 0>

@xffxff xffxff changed the title support associated_const_equality in parser fix: support associated_const_equality in parser Apr 17, 2022
Comment on lines 1 to 3
impl<T, const N: usize> Foo for T where T: HasCount<COUNT = {N}> {}

impl<T> Foo for T where T: HasCount<COUNT = 0> {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests should be written as comments in the source code and then auto-generated by running cargo test -p syntax. See the // test test_name comments in the parser modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have written these tests as comments and changed them a bit.
It seems that cargo test -p syntax doesn't automatically generate tests files, instead, I manually run sourcegen_parser_tests

Copy link
Member

@Veykril Veykril Apr 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah my bad, its cargo test -p parser, sourcegen_parser_tests is the relevant one as you've found ye

@xffxff xffxff force-pushed the associated_const_equality branch from efe92b4 to b36f884 Compare April 17, 2022 12:12
@xffxff xffxff force-pushed the associated_const_equality branch from b36f884 to 6580d75 Compare April 17, 2022 12:26
@xffxff
Copy link
Contributor Author

xffxff commented Apr 17, 2022

Make the CI happy again :). Please take a look @Veykril

@Veykril
Copy link
Member

Veykril commented Apr 17, 2022

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Apr 17, 2022

📌 Commit 6580d75 has been approved by Veykril

@bors
Copy link
Contributor

bors commented Apr 17, 2022

⌛ Testing commit 6580d75 with merge a45a63e...

@bors
Copy link
Contributor

bors commented Apr 17, 2022

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing a45a63e to master...

@bors bors merged commit a45a63e into rust-lang:master Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False syntax errors with associated_const_equality
3 participants