Skip to content

f32 seen as ambiguous associated type #26760

Closed
@pfalabella

Description

@pfalabella

see http://stackoverflow.com/questions/31208465/pi-constant-is-ambiguous

   fn main() {
        let _ = f32::consts::PI;
    }

fails to compile with:

$ rustc -
<anon>:2:13: 2:28 error: ambiguous associated type; specify the type using the syntax `<f32 as Trait>::consts` [E0223]
<anon>:2     let i = f32::consts::PI;
                     ^~~~~~~~~~~~~~~
error: aborting due to previous error

on rust 1.0 stable and 1.1 stable

using the full path std::f32::consts::PI; works. The compilation error looks wrong (why is f32 an associated type)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.WG-diagnosticsWorking group: Diagnostics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions