@@ -221,7 +221,9 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_
221221 let ty = icx. lower_ty ( ty) ;
222222 // MIR relies on references to statics being scalars.
223223 // 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 ) {
225227 Ok ( ( ) ) => ty,
226228 Err ( guar) => Ty :: new_error ( tcx, guar) ,
227229 }
@@ -286,7 +288,9 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_
286288 let ty = icx. lower_ty ( ty) ;
287289 // MIR relies on references to statics being scalars.
288290 // 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 ) {
290294 Ok ( ( ) ) => ty,
291295 Err ( guar) => Ty :: new_error ( tcx, guar) ,
292296 }
0 commit comments