Skip to content

Commit

Permalink
rustc_target: Make sure that in-tree targets follow conventions for o…
Browse files Browse the repository at this point in the history
…s and vendor values
  • Loading branch information
petrochenkov committed Nov 11, 2020
1 parent 1def24c commit e0a8f22
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions compiler/rustc_target/src/spec/tests/tests_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

0 comments on commit e0a8f22

Please sign in to comment.