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
I tried to use cargo fix --edition to upgrade my block-utils crate to the 2018 edition. It fails to apply and gives output suggesting I file a bug so here i am :)
cargo fix --edition --allow-dirty
Checking block-utils v0.6.0 (/home/chris/repos/block-utils)
warning: failed to automatically apply fixes suggested by rustc to crate `block_utils`
after fixes were automatically applied the compiler reported errors within these files:
* src/lib.rs
This likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/cargo/issues
quoting the full output of this command we'd be very appreciative!
warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> src/nvme.rs:5:5
|
5 | use {BlockResult, BlockUtilsError};
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::{BlockResult, BlockUtilsError}`
|
= note: `-W absolute-paths-not-starting-with-crate` implied by `-W rust-2018-compatibility`
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
warning: unused variable: `e`
--> src/lib.rs:1520:33
|
1520 | Err(nom::Err::Error(e)) | Err(nom::Err::Failure(e)) => Err(BlockUtilsError::new(
| ^ help: consider using `_e` instead
|
= note: #[warn(unused_variables)] on by default
warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> src/nvme.rs:5:5
|
5 | use {BlockResult, BlockUtilsError};
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::{BlockResult, BlockUtilsError}`
|
= note: `-W absolute-paths-not-starting-with-crate` implied by `-W rust-2018-compatibility`
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
warning: unused variable: `e`
--> src/lib.rs:1520:33
|
1520 | Err(nom::Err::Error(e)) | Err(nom::Err::Failure(e)) => Err(BlockUtilsError::new(
| ^ help: consider using `_e` instead
|
= note: #[warn(unused_variables)] on by default
Finished dev [unoptimized + debuginfo] target(s) in 5.56s
Output of cargo version: cargo 1.31.0 (339d9f9 2018-11-16)
The unused_variables lint does not give proper suggestions with | patterns in match arms. It only suggests _x for the first variable, but not the second, causing compilation to fail. Surprisingly I can't find any upstream issues for this.
To work around this, just update your match blocks to use _ or _e for the bindings.
Thanks for the report @cholcombe973 and the reduction @ehuss! I've moved the suggestion bug to rust-lang/rust as it's a compiler bug and the otherwise relevant but for edition migration is at #5738, so I'm going to close this.
I tried to use
cargo fix --edition
to upgrade my block-utils crate to the 2018 edition. It fails to apply and gives output suggesting I file a bug so here i am :)Steps
cargo fix --edition
against it.Possible Solution(s)
Notes
Output of
cargo version
: cargo 1.31.0 (339d9f9 2018-11-16)running on Ubuntu 16.04.4 LTS
The text was updated successfully, but these errors were encountered: