Skip to content
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

Add Values and Representation chapter #1664

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
21ad051
Add Values and Representation chapter
chorman0773 Oct 25, 2024
0e3d2ef
Specify representation of floating-point types
chorman0773 Oct 25, 2024
c24fb7c
Fix lines must not end with spaces
chorman0773 Oct 25, 2024
ab0702b
Apply requested changes from PR Reviews
chorman0773 Nov 11, 2024
c79edfb
Update src/values.md
chorman0773 Nov 11, 2024
42f626f
Add section giving a brief explainer of provenance.
chorman0773 Nov 11, 2024
66b7fc6
Fix "Line Must End with Spaces"
chorman0773 Nov 11, 2024
290efc1
Move value definitions to appropriate chapters under `types`.
chorman0773 Nov 21, 2024
d565328
Remove double line break issues
chorman0773 Nov 21, 2024
b2e8c30
Fix "File must end with a newline"
chorman0773 Nov 21, 2024
e634550
Move aggregate values into appropriate chapters
chorman0773 Nov 22, 2024
98d4d8e
Add note about producing `!` at runtime being UB
chorman0773 Nov 22, 2024
97778c3
Redefine array layout directly
chorman0773 Nov 22, 2024
695d517
Remove redundant sections on bit validity
chorman0773 Nov 22, 2024
5bc13a0
Elaborate on how union constructors produce union values
chorman0773 Nov 22, 2024
0823313
Change definition of memory.encoding in response to PR comments
chorman0773 Dec 10, 2024
2cbdb58
Fix "Line must not end with spaces" for the 3rd time this PR
chorman0773 Dec 11, 2024
9349cd3
Refactor definition of struct values/representation
chorman0773 Dec 11, 2024
900ee93
Attempt to define certain representations in less confusing ways.
chorman0773 Dec 12, 2024
41ca263
Fix "Line must not end with spaces" and link error
chorman0773 Dec 12, 2024
0bd1163
I missed some ;(
chorman0773 Dec 12, 2024
03aa1fc
Remove "Unique Representation" Note.
chorman0773 Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove redundant sections on bit validity
chorman0773 committed Dec 11, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 695d5170be89648c2255aafd76721e636f80ffdd
8 changes: 0 additions & 8 deletions src/types/boolean.md
Original file line number Diff line number Diff line change
@@ -127,14 +127,6 @@ r[type.bool.expr.cmp.less]
r[type.bool.expr.cmp.less-eq]
* `a <= b` is the same as `a == b | a < b`

## Bit validity

r[type.bool.validity]

The single byte of a `bool` is guaranteed to be initialized (in other words,
`transmute::<bool, u8>(...)` is always sound -- but since some bit patterns
are invalid `bool`s, the inverse is not always sound).

[boolean logic]: https://en.wikipedia.org/wiki/Boolean_algebra
[enumerated type]: enum.md
[expressions]: ../expressions.md
7 changes: 0 additions & 7 deletions src/types/numeric.md
Original file line number Diff line number Diff line change
@@ -59,13 +59,6 @@ r[type.numeric.int.size.minimum]
> pointer support is limited and may require explicit care and acknowledgment
> from a library to support.

## Bit validity

r[type.numeric.validity]

For every numeric type, `T`, the bit validity of `T` is equivalent to the bit
validity of `[u8; size_of::<T>()]`. An uninitialized byte is not a valid `u8`.

## Representation

r[type.numeric.repr]
12 changes: 0 additions & 12 deletions src/types/textual.md
Original file line number Diff line number Diff line change
@@ -29,18 +29,6 @@ r[type.text.str-unsized]
Since `str` is a [dynamically sized type], it can only be instantiated through a
pointer type, such as `&str`.

## Layout and bit validity

r[type.text.layout]

r[type.layout.char-layout]
`char` is guaranteed to have the same size and alignment as `u32` on all platforms.

r[type.layout.char-validity]
Every byte of a `char` is guaranteed to be initialized (in other words,
`transmute::<char, [u8; size_of::<char>()]>(...)` is always sound -- but since
some bit patterns are invalid `char`s, the inverse is not always sound).

[Unicode scalar value]: http://www.unicode.org/glossary/#unicode_scalar_value
[undefined behavior]: ../behavior-considered-undefined.md
[dynamically sized type]: ../dynamically-sized-types.md