You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The project doesn't compile if the tonic dependency is added
To Reproduce
Add tonic dependency to Cargo.toml (I used 0.5 to avoid switching to Edition2021)
[dependencies]
...
tonic = "0.5.0"
Execute cargo check
$ cargo check
Checking kadcast v0.1.0
error[E0382]: use of moved value: `nodes`
--> src/lib.rs:111:17
|
107 | table_read.all_sorted().for_each(|(h, nodes)| {
| ----- move occurs because `nodes` has type `impl Iterator`, which does not implement the `Copy` trait
...
111 | nodes.map(|p| p.value().address()).join(",")
| ^^^^^ ---------------------------- `nodes` moved due to this method call
| |
| value used here after move
|
note: this function takes ownership of the receiver `self`, which moves `nodes`
--> ~/.rustup/toolchains/nightly-2021-06-06-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:681:18
|
681 | fn map<B, F>(self, f: F) -> Map<Self, F>
| ^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0382`.
error: could not compile `kadcast`
To learn more, run the command again with --verbose.
Expected behaviour
$ cargo b
Compiling kadcast v0.1.0
Finished dev [unoptimized + debuginfo] target(s) in 7.63s
The text was updated successfully, but these errors were encountered:
First issue:
The expanded code of `info!` macro changes when the `log` feature is
enable on the `tracing` crate. The expanded code performs a `move` of
the input parameters.
Said that, you will receive a compilation error if you are passing a
param which calls a `move` by itself (unless the param supports the
`Copy` trait)
For futher information related to the compilation error see:
#60
Second issue:
I suspect that `Cargo` is behaving wrong, because it enables a nested
dependency feature even if this feature is not explicit declared.
This happens for both `edition = "2021"` and `resolver = "2"`.
Indeed, in the case of the original issue, the `tonic` crate add the
`tower` traversal dependency which use the `tracing` crate with the
`log` feature enabled.
For futher information related to tower dependency see:
https://github.com/tower-rs/tower/blob/b20b3cbd5788727996510fb2e8db04623f60f8ee/tower/Cargo.toml#L27
Refactoring this way, we are sure there will be at most only one `move`
Resolves#60
Describe the bug
The project doesn't compile if the
tonic
dependency is addedTo Reproduce
Add
tonic
dependency to Cargo.toml (I used 0.5 to avoid switching to Edition2021)Execute
cargo check
Expected behaviour
The text was updated successfully, but these errors were encountered: