Skip to content

line!() macro is confused by closures. #26322

Closed
@SirVer

Description

@SirVer

On
rustc 1.2.0-nightly (8937ec1 2015-06-15)

Linux 3.13.0-46-generic #79-Ubuntu SMP x86_64 GNU/Linux

This program:

fn main() {
    let func = move || {
        println!("ALIVE {}:{}", file!(), line!());
        println!("ALIVE {}:{}", file!(), line!());
        println!("ALIVE {}:{}", file!(), line!());
        println!("ALIVE {}:{}", file!(), line!());
        println!("ALIVE {}:{}", file!(), line!());
        println!("ALIVE {}:{}", file!(), line!());
        println!("ALIVE {}:{}", file!(), line!());
    };

    func();
}

prints a bunch of time:
ALIVE /tmp/blub.rs:2

Confusingly enough it works correctly on the playground.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions