@@ -221,7 +221,9 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_
221
221
let ty = icx. lower_ty ( ty) ;
222
222
// MIR relies on references to statics being scalars.
223
223
// Verify that here to avoid ill-formed MIR.
224
- match check_static_item ( tcx, def_id, ty, false ) {
224
+ // We skip the `Sync` check to avoid cycles for type-alias-impl-trait,
225
+ // relying on the fact that non-Sync statics don't ICE the rest of the compiler.
226
+ match check_static_item ( tcx, def_id, ty, /* should_check_for_sync */ false ) {
225
227
Ok ( ( ) ) => ty,
226
228
Err ( guar) => Ty :: new_error ( tcx, guar) ,
227
229
}
@@ -286,7 +288,9 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_
286
288
let ty = icx. lower_ty ( ty) ;
287
289
// MIR relies on references to statics being scalars.
288
290
// Verify that here to avoid ill-formed MIR.
289
- match check_static_item ( tcx, def_id, ty, false ) {
291
+ // We skip the `Sync` check to avoid cycles for type-alias-impl-trait,
292
+ // relying on the fact that non-Sync statics don't ICE the rest of the compiler.
293
+ match check_static_item ( tcx, def_id, ty, /* should_check_for_sync */ false ) {
290
294
Ok ( ( ) ) => ty,
291
295
Err ( guar) => Ty :: new_error ( tcx, guar) ,
292
296
}
0 commit comments