diff --git a/cli/src/bin/naga.rs b/cli/src/bin/naga.rs index 3ca7305e4..3b0873a37 100644 --- a/cli/src/bin/naga.rs +++ b/cli/src/bin/naga.rs @@ -374,13 +374,7 @@ fn run() -> Result<(), Box> { .set(naga::back::spv::WriterFlags::DEBUG, true); params.spv_out.debug_info = Some(naga::back::spv::DebugInfo { source_code: input_text, - file_name: input_path - .file_name() - .and_then(std::ffi::OsStr::to_str) - .ok_or(CliError( - "input path for couldn't be converted to string \ - for `--generate-debug-symbols", - ))?, + file_name: input_path, }) } else { eprintln!( diff --git a/src/back/spv/mod.rs b/src/back/spv/mod.rs index 52e304a23..c52827908 100644 --- a/src/back/spv/mod.rs +++ b/src/back/spv/mod.rs @@ -85,7 +85,7 @@ impl IdGenerator { #[derive(Debug, Clone)] pub struct DebugInfo<'a> { pub source_code: &'a str, - pub file_name: &'a str, + pub file_name: &'a std::path::Path, } /// A SPIR-V block to which we are still adding instructions. diff --git a/src/back/spv/writer.rs b/src/back/spv/writer.rs index fd39fe2e4..56d018b6f 100644 --- a/src/back/spv/writer.rs +++ b/src/back/spv/writer.rs @@ -1840,8 +1840,10 @@ impl Writer { if self.flags.contains(WriterFlags::DEBUG) { if let Some(debug_info) = debug_info.as_ref() { let source_file_id = self.id_gen.next(); - self.debugs - .push(Instruction::string(debug_info.file_name, source_file_id)); + self.debugs.push(Instruction::string( + &debug_info.file_name.display().to_string(), + source_file_id, + )); debug_info_inner = Some(DebugInfoInner { source_code: debug_info.source_code, diff --git a/tests/snapshots.rs b/tests/snapshots.rs index 495051084..b7327cce7 100644 --- a/tests/snapshots.rs +++ b/tests/snapshots.rs @@ -159,7 +159,7 @@ fn check_targets( let debug_info = if cfg!(feature = "span") { source_code.map(|code| naga::back::spv::DebugInfo { source_code: code, - file_name: name, + file_name: name.as_ref(), }) } else { None