Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
SirVer opened this issue Jun 15, 2015 · 2 comments
Closed

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

SirVer opened this issue Jun 15, 2015 · 2 comments

Comments

@SirVer
Copy link

SirVer commented Jun 15, 2015

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.

@nagisa
Copy link
Member

nagisa commented Jun 15, 2015

Regression happened somewhere between stable (1.0) and current beta (1.1).

@bors bors closed this as completed in 7ff55ea Jun 18, 2015
brson pushed a commit to brson/rust that referenced this issue Jun 18, 2015
These used to return wrong results in case they were expanded inside compiler’s
iternal syntax sugar (closures, if-let) expansions

Fixes rust-lang#26322
@SirVer
Copy link
Author

SirVer commented Jun 19, 2015

Wow, that was quick. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants