Skip to content

rust/flexbuffers: set MSRV and modernize#8973

Open
kaathewisegit wants to merge 2 commits intogoogle:masterfrom
kaathewisegit:msrv
Open

rust/flexbuffers: set MSRV and modernize#8973
kaathewisegit wants to merge 2 commits intogoogle:masterfrom
kaathewisegit:msrv

Conversation

@kaathewisegit
Copy link

flexbuffers don't use a lockfile, so they have a pretty recent minimum stable Rust version because of the transitive indexmap dependency. cargo-msrv put it at 1.82, so that's what I set rust-version to.

cargo-msrv on gnu
  [Meta]   cargo-msrv 0.18.4

Compatibility Check #1: Rust 1.63.0
  [FAIL]   Is incompatible

  ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
  │ error: failed to parse lock file at: /home/akolchin/fork/flatbuffers/rust/flexbuffers/Cargo.lock                                    │
  │                                                                                                                                     │
  │ Caused by:                                                                                                                          │
  │   lock file version `4` was found, but this version of Cargo does not understand this lock file, perhaps Cargo needs to be updated? │
  │                                                                                                                                     │
  ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯


Compatibility Check #2: Rust 1.79.0
  [FAIL]   Is incompatible

  ╭────────────────────────────────────────────────────────────────────────╮
  │     Updating crates.io index                                           │
  │  Downloading crates ...                                                │
  │   Downloaded num_enum_derive v0.5.11                                   │
  │   Downloaded equivalent v1.0.2                                         │
  │   Downloaded toml_datetime v0.6.11                                     │
  │   Downloaded proc-macro-crate v1.3.1                                   │
  │   Downloaded num_enum v0.5.11                                          │
  │   Downloaded byteorder v1.5.0                                          │
  │   Downloaded bitflags v1.3.2                                           │
  │   Downloaded once_cell v1.21.3                                         │
  │   Downloaded quote v1.0.45                                             │
  │   Downloaded unicode-ident v1.0.24                                     │
  │   Downloaded serde_core v1.0.228                                       │
  │   Downloaded serde_derive v1.0.228                                     │
  │   Downloaded proc-macro2 v1.0.106                                      │
  │   Downloaded memchr v2.8.0                                             │
  │   Downloaded toml_edit v0.19.15                                        │
  │   Downloaded serde v1.0.228                                            │
  │   Downloaded indexmap v2.13.0                                          │
  │   Downloaded hashbrown v0.16.1                                         │
  │   Downloaded winnow v0.5.40                                            │
  │   Downloaded syn v2.0.117                                              │
  │   Downloaded syn v1.0.109                                              │
  │ error: rustc 1.79.0 is not supported by the following package:         │
  │   indexmap@2.13.0 requires rustc 1.82                                  │
  │ Either upgrade rustc or select compatible dependency versions with     │
  │ `cargo update <name>@<current-ver> --precise <compatible-ver>`         │
  │ where `<compatible-ver>` is the latest version supporting rustc 1.79.0 │
  │                                                                        │
  │                                                                        │
  ╰────────────────────────────────────────────────────────────────────────╯


Compatibility Check #3: Rust 1.87.0
  [OK]     Is compatible

Compatibility Check #4: Rust 1.83.0
  [OK]     Is compatible

Compatibility Check #5: Rust 1.81.0
  [FAIL]   Is incompatible

  ╭────────────────────────────────────────────────────────────────────────╮
  │ error: rustc 1.81.0 is not supported by the following package:         │
  │   indexmap@2.13.0 requires rustc 1.82                                  │
  │ Either upgrade rustc or select compatible dependency versions with     │
  │ `cargo update <name>@<current-ver> --precise <compatible-ver>`         │
  │ where `<compatible-ver>` is the latest version supporting rustc 1.81.0 │
  │                                                                        │
  │                                                                        │
  ╰────────────────────────────────────────────────────────────────────────╯


Compatibility Check #6: Rust 1.82.0
  [OK]     Is compatible

Result:
   Considered (min … max):   Rust 1.31.1 … Rust 1.94.0
   Search method:            bisect
   MSRV:                     1.82.0
   Target:                   x86_64-unknown-linux-gnu
cargo-msrv on musl
  [Meta]   cargo-msrv 0.19.2

Compatibility Check #1: Rust 1.63.0
  [FAIL]   Is incompatible

  ╭──────────────────────────────────────────────────────────────────────────────╮
  │ error: failed to parse lock file at: /home/kaathewise/fork/flatbuffers/rust/ │
  │ flexbuffers/Cargo.lock                                                       │
  │                                                                              │
  │ Caused by:                                                                   │
  │   lock file version `4` was found, but this                                  │
  │ version of Cargo does not understand this lock file, perhaps Cargo needs to  │
  │ be updated?                                                                  │
  │                                                                              │
  ╰──────────────────────────────────────────────────────────────────────────────╯


Compatibility Check #2: Rust 1.79.0
  [FAIL]   Is incompatible

  ╭─────────────────────────────────────────────────────────────────╮
  │ error: rustc 1.79.0 is not supported by the following packages: │
  │   flexbuffers@25.12.19 requires rustc 1.82                      │
  │   indexmap@2.13.0 requires rustc 1.82                           │
  │                                                                 │
  │                                                                 │
  ╰─────────────────────────────────────────────────────────────────╯


Compatibility Check #3: Rust 1.87.0
  [OK]     Is compatible

Compatibility Check #4: Rust 1.83.0
  [OK]     Is compatible

Compatibility Check #5: Rust 1.81.0
  [FAIL]   Is incompatible

  ╭─────────────────────────────────────────────────────────────────╮
  │ error: rustc 1.81.0 is not supported by the following packages: │
  │   flexbuffers@25.12.19 requires rustc 1.82                      │
  │   indexmap@2.13.0 requires rustc 1.82                           │
  │                                                                 │
  │                                                                 │
  ╰─────────────────────────────────────────────────────────────────╯


Compatibility Check #6: Rust 1.82.0
  [OK]     Is compatible

Result:
   Considered (min … max):   Rust 1.31.1 … Rust 1.94.0
   Search method:            bisect
   MSRV:                     1.82.0
   Target:                   x86_64-unknown-linux-musl

All of the other changes were made with the 1.82 toolchain:

  • There are a lot of formatting updates because rustfmt has changed its rules since then.
  • Replaced min_value and max_value integer methods with MIN and MAX associated constants
  • extern crate declarations replaced with imports
  • Outdated 1.42 lint silencer removed and matches is now used where the lint was failing
  • I also replaced a few redundant casts (u8 as u8, usize as usize) because they showed up as warnings

Most of the other clippy warnings are about doc comment formatting.

This PR should unblock this feature:

// TODO(cneo): serde stuff are behind a default-on feature flag

which I initially wanted to implement but didn't because I unsure what effect on MSRV it would have

@google-cla
Copy link

google-cla bot commented Mar 11, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions bot added the rust label Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants