@@ -928,37 +928,6 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
928928 ) ;
929929 }
930930
931- /// Check that user type annotations are well formed.
932- fn check_user_type_annotations_are_well_formed ( & mut self ) {
933- for index in self . mir . user_type_annotations . indices ( ) {
934- let ( span, _) = & self . mir . user_type_annotations [ index] ;
935- let type_annotation = self . instantiated_type_annotations [ & index] ;
936- match type_annotation {
937- // We can't check the well-formedness of a `UserTypeAnnotation::Ty` here, it will
938- // cause ICEs (see comment in `relate_type_and_user_type`).
939- UserTypeAnnotation :: TypeOf ( ..) => {
940- if let Err ( terr) = self . fully_perform_op (
941- Locations :: All ( * span) ,
942- ConstraintCategory :: Assignment ,
943- self . param_env . and (
944- type_op:: ascribe_user_type:: AscribeUserTypeWellFormed :: new (
945- type_annotation,
946- )
947- ) ,
948- ) {
949- span_mirbug ! (
950- self ,
951- type_annotation,
952- "bad user type annotation: {:?}" ,
953- terr,
954- ) ;
955- }
956- } ,
957- _ => { } ,
958- }
959- }
960- }
961-
962931 /// Given some operation `op` that manipulates types, proves
963932 /// predicates, or otherwise uses the inference context, executes
964933 /// `op` and then executes all the further obligations that `op`
@@ -1127,27 +1096,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
11271096 if let Ok ( projected_ty) = curr_projected_ty {
11281097 let ty = projected_ty. to_ty ( tcx) ;
11291098 self . relate_types ( ty, v1, a, locations, category) ?;
1130-
1131- // We'll get an ICE if we check for well-formedness of a
1132- // `UserTypeAnnotation::Ty` that hasn't had types related.
1133- //
1134- // Doing this without the types having been related will result in
1135- // `probe_ty_var` failing in the canonicalizer - in practice, this
1136- // results in three run-pass tests failing. You can work around that
1137- // by keeping an vec of projections instead of annotations and performing
1138- // the projections before storing into `instantiated_type_annotations`
1139- // but that still fails in dead code.
1140- self . fully_perform_op (
1141- locations,
1142- category,
1143- self . param_env . and (
1144- type_op:: ascribe_user_type:: AscribeUserTypeWellFormed :: new (
1145- UserTypeAnnotation :: Ty ( ty) ,
1146- )
1147- ) ,
1148- ) ?;
11491099 }
1150-
11511100 }
11521101 UserTypeAnnotation :: TypeOf ( def_id, user_substs) => {
11531102 let projs = self . infcx . tcx . intern_projs ( & user_ty. projs ) ;
@@ -2453,8 +2402,6 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
24532402 self . check_terminator ( mir, block_data. terminator ( ) , location) ;
24542403 self . check_iscleanup ( mir, block_data) ;
24552404 }
2456-
2457- self . check_user_type_annotations_are_well_formed ( ) ;
24582405 }
24592406
24602407 fn normalize < T > ( & mut self , value : T , location : impl NormalizeLocation ) -> T
0 commit comments