-
Notifications
You must be signed in to change notification settings - Fork 508
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
prost-build 0.8.0 only adds final type_attribute
#502
Comments
Added a minimal example that fails to compile with |
After investigation, there appear two be two distinct changes introduced by the
use prost_build::Config;
fn main() {
let mut config = Config::new();
config.type_attribute(".", "#[derive(PartialOrd)]");
config.type_attribute("Example", "#[derive(Ord)]");
config
.compile_protos(&["./src/example.proto"], &["./src"])
.unwrap();
} The following rust code is generated: #[derive(Ord)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Example {
#[prost(string, tag="1")]
pub example_field: ::prost::alloc::string::String,
} Note that only the attribute matched by the |
This temporarily reverts commit 1efe42c. We'll reintroduce these changes when tokio-rs/prost#502 is fixed. Signed-off-by: Thane Thomson <connect@thanethomson.com>
This temporarily reverts commit 1efe42c. We'll reintroduce these changes when tokio-rs/prost#502 is fixed. Signed-off-by: Thane Thomson <connect@thanethomson.com>
prost_build::Config::type_attribute() doesn't appear to support repeated attributes any more, so fold together. (tokio-rs/prost#502) Also upgrade tonic* to 0.5
prost_build::Config::type_attribute() doesn't appear to support repeated attributes any more, so fold together. (tokio-rs/prost#502) Also upgrade tonic* to 0.5
@danburkert, this seems like a serious regression that blocks us from updating to the new version and fixing the RUSTSEC advisory... |
^ sorry to +1 this, but same - can't use |
just in case this helps anybody else, in my case I was able to use a single attribute with line break to achieve two attributes .type_attribute(".", "// first attribute\n// second attribute") not ideal and likely not covering all scenarios but at least does the trick in certain cases. |
I think this is either a duplicate of or related to #490. If so, I think this issue is more comprehensive, so it might be worth folding into this one. |
Fix/revert 7940dfd tokio-rs#502
Fixed in #522 |
This address tokio-rs#490 tokio-rs#502 tokio-rs#507 Co-authored-by: Guilhem Vallat <guilhem@harfanglab.fr> Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
This temporarily reverts commit 1efe42c8625045fd99072718faf96e81aeb9c6e6. We'll reintroduce these changes when tokio-rs/prost#502 is fixed. Signed-off-by: Thane Thomson <connect@thanethomson.com>
In prost-build 0.7.0, it was possible to add any number of type attributes, and all would be added to the generated struct. In the following minimal example:
Generates the following on prost-build 0.7.0:
Note that all configured type_attributes are added in the order they are configured. However, with prost-build 0.8.0, the generated output is:
Note that only the most recent
type_attribute
,PartialOrd
, has been added.This appears to be an unintentional breaking change, I expect introduced here: 79f0dfd#diff-5283c009c22e833ce65e3b8a6d7f57c026e0562f79225a9375f8e738ad4080c2R252-R260
I'll investigate further and see if I can submit a fix today.
The text was updated successfully, but these errors were encountered: