rust/src
bors 8188f6c808 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
..
bootstrap Auto merge of #147372 - jieyouxu:rust-analyzer-main-tests, r=Kobzol 2025-12-13 10:11:41 +00:00
build_helper Use yarn instead of npm in tidy 2025-11-17 10:58:13 +02:00
ci Use ubuntu:24.04 for the x86_64-gnu-miri and x86_64-gnu-aux jobs 2025-12-10 17:50:35 +01:00
doc update docs 2025-12-10 16:34:16 +01:00
etc add a missing comma to default r-a settings file 2025-11-29 21:31:43 +00:00
gcc@0081ca6631 Update GCC submodule 2025-11-26 20:11:43 +01:00
librustdoc Auto merge of #149709 - Urgau:overhaul-filenames, r=davidtwco 2025-12-13 14:32:09 +00:00
llvm-project@16b5ac8b0a Update LLVM to 21.1.5 2025-11-08 10:21:22 +08:00
rustc-std-workspace Generalize branch references to HEAD 2025-11-02 11:15:55 +01:00
rustdoc-json-types rustdoc-json: add rlib path to ExternalCrate to enable robust crate resolution 2025-11-21 09:22:59 +00:00
tools Auto merge of #149709 - Urgau:overhaul-filenames, r=davidtwco 2025-12-13 14:32:09 +00:00
README.md
stage0 Change default branch to main 2025-11-10 10:21:34 +01:00
version bump version number 2025-12-05 19:33:24 +00:00

This directory contains some source code for the Rust project, including:

  • The bootstrapping build system
  • Various submodules for tools, like cargo, tidy, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.