@@ -990,11 +990,17 @@ impl<'tcx> InferCtxt<'tcx> {
990
990
991
991
#[ inline( always) ]
992
992
pub fn can_define_opaque_ty ( & self , id : impl Into < DefId > ) -> bool {
993
+ debug_assert ! ( !self . next_trait_solver( ) ) ;
993
994
match self . typing_mode ( ) {
994
995
TypingMode :: Analysis { defining_opaque_types } => {
995
996
id. into ( ) . as_local ( ) . is_some_and ( |def_id| defining_opaque_types. contains ( & def_id) )
996
997
}
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 ,
998
1004
}
999
1005
}
1000
1006
@@ -1276,15 +1282,16 @@ impl<'tcx> InferCtxt<'tcx> {
1276
1282
/// using canonicalization or carrying this inference context around.
1277
1283
pub fn typing_env ( & self , param_env : ty:: ParamEnv < ' tcx > ) -> ty:: TypingEnv < ' tcx > {
1278
1284
let typing_mode = match self . typing_mode ( ) {
1279
- ty:: TypingMode :: Coherence => ty:: TypingMode :: Coherence ,
1280
1285
// FIXME(#132279): This erases the `defining_opaque_types` as it isn't possible
1281
1286
// to handle them without proper canonicalization. This means we may cause cycle
1282
1287
// errors and fail to reveal opaques while inside of bodies. We should rename this
1283
1288
// function and require explicit comments on all use-sites in the future.
1284
1289
ty:: TypingMode :: Analysis { defining_opaque_types : _ } => {
1285
1290
TypingMode :: non_body_analysis ( )
1286
1291
}
1287
- ty:: TypingMode :: PostAnalysis => ty:: TypingMode :: PostAnalysis ,
1292
+ mode @ ( ty:: TypingMode :: Coherence
1293
+ | ty:: TypingMode :: PostBorrowckAnalysis { .. }
1294
+ | ty:: TypingMode :: PostAnalysis ) => mode,
1288
1295
} ;
1289
1296
ty:: TypingEnv { typing_mode, param_env }
1290
1297
}
0 commit comments