File tree Expand file tree Collapse file tree
compiler/rustc_target/src/spec Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3218,6 +3218,30 @@ 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+ "`Other` variants are only meant for JSON targets"
3226+ ) ;
3227+ check ! (
3228+ !matches!( self . os, Os :: Other ( _) ) ,
3229+ "`Other` variants are only meant for JSON targets"
3230+ ) ;
3231+ check ! (
3232+ !matches!( self . env, Env :: Other ( _) ) ,
3233+ "`Other` variants are only meant for JSON targets"
3234+ ) ;
3235+ check ! (
3236+ !matches!( self . cfg_abi, CfgAbi :: Other ( _) ) ,
3237+ "`Other` variants are only meant for JSON targets"
3238+ ) ;
3239+ check ! (
3240+ !matches!( self . llvm_abiname, LlvmAbi :: Other ( _) ) ,
3241+ "`Other` variants are only meant for JSON targets"
3242+ ) ;
3243+ }
3244+
32213245 // Check ABI flag consistency, for the architectures where we have proper ABI treatment.
32223246 // To ensure targets are trated consistently, please consult with the team before allowing
32233247 // new cases.
You can’t perform that action at this time.
0 commit comments