-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add method to get repr data of an ADT to ChalkDatabase #523
Conversation
Good start, couple of things I want to point out: |
Thanks for the feedback; I revised my PR accordingly. I'm not sure why the tests are failing though. |
Hmm, not sure, it doesn't like the letter "C" for some reason |
I think what is going is that due to this line the character C becomes a separate token which breaks occurrences of "C" as an identifier. I'm pretty clueless on how to fix this. |
I have no idea how lalrpop works internally, @nikomatsakis should know |
I think that (roughly) what happens is that the identifier I'll leave suggestions to fix it in a separate comment. |
chalk-parse/src/parser.lalrpop
Outdated
@@ -58,8 +58,11 @@ WellKnownTrait: WellKnownTrait = { | |||
"#" "[" "lang" "(" "unsize" ")" "]" => WellKnownTrait::Unsize, | |||
}; | |||
|
|||
StructReprC: () = "#" "[" "repr(C)" "]"; | |||
StructReprPacked: () = "#" "[" "repr(packed)" "]"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for this we should just parse any identifier and then generate a list of identifiers in the AST, perhaps, which lowering can match against "C" or "packed", or else have a match
statement that examines the identifier in the parser:
StructRepr: XXX = "#" "[" "repr" "(" <name:Ident>")" "]" => {
match name {
"C" => ...
"repr" => ...
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implemented your suggestion so that StructRepr now parses to an Atom.
Co-authored-by: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com>
a1cb5fe
to
931d61d
Compare
I think this looks good. @Areredify do you think we need anything other than |
Not for the foreseeable future I think (ignoring the shared type library part, that is) |
Thanks @voidc! |
Hi everyone! I'm Dominik and I'm interested in getting involved in rustc and chalk development. #517 seems like a good place to start and get familiar with the code.
With this WIP PR I would like to get some feedback on whether I understood the issue correctly and this is going in the right direction.
closes #517