-
Notifications
You must be signed in to change notification settings - Fork 493
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
Referencify bool type #940
Conversation
19d8c56
to
e821472
Compare
I really don't know how to describe layout. I don't know if we should call it a property of memory objects, specific values, types, or what. I'm calling them objects here... I gave all the links with a `p-` prefix that so that they can be trivially copied and pasted into the other primitive types chapters.
This commit mostly adds links across the reference where things talked about the boolean type. I also normalized the language so that it always uses "boolean type". Other links were added as appropriate. This commit also changes a few "x expressions" to "x operands" for if and while expressions. The whole books needs this treatment, but while I was here, I did it for these sections. I also changed "`#[repr(C)]`" to "the C representation" in unions so that I could actually link to them without breaking linkcheck.
In practice, this mostly means that constructors are not associated to the type | ||
(e.g. `bool::true`). | ||
|
||
Like all primitives, the boolean type [implements][p-impl] 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.
Is there a reason this doesn't list other traits like the operator traits? It does seem like a little bit of a gray area of which trait impls are part of the "language", but it is not clear to me how that line is drawn.
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.
I just referenced the traits on the special traits page, and didn't think too much about the operator traits. It is an oversight, sorta. There's inherent behavior with the operators themselves, but the trait implementations are library-side:
macro_rules! bitand_impl {
($($t:ty)*) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl BitAnd for $t {
type Output = $t;
#[inline]
fn bitand(self, rhs: $t) -> $t { self & rhs }
}
forward_ref_binop! { impl BitAnd, bitand for $t, $t }
)*)
}
bitand_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
Comparison operators are also built-in that way.
How about I add truth tables for all the things you can do with a boolean, and then link to those from the operator expressions?
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.
👍
Update books ## nomicon 1 commits in bbf06ad39d1f45654047e9596b750cc6e6d1b693..adca786547d08fe676b2fc7a6f08c2ed5280ca38 2021-01-22 07:07:31 -0800 to 2021-02-16 16:34:20 +0900 - Merge pull request rust-lang/nomicon#254 from mdaverde/ml/adds-compiler-err-lifetimes ## reference 9 commits in f02b09eb6e8af340ad1256a54adb7aae2ff3163e..361367c126290ac17cb4089f8d38fd8b2ac43f98 2021-01-22 01:53:02 -0800 to 2021-02-15 09:58:13 -0800 - Define turbofish in the glossary (rust-lang/reference#964) - Remove enum variant expr (rust-lang/reference#963) - One sentence is one line src/expressions/* (rust-lang/reference#962) - Referencify bool type (rust-lang/reference#940) - Fix typo in type cast expression table (rust-lang/reference#959) - Define rust (rust-lang/reference#953) - Remove "Memory Ownership" chapter (rust-lang/reference#952) - Added setting nightly as a requirement for running tests (rust-lang/reference#955) - Refactored build steps for better readability (rust-lang/reference#936) ## book 13 commits in e724bd826580ff95df48a8533af7dec1080693d4..db5e8a5105aa22979490dce30e33b68d8645761d 2021-01-20 08:19:49 -0600 to 2021-02-12 16:58:20 -0500 - Update to Rust 1.50 - Fix issue rust-lang/book#2574 - Improve the explanation about the behaviour of `read_line`. (rust-lang/book#2575) - closures: replace "is called" with "is defined" (rust-lang/book#2556) - Minor clarification: types -> values in ch16-04 (rust-lang/book#2587) - fixed hidden code listing (rust-lang/book#2610) - Merge remote-tracking branch 'origin/pr/2604' - (rust-lang/book#2601) - Merge remote-tracking branch 'origin/pr/2589' - Fix text wrapping - Some small rewordings I noticed while rereading just now - (rust-lang/book#2592) - Removed 'of' between type alias in Ch 19-04. (rust-lang/book#2581) - Merge remote-tracking branch 'origin/pr/2554' ## rust-by-example 2 commits in f633769acef68574427a6fae6c06f13bc2199573..551cc4bc8394feccea6acd21f86d9a4e1d2271a0 2021-01-13 20:58:25 -0300 to 2021-02-03 17:12:37 -0300 - remove // (rust-lang/rust-by-example#1409) - Update arc.md (rust-lang/rust-by-example#1406) ## edition-guide 3 commits in b91a9a881ee007c12e74e844460ec407cf07a50f..1da3c411f17adb1ba5de1683bb6acee83362b54a 2020-11-02 11:02:03 -0600 to 2021-02-16 16:46:40 -0800 - Update link for no_std. (rust-lang/edition-guide#231) - Add git link to the source. (rust-lang/edition-guide#228) - Update musl libc link (rust-lang/edition-guide#230) ## embedded-book 1 commits in ceec19e873be87c6ee5666b030c6bb612f889a96..4cf7981696a85c3e633076c6401611bd3f6346c4 2021-01-03 13:13:10 +0000 to 2021-02-11 10:55:22 +0000 - Fix installing dateutil since it is now a dependency of the GHP import script (rust-embedded/book#282)
I never knew there was so much to say about booleans.