You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 first line!() is 1 and the first column!() is 0. This seems like an oversight. We would like to make column!() 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!() and column!() 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:
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.
Make the output of the column! macro 1 based
Fixes#46868.
I didn't add any regression tests as the change already had to change tests inside the codebase.
r? @dtolnay
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: