-
Notifications
You must be signed in to change notification settings - Fork 550
Add a (short) chapter on Kind
#282
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
Conversation
`UnpackedKind`s first. This is done by calling the `.unpack()` method. | ||
|
||
```rust | ||
// An example of unpacking and packing a kind. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need imports here in order to make the example compile and pass travis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this example compile and pass without importing the whole compiler? Usually, I just add rust,ignore
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @varkor! r=me when travis is green
|
||
## `Kind` | ||
The actual `Kind` struct is optimised for space, storing the type, lifetime or | ||
const as an interned pointer containing a mask identifying its kind (in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lowest 2 bits are the "tag", a (bit) "mask" is what you use to "mask out" bits other than the ones you're interested in (e.g. let (tag, ptr) = (x & 0b11, x & !0b11);
uses 0b11
to get the lowest 2 bits and !0b11
for everything else).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #287 to fix.
This chapter briefly describes the use of
Kind
,UnpackedKind
andSubst
.This has been delayed long enough that I think it's worth getting something in the guide, just to provide some explanation. We can always extend this in the future with more examples.
Fixes #97.