File tree 5 files changed +9
-9
lines changed
5 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -601,5 +601,5 @@ impl<'tcx> AdtDef<'tcx> {
601
601
#[ derive( HashStable ) ]
602
602
pub enum Representability {
603
603
Representable ,
604
- Infinite ,
604
+ Infinite ( ErrorGuaranteed ) ,
605
605
}
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ pub(crate) fn provide(providers: &mut Providers) {
61
61
/// requires calling [`InhabitedPredicate::instantiate`]
62
62
fn inhabited_predicate_adt ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> InhabitedPredicate < ' _ > {
63
63
if let Some ( def_id) = def_id. as_local ( ) {
64
- if matches ! ( tcx. representability( def_id) , ty:: Representability :: Infinite ) {
64
+ if matches ! ( tcx. representability( def_id) , ty:: Representability :: Infinite ( _ ) ) {
65
65
return InhabitedPredicate :: True ;
66
66
}
67
67
}
Original file line number Diff line number Diff line change @@ -106,8 +106,8 @@ impl<'tcx> Value<TyCtxt<'tcx>> for Representability {
106
106
representable_ids. insert ( def_id) ;
107
107
}
108
108
}
109
- recursive_type_error ( tcx, item_and_field_ids, & representable_ids) ;
110
- Representability :: Infinite
109
+ let guar = recursive_type_error ( tcx, item_and_field_ids, & representable_ids) ;
110
+ Representability :: Infinite ( guar )
111
111
}
112
112
}
113
113
@@ -268,7 +268,7 @@ pub fn recursive_type_error(
268
268
tcx : TyCtxt < ' _ > ,
269
269
mut item_and_field_ids : Vec < ( LocalDefId , LocalDefId ) > ,
270
270
representable_ids : & FxHashSet < LocalDefId > ,
271
- ) {
271
+ ) -> ErrorGuaranteed {
272
272
const ITEM_LIMIT : usize = 5 ;
273
273
274
274
// Rotate the cycle so that the item with the lowest span is first
@@ -344,7 +344,7 @@ pub fn recursive_type_error(
344
344
suggestion,
345
345
Applicability :: HasPlaceholders ,
346
346
)
347
- . emit ( ) ;
347
+ . emit ( )
348
348
}
349
349
350
350
fn find_item_ty_spans (
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ pub(crate) fn provide(providers: &mut Providers) {
12
12
macro_rules! rtry {
13
13
( $e: expr) => {
14
14
match $e {
15
- e @ Representability :: Infinite => return e,
15
+ e @ Representability :: Infinite ( _ ) => return e,
16
16
Representability :: Representable => { }
17
17
}
18
18
} ;
Original file line number Diff line number Diff line change @@ -99,8 +99,8 @@ fn adt_sized_constraint<'tcx>(
99
99
def_id : DefId ,
100
100
) -> ty:: EarlyBinder < & ' tcx ty:: List < Ty < ' tcx > > > {
101
101
if let Some ( def_id) = def_id. as_local ( ) {
102
- if matches ! ( tcx . representability ( def_id ) , ty:: Representability :: Infinite ) {
103
- return ty:: EarlyBinder :: bind ( tcx. mk_type_list ( & [ Ty :: new_misc_error ( tcx) ] ) ) ;
102
+ if let ty:: Representability :: Infinite ( guar ) = tcx . representability ( def_id ) {
103
+ return ty:: EarlyBinder :: bind ( tcx. mk_type_list ( & [ Ty :: new_error ( tcx, guar ) ] ) ) ;
104
104
}
105
105
}
106
106
let def = tcx. adt_def ( def_id) ;
You can’t perform that action at this time.
0 commit comments