Skip to content

Commit

Permalink
[smithy-rs] Fix compiling S3 crate for wasm (#3590)
Browse files Browse the repository at this point in the history
## Motivation and Context
Running `cargo build --target wasm32-unknown-unknown
--no-default-features` on an S3 crate has stopped working since
smithy-lang/smithy-rs#3465 with the following
error:
```
error: the wasm*-unknown-unknown targets are not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support
   --> /Users/[REDACTED]/.cargo/registry/src/index.crates.io-6f17d22bba15001f/getrandom-0.2.14/src/lib.rs:352:9
    |
352 | /         compile_error!("the wasm*-unknown-unknown targets are not supported by \
353 | |                         default, you may need to enable the \"js\" feature. \
354 | |                         For more information see: \
355 | |                         https://docs.rs/getrandom/#webassembly-support");
    | |________________________________________________________________________^
```

To address the issue, this PR updates an S3's dependency on `ahash` in a
way that disables default features.

## Testing
Updated the existing test `integration-tests/webassembly` so that
`check-aws-sdk-standalone-integration-tests` will run `cargo check`
`aws-sdk-s3` against both `wasm32-wasi` and `wasm32-unknown-unknown`
(the updated check would break if we removed `default-features = false`
from the `ahash` dependency).

## Checklist
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
  • Loading branch information
ysaito1001 authored and aws-sdk-rust-ci committed Apr 22, 2024
1 parent bf06714 commit fe05fcc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions sdk/s3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ all-features = true
targets = ["x86_64-unknown-linux-gnu"]
[dependencies.ahash]
version = "0.8.11"
default-features = false

[dependencies.aws-credential-types]
path = "../aws-credential-types"
Expand Down
2 changes: 1 addition & 1 deletion tests/webassembly/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build]
target = "wasm32-wasi"
target = ["wasm32-unknown-unknown", "wasm32-wasi"]

[target.wasm32-wasi]
rustflags = ["-C", "opt-level=1"]
Expand Down
4 changes: 2 additions & 2 deletions versions.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
smithy_rs_revision = '7fbdcc2b18886ac24e6f2ece06a3580df32bd077'
smithy_rs_revision = '6b59ba26c41a03983de7321795681da137dffc02'
aws_doc_sdk_examples_revision = '85778d68832c75a9306cb32e10cbc9887840e2d4'

[manual_interventions]
Expand Down Expand Up @@ -1895,7 +1895,7 @@ model_hash = '34648839402316ab9da4bef0fe11beb9bc3ec1d05b3ff7d09664ab74c0cb3d2b'
[crates.aws-sdk-s3]
category = 'AwsSdk'
version = '1.24.0'
source_hash = '8f50694126c5ea55f373b8e6f21a66bb7d7316f3e075d7a344018f3b23034c5f'
source_hash = 'd585247da7366a1e4c39904e5e9b22b0f9f8adec323d0dc65dd7b253d86fceb4'
model_hash = 'd4cf9f91188e26ca9b296ddc7177d3035cd9e87c5e0e7976d9cd65de5b649d53'

[crates.aws-sdk-s3control]
Expand Down

0 comments on commit fe05fcc

Please sign in to comment.