Skip to content

Commit

Permalink
Unrolled build for rust-lang#132627
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#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.
  • Loading branch information
rust-timer authored Nov 12, 2024
2 parents 67f2127 + 15a71b6 commit 2a89748
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_mir_build/src/check_unsafety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down

0 comments on commit 2a89748

Please sign in to comment.