Skip to content

[regression] ambiguous local variable #71765

Closed
@Mark-Simulacrum

Description

@Mark-Simulacrum
Member

For example:

INFO] [stderr] error[E0659]: `time` is ambiguous (glob import vs glob import in the same module)
[INFO] [stderr]    --> src/main.rs:257:13
[INFO] [stderr]     |
[INFO] [stderr] 257 |     let mut time = Local::now();
[INFO] [stderr]     |             ^^^^ ambiguous name
[INFO] [stderr]     |
[INFO] [stderr] note: `time` could refer to the function imported here
[INFO] [stderr]    --> src/main.rs:4:5
[INFO] [stderr]     |
[INFO] [stderr] 4   | use libc::*;
[INFO] [stderr]     |     ^^^^^^^
[INFO] [stderr]     = help: consider adding an explicit import of `time` to disambiguate
[INFO] [stderr] note: `time` could also refer to the function imported here
[INFO] [stderr]    --> src/main.rs:11:5
[INFO] [stderr]     |
[INFO] [stderr] 11  | use xcb_bindings::*;
[INFO] [stderr]     |     ^^^^^^^^^^^^^^^
[INFO] [stderr]     = help: consider adding an explicit import of `time` to disambiguate
[INFO] [stderr] 

cc @petrochenkov

Activity

added
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on May 1, 2020
added this to the 1.44 milestone on May 1, 2020
self-assigned this
on May 1, 2020
added
C-bugCategory: This is a bug.
A-resolveArea: Name/path resolution done by `rustc_resolve` specifically
on May 1, 2020
petrochenkov

petrochenkov commented on May 3, 2020

@petrochenkov
Contributor

This is a regression from #70006.

#70006 produced an ambiguity error even if the binding is syntactically unambiguous (e.g. mut time like in the example above) for some future-compatibility reasons (#33118 (comment)), but it can be easily tweaked to not produce it because backward-compatibility is more important.

petrochenkov

petrochenkov commented on May 3, 2020

@petrochenkov
Contributor

Fixed in #71846.

removed their assignment
on May 3, 2020
added and removed
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on May 5, 2020
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

    A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.P-criticalCritical priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Participants

      @wesleywiser@jonas-schievink@Mark-Simulacrum@petrochenkov

      Issue actions

        [regression] ambiguous local variable · Issue #71765 · rust-lang/rust