Skip to content

"X is ambiguous" error is missing a span when the standard library source is not available #91028

Closed
@RalfJung

Description

@RalfJung

This code on the playground

pub enum Option<T> {
    /// No value
    None,
    /// Some value `T`
    Some(T),
}

pub use Option::*;

produces the following error

error[E0659]: `Option` is ambiguous
   --> src/lib.rs:8:9
    |
8   | pub use Option::*;
    |         ^^^^^^ ambiguous name
    |
    = note: ambiguous because of multiple potential import sources
note: `Option` could refer to the enum defined here
   --> src/lib.rs:1:1
    |
1   | / pub enum Option<T> {
2   | |     /// No value
3   | |     None,
4   | |     /// Some value `T`
5   | |     Some(T),
6   | | }
    | |_^
    = help: use `crate::Option` to refer to this enum unambiguously
note: `Option` could also refer to the enum defined here

Note how the 2nd note is dangling: no span is shown after it says 'could also refer to the enum defined here'.

I was not able to reproduce this locally, so this might also have to do with something special the playground is doing -- Cc @shepmaster

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions