Skip to content

Commit 97ef673

Browse files
authored
Merge pull request #75212 from kavon/6.0-handle-stdlib-with-no-files-129092011
[6.0🍒] NCGenerics: handle failure to load stdlib
2 parents 1d91e7d + 95d6ddf commit 97ef673

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/AST/ASTContext.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,14 @@ ASTContext::synthesizeInvertibleProtocolDecl(InvertibleProtocolKind ip) const {
12551255
return proto;
12561256

12571257
ModuleDecl *stdlib = getStdlibModule();
1258+
if (stdlib && stdlib->failedToLoad()) {
1259+
stdlib = nullptr; // Use the Builtin module instead.
1260+
1261+
// Ensure we emitted an error diagnostic!
1262+
if (!Diags.hadAnyError())
1263+
Diags.diagnose(SourceLoc(), diag::serialization_load_failed, "Swift");
1264+
}
1265+
12581266
FileUnit *file = nullptr;
12591267
if (stdlib) {
12601268
file = &stdlib->getFiles()[0]->getOrCreateSynthesizedFile();

0 commit comments

Comments
 (0)