rustc_target: Add some more target spec sanity checking

This commit is contained in:
Vadim Petrochenkov 2022-06-28 12:40:39 +03:00
parent 4065b89b1e
commit 2e83c22154
5 changed files with 60 additions and 17 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);
}
)+
}