CosmWasm/cw-plus

unresolved import cosmwasm_std::testing

Closed this issue · 5 comments

Upon running

docker run --rm -v "$(pwd)":/code \
  --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
  --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
  cosmwasm/rust-optimizer-arm64:0.12.5
Info: RUSTC_WRAPPER=sccache
Info: sccache stats before build
Compile requests                      0
Compile requests executed             0
Cache hits                            0
Cache misses                          0
Cache timeouts                        0
Cache read errors                     0
Forced recaches                       0
Cache write errors                    0
Compilation failures                  0
Cache errors                          0
Non-cacheable compilations            0
Non-cacheable calls                   0
Non-compilation calls                 0
Unsupported compiler calls            0
Average cache write               0.000 s
Average cache read miss           0.000 s
Average cache read hit            0.000 s
Failed distributed compilations       0
Cache location                  Local disk: "/root/.cache/sccache"
Cache size                            0 bytes
Max cache size                       10 GiB
Building contract in /code ...
   Compiling cw-storage-plus v0.13.0 (/code/packages/storage-plus)
   Compiling cw2 v0.13.0 (/code/packages/cw2)
   Compiling cw4 v0.13.0 (/code/packages/cw4)
   Compiling cw-controllers v0.13.0 (/code/packages/controllers)
   Compiling cw-multi-test v0.13.0 (/code/packages/multi-test)
error[E0432]: unresolved import `cosmwasm_std::testing`
 --> packages/multi-test/src/app.rs:5:19
  |
5 | use cosmwasm_std::testing::{mock_env, MockApi, MockStorage};
  |                   ^^^^^^^ could not find `testing` in `cosmwasm_std`

error[E0432]: unresolved import `cosmwasm_std::testing`
  --> packages/multi-test/src/wasm.rs:24:19
   |
24 | use cosmwasm_std::testing::mock_wasmd_attr;
   |                   ^^^^^^^ could not find `testing` in `cosmwasm_std`

warning: ignoring -C extra-filename flag due to -o flag

For more information about this error, try `rustc --explain E0432`.
warning: `cw-multi-test` (lib) generated 1 warning
error: could not compile `cw-multi-test` due to 2 previous errors; 1 warning emitted
warning: build failed, waiting for other jobs to finish...
error: build failed

Odd... can you share the Cargo.toml file of the project?

Does it work with cargo build and just not with the rust-optimzier (if so, best to post on the rust-optimiser repo)

The Cargo.toml is from this repo, cw-plus v0.13.0. Note, I'm using rust-optimizer-arm64:0.12.5

cargo build indeed works fine. Issue created on rust-optimizer CosmWasm/optimizer#78

@albertchon could you share why did you close the ticket? Does that work in the end, was something fixed?

It works with the workspace-optimizer, see the discussion here CosmWasm/optimizer#78