I am working on getting an example of Rust BTreeMap working, and so far the docs are very good, and it is working well.
However, I get this unusual error from the compiler which I do not understand, can someone please explains what it means and how to fix it, do I need to fix it?
warning: some crates are on edition 2021 which defaults to resolver = "2", but virtual workspaces default to resolver = "1"
note: to keep the current resolver, specify workspace.resolver = "1" in the workspace root’s manifest
note: to use the edition 2021 resolver, specify workspace.resolver = "2" in the workspace root’s manifest
Below is my Cargo.toml file for the backend in case, and I am using DFX 15.1:
name = "rust_profile_backend"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
crate-type = ["cdylib"]
candid = "0.8.2"
ic-cdk = "0.7"
ic-cdk-timers = "0.1" # Feel free to remove this dependency if you don't need timers
ic-stable-structures = "0.6.0-beta.2"
serde = "1.0"
The code itself comes from the BTreeMap tutorial here:
Thanks Saikatdas! Here is a summary from those who just want to read here.
First what is the resolver:
One of Cargo’s primary tasks is to determine the versions of dependencies to use based on the version requirements specified in each package. This process is called “dependency resolution” and is performed by the “resolver”. The result of the resolution is stored in the Cargo.lock file which “locks” the dependencies to specific versions, and keeps them fixed over time.
The resolver attempts to unify common dependencies while considering possibly conflicting requirements.
Second your link, which now says that the resolver should explicitly default to 2 to avoid warnings:
Since Rust 1.51.0, Cargo has opt-in support for a new feature resolver which can be activated with resolver = “2” in Cargo.toml.
Starting in Rust 2021, this will be the default. That is, writing edition = “2021” in Cargo.toml will imply resolver = “2”.