Skip to content

[Integration PR] Noncopyable generics in stdlib (phase 2) + Use new noncopyable types infrastructure #72346

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

Closed

Conversation

lorentey
Copy link
Member

This integrates #71688 and #72276 into a single PR, to let me look at test failures in the former before waiting on the latter.

@lorentey
Copy link
Member Author

swiftlang/llvm-project#8384
@swift-ci smoke test

@lorentey
Copy link
Member Author

@lorentey
Copy link
Member Author

swiftlang/llvm-project#8384
@swift-ci build toolchain macOS

@lorentey
Copy link
Member Author

swiftlang/llvm-project#8384
@swift-ci benchmark

@lorentey
Copy link
Member Author

Hm, I see some local failures and unexpected passes:

Failed Tests (14):
  Swift(macosx-arm64) :: Generics/inverse_copyable_requirement_legacy_errors.swift
  Swift(macosx-arm64) :: Generics/inverse_generics.swift
  Swift(macosx-arm64) :: IDE/complete_in_closures.swift
  Swift(macosx-arm64) :: IDE/complete_swift_key_path_optional_root.swift
  Swift(macosx-arm64) :: Python/python_lint.swift
  Swift(macosx-arm64) :: SIL/lifetime_dependence_buffer_view_test.swift
  Swift(macosx-arm64) :: SILGen/borrow_from_load_expr.swift
  Swift(macosx-arm64) :: SILGen/closures.swift
  Swift(macosx-arm64) :: SILOptimizer/access_marker_verify.swift
  Swift(macosx-arm64) :: Sema/moveonly_illegal_types.swift
  Swift(macosx-arm64) :: Sema/moveonly_restrictions.swift
  Swift(macosx-arm64) :: SourceKit/DocSupport/doc_clang_module.swift
  Swift(macosx-arm64) :: embedded/managed-buffer.swift
  Swift-validation(macosx-arm64) :: SILOptimizer/rdar114699006.swift

********************
Unexpectedly Passed Tests (10):
  Swift(macosx-arm64) :: Interop/Cxx/class/move-only/move-only-cxx-value-type.swift
  Swift(macosx-arm64) :: SILGen/variadic-generic-reabstract-tuple-result.swift
  Swift(macosx-arm64) :: Serialization/AllowErrors/removed-decls.swift
  Swift(macosx-arm64) :: api-digester/compare-dump-abi-parsable-interface.swift
  Swift(macosx-arm64) :: api-digester/compare-dump-abi.swift
  Swift(macosx-arm64) :: api-digester/compare-dump-parsable-interface.swift
  Swift(macosx-arm64) :: api-digester/compare-dump.swift
  Swift(macosx-arm64) :: api-digester/dump-module.swift
  Swift(macosx-arm64) :: api-digester/internal-extension.swift
  Swift(macosx-arm64) :: api-digester/stability-concurrency-abi.test

@lorentey
Copy link
Member Author

Well this isn't annoying at all

/Users/klorentey/Swift/swift/test/IDE/complete_in_closures.swift:338:38: error: SINGLE_EXPR_CLOSURE_CONTEXT-DAG: expected string not found in input
 // SINGLE_EXPR_CLOSURE_CONTEXT-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem/TypeRelation[Invalid]: .deallocate()[#Void#]; name=deallocate()
                                     ^
/Users/klorentey/Swift/build/Ninja-RelWithDebInfoAssert+stdlib-RelWithDebInfo/swift-macosx-arm64/test-macosx-arm64/IDE/Output/complete_in_closures.swift.tmp/batch-code-completion/complete-SINGLE_EXPR_CLOSURE_CONTEXT.result:1:1: note: scanning from here
// Token: SINGLE_EXPR_CLOSURE_CONTEXT
^
/Users/klorentey/Swift/build/Ninja-RelWithDebInfoAssert+stdlib-RelWithDebInfo/swift-macosx-arm64/test-macosx-arm64/IDE/Output/complete_in_closures.swift.tmp/batch-code-completion/complete-SINGLE_EXPR_CLOSURE_CONTEXT.result:5:1: note: possible intended match here
Decl[InstanceMethod]/CurrNominal/IsSystem/TypeRelation[Convertible]: .deallocate[#() -> ()#]; name=deallocate
^

@lorentey lorentey force-pushed the noncopyable-primitives-and-more! branch 2 times, most recently from 8fa25b7 to 9b8ddc2 Compare March 15, 2024 10:28
@lorentey
Copy link
Member Author

@lorentey
Copy link
Member Author

swiftlang/llvm-project#8384
@swift-ci build toolchain macOS

@lorentey
Copy link
Member Author

@swift-ci benchmark

@lorentey
Copy link
Member Author

swiftlang/llvm-project#8384
@swift-ci smoke test

@lorentey
Copy link
Member Author

Oh hey, the benchmarks succeeded!

@lorentey lorentey force-pushed the noncopyable-primitives-and-more! branch from 6b168dc to 3bf9ef0 Compare March 15, 2024 18:33
@lorentey
Copy link
Member Author

@lorentey
Copy link
Member Author

swiftlang/llvm-project#8384
@swift-ci smoke test

@lorentey
Copy link
Member Author

@swift-ci benchmark

@lorentey lorentey force-pushed the noncopyable-primitives-and-more! branch from 8cfcd5e to c821c2f Compare March 15, 2024 18:59
@lorentey
Copy link
Member Author

@lorentey
Copy link
Member Author

swiftlang/llvm-project#8384
@swift-ci smoke test

@lorentey
Copy link
Member Author

@swift-ci benchmark

@lorentey
Copy link
Member Author

@swift-ci build toolchain macOS

@lorentey
Copy link
Member Author

D'oh, I have a duplicate entry in the ABI expectations list:

--
--- /Users/ec2-user/jenkins/workspace/swift-PR-macos/branch-main/build/buildbot_incremental/swift-macosx-x86_64/test-macosx-x86_64/api-digester/Output/stability-stdlib-abi-with-asserts.test.tmp.tmp/stability-stdlib-abi.swift.expected.sorted	2024-03-15 21:00:27
+++ /Users/ec2-user/jenkins/workspace/swift-PR-macos/branch-main/build/buildbot_incremental/swift-macosx-x86_64/test-macosx-x86_64/api-digester/Output/stability-stdlib-abi-with-asserts.test.tmp.tmp/changes.txt.tmp	2024-03-15 21:00:27
@@ -357,7 +357,6 @@
 Func UnsafeMutableRawBufferPointer.bindMemory(to:) has mangled name changing from 'Swift.UnsafeMutableRawBufferPointer.bindMemory<A>(to: A.Type) -> Swift.UnsafeMutableBufferPointer<A>' to 'Swift.UnsafeMutableRawBufferPointer.bindMemory<A where A: ~Swift.Copyable>(to: A.Type) -> Swift.UnsafeMutableBufferPointer<A>'
 Func UnsafeMutableRawBufferPointer.bindMemory(to:) is now with @_preInverseGenerics
 Func UnsafeMutableRawBufferPointer.storeBytes(of:toByteOffset:as:) has been removed
-Func UnsafeMutableRawBufferPointer.storeBytes(of:toByteOffset:as:) has been removed
 Func UnsafeMutableRawPointer.assumingMemoryBound(to:) has generic signature change from <T> to <T where T : ~Copyable>
 Func UnsafeMutableRawPointer.assumingMemoryBound(to:) has mangled name changing from 'Swift.UnsafeMutableRawPointer.assumingMemoryBound<A>(to: A.Type) -> Swift.UnsafeMutablePointer<A>' to 'Swift.UnsafeMutableRawPointer.assumingMemoryBound<A where A: ~Swift.Copyable>(to: A.Type) -> Swift.UnsafeMutablePointer<A>'
 Func UnsafeMutableRawPointer.assumingMemoryBound(to:) is now with @_preInverseGenerics

@lorentey
Copy link
Member Author

lorentey commented Mar 15, 2024

#72348 has probably obsoleted some symbol mismatch expectations; I'll rebase and try to verify locally

[stdlib] MemoryLayout: Update Swift version numbers

[stdlib] MemoryLayout: Actually hide legacy ABI
… types

[stdlib] Pull back @_aeic on pointer → integer conversions

[stdlib] UnsafeMutablePointer.allocate: Fix thinko

[stdlib] Disable support for noncopyable pointees on some pointer operations

We have to temporarily pull back support for noncopyable pointees for UnsafeMutablePointer.initialize(to:), .moveInitialize, .moveUpdate, as the builtins they’re calling are no longer accepting such types.

These will return following a builtin audit.

[stdlib] Remove workarounds for certain builtins not supporting noncopyable use

swiftlang#71733 fixed this!

[stdlib] Update FIXME

[stdlib] UnsafePointer: Update Swift version numbers

[stdlib] UnsafePointer: Actually hide legacy ABI

[stdlib] Remove workaround for U[M]BP.withMemoryRebound
- Enable BorrowingSwitch feature within the stdlib
- ExpressibleByNilLiteral: Add retroactive support for noncopyable conforming types
- Optional: draft an API surface for noncopyable payloads

[stdlib] Oops, the ExpressibleByNilLiteral conformance kept its implicit copyability
kavon and others added 27 commits March 15, 2024 14:38
The test was relying on UnsafeMutablePointer (UMP) not having a Copyable
 requirement. Those Copyable requirements are more prominent when using
the new infrastructure for noncopyable types. Since UMP is planned to
have `~Copyable` on its generic parameter quite soon, this shouldn't
remain broken for too long.
It's not currently clear whether this is a regression or just a test
that needs updating. Investigation is needed.
It's not currently clear whether this is a regression or just a test
that needs updating. For now it seems harmless to just update the test
rather than disable it.
This test is failing to verify the generic signature for this bogus
 program, because the generic signature isn't minimal. We should
 gracefully handle this situation and still have a minimal signature,
 despite rejecting this program.
The presence of Copyable/Escapable conformances doesn't affect ABI. Only
their absence in terms of suppressed requirements like `~Copyable` need
to be output for diffing by the APIDigester.
This appears to be a code path that wasn't previously stressed when
deserializing a bogus module, but now it is with NoncopyableGenerics, as
Copyable is often emitted as a builtin conformance.
After removing the implicit conditional conformance synthesis for
inverses, this test wasn't updated.
[gardening] update copyright notice

[gardening] update copyright notice

[gardening] update copyright notice

[gardening] update copyright notice
…rk when using Optional and other stdlib features
@lorentey lorentey force-pushed the noncopyable-primitives-and-more! branch from c821c2f to 8ea0a2d Compare March 15, 2024 22:39
@lorentey
Copy link
Member Author

Closing as obsolete, as #72276 has now landed on main 🎉

@lorentey lorentey closed this Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants