Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strange absolute paths warning if ed2018 crate is build with warn( rust_2018_compatibility) #56311

Closed
matthiaskrgr opened this issue Nov 28, 2018 · 4 comments
Assignees
Labels
A-resolve Area: Path resolution P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Nov 28, 2018

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

@petrochenkov petrochenkov self-assigned this Nov 28, 2018
@petrochenkov petrochenkov added A-resolve Area: Path resolution regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Nov 28, 2018
@petrochenkov petrochenkov added this to Triaged in 1.31 regressions via automation Nov 28, 2018
@petrochenkov
Copy link
Contributor

Fixed in #56322

@petrochenkov petrochenkov moved this from Triaged to Fix in progress in 1.31 regressions Nov 28, 2018
@pietroalbini pietroalbini added this to the Rust 2018 Release milestone Nov 28, 2018
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Nov 29, 2018
resolve: Fix false-positives from lint `absolute_paths_not_starting_with_crate`

Fixes rust-lang#56311 (stable-to-beta regression)
@pnkfelix pnkfelix added the P-high High priority label Nov 29, 2018
@pnkfelix
Copy link
Member

triage: tagging as P-high. Has an r+'ed p=1 fix in PR #56322

@pnkfelix
Copy link
Member

reopening issue to ensure we don't close it until beta backport is done.

@pnkfelix pnkfelix reopened this Nov 29, 2018
1.31 regressions automation moved this from Fix in progress to Triaged Nov 29, 2018
@alexcrichton alexcrichton moved this from Triaged to Backport in progress in 1.31 regressions Nov 29, 2018
@alexcrichton
Copy link
Member

This is now tracked at #56352 and this won't get auto-closed when that merges because github only does that for the master branch, so I'm going to go ahead and close this in favor of that PR.

bors added a commit that referenced this issue Nov 30, 2018
Rollup beta backports

* #56264
* #56300
* #56322
* #56329

Neither #56300 nor #56329 applied cleanly, but I think I've gotten it working with @nikic's [help](#56300 (comment)) (thanks!)

Closes #56311
Closes #56263
@alexcrichton alexcrichton moved this from Backport in progress to Fixed in 1.31 regressions Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Path resolution P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta.
Projects
No open projects
Development

No branches or pull requests

5 participants