Skip to content

Commit 2ad4a35

Browse files
authored
Rollup merge of #132627 - adwinwhite:thir_body_cleanup, r=compiler-errors
cleanup: Remove outdated comment of `thir_body` When typeck fails, `thir_body` returns `ErrorGuaranteed` rather than empty body. No other code follows this outdated description except `check_unsafety`, which is also cleaned up in this PR.
2 parents 9098e03 + 15a71b6 commit 2ad4a35

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

compiler/rustc_middle/src/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ rustc_queries! {
463463
separate_provide_extern
464464
}
465465

466-
/// Fetch the THIR for a given body. If typeck for that body failed, returns an empty `Thir`.
466+
/// Fetch the THIR for a given body.
467467
query thir_body(key: LocalDefId) -> Result<(&'tcx Steal<thir::Thir<'tcx>>, thir::ExprId), ErrorGuaranteed> {
468468
// Perf tests revealed that hashing THIR is inefficient (see #85729).
469469
no_hash

compiler/rustc_mir_build/src/check_unsafety.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1005,10 +1005,6 @@ pub(crate) fn check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) {
10051005
// Runs all other queries that depend on THIR.
10061006
tcx.ensure_with_value().mir_built(def);
10071007
let thir = &thir.steal();
1008-
// If `thir` is empty, a type error occurred, skip this body.
1009-
if thir.exprs.is_empty() {
1010-
return;
1011-
}
10121008

10131009
let hir_id = tcx.local_def_id_to_hir_id(def);
10141010
let safety_context = tcx.hir().fn_sig_by_hir_id(hir_id).map_or(SafetyContext::Safe, |fn_sig| {

0 commit comments

Comments
 (0)