rust/src/debuginfo
bors 956134622e Auto merge of #149709 - Urgau:overhaul-filenames, r=davidtwco
Overhaul filename handling for cross-compiler consistency

This PR overhauls the way we handle filenames in the compiler and `rmeta` in order to achieve achieve cross-compiler consistency (ie. having the same path no matter if the filename was created in the current compiler session or is coming from `rmeta`).

This is required as some parts of the compiler rely on consistent paths for the soundness of generated code (see rust-lang/rust#148328).

In order to achieved consistency multiple steps are being taken by this PR:
 - by making `RealFileName` immutable
 - by only having `SourceMap::to_real_filename` create `RealFileName`
   - currently `RealFileName` can be created from any `Path` and are remapped afterwards, which creates consistency issue
 - by also making `RealFileName` holds it's working directory, embeddable name and the remapped scopes
   - this removes the need for a `Session`, to know the current(!) scopes and cwd, which is invalid as they may not be equal to the scopes used when creating the filename

In order for `SourceMap::to_real_filename` to know which scopes to apply `FilePathMapping` now takes the current remapping scopes to apply, which makes `FileNameDisplayPreference` and company useless and are removed.

This PR is split-up in multiple commits (unfortunately not atomic), but should help review the changes.

Unblocks https://github.com/rust-lang/rust/pull/147611
Fixes https://github.com/rust-lang/rust/issues/148328
2025-12-13 14:32:09 +00:00
..
emit.rs Merge commit 'a0b865dc87' into sync_cg_clif-2025-11-08 2025-11-08 14:18:53 +00:00
gcc_except_table.rs Merge commit 'a0b865dc87' into sync_cg_clif-2025-11-08 2025-11-08 14:18:53 +00:00
line_info.rs Adapt cg_cranelift to the overhauled filename handling 2025-12-12 07:34:52 +01:00
mod.rs Adapt cg_cranelift to the overhauled filename handling 2025-12-12 07:34:52 +01:00
object.rs Rustfmt 2025-02-08 22:12:13 +00:00
types.rs Merge commit 'e24f0fa3c5' into sync_cg_clif-2025-12-08 2025-12-08 16:20:48 +00:00
unwind.rs Use let...else instead of match foo { ... _ => return }; and if let ... else return 2025-12-12 17:52:39 +00:00