datrs / hypercore

Secure, distributed, append-only log
https://docs.rs/hypercore
Apache License 2.0
332 stars 37 forks source link

Running benchmarks fails #127

Closed GildedHonour closed 3 years ago

GildedHonour commented 3 years ago
$ rustup toolchain list
stable-x86_64-unknown-linux-gnu (default)
1.47.0-x86_64-unknown-linux-gnu

And

$ rustc --test -O benches/bench.rs 
error[E0670]: `async fn` is not permitted in the 2015 edition
  --> benches/bench.rs:10:1
   |
10 | async fn create_feed(page_size: usize) -> Result<Feed<RandomAccessMemory>, Error> {
   | ^^^^^ to use `async fn`, switch to Rust 2018
   |
   = help: set `edition = "2018"` in `Cargo.toml`
   = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found keyword `move`
  --> benches/bench.rs:12:28
   |
12 |         |_| Box::pin(async move { Ok(RandomAccessMemory::new(page_size)) }),
   |                            ^^^^ expected one of 8 possible tokens

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0670`.

But in the toml file there's already

edition = "2018"

why is it being ignored?

GildedHonour commented 3 years ago

If I remove "edition=2018" and run "cargo fix --edition --allow-dirty", it'll throw 100 errors, for instance:

error: cannot determine resolution for the macro `anyhow`
   --> src/storage/mod.rs:108:30
    |
108 |                 .map_err(|e| anyhow!(e))?;
    |                              ^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `anyhow`
   --> src/storage/mod.rs:117:58
    |
117 |         self.data.write(offset, &data).await.map_err(|e| anyhow!(e))
    |                                                          ^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `ensure`
   --> src/storage/mod.rs:135:9
    |
135 |         ensure!(
    |         ^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `anyhow`
   --> src/storage/mod.rs:143:26
    |
143 |             .map_err(|e| anyhow!(e))
    |                          ^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `anyhow`
   --> src/storage/mod.rs:156:26
    |
156 |             .map_err(|e| anyhow!(e))
    |                          ^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `anyhow`
   --> src/storage/mod.rs:188:26
    |
188 |             .map_err(|e| anyhow!(e))?;
    |                          ^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `ensure`
   --> src/storage/mod.rs:189:9
    |
189 |         ensure!(not_zeroes(&bytes), "No signature found");
    |         ^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `anyhow`
   --> src/storage/mod.rs:206:26
    |
206 |             .map_err(|e| anyhow!(e))
    |                          ^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `anyhow`
   --> src/storage/mod.rs:266:26
    |
266 |             .map_err(|e| anyhow!(e))?;
    |                          ^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `anyhow`
   --> src/storage/mod.rs:281:26
    |
281 |             .map_err(|e| anyhow!(e))
    |                          ^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `anyhow`
   --> src/storage/mod.rs:292:26
    |
292 |             .map_err(|e| anyhow!(e))
    |                          ^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `anyhow`
   --> src/storage/mod.rs:329:26
    |
329 |             .map_err(|e| anyhow!(e))?;
    |                          ^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `anyhow`
   --> src/storage/mod.rs:340:26
    |
340 |             .map_err(|e| anyhow!(e))?;
    |                          ^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `anyhow`
   --> src/storage/mod.rs:348:55
    |
348 |         self.keypair.write(0, &buf).await.map_err(|e| anyhow!(e))
    |                                                       ^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `anyhow`
   --> src/storage/mod.rs:357:26
    |
357 |             .map_err(|e| anyhow!(e))
    |                          ^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

error[E0433]: failed to resolve: use of undeclared type or module `Blake2b`
  --> src/crypto/hash.rs:29:26
   |
29 |         let mut hasher = Blake2b::new(32);
   |                          ^^^^^^^ use of undeclared type or module `Blake2b`

error[E0433]: failed to resolve: use of undeclared type or module `Blake2b`
  --> src/crypto/hash.rs:49:26
   |
49 |         let mut hasher = Blake2b::new(32);
   |                          ^^^^^^^ use of undeclared type or module `Blake2b`

error[E0433]: failed to resolve: use of undeclared type or module `Blake2b`
  --> src/crypto/hash.rs:63:26
   |
63 |         let mut hasher = Blake2b::with_key(32, public_key.as_bytes());
   |                          ^^^^^^^ use of undeclared type or module `Blake2b`
GildedHonour commented 3 years ago

cargo test --benches - same 100 errors