@@ -9,7 +9,7 @@ use rustc_errors::ErrorGuaranteed;
99use rustc_hir:: LangItem ;
1010use rustc_infer:: infer:: TyCtxtInferExt ;
1111use rustc_middle:: mir:: * ;
12- use rustc_middle:: ty:: { self , AdtDef , Ty } ;
12+ use rustc_middle:: ty:: { self , AdtDef , Ty , TypingMode } ;
1313use rustc_middle:: { bug, mir} ;
1414use rustc_trait_selection:: traits:: { Obligation , ObligationCause , ObligationCtxt } ;
1515use tracing:: instrument;
@@ -100,13 +100,14 @@ impl Qualif for HasMutInterior {
100100 // Instead we invoke an obligation context manually, and provide the opaque type inference settings
101101 // that allow the trait solver to just error out instead of cycling.
102102 let freeze_def_id = cx. tcx . require_lang_item ( LangItem :: Freeze , cx. body . span ) ;
103- // FIXME(#132279): Once we've got a typing mode which reveals opaque types using the HIR
104- // typeck results without causing query cycles, we should use this here instead of defining
105- // opaque types.
106- let typing_env = ty:: TypingEnv :: new (
107- cx. typing_env . param_env ,
108- ty:: TypingMode :: analysis_in_body ( cx. tcx , cx. body . source . def_id ( ) . expect_local ( ) ) ,
109- ) ;
103+ let did = cx. body . source . def_id ( ) . expect_local ( ) ;
104+
105+ let typing_env = if cx. tcx . use_typing_mode_borrowck ( ) {
106+ cx. typing_env
107+ } else {
108+ ty:: TypingEnv :: new ( cx. typing_env . param_env , TypingMode :: analysis_in_body ( cx. tcx , did) )
109+ } ;
110+
110111 let ( infcx, param_env) = cx. tcx . infer_ctxt ( ) . build_with_typing_env ( typing_env) ;
111112 let ocx = ObligationCtxt :: new ( & infcx) ;
112113 let obligation = Obligation :: new (
0 commit comments