proc-macro2 icon indicating copy to clipboard operation
proc-macro2 copied to clipboard

Inconsistent "indexed-ness" for columns when using within and outside a proc-macro environment

Open samuelpilz opened this issue 3 years ago • 3 comments

This crates docs for LineColumn say that the column is 0-indexed. The docs for proc_macro::LineColumn say that the column is 1-indexed. As far as I can see, this is a documentation issue in proc_macro2 and the column value from the proc_macro::LineColumn is used without offset.

samuelpilz avatar Apr 21 '22 19:04 samuelpilz

Looking at the tests, when using the parse::<TokenStream> method outside a proc-macro environment, the column seems to be 0-indexed. PR #372 shows that they are 1-indexed in a proc-macro environment.

samuelpilz avatar Mar 25 '23 13:03 samuelpilz

Yeah it seems this got changed in libproc_macro in https://github.com/rust-lang/rust/pull/87712.

dtolnay avatar Mar 25 '23 20:03 dtolnay

can I help fixing this?

samuelpilz avatar May 20 '23 08:05 samuelpilz