protobuf-build icon indicating copy to clipboard operation
protobuf-build copied to clipboard

Bump prost to v0.12

Open timvisee opened this issue 1 year ago • 3 comments

This updates prost and related dependencies to v0.12.

We'd like to see this bump because this is blocking other dependency updates for us in Qdrant.

Similar to https://github.com/tikv/protobuf-build/pull/63 but for a newer version.

timvisee avatar Sep 08 '23 10:09 timvisee

@timvisee Bumping prost/prost-build alone won't work. run cargo build --no-default-features --features prost-codec

error[E0369]: binary operation `!=` cannot be applied to type `&syn::Type`
   --> src/wrapper.rs:443:23
    |
443 |                 if ty != &unboxed_type {
    |                    -- ^^ ------------- &syn::Type
    |                    |
    |                    &syn::Type

error[E0369]: binary operation `==` cannot be applied to type `Option<Colon2>`
   --> src/wrapper.rs:760:31
    |
760 |             if a.colon2_token == None {
    |                -------------- ^^ ---- Option<Colon2>
    |                |
    |                Option<Colon2>

For more information about this error, try `rustc --explain E0369`.
error: could not compile `protobuf-build` (lib) due to 2 previous errors

prost 0.12.x now uses syn 2.0.x while 0.11.x uses 1.0.y. Unfortunately, syn 2.0 and 1.0 are not compatible...

lizhanhui avatar Oct 10 '23 16:10 lizhanhui

The second issue is pretty easy to fix; while the first one, introduced in #67 , for some reason, becomes uncomparable @sunxiaoguang , would you please take a look?

lizhanhui avatar Oct 10 '23 16:10 lizhanhui

The second issue is pretty easy to fix; while the first one, introduced in #67 , for some reason, becomes uncomparable @sunxiaoguang , would you please take a look?

Thanks for looking into it! I wasn't aware that a different feature set had breakage.

I did attempt to bump syn as well just now. Sadly I'm a stuck, because it's unclear to me how to migrate nested meta parsing to the new API in syn 2.0.

The breaking changes for 2.0 are described in their change log here: https://github.com/dtolnay/syn/releases/tag/2.0.0

I've pushed all my changes and am left with:

$ cargo build --no-default-features --features prost-codec

   Compiling protobuf-build v0.15.1 (/home/timvisee/git/rust-protobuf-build)
error[E0599]: no method named `parse_meta` found for reference `&Attribute` in the current scope
   --> src/wrapper.rs:281:49
    |
281 |                 if let Ok(Meta::List(list)) = a.parse_meta() {
    |                                                 ^^^^^^^^^^ help: there is a method with a similar name: `parse_nested_meta`

error[E0609]: no field `nested` on type `MetaList`
   --> src/wrapper.rs:283:26
    |
283 |                         .nested
    |                          ^^^^^^ unknown field
    |
    = note: available fields are: `path`, `delimiter`, `tokens`

error[E0433]: failed to resolve: use of undeclared type `NestedMeta`
   --> src/wrapper.rs:286:36
    |
286 | ...                   if let NestedMeta::Meta(Meta::Path(id)) = item {
    |                              ^^^^^^^^^^ use of undeclared type `NestedMeta`

error[E0433]: failed to resolve: use of undeclared type `NestedMeta`
   --> src/wrapper.rs:312:43
    |
312 | ...                   } else if let NestedMeta::Meta(Meta::NameValue(mnv)) = item {
    |                                     ^^^^^^^^^^ use of undeclared type `NestedMeta`

Some errors have detailed explanations: E0433, E0599, E0609.
For more information about an error, try `rustc --explain E0433`.
error: could not compile `protobuf-build` (lib) due to 4 previous errors

Maybe someone with better understanding of these internals can take a look. I don't want to touch this without me understanding it.

timvisee avatar Oct 11 '23 08:10 timvisee