Fix off-by-one in column numbers in panic debugPrintf traces.

This commit is contained in:
Eduard-Mihai Burtescu 2023-07-24 17:10:20 +03:00 committed by Eduard-Mihai Burtescu
parent 88457ae249
commit 779951bc8d

View File

@ -342,6 +342,15 @@ pub fn convert_custom_aborts_to_unstructured_returns_in_entry_points(
.unwrap_or_default(); .unwrap_or_default();
let fmt_dbg_src_loc = |(file, line, col)| { let fmt_dbg_src_loc = |(file, line, col)| {
// FIXME(eddyb) figure out what is going on with
// these column number conventions, below is a
// related comment from `spirt::print`:
// > // HACK(eddyb) Rust-GPU's column numbers seem
// > // off-by-one wrt what e.g. VSCode expects
// > // for `:line:col` syntax, but it's hard to
// > // tell from the spec and `glslang` doesn't
// > // even emit column numbers at all!
let col = col + 1;
format!("{file}:{line}:{col}").replace('%', "%%") format!("{file}:{line}:{col}").replace('%', "%%")
}; };