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

libsyntax/librustc_front: Some visitor methods don't have access to span information #28750

Closed
petrochenkov opened this issue Sep 30, 2015 · 0 comments · Fixed by #29102
Closed

Comments

@petrochenkov
Copy link
Contributor

Namely:

visit_struct_def
visit_enum_def
visit_generics
visit_arm (can use span of inner Expr, but it's bad)

+ maybe

visit_trait_ref (can use span of inner Path, acceptable)
visit_ty_param_bound (can use span of inner Lifetime or PolyTraitRef, acceptable)
visit_lifetime_def (can use span of inner Lifetime, acceptable)

So, if I want to visit, for example, a StructDef and report an error, I can't do it and have to visit all its parents instead.

bors added a commit that referenced this issue Oct 14, 2015
This patch uses the same data structures for structs and enum variants in AST and HIR. These changes in data structures lead to noticeable simplification in most of code dealing with them.
I didn't touch the top level, i.e. `ItemStruct` is still `ItemStruct` and not `ItemEnum` with one variant, like in the type checker.
As part of this patch, structures and variants get the `kind` field making distinction between "normal" structs, tuple structs and unit structs explicit instead of relying on the number of fields and presence of constructor `NodeId`. In particular, we can now distinguish empty tuple structs from unit structs, which was impossible before! Comprehensive tests for empty structs are added and some improvements to empty struct feature gates are made. Some tests don't pass due to issue #28692 , they are still there for completeness, but are commented out.
This patch fixes issue mentioned in #16819 (comment), now emptiness of tuple structs is checked after expansion.
It also touches #28750 by providing span for visit_struct_def
cc #28336

r? @nrc
bors added a commit that referenced this issue Oct 17, 2015
Closes #28750
`Arm` and `Generics` don't have spans at all, so it's not a visitor's problem, `visit_struct_def` was fixed in #28816
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 a pull request may close this issue.

1 participant