Skip to content

Commit 42e1bc8

Browse files
committedOct 23, 2024
Auto merge of rust-lang#131856 - lcnr:typing-mode, r=<try>
TypingMode 🤔 unsure how and whether to actually get this ready for merge, opening for input + perf for now r? `@compiler-errors`
2 parents be01dab + 02dce21 commit 42e1bc8

File tree

74 files changed

+422
-484
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+422
-484
lines changed
 

‎compiler/rustc_borrowck/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use rustc_infer::infer::{
3434
use rustc_middle::mir::tcx::PlaceTy;
3535
use rustc_middle::mir::*;
3636
use rustc_middle::query::Providers;
37-
use rustc_middle::ty::{self, ParamEnv, RegionVid, TyCtxt};
37+
use rustc_middle::ty::{self, ParamEnv, RegionVid, TyCtxt, TypingMode};
3838
use rustc_middle::{bug, span_bug};
3939
use rustc_mir_dataflow::Analysis;
4040
use rustc_mir_dataflow::impls::{
@@ -440,7 +440,7 @@ pub struct BorrowckInferCtxt<'tcx> {
440440

441441
impl<'tcx> BorrowckInferCtxt<'tcx> {
442442
pub(crate) fn new(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Self {
443-
let infcx = tcx.infer_ctxt().with_opaque_type_inference(def_id).build();
443+
let infcx = tcx.infer_ctxt().build(TypingMode::analysis_in_body(tcx, def_id));
444444
BorrowckInferCtxt { infcx, reg_var_to_origin: RefCell::new(Default::default()) }
445445
}
446446

‎compiler/rustc_borrowck/src/region_infer/opaque_types.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use rustc_macros::extension;
99
use rustc_middle::ty::visit::TypeVisitableExt;
1010
use rustc_middle::ty::{
1111
self, GenericArgKind, GenericArgs, OpaqueHiddenType, OpaqueTypeKey, Ty, TyCtxt, TypeFoldable,
12+
TypingMode,
1213
};
1314
use rustc_span::Span;
1415
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
@@ -346,8 +347,7 @@ fn check_opaque_type_well_formed<'tcx>(
346347
let infcx = tcx
347348
.infer_ctxt()
348349
.with_next_trait_solver(next_trait_solver)
349-
.with_opaque_type_inference(parent_def_id)
350-
.build();
350+
.build(TypingMode::analysis_in_body(tcx, parent_def_id));
351351
let ocx = ObligationCtxt::new_with_diagnostics(&infcx);
352352
let identity_args = GenericArgs::identity_for_item(tcx, def_id);
353353

@@ -516,7 +516,7 @@ impl<'tcx> LazyOpaqueTyEnv<'tcx> {
516516
},
517517
);
518518

519-
let infcx = tcx.infer_ctxt().build();
519+
let infcx = tcx.infer_ctxt().build(TypingMode::non_body_analysis());
520520
let ocx = ObligationCtxt::new(&infcx);
521521

522522
let wf_tys = ocx.assumed_wf_types(param_env, parent).unwrap_or_else(|_| {

0 commit comments

Comments
 (0)