Skip to content

Bad interaction between missing semicolon in fully qualified fn path and type ascription #54516

Closed
@leonardo-m

Description

@leonardo-m

This is almost a feature request. This code:

fn main() {
    use std::collections::BTreeMap;
    println!("{}", std::mem:size_of::<BTreeMap<u32, u32>>());
}

Gives the errors (rustc 1.30.0-nightly 4591a24 2018-09-22):

warning: unnecessary path disambiguator
 --> ...\test.rs:3:36
  |
3 |     println!("{}", std::mem:size_of::<BTreeMap<u32, u32>>());
  |                                    ^^ try removing `::`

error: expected token: `,`
 --> ...\test.rs:3:58
  |
3 |     println!("{}", std::mem:size_of::<BTreeMap<u32, u32>>());
  |                                                          ^

error: aborting due to previous error

But the problem is a missing : after std::mem:. Can rustc give a better error message here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions