Skip to content

uniform_paths edition 2018 feature emits spurrious ambiguity for the log crate #53408

Closed
@uberjay

Description

@uberjay

I'm fairly sure this is a bug. At the very least It's confusing! Enabling uniform_paths, there's a detected ambiguous use for log. But I can't figure out where the non-crate log is coming from. Furthermore, if I change use log; to use self::log;, just to see if it'll work, the compiler claims there's no log module in the root!

I didn't run into any other cases like this (with the projects I've tried it with so far).

  1. cargo new uniform-paths
  2. switch crate over to 2018 edition.
  3. cargo add log
  4. in src/main.rs:
#![feature(rust_2018_preview, uniform_paths)]

use log;

fn main() {}

attempting to build:

error: import from `log` is ambiguous
 --> src/main.rs:3:5
  |
3 | use log;
  |     ^^^
  |     |
  |     could refer to external crate `::log`
  |     could also refer to `self::log`
  |
  = help: write `::log` or `self::log` explicitly instead
  = note: relative `use` paths enabled by `#![feature(uniform_paths)]`

Changing log to self::log:

error[E0432]: unresolved import `self::log`
 --> src/main.rs:3:5
  |
3 | use self::log;
  |     ^^^^^^^^^ no `log` in the root

Playground link: https://play.rust-lang.org/?gist=f749f38540242c143f2e4c41e2f1625c&version=nightly&mode=debug&edition=2018

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-edition-2018Area: The 2018 editionF-rust_2018_preview`#![feature(rust_2018_preview)]`T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions