Repository navigation
Rust: Bump toolchain to 1.94.1 and fix resulting lint/dependency failures - #8207
Conversation
There was a problem hiding this comment.
🤖 AI Code Example Review
This PR is a well-scoped maintenance update that restores a broken Rust CI pipeline by bumping the toolchain to 1.94.1 and addressing the resulting lint/dependency failures. All changes are minimal, targeted, and correct — this should pass review.
Detailed Review
-
[nit]
rustv1/webassembly/Cargo.toml: The version range>=1.1, <1.2foraws-configis very narrow (only the 1.1.x patch series). Given that AWS SDK crates follow a rapid release cadence, this tight upper bound may need revisiting sooner than expected. A comment explaining why the cap sits below 1.2 (i.e., thehttp0.2 vs 1.x TryFrom breakage) would help future maintainers avoid accidentally widening it. -
[nit]
rustv1/webassembly/Cargo.toml: Similarly, the range foraws-sdk-lambda(>=1.3, <1.20) has a wider upper bound than the smithy crates (<1.8,<1.3). Ifaws-sdk-lambda1.19 pulls in an incompatibleaws-smithy-runtime-api, Cargo will still resolve within the declared range and could surface a runtime breakage. Ideally the caps would be tightened consistently, or the PR description's rationale (aws-smithy-runtime-api 1.7.3) would be encoded as a pinned version comment. -
[nit]
rustv1/examples/iam/src/bin/hello.rs: ReturningBox<SdkError<...>>frommainsilences theresult_large_errlint but makes the error output slightly less readable for end-users (theDebugimpl forBox<E>delegates toE, so it's functionally fine). An alternative would be a newtype or aStringconversion, but boxing is an accepted idiom here and consistent with how the SDK docs handle this. -
[nit]
rustv1/cross_service/photo_asset_management/src/handlers/detect_labels.rs: The async functiondetect_recordpreviously carried a spurious'alifetime that was elided. The removal is correct. However, the parametersbucket: &Stringandobject: &Stringwould be more idiomatic asbucket: &str/object: &str— this is a pre-existing issue unrelated to the PR, so it's a nit rather than blocking. -
[nit]
rustv1/examples/testing/src/traits.rs: The#[allow(dead_code)]is placed on the struct. The fieldsexpected_bucket,expected_prefix, andpagesare still read withinimpl ListObjects for TestListObjects, so the lint most likely fires only becauseTestListObjects::new(a constructor) is absent and the struct is only instantiated via struct literals in tests. The attribute is correct and the comment// Demonstration fake used by the documentation snippet.is a nice touch that explains the intent. -
[policy] No new tests are added, which is appropriate — this PR only fixes existing lint/toolchain issues rather than adding new functionality. The existing tests in
detect_labels.rsandtraits.rsare unchanged and continue to cover the modified code. -
[nit]
rustv1/cross_service/rust-toolchain.tomljumps from1.87.0to1.94.1, skipping intermediate versions. The PR description explains the version was already one step behind (1.88.0in CI vs1.87.0in toml) before this PR. Going forward it would be cleaner to keep both files in sync, but this is a pre-existing skew that this PR resolves. -
[nit] The
webassemblyworkspace does not appear to have its ownrust-toolchain.tomlupdated (onlycross_serviceandexamplesare updated). Since the wasm workspace intentionally pins older AWS crates, this may be intentional — a brief comment in the PR or the toml itself would clarify whether the wasm workspace is expected to run under a different channel. -
[policy] The PR description mentions that
cargo clippy --allandcargo fmt --all --checkwere verified locally across all four workspaces. Since the CI job was the exact thing being fixed, it is important that this PR itself triggers theLint Rustjob on the PR branch; the reviewer should confirm the CI badge is green before merging. -
[nit]
rustv1/examples/eks/src/bin/create-cluster.rsalready has a file-level#![allow(clippy::result_large_err)]but also has#[allow(clippy::result_large_err)]onmain. The doc indentation fix is the actual change here; the duplicate allow attributes are pre-existing and unrelated to this PR.
Reviewed at commit 39cb37923d13f3403642c0830eb5f651d6831200. This review was generated automatically using Amazon Bedrock. It compares your changes against existing examples and coding guidelines. Findings are labeled by severity (blocking / nit / policy) and reflect only the commit above. Please use your judgment — this is advisory, not authoritative.
39cb379 to
17198ec
Compare
|
Updated per Rust team feedback:
Verified: |
There was a problem hiding this comment.
🤖 AI Code Example Review
This follow-up commit adds Cargo.lock files and removes the global Cargo.lock gitignore entry — a necessary companion to the toolchain/dependency changes from the prior commit. All previously raised nits remain valid but unchanged; no new blocking issues are introduced.
Detailed Review
-
[policy] The primary change in this commit is adding
rustv1/cross_service/Cargo.lock(5615 lines) and removingCargo.lockfromrustv1/.gitignore. This is a significant policy shift: the repo previously intentionally gitignored lock files (per the PR description), but this commit checks one in. The PR description says 'The repo intentionally gitignoresCargo.lock', yet this commit contradicts that. A human reviewer should explicitly decide whether committing lock files is the new policy for all workspaces or justcross_service. -
[nit] Only
rustv1/cross_service/Cargo.lockis added, but the.gitignoreremoval applies to all ofrustv1/. This meansexamples/,lambda/, andwebassembly/workspaces will also no longer have their lock files ignored going forward, yet no lock files are committed for those workspaces. This asymmetry could lead to accidental lock file commits in those workspaces by contributors, or confusion about why they are not present. Consider either committing all four lock files or restoring the gitignore and adding per-workspace overrides. -
[nit] The
cross_servicelock file resolvesaws-smithy-runtime-apito1.19.0(visible in the lock), while thewebassemblyworkspace intentionally caps it at<1.8(from the prior commit). This is correct and expected per the PR description, but worth noting for reviewers: the two workspaces are intentionally on divergent SDK generations. -
[nit] Previously raised concern about
bucket: &String/object: &Stringindetect_labels.rs(prefer&str) is still present in the current code at lines ~55-57 of that file. This is pre-existing and unrelated to this PR's changes, so it remains a nit. -
[nit] The
rustv1/examples/eks/src/bin/create-cluster.rsfile has both a file-level#![allow(clippy::result_large_err)]and a function-level#[allow(clippy::result_large_err)]onmain. This duplicate allow is still present and pre-existing; the PR only touched the doc comment indentation in that file. -
[policy] No lock files are committed for
examples,lambda, orwebassemblyworkspaces. If the intent is to stabilize CI by locking dependency resolution, all four workspaces should have committed lock files, otherwise onlycross_servicebenefits from reproducible builds. -
[nit] The committed
Cargo.lockuses formatversion = 4, which requires Cargo 1.78+. This is consistent with the 1.94.1 toolchain pin, so it is fine — but worth noting that the lock file cannot be read by older Cargo versions if someone tries to use an older toolchain. -
[policy] The prior review's suggestion to add an inline comment to
webassembly/Cargo.tomlexplaining the<1.2cap onaws-config(to help future maintainers) has not been addressed. This remains an open nit from the previous review cycle.
Reviewed at commit 17198ecc7faacbb008e85827917137f7d4880cb8. This review was generated automatically using Amazon Bedrock. It compares your changes against existing examples and coding guidelines. Findings are labeled by severity (blocking / nit / policy) and reflect only the commit above. Please use your judgment — this is advisory, not authoritative.
landonxjames
left a comment
There was a problem hiding this comment.
All changes look good to me, thanks for keeping our examples updated!
The AWS SDK for Rust crates raised their MSRV to 1.94.1, so the pinned 1.88.0 CI toolchain can no longer resolve/compile the rustv1 workspaces. Run tools/set_rust_version.py 1.94.1 to update the lint-rust workflow and both rust-toolchain.toml channels in sync with the SDK MSRV. sim: https://t.corp.amazon.com/V2245921888
Bumping to 1.94.1 enabled new lints that failed under -D warnings in pre-existing examples: - cross_service photo_asset_management: drop unused/elided lifetimes - examples/eks: fix doc list item overindentation - examples/iam hello: box the large SdkError variant (result_large_err) - examples/testing: allow dead_code on a documentation fake struct cargo clippy --all and cargo fmt --check pass on cross_service and examples with the 1.94.1 toolchain. webassembly is handled separately (http 0.2 -> 1.x breaking change). sim: https://t.corp.amazon.com/V2245921888
aws-smithy-runtime-api >= 1.8 switched its http Request/Response conversions from http 0.2 to http 1.x. Bump the webassembly crate's http dependency from 0.2 to 1 so aws-wasm's custom HTTP adapter builds against the current SDK. The http::Response builder API (status/header/ body) is unchanged between 0.2 and 1.x, so no changes to lib.rs are required; the aws-* dependencies return to their original (unpinned) versions. Per Rust team guidance (they migrated SDK internals to http 1.x). Verified: cargo clippy --all, fmt --check, and test --no-run pass on the wasm32 target with 1.94.1. sim: https://t.corp.amazon.com/V2245921888
The rustv1 workspaces gitignored Cargo.lock, so CI resolved dependencies freshly on every run and drifted to the latest crates - the root cause of the recurring MSRV breakage (crates silently requiring newer rustc) that this PR fixes. Stop ignoring Cargo.lock and commit a lockfile per workspace (cross_service, examples, lambda, webassembly) so builds are reproducible and dependency/MSRV changes become explicit, reviewed diffs. Per Rust team guidance (lockfiles should be committed). sim: https://t.corp.amazon.com/V2245921888
17198ec to
8943e32
Compare
There was a problem hiding this comment.
🤖 AI Code Example Review
This follow-up commit is a clean maintenance update. All previously raised nits remain valid but are pre-existing or stylistic; no new blocking issues are introduced. The commit correctly adds Cargo.lock files and removes the global gitignore entry, completing the toolchain bump work from the prior commit.
Detailed Review
-
[policy] The addition of Cargo.lock files to the repository (removing the global
Cargo.lockentry from.gitignore) is the primary change in this commit. This is the correct companion step to the toolchain/dependency changes: pinning lock files ensures reproducible builds in CI and prevents silent dependency float. This is good practice. -
[nit] Prior item (still present, not new):
rustv1/cross_service/photo_asset_management/src/handlers/detect_labels.rsline ~54 —detect_recordtakesbucket: &Stringandobject: &String. These would be more idiomatic as&str. This is pre-existing and unrelated to this commit's changes. -
[nit] Prior item (still present, not new):
rustv1/examples/iam/src/bin/hello.rsreturnsBox<SdkError<ListPoliciesError>>frommain. Boxing is an accepted idiom here and functionally fine; a newtype oranyhowwould be marginally more user-friendly but is not required. -
[nit] The
cross_service/Cargo.lockis 5,615 lines, covering many transitive dependencies (actix-web, bindgen, chrono, etc.). This is expected for a multi-crate workspace, but reviewers should be aware that future SDK bumps will require regenerating this file. A brief note inrustv1/README.mdabout how to regenerate the lock files after SDK updates would be helpful for future maintainers. -
[nit] Prior item (addressed): The
detect_recordfunction's spurious'alifetime has been correctly removed in the prior commit and remains absent in the current code. This is resolved. -
[nit] Prior item (addressed): The
#[allow(dead_code)]placement onTestListObjectsintraits.rsis correct and remains in place with the explanatory comment. This is resolved. -
[policy] No new tests are added, which is appropriate — this PR only fixes toolchain/dependency/lock file issues rather than adding new functionality.
-
[nit] The
Cargo.lockforcross_serviceresolvesaws-smithy-runtime-apito1.19.0(visible in the lock file snippet), which is the latest generation usinghttp1.x. This is correct for thecross_serviceworkspace. Thewebassemblyworkspace's lock file (not shown in this diff) should resolve toaws-smithy-runtime-api 1.7.3as described in the PR. Reviewers should verify thewebassembly/Cargo.lockis also committed and resolves to the capped versions. -
[nit] Prior item (addressed): The
rustv1/.gitignorepreviously removedCargo.lockglobally; this has been corrected by removing that line and committing the lock files per-workspace. This is the right approach. -
[policy] The CI job (
Lint Rust) is the primary thing being fixed. The reviewer should confirm the CI badge is green on this PR branch before merging, as noted in the prior review.
Reviewed at commit 8943e32885dbc0357b97d25edcd77dd61f45b388. This review was generated automatically using Amazon Bedrock. It compares your changes against existing examples and coding guidelines. Findings are labeled by severity (blocking / nit / policy) and reflect only the commit above. Please use your judgment — this is advisory, not authoritative.
This pull request restores the Rust CI (
Lint Rust) job, which is currently failing on every PR that touchesrustv1/**because the AWS SDK for Rust crates raised their MSRV past the pinned CI toolchain.Why
Lint Rustpins rustc1.88.0, but the currentaws-config/aws-sdk-*/aws-smithy-*crates now require1.94.1, socargo clippy/testfail at dependency resolution for all four Rust workspaces. (The repo intentionally gitignoresCargo.lock, so resolution always floats to the latest crates.)What changed
Followed the maintenance procedure documented in
rustv1/README.md:rustv1/tools/set_rust_version.py 1.94.1, which updates.github/workflows/lint-rust.ymland bothrust-toolchain.tomlchannels in sync with the SDK MSRV.-D warningsin pre-existing examples (cargo clippy --fixplus manual fixes):cross_service/photo_asset_management: drop unused/elided lifetimesexamples/eks/create-cluster: fix doc list item overindentationexamples/iam/hello: box the largeSdkErrorvariant (result_large_err)examples/testing:#[allow(dead_code)]on a documentation fake structwebassemblyworkspace's AWS deps to the pre-http1.x generation.aws-smithy-runtime-api >= 1.8dropped theTryFrom<http 0.2 Response>impl in favor ofhttp1.x, which breaksaws-wasm's custom HTTP adapter. Cappingaws-config/aws-sdk-lambda/aws-smithy-*avoids migrating the wasm adapter; resolves toaws-smithy-runtime-api 1.7.3/http 0.2.12.Ran WRITEME for Rust afterward — no README changes were required (the lint fixes did not shift any snippet anchors).
Verification
cargo clippy --all(withRUSTFLAGS="-D warnings") andcargo fmt --all --checkpass on all four workspaces (cross_service,examples,lambda,webassembly) with the 1.94.1 toolchain, matching the CI job's format + lint steps.All Rust examples across all four workspaces now compile and lint cleanly on the corrected toolchain, and their unit test suites compile; the subset of tests that don't require live AWS pass.
This should be merged before the Bedrock sample PRs (#8204, #8205, #8206), which currently fail
Lint Rustfor this same pre-existing reason.Related: internal ticket V2245921888.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.