Skip to content

[BitwiseCopyable] Suppress a few conformances. #72083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions stdlib/public/core/CommandLine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,7 @@ public enum CommandLine {
= (0..<Int(argc)).map { String(cString: _unsafeArgv[$0]!) }
}

@available(*, unavailable)
extension CommandLine : _BitwiseCopyable {}

#endif // SWIFT_STDLIB_HAS_COMMANDLINE
3 changes: 3 additions & 0 deletions stdlib/public/core/MemoryLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public enum MemoryLayout<T> {
}
}

@available(*, unavailable)
extension MemoryLayout : _BitwiseCopyable {}

extension MemoryLayout {
/// Returns the contiguous memory footprint of the given instance.
///
Expand Down
3 changes: 3 additions & 0 deletions stdlib/public/core/Unicode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -674,3 +674,6 @@ public func transcode<Input, InputEncoding, OutputEncoding>(
@frozen
public enum Unicode {}

@available(*, unavailable)
extension Unicode : _BitwiseCopyable {}

29 changes: 28 additions & 1 deletion test/Sema/bitwise_copyable_2.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// RUN: %target-typecheck-verify-swift \
// RUN: -disable-availability-checking \
// RUN: -enable-experimental-feature NonescapableTypes \
// RUN: -enable-experimental-feature BitwiseCopyable \
// RUN: -enable-builtin-module \
Expand Down Expand Up @@ -35,3 +34,31 @@ func take<T : _BitwiseCopyable>(_ t: T) {}

func passInternalUsableStruct(_ s: InternalUsableStruct) { take(s) } // expected-error{{type_does_not_conform_decl_owner}}
// expected-note@-8{{where_requirement_failure_one_subst}}

func passMemoryLayout<T>(_ m: MemoryLayout<T>) { take(m) } // expected-error{{conformance_availability_unavailable}}

func passCommandLine(_ m: CommandLine) { take(m) } // expected-error{{conformance_availability_unavailable}}

func passUnicode(_ m: Unicode) { take(m) } // expected-error{{conformance_availability_unavailable}}

import Builtin

#if arch(arm)
func passBuiltinFloat16(_ f: Builtin.FPIEEE16) { take(f) }
@available(SwiftStdlib 5.3, *)
func passFloat16(_ f: Float16) { take(f) }
#endif

enum E_Raw_Int : Int {
case one = 1
case sixty_three = 63
}

func passE_Raw_Int(_ e: E_Raw_Int) { take(e) }

enum E_Raw_String : String {
case one = "one"
case sixty_three = "sixty three"
}

func passE_Raw_String(_ e: E_Raw_String) { take(e) }