1
Fork 0

rustc_target: Make sure that in-tree targets follow conventions for os and vendor values

This commit is contained in:
Vadim Petrochenkov 2020-11-11 20:59:37 +03:00
parent 1def24c5f4
commit e0a8f22053

View file

@ -36,5 +36,18 @@ impl Target {
&& self.post_link_objects_fallback.is_empty())
|| self.crt_objects_fallback.is_some()
);
// Keep the default "unknown" vendor instead.
assert_ne!(self.vendor, "");
if !self.can_use_os_unknown() {
// Keep the default "none" for bare metal targets instead.
assert_ne!(self.os, "unknown");
}
}
// Add your target to the whitelist if it has `std` library
// and you certainly want "unknown" for the OS name.
fn can_use_os_unknown(&self) -> bool {
self.llvm_target == "wasm32-unknown-unknown"
|| (self.env == "sgx" && self.vendor == "fortanix")
}
}