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

Compile Error when trying to compile schema with a List in it #122

Closed
gibsond opened this issue Feb 18, 2019 · 3 comments
Closed

Compile Error when trying to compile schema with a List in it #122

gibsond opened this issue Feb 18, 2019 · 3 comments

Comments

@gibsond
Copy link

gibsond commented Feb 18, 2019

I have a schema as such:

struct GatewayMsg {
       daqs @0 :List(DaqMsg);
       seq @1 :UInt64;
       title @2 :Text;
       version @3 :Text;
       datetime @4 :Text;
       health @5: UInt16;

       struct DaqMsg {
       	      mdata @0 :Data;
	}
}

And I get the error:
rror[E0433]: failed to resolve: could not find foo_capnp in {{root}}
--> /home/gibsond/rust_projs/es1800_zmqsubr/target/debug/build/es1800_zmqsubr-fbe222f1c797ab23/out/foo_capnp.rs:326:80
|
326 | pub fn get_daqs(self) -> ::capnp::Result<::capnp::struct_list::Reader<'a,::foo_capnp::gateway_msg::daq_msg::Owned>> {
| ^^^^^^^^^ could not find foo_capnp in {{root}}

error[E0433]: failed to resolve: could not find foo_capnp in {{root}}
--> /home/gibsond/rust_projs/es1800_zmqsubr/target/debug/build/es1800_zmqsubr-fbe222f1c797ab23/out/foo_capnp.rs:416:81
|
416 | pub fn get_daqs(self) -> ::capnp::Result<::capnp::struct_list::Builder<'a,::foo_capnp::gateway_msg::daq_msg::Owned>> {
| ^^^^^^^^^ could not find foo_capnp in {{root}}

error[E0433]: failed to resolve: could not find foo_capnp in {{root}}
--> /home/gibsond/rust_projs/es1800_zmqsubr/target/debug/build/es1800_zmqsubr-fbe222f1c797ab23/out/foo_capnp.rs:420:73
|
420 | pub fn set_daqs(&mut self, value: ::capnp::struct_list::Reader<'a,::foo_capnp::gateway_msg::daq_msg::Owned>) -> ::capnp::Result<()> {
| ^^^^^^^^^ could not find foo_capnp in {{root}}

error[E0433]: failed to resolve: could not find foo_capnp in {{root}}
--> /home/gibsond/rust_projs/es1800_zmqsubr/target/debug/build/es1800_zmqsubr-fbe222f1c797ab23/out/foo_capnp.rs:424:77
|
424 | pub fn init_daqs(self, size: u32) -> ::capnp::struct_list::Builder<'a,::foo_capnp::gateway_msg::daq_msg::Owned> {
| ^^^^^^^^^ could not find foo_capnp in {{root}}

I can fix the problem, after the fact, by changing the generated source code:
::foo_capnp::first_msg::second_msg to self::second_msg.

Or, in this example
:foo_capnp::gateway_msg::daq_msg to self::daq_msg

I see a similar issue inf the closed issues:
capnproto/capnpc-rust#5
capnproto/capnpc-rust#30
capnproto-rust/issues/16

However, this issue comes up in capnp version 0.9.4, and capnpc version 0.9.3.

Any help would be appreciated,
Daniel Gibson

@dwrensha
Copy link
Member

Are you using edition = "2018" in your Cargo.toml? If you, you'll need to call edition(RustEdition::Rust2018) when constructing your CompilerCommand in your build.rs.

@gibsond
Copy link
Author

gibsond commented Feb 19, 2019

Awesome !! Thank-you, that fixed the problem. Any thought of having capnproto-rust read the edition from the Cargo.toml file?

@dwrensha
Copy link
Member

I don't there's currently any way to automatically detect the edition.

I found some discussion on this topic:
rust-lang/cargo#6408
https://users.rust-lang.org/t/detect-edition-2018-from-cargo-build-rs/21134/5

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