]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_mir/src/transform/check_unsafety.rs
Auto merge of #85617 - hi-rustin:rustin-patch-fix, r=estebank
[rust.git] / compiler / rustc_mir / src / transform / check_unsafety.rs
index 8d4316c30b3efed07f4ec29cf609f31afe47ef4e..103ddda1a1d262c45069da1fab78d78404a7776b 100644 (file)
@@ -376,6 +376,12 @@ fn check_mut_borrowing_layout_constrained_field(
     /// Checks whether calling `func_did` needs an `unsafe` context or not, i.e. whether
     /// the called function has target features the calling function hasn't.
     fn check_target_features(&mut self, func_did: DefId) {
+        // Unsafety isn't required on wasm targets. For more information see
+        // the corresponding check in typeck/src/collect.rs
+        if self.tcx.sess.target.options.is_like_wasm {
+            return;
+        }
+
         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;