@@ -23,7 +23,7 @@ use rustc_macros::{Decodable, Encodable, HashStable_Generic};
2323use rustc_span:: edition:: { DEFAULT_EDITION , EDITION_NAME_LIST , Edition , LATEST_STABLE_EDITION } ;
2424use rustc_span:: source_map:: FilePathMapping ;
2525use rustc_span:: {
26- FileName , FileNameDisplayPreference , RealFileName , SourceFileHashAlgorithm , Symbol , sym,
26+ FileName , FileNameDisplayPreference , RealFileName , SourceFileHashAlgorithm , Symbol , kw , sym,
2727} ;
2828use rustc_target:: spec:: {
2929 FramePointer , LinkSelfContainedComponents , LinkerFeatures , SplitDebuginfo , Target , TargetTuple ,
@@ -2931,13 +2931,13 @@ pub(crate) mod dep_tracking {
29312931 } ;
29322932
29332933 use super :: {
2934- AutoDiff , BranchProtection , CFGuard , CFProtection , CollapseMacroDebuginfo , CoverageOptions ,
2935- CrateType , DebugInfo , DebugInfoCompression , ErrorOutputType , FmtDebug , FunctionReturn ,
2936- InliningThreshold , InstrumentCoverage , InstrumentXRay , LinkerPluginLto , LocationDetail ,
2937- LtoCli , MirStripDebugInfo , NextSolverConfig , OomStrategy , OptLevel , OutFileName ,
2938- OutputType , OutputTypes , PatchableFunctionEntry , Polonius , RemapPathScopeComponents ,
2939- ResolveDocLinks , SourceFileHashAlgorithm , SplitDwarfKind , SwitchWithOptPath ,
2940- SymbolManglingVersion , WasiExecModel ,
2934+ AutoDiff , BranchProtection , CCharType , CFGuard , CFProtection , CollapseMacroDebuginfo ,
2935+ CoverageOptions , CrateType , DebugInfo , DebugInfoCompression , ErrorOutputType , FmtDebug ,
2936+ FunctionReturn , InliningThreshold , InstrumentCoverage , InstrumentXRay , LinkerPluginLto ,
2937+ LocationDetail , LtoCli , MirStripDebugInfo , NextSolverConfig , OomStrategy , OptLevel ,
2938+ OutFileName , OutputType , OutputTypes , PatchableFunctionEntry , Polonius ,
2939+ RemapPathScopeComponents , ResolveDocLinks , SourceFileHashAlgorithm , SplitDwarfKind ,
2940+ SwitchWithOptPath , SymbolManglingVersion , WasiExecModel ,
29412941 } ;
29422942 use crate :: lint;
29432943 use crate :: utils:: NativeLib ;
@@ -3040,6 +3040,7 @@ pub(crate) mod dep_tracking {
30403040 FunctionReturn ,
30413041 WasmCAbi ,
30423042 Align ,
3043+ CCharType ,
30433044 ) ;
30443045
30453046 impl < T1 , T2 > DepTrackingHash for ( T1 , T2 )
@@ -3314,3 +3315,31 @@ impl MirIncludeSpans {
33143315 self == MirIncludeSpans :: On
33153316 }
33163317}
3318+
3319+ /// The different settings that the `-Zc-char-type` flag can have.
3320+ #[ derive( Clone , Copy , PartialEq , Hash , Debug , Default ) ]
3321+ pub enum CCharType {
3322+ /// Use default signed/unsigned c_char according to target configuration
3323+ #[ default]
3324+ Default ,
3325+
3326+ /// Set c_char to signed i8
3327+ Signed ,
3328+
3329+ /// Set c_char to unsigned u8
3330+ Unsigned ,
3331+ }
3332+
3333+ impl CCharType {
3334+ pub const fn desc_symbol ( & self ) -> Symbol {
3335+ match * self {
3336+ Self :: Default => kw:: Default ,
3337+ Self :: Signed => sym:: signed,
3338+ Self :: Unsigned => sym:: unsigned,
3339+ }
3340+ }
3341+
3342+ pub const fn all ( ) -> [ Symbol ; 3 ] {
3343+ [ Self :: Unsigned . desc_symbol ( ) , Self :: Signed . desc_symbol ( ) , Self :: Default . desc_symbol ( ) ]
3344+ }
3345+ }
0 commit comments