ipfs-rust / ipfs-embed

A small embeddable ipfs implementation
352 stars 48 forks source link

compile error: trait bound not satisfied for `sled::ivec::IVec` #15

Closed 4meta5 closed 4 years ago

4meta5 commented 4 years ago

I noticed this when trying to compile the client in sunshine-node, which uses ipfs-embed

and I reproduced after pulling this repo and running cargo update

➜  ipfs-embed git:(master) ✗ carb        
   Compiling syn v1.0.32
   Compiling bytes v0.5.5
   Compiling pin-project-internal v0.4.22
   Compiling proc-macro-nested v0.1.6
   Compiling remove_dir_all v0.5.3
   Compiling tinyvec v0.3.3
   Compiling serde v1.0.113
   Compiling pin-project-lite v0.1.7
   Compiling adler32 v1.1.0
   Compiling object v0.20.0
   Compiling indexmap v1.4.0
   Compiling ring v0.16.15
   Compiling clear_on_drop v0.2.4
   Compiling addr2line v0.12.2
   Compiling quote v1.0.7
   Compiling tempfile v3.1.0
   Compiling quicksink v0.1.2
   Compiling miniz_oxide v0.3.7
   Compiling unicode-normalization v0.1.13
   Compiling ed25519-dalek v1.0.0-pre.3
   Compiling petgraph v0.5.1
   Compiling idna v0.2.0
   Compiling url v2.1.1
   Compiling backtrace v0.3.49
   Compiling sled v0.32.0
   Compiling synstructure v0.12.4
   Compiling futures-macro v0.3.5
   Compiling prost-derive v0.6.1
   Compiling thiserror-impl v1.0.20
   Compiling asn1_der_derive v0.1.2
   Compiling data-encoding-macro-internal v0.1.8
   Compiling async-attributes v1.1.1
   Compiling libp2p-core-derive v0.19.1
   Compiling libipld-cbor-derive v0.3.0
   Compiling async-std v1.5.0
   Compiling asn1_der v0.6.3
   Compiling data-encoding-macro v0.1.8
   Compiling thiserror v1.0.20
   Compiling pin-project v0.4.22
   Compiling multibase v0.8.0
   Compiling prost v0.6.1
   Compiling futures-util v0.3.5
   Compiling prost-types v0.6.1
   Compiling prost-build v0.6.1
   Compiling libp2p-core v0.19.1
   Compiling libp2p-identify v0.19.1
   Compiling libp2p-secio v0.19.1
   Compiling libp2p-kad v0.19.0
   Compiling libp2p-bitswap v0.4.1
   Compiling futures-executor v0.3.5
   Compiling futures v0.3.5
   Compiling futures_codec v0.3.4
   Compiling rw-stream-sink v0.2.1
   Compiling wasm-timer v0.2.4
   Compiling yamux v0.4.7
   Compiling unsigned-varint v0.3.3
   Compiling multihash v0.11.2
   Compiling multistream-select v0.8.1
   Compiling parity-multiaddr v0.9.0
   Compiling cid v0.5.1
   Compiling libipld-core v0.3.0
   Compiling libipld-macro v0.3.0
   Compiling libipld-cbor v0.3.0
   Compiling libipld v0.3.0
   Compiling libp2p-swarm v0.19.0
   Compiling libp2p-yamux v0.19.0
   Compiling libp2p-mplex v0.19.1
   Compiling libp2p-tcp v0.19.1
   Compiling libp2p-ping v0.19.2
   Compiling libp2p-mdns v0.19.1
   Compiling libp2p v0.19.1
   Compiling ipfs-embed v0.1.0 (/Users/4meta5/sunshine-protocol/ipfs/ipfs-embed)
error[E0277]: the trait bound `sled::ivec::IVec: std::convert::From<std::boxed::Box<[u8]>>` is not satisfied
   --> src/network/mod.rs:101:70
    |
101 |                     if let Err(err) = self.storage.insert(&cid, data.into(), Visibility::Public) {
    |                                                                      ^^^^ the trait `std::convert::From<std::boxed::Box<[u8]>>` is not implemented for `sled::ivec::IVec`
    |
    = help: the following implementations were found:
              <sled::ivec::IVec as std::convert::From<&[u8; 0]>>
              <sled::ivec::IVec as std::convert::From<&[u8; 10]>>
              <sled::ivec::IVec as std::convert::From<&[u8; 11]>>
              <sled::ivec::IVec as std::convert::From<&[u8; 12]>>
            and 35 others
    = note: required because of the requirements on the impl of `std::convert::Into<sled::ivec::IVec>` for `std::boxed::Box<[u8]>`

error[E0277]: the trait bound `sled::ivec::IVec: std::convert::From<std::boxed::Box<[u8]>>` is not satisfied
  --> src/store.rs:93:64
   |
93 |         Box::pin(async move { Ok(self.storage.insert(cid, data.into(), visibility)?) })
   |                                                                ^^^^ the trait `std::convert::From<std::boxed::Box<[u8]>>` is not implemented for `sled::ivec::IVec`
   |
   = help: the following implementations were found:
             <sled::ivec::IVec as std::convert::From<&[u8; 0]>>
             <sled::ivec::IVec as std::convert::From<&[u8; 10]>>
             <sled::ivec::IVec as std::convert::From<&[u8; 11]>>
             <sled::ivec::IVec as std::convert::From<&[u8; 12]>>
           and 35 others
   = note: required because of the requirements on the impl of `std::convert::Into<sled::ivec::IVec>` for `std::boxed::Box<[u8]>`

error[E0277]: the trait bound `sled::ivec::IVec: std::convert::From<std::boxed::Box<[u8]>>` is not satisfied
   --> src/store.rs:103:51
    |
103 |             .map(|Block { cid, data }| (cid, data.into()));
    |                                                   ^^^^ the trait `std::convert::From<std::boxed::Box<[u8]>>` is not implemented for `sled::ivec::IVec`
    |
    = help: the following implementations were found:
              <sled::ivec::IVec as std::convert::From<&[u8; 0]>>
              <sled::ivec::IVec as std::convert::From<&[u8; 10]>>
              <sled::ivec::IVec as std::convert::From<&[u8; 11]>>
              <sled::ivec::IVec as std::convert::From<&[u8; 12]>>
            and 35 others
    = note: required because of the requirements on the impl of `std::convert::Into<sled::ivec::IVec>` for `std::boxed::Box<[u8]>`

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0277`.
error: could not compile `ipfs-embed`.

To learn more, run the command again with --verbose.
dvc94ch commented 4 years ago

Fixed and released 0.1.1