Commit Graph

7 Commits

Author SHA1 Message Date
Kavon Farvardin
31aa2f77e3 polish noncopyable types diagnostic wordings
- replaces "move-only" terminology with "noncopyable"
- replaces compiler jargon like "guaranteed parameters"
  and "lvalue" with corresponding language-level notions
- simplifies diagnostics about closures.

and probably more.

rdar://109281444
2023-05-24 20:56:36 -07:00
Michael Gottesman
739417ff09 [move-only] Convert __shared to borrowing in move only tests.
These are the same semantically, just the mangling is slightly different. The
benefit of doing this is that we are actually testing what we expect our users
to do.

rdar://108511703
2023-04-25 10:51:04 -07:00
Kavon Farvardin
2c7d9a5047 update tests given move-only types are enabled
the main things still left behind the experimental flag(s) are
- move-only classes (guarded by MoveOnlyClasses feature)
- noimplicitcopy
- the _borrow operator
2023-03-14 18:35:13 -07:00
Kavon Farvardin
c948f3c04f add ownership to tests using noncopyable parameters 2023-02-16 22:08:13 -08:00
Kavon Farvardin
5b7eada4dd permit conformances in extensions of move-only types
previously we were blindly rejecting anything
that such extensions conformed to, but Sendable
is now allowed for move-only types.
2023-02-10 10:02:43 -08:00
Kavon Farvardin
9a18422647 statically prevent runtime casts of move-only type
It appears that conditional casts require a check of the
type's metadata at runtime. There's no reason for us to
permit that at this time, since all such conditional
casts are going to fail, unless its the identity cast.

That is, a move-only type is currently only a subtype
of itself.

So for now, `is`, `as?`, `as!` casts from or to a
move-only type are now an error. The `as` casts
are permitted only if the two move-only types are
equal.
2023-02-07 16:51:46 -07:00
Kavon Farvardin
244cce0a09 allow move-only types to conform to Sendable
Part of the reason why we do not want to
permit conformance to protocols for
move-only types is that they're
fundamentally wrong: all existing protocols
assume the type is copyable, so we'd be
allowing people to write conformances to
things that are not actually true.

The other aspect of it is that we may
need to change the runtime representation
for conformance descriptors of move-only
types. So we can't have these conformances
leaving residue at runtime. Luckily, that
means marker protocols would be OK,
since they leave no residue at runtime.

So for, now we're going to specifically
permit move-only types to conform to the
marker protocol `Sendable` since it's needed
for move-only types to work with concurrency.

All of the existing rules about mixing
move-only types with generics still apply.
That means you still can't turn it into the
existential `any Sendable` in any way at all,
despite it conforming. The purpose of the
conformance is purely to allow the concrete
instances to cross actor isolation boundaries
if it is actually `Sendable`.

resolves rdar://104987062
2023-02-03 19:45:20 -08:00