@@ -23,7 +23,7 @@ use rustc_macros::{Decodable, Encodable, HashStable_Generic};
23
23
use rustc_span:: edition:: { DEFAULT_EDITION , EDITION_NAME_LIST , Edition , LATEST_STABLE_EDITION } ;
24
24
use rustc_span:: source_map:: FilePathMapping ;
25
25
use rustc_span:: {
26
- FileName , FileNameDisplayPreference , RealFileName , SourceFileHashAlgorithm , Symbol , sym,
26
+ FileName , FileNameDisplayPreference , RealFileName , SourceFileHashAlgorithm , Symbol , kw , sym,
27
27
} ;
28
28
use rustc_target:: spec:: {
29
29
FramePointer , LinkSelfContainedComponents , LinkerFeatures , SplitDebuginfo , Target , TargetTuple ,
@@ -2931,13 +2931,13 @@ pub(crate) mod dep_tracking {
2931
2931
} ;
2932
2932
2933
2933
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 ,
2941
2941
} ;
2942
2942
use crate :: lint;
2943
2943
use crate :: utils:: NativeLib ;
@@ -3040,6 +3040,7 @@ pub(crate) mod dep_tracking {
3040
3040
FunctionReturn ,
3041
3041
WasmCAbi ,
3042
3042
Align ,
3043
+ CCharType ,
3043
3044
) ;
3044
3045
3045
3046
impl < T1 , T2 > DepTrackingHash for ( T1 , T2 )
@@ -3314,3 +3315,31 @@ impl MirIncludeSpans {
3314
3315
self == MirIncludeSpans :: On
3315
3316
}
3316
3317
}
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