Auto merge of #100537 - petrochenkov:piccheck, r=oli-obk

rustc_target: Add some more target spec sanity checking
This commit is contained in:
bors 2022-09-01 03:13:46 +00:00
commit aa857eb953
14 changed files with 85 additions and 54 deletions

View file

@ -837,15 +837,15 @@ impl fmt::Display for StackProtector {
}
macro_rules! supported_targets {
( $(($( $triple:literal, )+ $module:ident ),)+ ) => {
( $(($triple:literal, $module:ident ),)+ ) => {
$(mod $module;)+
/// List of supported targets
pub const TARGETS: &[&str] = &[$($($triple),+),+];
pub const TARGETS: &[&str] = &[$($triple),+];
fn load_builtin(target: &str) -> Option<Target> {
let mut t = match target {
$( $($triple)|+ => $module::target(), )+
$( $triple => $module::target(), )+
_ => return None,
};
t.is_builtin = true;
@ -861,7 +861,7 @@ macro_rules! supported_targets {
$(
#[test] // `#[test]`
fn $module() {
tests_impl::test_target(super::$module::target());
tests_impl::test_target(super::$module::target(), $triple);
}
)+
}
@ -1528,7 +1528,7 @@ fn add_link_args(link_args: &mut LinkArgs, flavor: LinkerFlavor, args: &[&'stati
match flavor {
LinkerFlavor::Ld => insert(LinkerFlavor::Lld(LldFlavor::Ld)),
LinkerFlavor::Msvc => insert(LinkerFlavor::Lld(LldFlavor::Link)),
LinkerFlavor::Lld(LldFlavor::Wasm) => {}
LinkerFlavor::Lld(LldFlavor::Ld64) | LinkerFlavor::Lld(LldFlavor::Wasm) => {}
LinkerFlavor::Lld(lld_flavor) => {
panic!("add_link_args: use non-LLD flavor for {:?}", lld_flavor)
}