Skip to content

Specify minimal rust version #360

@artlog

Description

@artlog

My current system is using a rust version 1.80 which is what my system provides by default. and build fails with it.

Having a minimal version set to 1.85 ( https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2024 ) should fix it and clearly state from start what version of rust is required / supported ( rust-version = "1.85" ).

Find below the details of my issues

Launching the build will fail with

error[E0599]: no method named `is_multiple_of` found for type `usize` in the current scope
   --> heed/src/envs/env.rs:648:22
    |
648 |         if !new_size.is_multiple_of(page_size::get()) {
    |                      ^^^^^^^^^^^^^^
    |
help: there is a method `next_multiple_of` with a similar name
    |
648 |         if !new_size.next_multiple_of(page_size::get()) {
    |                      ~~~~~~~~~~~~~~~~

For more information about this error, try `rustc --explain E0599`.
error: could not compile `heed` (lib) due to 1 previous error

due to commit fd5ad4a

after fixing it by using previous code it compiles

diff --git a/heed/src/envs/env.rs b/heed/src/envs/env.rs
index ce269db..1d5f1ef 100644
--- a/heed/src/envs/env.rs
+++ b/heed/src/envs/env.rs
@@ -645,7 +645,7 @@ impl<T> Env<T> {
     /// it is okay to call `mdb_env_set_mapsize` for an open environment as long as no transactions are active,
     /// but the library does not check for this condition, so the caller must ensure it explicitly.
     pub unsafe fn resize(&self, new_size: usize) -> Result<()> {
-        if !new_size.is_multiple_of(page_size::get()) {
+        if new_size % page_size::get() != 0 {
             let msg = format!(
                 "map size ({}) must be a multiple of the system page size ({})",
                 new_size,

but i can't run tests

cargo test

Caused by:
  feature `edition2024` is required

  The package requires the Cargo feature called `edition2024`, but that feature is not stabilized in this version of Cargo (1.80.1 (376290515 2024-07-16)).
  Consider trying a more recent nightly release.
  See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2024 for more information about the status of this feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions