google-cloud-rust icon indicating copy to clipboard operation
google-cloud-rust copied to clipboard

doc/contributor: error following doc/contributor/howto-guide-generated-code-maintenance.md

Open julieqiu opened this issue 7 months ago • 3 comments

Tools:

protoc --version
libprotoc 29.3
cargo --version
cargo 1.80.1
go version
go version go1.24.3 darwin/arm64

When following https://github.com/googleapis/google-cloud-rust/blob/main/doc/contributor/howto-guide-generated-code-maintenance.md, I did the following:

  1. Deleted these files, so that I can generate them:
rm -rf /Users/julieqiu/code/googleapis/google-cloud-rust/src/generated/cloud/websecurityscanner/v1
  1. Ran this command:
go run -C generator/ ./cmd/sidekick rust-generate \                    
  -project-root .. \
  -service-config google/cloud/websecurityscanner/v1/websecurityscanner_v1.yaml
  1. Output:
2025/06/17 09:35:45 INFO Preparing cargo workspace to get new package
2025/06/17 09:35:45 INFO Generating new library code and adding it to git
/Users/julieqiu/bin/homebrew/bin/cargo fmt: exit status 1
`cargo metadata` exited with an error: error: failed to load manifest for workspace member `/Users/julieqiu/code/googleapis/google-cloud-rust/guide/samples`
referenced by workspace at `/Users/julieqiu/code/googleapis/google-cloud-rust/Cargo.toml`

Caused by:
  failed to parse manifest at `/Users/julieqiu/code/googleapis/google-cloud-rust/guide/samples/Cargo.toml`

Caused by:
  feature `edition2024` is required

  The package requires the Cargo feature called `edition2024`, but that feature is not stabilized in this version of Cargo (1.80.1).
  Consider trying a newer version of Cargo (this may require the nightly release).
  See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2024 for more information about the status of this feature.

This utility formats all bin and lib files of the current crate using rustfmt.

Usage: cargo fmt [OPTIONS] [-- <rustfmt_options>...]

Arguments:
  [rustfmt_options]...  Options passed to rustfmt

Options:
  -q, --quiet
          No output printed to stdout
  -v, --verbose
          Use verbose output
      --version
          Print rustfmt version and exit
  -p, --package <package>...
          Specify package to format
      --manifest-path <manifest-path>
          Specify path to Cargo.toml
      --message-format <message-format>
          Specify message-format: short|json|human
      --all
          Format all packages, and also their local path-based dependencies
      --check
          Run rustfmt in check mode
  -h, --help
          Print help


exit status 1

julieqiu avatar Jun 17 '25 13:06 julieqiu

/cc @coryan

julieqiu avatar Jun 17 '25 13:06 julieqiu

I ran into the same issues with refreshall:

go -C generator/ run ./cmd/sidekick refreshall -project-root .. && cargo fmt

refreshing 212 directories
2025/06/17 09:38:55 WARN mismatched body in additional binding (see AIP-127) message=.google.devtools.cloudbuild.v1.RunBuildTriggerRequest topLevelBody=source additionalBindingBody=*
2025/06/17 09:38:56 WARN message dropped documentation loc=[9] docs=" Reserved for testing unknown fields\n"
`cargo metadata` exited with an error: error: failed to load manifest for workspace member `/Users/julieqiu/code/googleapis/google-cloud-rust/guide/samples`
referenced by workspace at `/Users/julieqiu/code/googleapis/google-cloud-rust/Cargo.toml`

Caused by:
  failed to parse manifest at `/Users/julieqiu/code/googleapis/google-cloud-rust/guide/samples/Cargo.toml`

Caused by:
  feature `edition2024` is required

  The package requires the Cargo feature called `edition2024`, but that feature is not stabilized in this version of Cargo (1.80.1).
  Consider trying a newer version of Cargo (this may require the nightly release).
  See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2024 for more information about the status of this feature.

This utility formats all bin and lib files of the current crate using rustfmt.

Usage: cargo fmt [OPTIONS] [-- <rustfmt_options>...]

Arguments:
  [rustfmt_options]...  Options passed to rustfmt

Options:
  -q, --quiet
          No output printed to stdout
  -v, --verbose
          Use verbose output
      --version
          Print rustfmt version and exit
  -p, --package <package>...
          Specify package to format
      --manifest-path <manifest-path>
          Specify path to Cargo.toml
      --message-format <message-format>
          Specify message-format: short|json|human
      --all
          Format all packages, and also their local path-based dependencies
      --check
          Run rustfmt in check mode
  -h, --help
          Print help

julieqiu avatar Jun 17 '25 13:06 julieqiu

cargo --version cargo 1.80.1

You need rustc >= 1.85. We should fix the documentation to say so.

rm -rf /Users/julieqiu/code/googleapis/google-cloud-rust/src/generated/cloud/websecurityscanner/v1

That leaves a reference in the top-level Cargo.toml file, which rust-generate tries to add again and fails.

coryan avatar Jun 17 '25 13:06 coryan