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

Implement typechecking for tuple structs #3848

Closed
wants to merge 1 commit into from

Conversation

pcwalton
Copy link
Contributor

@nikomatsakis
Copy link
Contributor

So, reading the code a bit more, my feeling is that there is no good reason to have the variant code and struct code do the same thing in two different places. I'd be happier saying r+ if the AST were refactored as necessary so that both structs and variants point to the same kind of AST node (perhaps struct_def or whatever it's called) that defines them both, and then they could share the same code in typeck, trans, etc Do you have plans in that direction?

@pcwalton
Copy link
Contributor Author

I do have plans to do that, yes, but part of the problem is that trans does have to treat them differently, due to the way enums are opaque and structs aren't, and enums have a discriminant and structs don't. So I don't think we'll get quite as much reuse as you were hoping (for example, ctor functions and patterns will need to be translated totally differently). There could definitely be more reuse at the AST level though.

@nikomatsakis
Copy link
Contributor

OK---I think we can get quite a bit of reuse in trans, but yes of course
there are differences between the two. Well, r+ in that case.

@pcwalton pcwalton closed this Oct 24, 2012
bors pushed a commit to rust-lang-ci/rust that referenced this pull request May 15, 2021
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.

None yet

4 participants