-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
coverage: llvm-cov expects column numbers to be bytes, not code points
#119033
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
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
#119034 has landed, so now I can think about making this ready for review. |
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
This comment was marked as resolved.
This comment was marked as resolved.
|
r? compiler |
davidtwco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me when CI passes
|
@bors delegate+ |
|
@bors r=davidtwco |
|
@rustbot label +relnotes This is a user-visible bug fix for taiki-e/cargo-llvm-cov#275. Suggested summary: “Fix coverage instrumentation/reports for non-ASCII source code” |
Normally the compiler emits column numbers as a 1-based number of Unicode code points.
But when we embed coverage mappings for
-Cinstrument-coverage, those mappings will ultimately be read by thellvm-covtool. That tool assumes that column numbers are 1-based numbers of bytes, and relies on that assumption when slicing up source code to apply highlighting (in HTML reports, and in text-based reports with colour).For the very common case of all-ASCII source code, bytes and code points are the same, so the difference isn't noticeable. But for code that contains non-ASCII characters, emitting column numbers as code points will result in
llvm-covslicing strings in the wrong places, producing mangled output or fatal errors.(See taiki-e/cargo-llvm-cov#275 as an example of what can go wrong.)