1
Fork 0
This commit is contained in:
lcnr 2022-05-09 17:47:02 +02:00
parent d371ebe117
commit 32b13ac928
11 changed files with 73 additions and 59 deletions

View file

@ -375,12 +375,8 @@ impl<'tcx> UnsafetyChecker<'_, 'tcx> {
}
let callee_features = &self.tcx.codegen_fn_attrs(func_did).target_features;
// Constants don't have codegen attributes, so the body might not have codegen attributes.
let self_features: &[_] = if self.tcx.has_codegen_attrs(self.tcx.def_kind(self.body_did)) {
&self.tcx.codegen_fn_attrs(self.body_did).target_features
} else {
&[]
};
// The body might be a constant, so it doesn't have codegen attributes.
let self_features = &self.tcx.body_codegen_attrs(self.body_did.to_def_id()).target_features;
// Is `callee_features` a subset of `calling_features`?
if !callee_features.iter().all(|feature| self_features.contains(feature)) {