about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdwin White <adwinw01@gmail.com>2024-11-05 12:41:52 +0800
committerAdwin White <adwinw01@gmail.com>2024-11-05 12:41:52 +0800
commit15a71b64b837373b205daaebcf75e179fdfec89e (patch)
treefaa13c77a4faa8781cb6b75fb253ab30ac80d8fb
parentfbab78289dd8c6e8860034e0048cfb538f217700 (diff)
downloadrust-15a71b64b837373b205daaebcf75e179fdfec89e.tar.gz
rust-15a71b64b837373b205daaebcf75e179fdfec89e.zip
cleanup: Remove outdated comment and logic of `thir_body`
-rw-r--r--compiler/rustc_middle/src/query/mod.rs2
-rw-r--r--compiler/rustc_mir_build/src/check_unsafety.rs4
2 files changed, 1 insertions, 5 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index 41d0b47388c..30a2e839fb4 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -463,7 +463,7 @@ rustc_queries! {
         separate_provide_extern
     }
 
-    /// Fetch the THIR for a given body. If typeck for that body failed, returns an empty `Thir`.
+    /// Fetch the THIR for a given body.
     query thir_body(key: LocalDefId) -> Result<(&'tcx Steal<thir::Thir<'tcx>>, thir::ExprId), ErrorGuaranteed> {
         // Perf tests revealed that hashing THIR is inefficient (see #85729).
         no_hash
diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs
index f3e6301d9d1..33e194fa246 100644
--- a/compiler/rustc_mir_build/src/check_unsafety.rs
+++ b/compiler/rustc_mir_build/src/check_unsafety.rs
@@ -1005,10 +1005,6 @@ pub(crate) fn check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) {
     // Runs all other queries that depend on THIR.
     tcx.ensure_with_value().mir_built(def);
     let thir = &thir.steal();
-    // If `thir` is empty, a type error occurred, skip this body.
-    if thir.exprs.is_empty() {
-        return;
-    }
 
     let hir_id = tcx.local_def_id_to_hir_id(def);
     let safety_context = tcx.hir().fn_sig_by_hir_id(hir_id).map_or(SafetyContext::Safe, |fn_sig| {