Skip to content

Lint suggesting crate:: makes overlapping suggestions #52754

Closed
rust-lang/cargo
#5842
@alexcrichton

Description

@alexcrichton

First reported at rust-lang/cargo#5797, this code:

#![feature(rust_2018_preview)]
#![warn(rust_2018_compatibility)]

fn generic_return<T>() {
}

pub struct B{}

pub mod submod {
    pub fn test() {
        ::generic_return::<::B>();
    }
}

fn main() {}

yields these warnings:

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
  --> src/main.rs:11:9
   |
11 |         ::generic_return::<::B>();
   |         ^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::generic_return::<::B>`
   |
note: lint level defined here
  --> src/main.rs:2:9
   |
2  | #![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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
  --> src/main.rs:11:28
   |
11 |         ::generic_return::<::B>();
   |                            ^^^ help: use `crate`: `crate::B`
   |
   = 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 TBD

unfortunately though, the overlapping suggestions here means that rustfix can't apply a fix!

Metadata

Metadata

Assignees

Labels

A-edition-2018Area: The 2018 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.F-rust_2018_preview`#![feature(rust_2018_preview)]`

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions