Skip to content
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

Documentation for std::column should state that it counts code points, not bytes or graphemes #92301

Closed
ecstatic-morse opened this issue Dec 26, 2021 · 1 comment · Fixed by #92335
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@ecstatic-morse
Copy link
Contributor

std::column counts the number of unicode characters that precede its invocation in that same line (then adds one). However, this behavior is not stated explicitly in its documentation. It's not unusual for programming languages or editors to use byte indexes for columns (vim does this for example), so I think it's worth clarifying.

@ecstatic-morse ecstatic-morse added A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 26, 2021
@ecstatic-morse ecstatic-morse changed the title Documentation for std::column should explicitly state that it counts characters, not bytes Documentation for std::column should explicitly state that it counts code points, not bytes Dec 27, 2021
@ecstatic-morse ecstatic-morse changed the title Documentation for std::column should explicitly state that it counts code points, not bytes Documentation for std::column should state that it counts code points, not bytes Dec 27, 2021
@ecstatic-morse ecstatic-morse changed the title Documentation for std::column should state that it counts code points, not bytes Documentation for std::column should state that it counts code points, not bytes or graphemes Dec 27, 2021
@clarfonthey
Copy link
Contributor

Perhaps there could be a version that does take into account graphemes, since the compiler itself already does this to ensure that errors are pointed to properly in the compiler output?

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 28, 2021
…r=Manishearth

Document units for `std::column`

Fixes rust-lang#92301.

r? `@Manishearth` (for the terminology and the Chinese)
@bors bors closed this as completed in c9cc9e5 Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants