]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_mir_transform/src/check_unsafety.rs
Auto merge of #96737 - ChrisDenton:win-manifest, r=wesleywiser
[rust.git] / compiler / rustc_mir_transform / src / check_unsafety.rs
index dde79214b16470e16b942d08992448172c2e1874..1f73b7da815c505e1b9a7c6f98f2987eca4e36f3 100644 (file)
@@ -375,7 +375,8 @@ fn check_target_features(&mut self, func_did: DefId) {
         }
 
         let callee_features = &self.tcx.codegen_fn_attrs(func_did).target_features;
-        let self_features = &self.tcx.codegen_fn_attrs(self.body_did).target_features;
+        // 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)) {