about summary refs log tree commit diff
diff options
context:
space:
mode:
authormojave2 <chenchen145@huawei.com>2023-09-06 10:51:28 +0800
committermojave2 <chenchen145@huawei.com>2023-09-06 17:46:46 +0800
commitdf6e6a6d08f1ccd04e852896553e3fd7927dcdd6 (patch)
treeef368ad274c45f56faed0629932b899d10fd03ec
parent51a9df8c70d69a253f9e563e3e4370297ad1746a (diff)
downloadrust-df6e6a6d08f1ccd04e852896553e3fd7927dcdd6.tar.gz
rust-df6e6a6d08f1ccd04e852896553e3fd7927dcdd6.zip
fix #115348
-rw-r--r--compiler/rustc_mir_transform/src/check_unsafety.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/check_unsafety.rs b/compiler/rustc_mir_transform/src/check_unsafety.rs
index 0fce9cb19a8..d5af321d726 100644
--- a/compiler/rustc_mir_transform/src/check_unsafety.rs
+++ b/compiler/rustc_mir_transform/src/check_unsafety.rs
@@ -483,7 +483,7 @@ fn unsafety_check_result(tcx: TyCtxt<'_>, def: LocalDefId) -> &UnsafetyCheckResu
     // `mir_built` force this.
     let body = &tcx.mir_built(def).borrow();
 
-    if body.is_custom_mir() {
+    if body.is_custom_mir() || body.tainted_by_errors.is_some() {
         return tcx.arena.alloc(UnsafetyCheckResult {
             violations: Vec::new(),
             used_unsafe_blocks: Default::default(),