@@ -232,18 +232,6 @@ pub enum DefiningAnchor {
232
232
pub struct InferCtxt < ' tcx > {
233
233
pub tcx : TyCtxt < ' tcx > ,
234
234
235
- /// The `DefId` of the item in whose context we are performing inference or typeck.
236
- /// It is used to check whether an opaque type use is a defining use.
237
- ///
238
- /// If it is `DefiningAnchor::Bubble`, we can't resolve opaque types here and need to bubble up
239
- /// the obligation. This frequently happens for
240
- /// short lived InferCtxt within queries. The opaque type obligations are forwarded
241
- /// to the outside until the end up in an `InferCtxt` for typeck or borrowck.
242
- ///
243
- /// Its default value is `DefiningAnchor::Error`, this way it is easier to catch errors that
244
- /// might come up during inference or typeck.
245
- pub old_defining_use_anchor : DefiningAnchor ,
246
-
247
235
/// Whether this inference context should care about region obligations in
248
236
/// the root universe. Most notably, this is used during hir typeck as region
249
237
/// solving is left to borrowck instead.
@@ -537,7 +525,6 @@ impl<'tcx> fmt::Display for FixupError<'tcx> {
537
525
/// Used to configure inference contexts before their creation
538
526
pub struct InferCtxtBuilder < ' tcx > {
539
527
tcx : TyCtxt < ' tcx > ,
540
- defining_use_anchor : DefiningAnchor ,
541
528
considering_regions : bool ,
542
529
/// Whether we are in coherence mode.
543
530
intercrate : bool ,
@@ -549,27 +536,11 @@ pub trait TyCtxtInferExt<'tcx> {
549
536
550
537
impl < ' tcx > TyCtxtInferExt < ' tcx > for TyCtxt < ' tcx > {
551
538
fn infer_ctxt ( self ) -> InferCtxtBuilder < ' tcx > {
552
- InferCtxtBuilder {
553
- tcx : self ,
554
- defining_use_anchor : DefiningAnchor :: Error ,
555
- considering_regions : true ,
556
- intercrate : false ,
557
- }
539
+ InferCtxtBuilder { tcx : self , considering_regions : true , intercrate : false }
558
540
}
559
541
}
560
542
561
543
impl < ' tcx > InferCtxtBuilder < ' tcx > {
562
- /// Whenever the `InferCtxt` should be able to handle defining uses of opaque types,
563
- /// you need to call this function. Otherwise the opaque type will be treated opaquely.
564
- ///
565
- /// It is only meant to be called in two places, for typeck
566
- /// (via `Inherited::build`) and for the inference context used
567
- /// in mir borrowck.
568
- pub fn with_opaque_type_inference ( mut self , defining_use_anchor : DefiningAnchor ) -> Self {
569
- self . defining_use_anchor = defining_use_anchor;
570
- self
571
- }
572
-
573
544
pub fn intercrate ( mut self ) -> Self {
574
545
self . intercrate = true ;
575
546
self
@@ -601,10 +572,9 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
601
572
}
602
573
603
574
pub fn build ( & mut self ) -> InferCtxt < ' tcx > {
604
- let InferCtxtBuilder { tcx, defining_use_anchor , considering_regions, intercrate } = * self ;
575
+ let InferCtxtBuilder { tcx, considering_regions, intercrate } = * self ;
605
576
InferCtxt {
606
577
tcx,
607
- old_defining_use_anchor : defining_use_anchor,
608
578
considering_regions,
609
579
inner : RefCell :: new ( InferCtxtInner :: new ( ) ) ,
610
580
lexical_region_resolutions : RefCell :: new ( None ) ,
0 commit comments