@@ -103,9 +103,10 @@ pub use self::region::{
103103} ;
104104pub use self :: sty:: {
105105 AliasTy , AliasTyKind , Article , Binder , BoundConst , BoundRegion , BoundRegionKind , BoundTy ,
106- BoundTyKind , BoundVariableKind , CanonicalPolyFnSig , CoroutineArgsExt , EarlyBinder , FnSig ,
107- InlineConstArgs , InlineConstArgsParts , ParamConst , ParamTy , PlaceholderConst ,
108- PlaceholderRegion , PlaceholderType , PolyFnSig , TyKind , TypeAndMut , TypingMode , UpvarArgs ,
106+ BoundTyKind , BoundVariableKind , CanonicalPolyFnSig , CoroutineArgsExt , EarlyBinder ,
107+ EqTypingMode , FnSig , InlineConstArgs , InlineConstArgsParts , ParamConst , ParamTy ,
108+ PlaceholderConst , PlaceholderRegion , PlaceholderType , PolyFnSig , TyKind , TypeAndMut ,
109+ TypingMode , UpvarArgs ,
109110} ;
110111pub use self :: trait_def:: TraitDef ;
111112pub use self :: typeck_results:: {
@@ -980,7 +981,7 @@ pub struct ParamEnvAnd<'tcx, T> {
980981pub struct TypingEnv < ' tcx > {
981982 #[ type_foldable( identity) ]
982983 #[ type_visitable( ignore) ]
983- pub typing_mode : TypingMode < ' tcx > ,
984+ pub typing_mode : EqTypingMode < ' tcx > ,
984985 pub param_env : ParamEnv < ' tcx > ,
985986}
986987
@@ -993,7 +994,10 @@ impl<'tcx> TypingEnv<'tcx> {
993994 /// use `TypingMode::PostAnalysis`, they may still have where-clauses
994995 /// in scope.
995996 pub fn fully_monomorphized ( ) -> TypingEnv < ' tcx > {
996- TypingEnv { typing_mode : TypingMode :: PostAnalysis , param_env : ParamEnv :: empty ( ) }
997+ TypingEnv {
998+ typing_mode : EqTypingMode ( TypingMode :: PostAnalysis ) ,
999+ param_env : ParamEnv :: empty ( ) ,
1000+ }
9971001 }
9981002
9991003 /// Create a typing environment for use during analysis outside of a body.
@@ -1006,7 +1010,10 @@ impl<'tcx> TypingEnv<'tcx> {
10061010 def_id : impl IntoQueryKey < DefId > ,
10071011 ) -> TypingEnv < ' tcx > {
10081012 let def_id = def_id. into_query_key ( ) ;
1009- TypingEnv { typing_mode : TypingMode :: non_body_analysis ( ) , param_env : tcx. param_env ( def_id) }
1013+ TypingEnv {
1014+ typing_mode : EqTypingMode ( TypingMode :: non_body_analysis ( ) ) ,
1015+ param_env : tcx. param_env ( def_id) ,
1016+ }
10101017 }
10111018
10121019 pub fn post_analysis ( tcx : TyCtxt < ' tcx > , def_id : impl IntoQueryKey < DefId > ) -> TypingEnv < ' tcx > {
@@ -1018,8 +1025,12 @@ impl<'tcx> TypingEnv<'tcx> {
10181025 /// opaque types in the `param_env`.
10191026 pub fn with_post_analysis_normalized ( self , tcx : TyCtxt < ' tcx > ) -> TypingEnv < ' tcx > {
10201027 let TypingEnv { typing_mode, param_env } = self ;
1021- if let TypingMode :: PostAnalysis = typing_mode {
1022- return self ;
1028+ match typing_mode. 0 {
1029+ TypingMode :: Coherence
1030+ | TypingMode :: Analysis { .. }
1031+ | TypingMode :: Borrowck { .. }
1032+ | TypingMode :: PostBorrowckAnalysis { .. } => { }
1033+ TypingMode :: PostAnalysis => return self ,
10231034 }
10241035
10251036 // No need to reveal opaques with the new solver enabled,
@@ -1029,7 +1040,7 @@ impl<'tcx> TypingEnv<'tcx> {
10291040 } else {
10301041 ParamEnv :: new ( tcx. reveal_opaque_types_in_bounds ( param_env. caller_bounds ( ) ) )
10311042 } ;
1032- TypingEnv { typing_mode : TypingMode :: PostAnalysis , param_env }
1043+ TypingEnv { typing_mode : EqTypingMode ( TypingMode :: PostAnalysis ) , param_env }
10331044 }
10341045
10351046 /// Combine this typing environment with the given `value` to be used by
0 commit comments