mirror of
https://github.com/apple/swift.git
synced 2026-02-27 18:26:24 +01:00
We turn off the AllowMarkerProtocols mangler flag when mangling the types that are passed into the runtime demangler. The logic in appendAnyProtocolConformance() was wrong when this flag was set; we would early exit from this function, but then appendRetroactiveConformances() would still call appendListSeparator(). The would result in an invalid mangled string which could not be parsed by the demangler. In particular, this meant that the recent changes to generalize Equatable to allow non-Copyable and non-Escapable conformers could introduce runtime crashes, because a mangled string for a retroactive conformance to Equatable could be incorrect. The fix is to handle AllowMarkerProtocols further up in forEachConditionalConformance(). Note that this change should not directly change ABI, because AllowMarkerProtocols is on for symbol names. When AllowMarkerProtocols is on, we still always mangle conformances to Copyable and Escapable in this code path. This means that even with this change, mangling a symbol name that contains a retroactive conformance to Equatable can output a different string than in Swift 6.3, which means we have an ABI break. That problem requires a separate fix. - Fixes rdar://problem/168023786.