Skip to content

Column offset should be 1-based instead of 0-based. #11183

Closed
@jhasse

Description

@jhasse

Other compilers (gcc) and editors (Sublime Text, vim) start columns at 1, but the rust compiler starts at 0:

~ echo "int main() { foo }" > tmp.c
~ echo " fn main() { foo }" > tmp.rs
~ gcc tmp.c
tmp.c:1:14: error: 'foo' undeclared (first use in this function)
~ rustc tmp.rs
tmp.rs:1:13: 1:16 error: unresolved name `foo`.

I'm not sure how to fix this properly. My patch simply adds 1 whenever col is displayed, but maybe it should be changed here? https://github.com/mozilla/rust/blob/master/src/libsyntax/codemap.rs#L148

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