From 779951bc8de8f58434dd9bf2163f1a04b1135f4d Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Mon, 24 Jul 2023 17:10:20 +0300 Subject: [PATCH] Fix off-by-one in column numbers in panic `debugPrintf` traces. --- .../src/linker/spirt_passes/controlflow.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/rustc_codegen_spirv/src/linker/spirt_passes/controlflow.rs b/crates/rustc_codegen_spirv/src/linker/spirt_passes/controlflow.rs index 523896acdb..5a173e43a4 100644 --- a/crates/rustc_codegen_spirv/src/linker/spirt_passes/controlflow.rs +++ b/crates/rustc_codegen_spirv/src/linker/spirt_passes/controlflow.rs @@ -342,6 +342,15 @@ pub fn convert_custom_aborts_to_unstructured_returns_in_entry_points( .unwrap_or_default(); 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('%', "%%") };