Skip to content

Conversation

@xymus
Copy link
Contributor

@xymus xymus commented Mar 7, 2025

Diagnose failures in readNormalProtocolConformanceXRef and finishNormalConformance. These are usually caused by a change in one library without the required rebuild of its dependents, leaving stale swiftmodule files behind.

If a single conformance is missing, show an error with the type and protocol and note indirect effects. When there's a mismatch between the number of requirements and the number of conformances found, show an error with the types and list the requirements and conformances to stderr for visual inspection.

Display a proper error instead of crashing when the compiler hit these issues during normal compilation. Or recover silently during indexing or in LLDB. This recovery is gated behind the new enableExtendedDeserializationRecovery which should only be enabled when we can afford reading inconsistent information from swiftmodule files.

rdar://125995448&145019988

xymus added 3 commits March 7, 2025 10:55
Introduce a new deserialization mode `enableExtendedDeserializationRecovery`
for use when we can afford inconsistent information from a swiftmodule
file. It's enabled automatically in debugger mode, when user errors are
allowed and during index-while-building.
Failures in `readNormalProtocolConformanceXRef` are usually caused by a
dependency change without the required rebuild of its dependents.
Display a proper error instead of crashing when encountering such an
issue during normal compilation. Recover silently when we can afford to,
during indexing or in LLDB.
When deserialization a protocol conformance from a binary swiftmodule
file the compiler can encounter inconsistencies caused by stale module
files. Replace the hard crash with a proper error and print the list of
requirements and conformances being compared to stderr for manual
inspection. Recover silently when we can afford to, during indexing or
in LLDB.
@xymus
Copy link
Contributor Author

xymus commented Mar 7, 2025

@swift-ci Please smoke test

Copy link
Contributor

@bnbarham bnbarham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 🥳!

@xymus xymus merged commit c0a4056 into swiftlang:main Mar 11, 2025
3 checks passed
@xymus xymus deleted the deser-recover-conformance-xref branch March 11, 2025 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants