Skip to content

Migration lint for use crate::... has incorrect suggestions for braced use #50673

Description

@alexcrichton

The following code:

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

use foo::{a, b};

mod foo {
    crate fn a() {}
    crate fn b() {}
}

fn main() {
    a();
    b();
}

yields:

warning: Absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
 --> src/main.rs:4:11
  |
4 | use foo::{a, b};
  |           ^ help: use `crate`: `crate::a`
  |
note: lint level defined here
 --> src/main.rs:1:9
  |
1 | #![warn(rust_2018_breakage)]
  |         ^^^^^^^^^^^^^^^^^^
  = note: #[warn(absolute_path_starting_with_module)] implied by #[warn(rust_2018_breakage)]
  = 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:4:14
  |
4 | use foo::{a, 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

but when rustfix automatically applies the suggestions they end up breaking compilation because the suggested fix isn't syntactically valid

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions