Skip to content

Commit

Permalink
Run cargo update on the runtime lockfiles and the SDK lockfile (#3896)
Browse files Browse the repository at this point in the history
Updating lockfiles introduced `pin-project` `0.2.15`, which revealed [a
bug in
`cargo-check-external-types`](awslabs/cargo-check-external-types#183).
This required `cargo-check-external-types` to release a new version with
a newer nightly version `nightly-2024-06-30`.

Switching to `nightly-2024-06-30` triggered a series of changes due to
the [automatic checking of cfg at compile
time](https://blog.rust-lang.org/2024/05/06/check-cfg.html). As a
result, the compiler has become stricter regarding unexpected `cfg` and
unused Cargo features in our codebase.

Most of the changes in this PR address these issues:
<details>
<summary>Expand to view the actual errors...</summary>

Ex.1
```
error: unexpected `cfg` condition name: `aws_sdk_unstable`
  --> aws-smithy-types/src/number.rs:29:13
   |
29 |         all(aws_sdk_unstable, feature = "serde-serialize")
   |             ^^^^^^^^^^^^^^^^
   |
   = help: consider using a Cargo feature instead
   = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
            [lints.rust]
            unexpected_cfgs = { level = "warn", check-cfg = ['cfg(aws_sdk_unstable)'] }
   = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(aws_sdk_unstable)");` to the top of the `build.rs`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
```
Ex.2
```
error: struct `ArrayIter` is never constructed
   --> aws-smithy-cbor/src/decode.rs:251:12
    |
251 | pub struct ArrayIter<'a, 'b, T> {
    |            ^^^^^^^^^
    |
    = note: `-D dead-code` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(dead_code)]`

error: struct `MapIter` is never constructed
   --> aws-smithy-cbor/src/decode.rs:266:12
    |
266 | pub struct MapIter<'a, 'b, K, V> {
    |            ^^^^^^^

error: could not compile `aws-smithy-cbor` (lib) due to 2 previous errors
```
Ex.3
```
error: for loop over a `&Option`. This is more readably written as an `if let` statement
   --> aws-smithy-runtime-api/src/client/runtime_components.rs:888:19
    |
888 |         validate!(&self.retry_strategy);
    |                   ^^^^^^^^^^^^^^^^^^^^
    |
help: to check pattern in a loop use `while let`
    |
871 |                 while let Some() =  in $field {
    |                 ~~~~~~~~~~~~~~~~~~
help: consider using `if let` to clear intent
    |
871 |                 if let Some() =  in $field {
    |                 ~~~~~~~~~~~~~~~

error: could not compile `aws-smithy-runtime-api` (lib) due to 4 previous errors
```
Ex.4
```
error: unexpected `cfg` condition name: `crypto_unstable`
   --> aws-smithy-experimental/src/hyper_1_0.rs:687:11
    |
687 |     #[cfg(crypto_unstable)]
    |           ^^^^^^^^^^^^^^^
    |
    = help: expected names are: `aws_sdk_unstable`, `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
    = help: consider using a Cargo feature instead
    = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
             [lints.rust]
             unexpected_cfgs = { level = "warn", check-cfg = ['cfg(crypto_unstable)'] }
    = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(crypto_unstable)");` to the top of the `build.rs`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
    = note: `-D unexpected-cfgs` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unexpected_cfgs)]`
```
Ex.5
```
error: unexpected `cfg` condition value: `http-1x`
   --> aws-inlineable/src/presigning.rs:249:11
    |
249 |     #[cfg(feature = "http-1x")]
    |           ^^^^^^^^^^---------
    |                     |
    |                     help: there is a expected value with a similar name: `"http_1x"`
    |
    = note: expected values for `feature` are: `http_1x`
    = help: consider adding `http-1x` as a feature in `Cargo.toml`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

error: could not document `aws-inlineable`
```
Ex.6
```
error: unexpected `cfg` condition value: `gated-tests`
  --> sdk/s3/src/endpoint_lib/substring.rs:35:17
   |
35 | #[cfg(all(test, feature = "gated-tests"))]
   |                 ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: expected values for `feature` are: `behavior-version-latest`, `default`, `http-1x`, `rt-tokio`, `rustls`, `sigv4a`, and `test-util`
   = help: consider adding `gated-tests` as a feature in `Cargo.toml`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

error: could not compile `aws-sdk-s3` (lib) due to 2 previous errors
```
Ex.7
```
error: unexpected `cfg` condition value: `test-util`
   --> src/lib.rs:514:40
    |
514 |             #[cfg(all(feature = "sso", feature = "test-util"))]
    |                                        ^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `feature` are: `allow-compilation`, `behavior-version-latest`, `client-hyper`, `credentials-process`, `default`, `rt-tokio`, `rustls`, and `sso`
    = help: consider adding `test-util` as a feature in `Cargo.toml`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
    = note: `-D unexpected-cfgs` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unexpected_cfgs)]`

error: could not compile `aws-config` (lib) due to 1 previous error
```
</details>

---------

Co-authored-by: ysaito1001 <[email protected]>
Co-authored-by: Zelda Hessler <[email protected]>
  • Loading branch information
3 people authored Nov 5, 2024
1 parent f648759 commit 80f6dd6
Show file tree
Hide file tree
Showing 19 changed files with 333 additions and 339 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ env:
apt_dependencies: libssl-dev gnuplot jq
java_version: 17
rust_toolchain_components: clippy,rustfmt
rust_nightly_version: nightly-2024-03-15
rust_nightly_version: nightly-2024-06-30

jobs:
generate-diff:
Expand Down
54 changes: 27 additions & 27 deletions aws/rust-runtime/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 17 additions & 17 deletions aws/rust-runtime/aws-config/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aws-config"
version = "1.5.9"
version = "1.5.10"
authors = [
"AWS Rust SDK Team <[email protected]>",
"Russell Cohen <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ mod loader {
pub fn test_credentials(self) -> Self {
#[allow(unused_mut)]
let mut ret = self.credentials_provider(Credentials::for_tests());
#[cfg(all(feature = "sso", feature = "test-util"))]
#[cfg(feature = "sso")]
{
use aws_smithy_runtime_api::client::identity::http::Token;
ret = ret.token_provider(Token::for_tests());
Expand Down
2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-inlineable/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ publish = false
repository = "https://github.com/smithy-lang/smithy-rs"

[features]
http_1x = ["dep:http-1x", "dep:http-body-1x", "aws-smithy-runtime-api/http-1x"]
http-1x = ["dep:http-1x", "dep:http-body-1x", "aws-smithy-runtime-api/http-1x"]

[dependencies]
aws-credential-types = { path = "../aws-credential-types" }
Expand Down
Loading

0 comments on commit 80f6dd6

Please sign in to comment.