Skip to content

Commit ddacabf

Browse files
Merge pull request #72083 from nate-chandler/bitwise-copyable/20240304/1
[BitwiseCopyable] Suppress a few conformances.
2 parents 3aea3a0 + 8a35b07 commit ddacabf

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

stdlib/public/core/CommandLine.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,7 @@ public enum CommandLine {
6161
= (0..<Int(argc)).map { String(cString: _unsafeArgv[$0]!) }
6262
}
6363

64+
@available(*, unavailable)
65+
extension CommandLine : _BitwiseCopyable {}
66+
6467
#endif // SWIFT_STDLIB_HAS_COMMANDLINE

stdlib/public/core/MemoryLayout.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ public enum MemoryLayout<T> {
7676
}
7777
}
7878

79+
@available(*, unavailable)
80+
extension MemoryLayout : _BitwiseCopyable {}
81+
7982
extension MemoryLayout {
8083
/// Returns the contiguous memory footprint of the given instance.
8184
///

stdlib/public/core/Unicode.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,3 +674,6 @@ public func transcode<Input, InputEncoding, OutputEncoding>(
674674
@frozen
675675
public enum Unicode {}
676676

677+
@available(*, unavailable)
678+
extension Unicode : _BitwiseCopyable {}
679+

test/Sema/bitwise_copyable_2.swift

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %target-typecheck-verify-swift \
2-
// RUN: -disable-availability-checking \
32
// RUN: -enable-experimental-feature NonescapableTypes \
43
// RUN: -enable-experimental-feature BitwiseCopyable \
54
// RUN: -enable-builtin-module \
@@ -35,3 +34,31 @@ func take<T : _BitwiseCopyable>(_ t: T) {}
3534

3635
func passInternalUsableStruct(_ s: InternalUsableStruct) { take(s) } // expected-error{{type_does_not_conform_decl_owner}}
3736
// expected-note@-8{{where_requirement_failure_one_subst}}
37+
38+
func passMemoryLayout<T>(_ m: MemoryLayout<T>) { take(m) } // expected-error{{conformance_availability_unavailable}}
39+
40+
func passCommandLine(_ m: CommandLine) { take(m) } // expected-error{{conformance_availability_unavailable}}
41+
42+
func passUnicode(_ m: Unicode) { take(m) } // expected-error{{conformance_availability_unavailable}}
43+
44+
import Builtin
45+
46+
#if arch(arm)
47+
func passBuiltinFloat16(_ f: Builtin.FPIEEE16) { take(f) }
48+
@available(SwiftStdlib 5.3, *)
49+
func passFloat16(_ f: Float16) { take(f) }
50+
#endif
51+
52+
enum E_Raw_Int : Int {
53+
case one = 1
54+
case sixty_three = 63
55+
}
56+
57+
func passE_Raw_Int(_ e: E_Raw_Int) { take(e) }
58+
59+
enum E_Raw_String : String {
60+
case one = "one"
61+
case sixty_three = "sixty three"
62+
}
63+
64+
func passE_Raw_String(_ e: E_Raw_String) { take(e) }

0 commit comments

Comments
 (0)