Closed
Description
Cargo.toml:
[package]
name = "claptest"
version = "0.1.0"
authors = ["Matthias Krüger"]
edition = "2018"
[dependencies]
clap ="2.32.0"
src/main.rs
#![warn(rust_2018_compatibility)]
use clap::{App,value_t};
fn main() {
println!("Hello, world!");
let matches = App::new("myapp")
.arg_from_usage("[length] 'Set the length to use as a pos whole num, i.e. 20'")
.get_matches();
let len = value_t!(matches.value_of("length"), u32)
.unwrap_or_else(|e|{
println!("{}",e);
std::process::exit(1)
});
}
This produces the warning
warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> src/main.rs:12:11
|
12 | let len = value_t!(matches.value_of("length"), u32)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
--> src/main.rs:1:9
|
1 | #![warn(rust_2018_compatibility)]
| ^^^^^^^^^^^^^^^^^^^^^^^
= note: #[warn(absolute_paths_not_starting_with_crate)] implied by #[warn(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>
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> src/main.rs:12:11
|
12 | let len = value_t!(matches.value_of("length"), u32)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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>
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
but only if rust_2018_compatibility
is warned about which is confusing.
Maybe rust_2018_compatibility
should be disabled if the crate is already edition 2018
?
This warning appeared first with
rustc 1.32.0-nightly (400c2bc5e 2018-11-27)
binary: rustc
commit-hash: 400c2bc5ed292f77c49693320f4eda37bb375e90
commit-date: 2018-11-27
host: x86_64-unknown-linux-gnu
release: 1.32.0-nightly
LLVM version: 8.0
Probably related to #56262