File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
compiler/rustc_target/src/spec Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -3218,6 +3218,27 @@ impl Target {
32183218 ) ;
32193219 }
32203220
3221+ // Ensure built-in targets don't use the `Other` variants.
3222+ if kind == TargetKind :: Builtin {
3223+ check ! (
3224+ !matches!( self . arch, Arch :: Other ( _) ) ,
3225+ "`Arch::Other` is only meant for JSON targets"
3226+ ) ;
3227+ check ! ( !matches!( self . os, Os :: Other ( _) ) , "`Os::Other` is only meant for JSON targets" ) ;
3228+ check ! (
3229+ !matches!( self . env, Env :: Other ( _) ) ,
3230+ "`Env::Other` is only meant for JSON targets"
3231+ ) ;
3232+ check ! (
3233+ !matches!( self . cfg_abi, CfgAbi :: Other ( _) ) ,
3234+ "`CfgAbi::Other` is only meant for JSON targets"
3235+ ) ;
3236+ check ! (
3237+ !matches!( self . llvm_abiname, LlvmAbi :: Other ( _) ) ,
3238+ "`LlvmAbi::Other` is only meant for JSON targets"
3239+ ) ;
3240+ }
3241+
32213242 // Check ABI flag consistency, for the architectures where we have proper ABI treatment.
32223243 // To ensure targets are trated consistently, please consult with the team before allowing
32233244 // new cases.
You can’t perform that action at this time.
0 commit comments