Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc_target: Change os and vendor values to "none" and "unknown" for some targets #78951

Merged
merged 3 commits into from
Nov 14, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
rustc_target: Make sure that in-tree targets follow conventions for o…
…s and vendor values
  • Loading branch information
petrochenkov committed Nov 11, 2020
commit e0a8f22053868982be59a82865fa11f4fbdf6af0
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")
}
}