Description
Spawned off of #87805 (comment)
When passing --remap-path-prefix C:\\path\\to\\project=nothing_to_see_here
to rustc I would expect all paths that start with C:\path\to\project
to be replaced with nothing_to_see_here
, instead a C:\path\to\project\target\release\deps\crate_name.pdb
is still present.
Note that this happens even in release mode, because rustc always tells the msvc linker to generate .pdb
files.
This can be "fixed" by passing either -Clink-arg=/PDBALTPATH:%_PDB%
, -Clink-arg=/DEBUG:NONE
or -Zstrip=debuginfo
to rustc, but doing so will break backtraces with RUST_BACKTRACE='full'
(RUST_BACKTRACE=1
already prints almost nothing in release mode). As a sidenote, do we really need backtraces in release mode, and by consequence .pdb
files? They will break anyway if only the .exe
is distributed or the target
directory is deleted.
Moreover this shouldn't be needed in the first place since --remap-path-prefix
promises to "remap source names in all output (compiler messages and output files)" (from the output of rustc --help -v
), "including [...] debug information" (from the rustc book here). Also note that neither rustc --help -v
nor the rustc book mention the need to pass one of those arguments to rustc to remap/remove the path to the .pdb
file, which makes it harder for non-experts to know how to remove them.
rustc --version --verbose
:
rustc 1.54.0 (a178d0322 2021-07-26)
binary: rustc
commit-hash: a178d0322ce20e33eac124758e837cbd80a6f633
commit-date: 2021-07-26
host: x86_64-pc-windows-msvc
release: 1.54.0
LLVM version: 12.0.1