diff options
| author | bors <bors@rust-lang.org> | 2025-06-29 19:12:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-06-29 19:12:29 +0000 |
| commit | 35f6036521777bdc0dcea1f980be4c192962a168 (patch) | |
| tree | fb0481db906b1294df2f9b051c607cd960dd2bbf | |
| parent | ed2d759783dc9de134bbb3f01085b1e6dbf539f3 (diff) | |
| parent | 582c2df9dd36ace673f94367b45e2d8d427978e3 (diff) | |
| download | rust-35f6036521777bdc0dcea1f980be4c192962a168.tar.gz rust-35f6036521777bdc0dcea1f980be4c192962a168.zip | |
Auto merge of #142802 - compiler-errors:dedup-analyses, r=lcnr
Collapse Analysis|Borrowck|PostBorrowckAnalysis when there are no opaques r? lcnr
| -rw-r--r-- | compiler/rustc_type_ir/src/infer_ctxt.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/compiler/rustc_type_ir/src/infer_ctxt.rs b/compiler/rustc_type_ir/src/infer_ctxt.rs index 2bc12d0a23b..8ba9e7105d6 100644 --- a/compiler/rustc_type_ir/src/infer_ctxt.rs +++ b/compiler/rustc_type_ir/src/infer_ctxt.rs @@ -117,12 +117,20 @@ impl<I: Interner> TypingMode<I> { } pub fn borrowck(cx: I, body_def_id: I::LocalDefId) -> TypingMode<I> { - TypingMode::Borrowck { defining_opaque_types: cx.opaque_types_defined_by(body_def_id) } + let defining_opaque_types = cx.opaque_types_defined_by(body_def_id); + if defining_opaque_types.is_empty() { + TypingMode::non_body_analysis() + } else { + TypingMode::Borrowck { defining_opaque_types } + } } pub fn post_borrowck_analysis(cx: I, body_def_id: I::LocalDefId) -> TypingMode<I> { - TypingMode::PostBorrowckAnalysis { - defined_opaque_types: cx.opaque_types_defined_by(body_def_id), + let defined_opaque_types = cx.opaque_types_defined_by(body_def_id); + if defined_opaque_types.is_empty() { + TypingMode::non_body_analysis() + } else { + TypingMode::PostBorrowckAnalysis { defined_opaque_types } } } } |
