Skip to content

invalid location with #debug type error #1387

@erickt

Description

@erickt
Contributor

This code highlights an invalid code location:

fn main() {
    let x = [1,2,3];
    #debug(x);
}

Returns this error message:

foo.rs:4:186: 4:187 error: first argument to #fmt must be a string literal.
foo.rs:4 }
                                                                                                                                                                                                   ^
rust: upcall fail 'explicit failure', ../src/comp/driver/session.rs:71
rust: domain main @0x102029600 root task failed
rust: fatal, 'leaked memory in rust main loop (2 objects)' failed, ../src/rt/memory_region.cpp:158 2 objects

Activity

graydon

graydon commented on Dec 30, 2011

@graydon
Contributor

This is a general problem with macros, not just #debug. When they report an error they go to (or near) the source line before the macro, and highlight it, but fail to pretty-print what the expanded syntax looked like. They should do both.

kevina

kevina commented on Jan 22, 2012

@kevina
Contributor

This bug turns out to be a duplicate of #1448. The fix to that will fix this one.

brson

brson commented on Jan 24, 2012

@brson
Contributor

Fixed by kevina

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @graydon@erickt@brson@kevina

      Issue actions

        invalid location with #debug type error · Issue #1387 · rust-lang/rust