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

Failures when building with rust 2018 #140

Open
SecurityInsanity opened this Issue Dec 11, 2018 · 2 comments

Comments

3 participants
@SecurityInsanity
Copy link

SecurityInsanity commented Dec 11, 2018

Enabling rust 2018 on a prost project will cause failures in certain generated messages. Specifically, those generated messages who end up generating modules. Specifically you might see error messages like:

error: cannot find derive macro `Oneof` in this scope
  --> /Users/vagrant/git/target/debug/build/gwiz-rust-427dfcfefeb48ff9/out/grpc.slack.rs:82:21
   |
82 |     #[derive(Clone, Oneof, PartialEq)]
   |                     ^^^^^

Or maybe even some messages like:

error[E0658]: The attribute `prost` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
  --> /Users/vagrant/git/target/debug/build/gwiz-rust-427dfcfefeb48ff9/out/grpc.slack.rs:90:9
   |
90 |         #[prost(string, tag="4")]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^

These are caused by internal modules not including the types from: prost_derive. (Specifically the generated macro types).

All we should need is an: "use prost_derive::*" in these generated modules, however we probably want to also turn it into a feature for only 2018, so this crate doesn't force 2018 edition code on others. Or maybe since it's an include that just won't get used it's fine since it'll be optimized away?

@leeola

This comment has been minimized.

Copy link

leeola commented Dec 31, 2018

Possibly related?

error[E0277]: the size for values of type `dyn std::fmt::Debug` cannot be known at compilation time
 --> /.../target/debug/build/prost-test-b14c221d72aa9018/out/foo.rs:1:28
  |
1 | #[derive(Clone, PartialEq, Message)]
  |                            ^^^^^^^ doesn't have a size known at compile-time
  |

via 2018 version. After switching to nightly, this went away. .. though, I'm still running into import failures via #142

@vorner

This comment has been minimized.

Copy link
Contributor

vorner commented Jan 6, 2019

I've worked around this with:

mod proto {
    use prost_derive::{Enumeration, Message};
    include!(concat!(env!("OUT_DIR"), "/proto.rs"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment