Specify minimal rust version

Open Beginner friendly
#360 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
70/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Quiet
Tech stack
rust
Domain
build-system

Research direction

Start by checking the package manifest's edition and Rust version settings, then review the failing call in heed/src/envs/env.rs:648. Set the minimum supported Rust version to 1.85 and verify that cargo test reports the required version clearly and runs with a compatible toolchain.

Written by the indexing model from the issue text.

Description

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 fd5ad4ac

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.
Dominant language
Rust
Stars
915
Forks
82
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from meilisearch/heed

All issues in meilisearch/heed

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.