1
1
use crate :: traits:: query:: evaluate_obligation:: InferCtxtExt as _;
2
- use crate :: traits:: { self , ObligationCtxt } ;
2
+ use crate :: traits:: { self , DefiningAnchor , ObligationCtxt } ;
3
3
4
4
use rustc_hir:: def_id:: DefId ;
5
5
use rustc_hir:: lang_items:: LangItem ;
@@ -80,7 +80,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
80
80
81
81
pub trait InferCtxtBuilderExt < ' tcx > {
82
82
fn enter_canonical_trait_query < K , R > (
83
- & mut self ,
83
+ self ,
84
84
canonical_key : & Canonical < ' tcx , K > ,
85
85
operation : impl FnOnce ( & ObligationCtxt < ' _ , ' tcx > , K ) -> Result < R , NoSolution > ,
86
86
) -> Result < CanonicalQueryResponse < ' tcx , R > , NoSolution >
@@ -108,7 +108,7 @@ impl<'tcx> InferCtxtBuilderExt<'tcx> for InferCtxtBuilder<'tcx> {
108
108
/// have `'tcx` be free on this function so that we can talk about
109
109
/// `K: TypeFoldable<TyCtxt<'tcx>>`.)
110
110
fn enter_canonical_trait_query < K , R > (
111
- & mut self ,
111
+ self ,
112
112
canonical_key : & Canonical < ' tcx , K > ,
113
113
operation : impl FnOnce ( & ObligationCtxt < ' _ , ' tcx > , K ) -> Result < R , NoSolution > ,
114
114
) -> Result < CanonicalQueryResponse < ' tcx , R > , NoSolution >
@@ -117,8 +117,9 @@ impl<'tcx> InferCtxtBuilderExt<'tcx> for InferCtxtBuilder<'tcx> {
117
117
R : Debug + TypeFoldable < TyCtxt < ' tcx > > ,
118
118
Canonical < ' tcx , QueryResponse < ' tcx , R > > : ArenaAllocatable < ' tcx > ,
119
119
{
120
- let ( infcx, key, canonical_inference_vars) =
121
- self . build_with_canonical ( DUMMY_SP , canonical_key) ;
120
+ let ( infcx, key, canonical_inference_vars) = self
121
+ . with_opaque_type_inference ( DefiningAnchor :: Bubble )
122
+ . build_with_canonical ( DUMMY_SP , canonical_key) ;
122
123
let ocx = ObligationCtxt :: new ( & infcx) ;
123
124
let value = operation ( & ocx, key) ?;
124
125
ocx. make_canonicalized_query_response ( canonical_inference_vars, value)
0 commit comments