-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow storing of heap types in stack types
Commit 8ca46bf introduces the ability to define stack allocated value types. This commit extends support to also allow defining of stack allocated types containing heap types. This means there are now three different kinds of allocation strategies: - class A: heap allocated, subject to single ownership - class inline A: stack allocated, subject to single ownership - class copy A: stack allocated, immutable value type that's copied upon a move When borrowing an `inline` type, the compiler copies the stack allocated portion and increments the borrow count for any heap values stored within. When dropping this copy, the borrow count is reduces. This means that borrowing an `inline` type is equivalent to borrowing all interior heap values, just without the need for doing so manually. This approach is inspired by Swift, which takes a similar approach using (atomic) reference counting. Changelog: added
- Loading branch information
1 parent
26070da
commit 9ecc573
Showing
64 changed files
with
1,226 additions
and
605 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.