@@ -31,7 +31,6 @@ use rustc_span::{self, Span};
3131use  rustc_target:: spec:: abi:: Abi ; 
3232use  rustc_trait_selection:: traits:: error_reporting:: TypeErrCtxtExt  as  _; 
3333use  rustc_trait_selection:: traits:: { self ,  ObligationCtxt } ; 
34- use  rustc_ty_utils:: representability:: { self ,  Representability } ; 
3534
3635use  std:: ops:: ControlFlow ; 
3736
@@ -381,7 +380,7 @@ fn check_struct(tcx: TyCtxt<'_>, def_id: LocalDefId) {
381380    let  def = tcx. adt_def ( def_id) ; 
382381    let  span = tcx. def_span ( def_id) ; 
383382    def. destructor ( tcx) ;  // force the destructor to be evaluated 
384-     check_representable ( tcx ,  span ,   def_id) ; 
383+     let  _ = tcx . representability ( def_id) ; 
385384
386385    if  def. repr ( ) . simd ( )  { 
387386        check_simd ( tcx,  span,  def_id) ; 
@@ -395,7 +394,7 @@ fn check_union(tcx: TyCtxt<'_>, def_id: LocalDefId) {
395394    let  def = tcx. adt_def ( def_id) ; 
396395    let  span = tcx. def_span ( def_id) ; 
397396    def. destructor ( tcx) ;  // force the destructor to be evaluated 
398-     check_representable ( tcx ,  span ,   def_id) ; 
397+     let  _ = tcx . representability ( def_id) ; 
399398    check_transparent ( tcx,  span,  def) ; 
400399    check_union_fields ( tcx,  span,  def_id) ; 
401400    check_packed ( tcx,  span,  def) ; 
@@ -1151,27 +1150,6 @@ fn check_impl_items_against_trait<'tcx>(
11511150    } 
11521151} 
11531152
1154- /// Checks whether a type can be represented in memory. In particular, it 
1155- /// identifies types that contain themselves without indirection through a 
1156- /// pointer, which would mean their size is unbounded. 
1157- pub ( super )  fn  check_representable ( tcx :  TyCtxt < ' _ > ,  sp :  Span ,  item_def_id :  LocalDefId )  -> bool  { 
1158-     let  rty = tcx. type_of ( item_def_id) ; 
1159- 
1160-     // Check that it is possible to represent this type. This call identifies 
1161-     // (1) types that contain themselves and (2) types that contain a different 
1162-     // recursive type. It is only necessary to throw an error on those that 
1163-     // contain themselves. For case 2, there must be an inner type that will be 
1164-     // caught by case 1. 
1165-     match  representability:: ty_is_representable ( tcx,  rty,  sp,  None )  { 
1166-         Representability :: SelfRecursive ( spans)  => { 
1167-             recursive_type_with_infinite_size_error ( tcx,  item_def_id. to_def_id ( ) ,  spans) ; 
1168-             return  false ; 
1169-         } 
1170-         Representability :: Representable  | Representability :: ContainsRecursive  => ( ) , 
1171-     } 
1172-     true 
1173- } 
1174- 
11751153pub  fn  check_simd ( tcx :  TyCtxt < ' _ > ,  sp :  Span ,  def_id :  LocalDefId )  { 
11761154    let  t = tcx. type_of ( def_id) ; 
11771155    if  let  ty:: Adt ( def,  substs)  = t. kind ( ) 
@@ -1509,7 +1487,7 @@ fn check_enum<'tcx>(tcx: TyCtxt<'tcx>, vs: &'tcx [hir::Variant<'tcx>], def_id: L
15091487
15101488    detect_discriminant_duplicate ( tcx,  def. discriminants ( tcx) . collect ( ) ,  vs,  sp) ; 
15111489
1512-     check_representable ( tcx ,  sp ,   def_id) ; 
1490+     let  _ = tcx . representability ( def_id) ; 
15131491    check_transparent ( tcx,  sp,  def) ; 
15141492} 
15151493
0 commit comments