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

Annotation and struct module names can conflict #404

Open
dzfranklin opened this issue Jun 4, 2023 · 1 comment
Open

Annotation and struct module names can conflict #404

dzfranklin opened this issue Jun 4, 2023 · 1 comment

Comments

@dzfranklin
Copy link
Contributor

In the capnp docs they mention a pattern where an annotation and the struct for its value share the same name.

struct Grault {
  value @0 :Int32 = 123;
}

annotation grault(file) :Grault;

Because both annations and structs get corresponding rust modules the generated code won't build.

I'm not sure what the right solution is here. A robust but maybe annoying option would be to add a prefix to annotation modules so you get something like annotation_grault and grault. Just naming the struct GraultOpts isn't a big deal either.

@dwrensha
Copy link
Member

dwrensha commented Jun 6, 2023

One thing we could do is make the $Rust.name annotation work on annotations:

annotation name @0xc2fe4c6d100166d0 (field, struct, enum, enumerant, union, group) :Text;

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

No branches or pull requests

2 participants