11use crate :: traits:: query:: evaluate_obligation:: InferCtxtExt as _;
2- use crate :: traits:: { self , ObligationCtxt } ;
2+ use crate :: traits:: { self , DefiningAnchor , ObligationCtxt } ;
33
44use rustc_hir:: def_id:: DefId ;
55use rustc_hir:: lang_items:: LangItem ;
@@ -80,7 +80,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
8080
8181pub trait InferCtxtBuilderExt < ' tcx > {
8282 fn enter_canonical_trait_query < K , R > (
83- & mut self ,
83+ self ,
8484 canonical_key : & Canonical < ' tcx , K > ,
8585 operation : impl FnOnce ( & ObligationCtxt < ' _ , ' tcx > , K ) -> Result < R , NoSolution > ,
8686 ) -> Result < CanonicalQueryResponse < ' tcx , R > , NoSolution >
@@ -108,7 +108,7 @@ impl<'tcx> InferCtxtBuilderExt<'tcx> for InferCtxtBuilder<'tcx> {
108108 /// have `'tcx` be free on this function so that we can talk about
109109 /// `K: TypeFoldable<TyCtxt<'tcx>>`.)
110110 fn enter_canonical_trait_query < K , R > (
111- & mut self ,
111+ self ,
112112 canonical_key : & Canonical < ' tcx , K > ,
113113 operation : impl FnOnce ( & ObligationCtxt < ' _ , ' tcx > , K ) -> Result < R , NoSolution > ,
114114 ) -> Result < CanonicalQueryResponse < ' tcx , R > , NoSolution >
@@ -117,8 +117,9 @@ impl<'tcx> InferCtxtBuilderExt<'tcx> for InferCtxtBuilder<'tcx> {
117117 R : Debug + TypeFoldable < TyCtxt < ' tcx > > ,
118118 Canonical < ' tcx , QueryResponse < ' tcx , R > > : ArenaAllocatable < ' tcx > ,
119119 {
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) ;
122123 let ocx = ObligationCtxt :: new ( & infcx) ;
123124 let value = operation ( & ocx, key) ?;
124125 ocx. make_canonicalized_query_response ( canonical_inference_vars, value)
0 commit comments