Skip to content

Commit

Permalink
[stdlib] Optional: Initial support for noncopyable payloads
Browse files Browse the repository at this point in the history
- Enable BorrowingSwitch feature within the stdlib
- ExpressibleByNilLiteral: Add retroactive support for noncopyable conforming types
- Optional: draft an API surface for noncopyable payloads
  • Loading branch information
lorentey committed Feb 29, 2024
1 parent 1c2cb18 commit e6dd049
Show file tree
Hide file tree
Showing 4 changed files with 272 additions and 37 deletions.
1 change: 1 addition & 0 deletions stdlib/public/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "Macros")
list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "FreestandingMacros")
list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "Extern")
list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "BitwiseCopyable")
list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "BorrowingSwitch")

if("${SWIFT_NATIVE_SWIFT_TOOLS_PATH}" STREQUAL "")
set(swift_bin_dir "${CMAKE_BINARY_DIR}/bin")
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/CompilerProtocols.swift
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public protocol CaseIterable {
/// `Optional` type conforms to `ExpressibleByNilLiteral`.
/// `ExpressibleByNilLiteral` conformance for types that use `nil` for other
/// purposes is discouraged.
public protocol ExpressibleByNilLiteral {
public protocol ExpressibleByNilLiteral: ~Copyable {
/// Creates an instance initialized with `nil`.
init(nilLiteral: ())
}
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/NFC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ extension Unicode._InternalNFC.Iterator: IteratorProtocol {
}

// If we have a leftover composee, make sure to return it.
return composee._take()
return composee.take()
}
}

Expand Down
Loading

0 comments on commit e6dd049

Please sign in to comment.