Skip to content

Commit 31aed27

Browse files
committed
Silence some standard library warnings
1 parent add012c commit 31aed27

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/Sema/TypeCheckDeclPrimary.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,6 +2032,17 @@ static void checkProtocolRefinementRequirements(ProtocolDecl *proto) {
20322032
// TODO(kavon): emit tailored error diagnostic to remove the ~Copyable
20332033
}
20342034

2035+
// SIMDScalar in the standard library currently emits this warning for:
2036+
// 'Hashable', 'Encodable', and 'Decodable'. This is unfortunate, but we
2037+
// cannot fix it as it would alter the ABI of the protocol. Silence these
2038+
// warnings specifically for those cases.
2039+
if (proto->isSpecificProtocol(KnownProtocolKind::SIMDScalar) &&
2040+
(otherProto->isSpecificProtocol(KnownProtocolKind::Hashable) ||
2041+
otherProto->isSpecificProtocol(KnownProtocolKind::Encodable) ||
2042+
otherProto->isSpecificProtocol(KnownProtocolKind::Decodable))) {
2043+
continue;
2044+
}
2045+
20352046
// GenericSignature::getRequiredProtocols() canonicalizes the protocol
20362047
// list by dropping protocols that are inherited by other protocols in
20372048
// the list. Any protocols that remain in the list other than 'proto'

stdlib/public/core/Macros.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
public macro externalMacro<T>(module: String, type: String) -> T =
2626
Builtin.ExternalMacro
2727

28+
#if false
29+
2830
// File and path-related information
2931

3032
/// Produces a unique identifier for the given source file, comprised of
@@ -71,4 +73,6 @@ public macro warning(_ message: String) = Builtin.WarningMacro
7173
@freestanding(declaration)
7274
public macro error(_ message: String) = Builtin.ErrorMacro
7375

74-
#endif
76+
#endif // false
77+
78+
#endif // $Macros && hasAttribute(attached)

0 commit comments

Comments
 (0)