@@ -24,7 +24,6 @@ use rustc_middle::mir::tcx::PlaceTy;
24
24
use rustc_middle:: mir:: visit:: { NonMutatingUseContext , PlaceContext , Visitor } ;
25
25
use rustc_middle:: mir:: * ;
26
26
use rustc_middle:: traits:: query:: NoSolution ;
27
- use rustc_middle:: traits:: ObligationCause ;
28
27
use rustc_middle:: ty:: adjustment:: PointerCoercion ;
29
28
use rustc_middle:: ty:: cast:: CastTy ;
30
29
use rustc_middle:: ty:: visit:: TypeVisitableExt ;
@@ -1028,7 +1027,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1028
1027
implicit_region_bound : ty:: Region < ' tcx > ,
1029
1028
borrowck_context : & ' a mut BorrowCheckContext < ' a , ' tcx > ,
1030
1029
) -> Self {
1031
- let mut checker = Self {
1030
+ Self {
1032
1031
infcx,
1033
1032
last_span : body. span ,
1034
1033
body,
@@ -1039,74 +1038,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1039
1038
implicit_region_bound,
1040
1039
borrowck_context,
1041
1040
reported_errors : Default :: default ( ) ,
1042
- } ;
1043
-
1044
- // FIXME(-Znext-solver): A bit dubious that we're only registering
1045
- // predefined opaques in the typeck root.
1046
- if infcx. next_trait_solver ( ) && !infcx. tcx . is_typeck_child ( body. source . def_id ( ) ) {
1047
- checker. register_predefined_opaques_for_next_solver ( ) ;
1048
- }
1049
-
1050
- checker
1051
- }
1052
-
1053
- pub ( super ) fn register_predefined_opaques_for_next_solver ( & mut self ) {
1054
- // OK to use the identity arguments for each opaque type key, since
1055
- // we remap opaques from HIR typeck back to their definition params.
1056
- let opaques: Vec < _ > = self
1057
- . infcx
1058
- . tcx
1059
- . typeck ( self . body . source . def_id ( ) . expect_local ( ) )
1060
- . concrete_opaque_types
1061
- . iter ( )
1062
- . map ( |( k, v) | ( * k, * v) )
1063
- . collect ( ) ;
1064
-
1065
- let renumbered_opaques = self . infcx . tcx . fold_regions ( opaques, |_, _| {
1066
- self . infcx . next_nll_region_var_in_universe (
1067
- NllRegionVariableOrigin :: Existential { from_forall : false } ,
1068
- ty:: UniverseIndex :: ROOT ,
1069
- )
1070
- } ) ;
1071
-
1072
- let param_env = self . param_env ;
1073
- let result = self . fully_perform_op (
1074
- Locations :: All ( self . body . span ) ,
1075
- ConstraintCategory :: OpaqueType ,
1076
- CustomTypeOp :: new (
1077
- |ocx| {
1078
- let mut obligations = Vec :: new ( ) ;
1079
- for ( opaque_type_key, hidden_ty) in renumbered_opaques {
1080
- let cause = ObligationCause :: dummy ( ) ;
1081
- ocx. infcx . insert_hidden_type (
1082
- opaque_type_key,
1083
- & cause,
1084
- param_env,
1085
- hidden_ty. ty ,
1086
- & mut obligations,
1087
- ) ?;
1088
-
1089
- ocx. infcx . add_item_bounds_for_hidden_type (
1090
- opaque_type_key. def_id . to_def_id ( ) ,
1091
- opaque_type_key. args ,
1092
- cause,
1093
- param_env,
1094
- hidden_ty. ty ,
1095
- & mut obligations,
1096
- ) ;
1097
- }
1098
-
1099
- ocx. register_obligations ( obligations) ;
1100
- Ok ( ( ) )
1101
- } ,
1102
- "register pre-defined opaques" ,
1103
- ) ,
1104
- ) ;
1105
-
1106
- if result. is_err ( ) {
1107
- self . infcx
1108
- . dcx ( )
1109
- . span_bug ( self . body . span , "failed re-defining predefined opaques in mir typeck" ) ;
1110
1041
}
1111
1042
}
1112
1043
0 commit comments