rust/compiler/rustc_codegen_llvm/src
bors e1ff91f439 Auto merge of #83813 - cbeuw:remap-std, r=michaelwoerister
Fix `--remap-path-prefix` not correctly remapping `rust-src` component paths and unify handling of path mapping with virtualized paths

This PR fixes #73167 ("Binaries end up containing path to the rust-src component despite `--remap-path-prefix`") by preventing real local filesystem paths from reaching compilation output if the path is supposed to be remapped.

`RealFileName::Named` introduced in #72767 is now renamed as `LocalPath`, because this variant wraps a (most likely) valid local filesystem path.

`RealFileName::Devirtualized` is renamed as `Remapped` to be used for remapped path from a real path via `--remap-path-prefix` argument, as well as real path inferred from a virtualized (during compiler bootstrapping) `/rustc/...` path. The `local_path` field is now an `Option<PathBuf>`, as it will be set to `None` before serialisation, so it never reaches any build output. Attempting to serialise a non-`None` `local_path` will cause an assertion faliure.

When a path is remapped, a `RealFileName::Remapped` variant is created. The original path is preserved in `local_path` field and the remapped path is saved in `virtual_name` field. Previously, the `local_path` is directly modified which goes against its purpose of "suitable for reading from the file system on the local host".

`rustc_span::SourceFile`'s fields `unmapped_path` (introduced by #44940) and `name_was_remapped` (introduced by #41508 when `--remap-path-prefix` feature originally added) are removed, as these two pieces of information can be inferred from the `name` field: if it's anything other than a `FileName::Real(_)`, or if it is a `FileName::Real(RealFileName::LocalPath(_))`, then clearly `name_was_remapped` would've been false and `unmapped_path` would've been `None`. If it is a `FileName::Real(RealFileName::Remapped{local_path, virtual_name})`, then `name_was_remapped` would've been true and `unmapped_path` would've been `Some(local_path)`.

cc `@eddyb` who implemented `/rustc/...` path devirtualisation
2021-05-12 11:05:56 +00:00
..
back Support -C passes in NewPM 2021-05-08 10:58:08 +02:00
coverageinfo Rollup merge of #84875 - richkadel:no-coverage-dont-check-unused, r=tmandry 2021-05-07 15:20:25 +09:00
debuginfo Auto merge of #83813 - cbeuw:remap-std, r=michaelwoerister 2021-05-12 11:05:56 +00:00
llvm Support -C passes in NewPM 2021-05-08 10:58:08 +02:00
abi.rs Enable mutable noalias by default for LLVM 12 2021-03-21 20:10:54 +01:00
allocator.rs Remove redundant to_string calls 2021-02-17 11:25:55 +01:00
asm.rs Allow clobbering unsupported registers in asm! 2021-04-04 10:42:32 +01:00
attributes.rs Auto merge of #83610 - bjorn3:driver_cleanup, r=cjgillot 2021-05-12 08:38:03 +00:00
base.rs Move SanitizerSet to rustc_target 2021-04-03 00:37:49 +03:00
builder.rs Disable LLVM's new fptoint intrinsics on riscv64 2021-04-23 07:45:23 -07:00
callee.rs Manually set dso_local when its valid to do so 2021-04-03 00:00:29 +03:00
common.rs Update and improve rustc_codegen_{llvm,ssa} docs 2020-12-22 19:42:23 -08:00
consts.rs Replace const_cstr with cstr crate 2021-02-14 09:45:35 +11:00
context.rs rustc: Use LLVM's new saturating float-to-int intrinsics 2021-04-21 07:15:53 -07:00
declare.rs Make declare_cfn more flexible 2021-01-23 17:19:49 -05:00
intrinsic.rs Don't set fast(-math) for certain simd ops 2021-04-17 23:33:10 +03:00
lib.rs Auto merge of #83610 - bjorn3:driver_cleanup, r=cjgillot 2021-05-12 08:38:03 +00:00
llvm_util.rs rustc: Support Rust-specific features in -Ctarget-feature 2021-05-06 08:52:03 -07:00
metadata.rs Change 'NULL' to 'null' 2021-05-02 17:46:00 -06:00
mono_item.rs Manually set dso_local when its valid to do so 2021-04-03 00:00:29 +03:00
type_.rs Use ty::{IntTy,UintTy,FloatTy} in rustc 2021-01-18 21:09:30 +01:00
type_of.rs Revert "cg_llvm: fewer_names in uncached_llvm_type" 2020-12-17 16:40:47 +00:00
va_arg.rs Add big-endian support for AArch64 va_arg 2021-01-27 22:47:56 +00:00
value.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00