diff options
| author | Michael Goulet <michael@errs.io> | 2025-06-20 18:56:40 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-06-20 18:57:00 +0000 |
| commit | 582c2df9dd36ace673f94367b45e2d8d427978e3 (patch) | |
| tree | f99aae613d4e49359a8a9b2d6eee85f5b699ffac /compiler | |
| parent | 9c4ff566babe632af5e30281a822d1ae9972873b (diff) | |
Collapse Analysis|Borrowck|PostBorrowckAnalysis when there are no opaques
Diffstat (limited to 'compiler')
| -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 } } } } |
