@@ -1429,10 +1429,11 @@ except that they can be enforced by the compiler.
1429
1429
- ``trivial ``: Promises that assignment just requires a fixed-size bit-for-bit
1430
1430
copy without any indirection or reference-counting operations.
1431
1431
1432
- - ``size_in_bits(N) ``: Promises that the type is not larger than a certain
1433
- size. (It may be smaller.)
1432
+ - ``maximumFootprint(sizeInBits: N, alignmentInBits: A) ``: Promises that the
1433
+ type's size and required alignment are at most N bits and A bits,
1434
+ respectively. (Both may be smaller.)
1434
1435
1435
- - ``fixed_size ``: Promises that the type has *some * size known at compile-time,
1436
+ - ``fixedSize ``: Promises that the type has *some * size known at compile-time,
1436
1437
allowing optimizations like promoting allocations to the stack. Only applies
1437
1438
to fixed-contents structs and closed enums, which can already infer this
1438
1439
information; the explicit annotation allows it to be enforced.
@@ -1442,14 +1443,19 @@ underscore the fact that they do not affect how a type is used at the source
1442
1443
level, but do allow for additional optimizations. We may also expose some of
1443
1444
these qualities to static or dynamic queries for performance-sensitive code.
1444
1445
1445
- .. note :: Previous revisions of this document contained a ``no_payload ``
1446
+ .. note :: Previous revisions of this document contained a ``noPayload ``
1446
1447
assertion for enums. However, this doesn't actually offer any additional
1447
- optimization opportunities over combining ``trivial `` with ``size_in_bits ``,
1448
- and the latter is more flexible.
1448
+ optimization opportunities over combining ``trivial `` with
1449
+ ``maximumFootprint ``, and the latter is more flexible.
1450
+
1451
+ .. note :: None of these names / spellings are final. The name "trivial" comes
1452
+ from C++, though Swift's trivial is closer to C++'s "`trivially copyable `__".
1449
1453
1450
1454
All of these features need to be versioned, just like the more semantic
1451
1455
fragility attributes above. The exact spelling is not proposed by this document.
1452
1456
1457
+ __ http://en.cppreference.com/w/cpp/types/is_trivially_copyable
1458
+
1453
1459
1454
1460
Resilience Domains
1455
1461
==================
0 commit comments