@@ -990,11 +990,17 @@ impl<'tcx> InferCtxt<'tcx> {
990990
991991 #[ inline( always) ]
992992 pub fn can_define_opaque_ty ( & self , id : impl Into < DefId > ) -> bool {
993+ debug_assert ! ( !self . next_trait_solver( ) ) ;
993994 match self . typing_mode ( ) {
994995 TypingMode :: Analysis { defining_opaque_types } => {
995996 id. into ( ) . as_local ( ) . is_some_and ( |def_id| defining_opaque_types. contains ( & def_id) )
996997 }
997- TypingMode :: Coherence | TypingMode :: PostAnalysis => false ,
998+ // FIXME(#132279): This function is quite weird in post-analysis
999+ // and post-borrowck analysis mode. We may need to modify its uses
1000+ // to support PostBorrowckAnalysis in the old solver as well.
1001+ TypingMode :: Coherence
1002+ | TypingMode :: PostBorrowckAnalysis { .. }
1003+ | TypingMode :: PostAnalysis => false ,
9981004 }
9991005 }
10001006
@@ -1276,15 +1282,16 @@ impl<'tcx> InferCtxt<'tcx> {
12761282 /// using canonicalization or carrying this inference context around.
12771283 pub fn typing_env ( & self , param_env : ty:: ParamEnv < ' tcx > ) -> ty:: TypingEnv < ' tcx > {
12781284 let typing_mode = match self . typing_mode ( ) {
1279- ty:: TypingMode :: Coherence => ty:: TypingMode :: Coherence ,
12801285 // FIXME(#132279): This erases the `defining_opaque_types` as it isn't possible
12811286 // to handle them without proper canonicalization. This means we may cause cycle
12821287 // errors and fail to reveal opaques while inside of bodies. We should rename this
12831288 // function and require explicit comments on all use-sites in the future.
12841289 ty:: TypingMode :: Analysis { defining_opaque_types : _ } => {
12851290 TypingMode :: non_body_analysis ( )
12861291 }
1287- ty:: TypingMode :: PostAnalysis => ty:: TypingMode :: PostAnalysis ,
1292+ mode @ ( ty:: TypingMode :: Coherence
1293+ | ty:: TypingMode :: PostBorrowckAnalysis { .. }
1294+ | ty:: TypingMode :: PostAnalysis ) => mode,
12881295 } ;
12891296 ty:: TypingEnv { typing_mode, param_env }
12901297 }
0 commit comments