CosmWasm / CosmWasm/storey

Unintuitive error

Open
#84 0 comments 0 reactions 0 assignees View on GitHub
prio 2 research trac 2
Dominant language
Rust
Stars
6
Forks
3
PR merge metrics
No merged PRs in 30d

Description

The error on missed `&` in the `access` method is very bloated and a little hard to read. This is not something that has to change, but I figured it's better to note it here.

```diff
+ let cw_storage = CwStorage(deps.storage);
+ let admins = ADMINS.access(&cw_storage).get()?;
- let cw_storage = CwStorage(deps.storage);
- let admins = ADMINS.access(cw_storage).get()?;
```

When the reference is omitted the error is as follows:

```shell
error[E0599]: the method `get` exists for struct `ItemAccess, StorageBranch>>`, but its trait bounds were not satisfied
--> src/contract.rs:54:48
|
54 | let admins = ADMINS.access(cw_storage).get();
| ^^^ method cannot be called due to unsatisfied trait bounds
|
::: /home/jan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/storey-0.3.0/src/storage/branch.rs:23:1
|
23 | pub struct StorageBranch {
| --------------------------- doesn't satisfy `_: StorageBackend` or `_: Storage`
|
= note: the following trait bounds were not satisfied:
`storey::storage::branch::StorageBranch>: storey_storage::backend::StorageBackend`
which is required by `storey::storage::branch::StorageBranch>: storey_storage::storage::Storage`
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the omitted-reference error at the ADMINS.access(cw_storage).get() call in src/contract.rs, then inspect the access method involved. The issue does not define a required fix, so agree on the desired diagnostic or behavior before making changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.