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

Support for include!() macro (e.g. cap'n'proto rust support) #13455

Open
vlovich opened this issue Oct 21, 2022 · 1 comment
Open

Support for include!() macro (e.g. cap'n'proto rust support) #13455

vlovich opened this issue Oct 21, 2022 · 1 comment
Labels
C-support Category: support questions

Comments

@vlovich
Copy link

vlovich commented Oct 21, 2022

The way cap'n'proto works is it generates a file from a schema within build.rs. Within your lib.rs you'll do something like:

mod example_capnp {
  include!(concat!(env!("OUT_DIR"), "/capnp/example_capnp.rs"));
}

However rust-analyzer gives up and doesn't offer any completions for example_capnp::. I'm guessing it's because it doesn't know how to handle include! (& maybe env!?).

@bjorn3
Copy link
Member

bjorn3 commented Oct 21, 2022

include!() and env!("OUT_DIR") are supported. If you are having issues, that is likely because the build script failed to run. I believe you can look at the Rust Analyzer Server output channel to see the result of running cargo by rust-analyzer for the purpose of running build scripts.

@jonas-schievink jonas-schievink added the C-support Category: support questions label Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-support Category: support questions
Projects
None yet
Development

No branches or pull requests

3 participants