[RFC 3127 - Trim Paths]: Add unstable option and parsing

This commit is contained in:
Urgau 2023-08-23 11:18:20 +02:00
parent 631a116cd3
commit 30f94717ca
4 changed files with 58 additions and 2 deletions

View file

@ -1018,6 +1018,32 @@ impl OutputFilenames {
}
}
bitflags::bitflags! {
/// Scopes used to determined if it need to apply to --remap-path-prefix
pub struct RemapPathScopeComponents: u8 {
/// Apply remappings to the expansion of std::file!() macro
const MACRO = 1 << 0;
/// Apply remappings to printed compiler diagnostics
const DIAGNOSTICS = 1 << 1;
/// Apply remappings to debug information only when they are written to
/// compiled executables or libraries, but not when they are in split
/// debuginfo files
const UNSPLIT_DEBUGINFO = 1 << 2;
/// Apply remappings to debug information only when they are written to
/// split debug information files, but not in compiled executables or
/// libraries
const SPLIT_DEBUGINFO = 1 << 3;
/// Apply remappings to the paths pointing to split debug information
/// files. Does nothing when these files are not generated.
const SPLIT_DEBUGINFO_PATH = 1 << 4;
/// An alias for macro,unsplit-debuginfo,split-debuginfo-path. This
/// ensures all paths in compiled executables or libraries are remapped
/// but not elsewhere.
const OBJECT = Self::MACRO.bits | Self::UNSPLIT_DEBUGINFO.bits | Self::SPLIT_DEBUGINFO_PATH.bits;
}
}
pub fn host_triple() -> &'static str {
// Get the host triple out of the build environment. This ensures that our
// idea of the host triple is the same as for the set of libraries we've
@ -3173,8 +3199,8 @@ pub(crate) mod dep_tracking {
BranchProtection, CFGuard, CFProtection, CrateType, DebugInfo, DebugInfoCompression,
ErrorOutputType, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, LocationDetail,
LtoCli, OomStrategy, OptLevel, OutFileName, OutputType, OutputTypes, Polonius,
ResolveDocLinks, SourceFileHashAlgorithm, SplitDwarfKind, SwitchWithOptPath,
SymbolManglingVersion, TraitSolver, TrimmedDefPaths,
RemapPathScopeComponents, ResolveDocLinks, SourceFileHashAlgorithm, SplitDwarfKind,
SwitchWithOptPath, SymbolManglingVersion, TraitSolver, TrimmedDefPaths,
};
use crate::lint;
use crate::options::WasiExecModel;
@ -3268,6 +3294,7 @@ pub(crate) mod dep_tracking {
StackProtector,
SwitchWithOptPath,
SymbolManglingVersion,
RemapPathScopeComponents,
SourceFileHashAlgorithm,
TrimmedDefPaths,
OutFileName,