Skip to content

Commit 779951b

Browse files
committed
Fix off-by-one in column numbers in panic debugPrintf traces.
1 parent 88457ae commit 779951b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

crates/rustc_codegen_spirv/src/linker/spirt_passes/controlflow.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,15 @@ pub fn convert_custom_aborts_to_unstructured_returns_in_entry_points(
342342
.unwrap_or_default();
343343

344344
let fmt_dbg_src_loc = |(file, line, col)| {
345+
// FIXME(eddyb) figure out what is going on with
346+
// these column number conventions, below is a
347+
// related comment from `spirt::print`:
348+
// > // HACK(eddyb) Rust-GPU's column numbers seem
349+
// > // off-by-one wrt what e.g. VSCode expects
350+
// > // for `:line:col` syntax, but it's hard to
351+
// > // tell from the spec and `glslang` doesn't
352+
// > // even emit column numbers at all!
353+
let col = col + 1;
345354
format!("{file}:{line}:{col}").replace('%', "%%")
346355
};
347356

0 commit comments

Comments
 (0)