File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
compiler/rustc_hir_typeck/src Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,13 @@ use std::ops::Deref;
28
28
pub struct Inherited < ' tcx > {
29
29
pub ( super ) infcx : InferCtxt < ' tcx > ,
30
30
31
+ /// The `DefId` of the item in whose context we are performing inference or typeck.
32
+ /// It is used to check whether an opaque type use is a defining use.
33
+ ///
34
+ /// Its default value is `DefiningAnchor::Error`, this way it is easier to catch errors that
35
+ /// might come up during inference or typeck.
36
+ pub ( super ) defining_use_anchor : DefiningAnchor ,
37
+
31
38
pub ( super ) typeck_results : RefCell < ty:: TypeckResults < ' tcx > > ,
32
39
33
40
pub ( super ) locals : RefCell < HirIdMap < super :: LocalTy < ' tcx > > > ,
@@ -118,7 +125,9 @@ impl<'tcx> Inherited<'tcx> {
118
125
let tcx = infcx. tcx ;
119
126
let body_id = tcx. hir ( ) . maybe_body_owned_by ( def_id) ;
120
127
128
+ let defining_use_anchor = DefiningAnchor :: Bind ( typeck_results. borrow ( ) . hir_owner . def_id ) ;
121
129
Inherited {
130
+ defining_use_anchor,
122
131
typeck_results,
123
132
infcx,
124
133
fulfillment_cx : RefCell :: new ( <dyn TraitEngine < ' _ > >:: new ( tcx) ) ,
You can’t perform that action at this time.
0 commit comments