-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
column!() should start at 1 not 0 #46868
Labels
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Comments
dtolnay
added
the
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
label
Dec 20, 2017
Definitely! We'll only have to coordinate with #46762 as if they get merged in the wrong order we might get into issues :). I'll have a look at this at friday. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In #46762 we noticed that column numbering is handled inconsistently throughout Rust. As of 1.22, panic columns are reported starting with 0.
Except panics that originate within the compiler which seem to start with 1, at least in the following case.
For #46762 we decided to at least make all panics consistent and go with 1 based. Discussed with the libs team today and we would be interested in applying the same fix for the
column!()
macro as well. Currently the firstline!()
is 1 and the firstcolumn!()
is 0. This seems like an oversight. We would like to makecolumn!()
return 1 in the first column. This matches how panics report the column as of #46762, and matches how most text editors number columns.Obviously if this change turns out to cause major problems then we would revisit, but
column!()
is used infrequently enough and its uses tend to be such that off-by-one is not important (pretty much limited to error reporting) so we are not too worried.Documentation for both
line!()
andcolumn!()
will need to be updated to be explicit about the numbering.@est31 would you be interested in tackling this change?
The text was updated successfully, but these errors were encountered: