-
Notifications
You must be signed in to change notification settings - Fork 508
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
Typo fixes #556
Typo fixes #556
Conversation
expressions/operator-expr.md
expressions/operator-expr.md
expressions/operator-expr.md
Syntax is not highlighted in <https://doc.rust-lang.org/reference/type-layout.html#reprc-unions>
Co-Authored-By: u32i64 <aymfst@gmail.com>
@@ -110,7 +110,7 @@ according to the following rules: | |||
closure that captures a `T` by shared reference and a `U` by value implements | |||
any auto traits that both `&T` and `U` do. | |||
|
|||
For generic types (counting the built-in types above as generic over `T`), if an | |||
For generic types (counting the built-in types above as generic over `T`), if a | |||
generic implementation is available, then the compiler does not automatically | |||
implement it for types that could use the implementation except that they do not |
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.
@Centril Perhaps this can be re-phrased? I can't seem to understand what the except that they do not meet...
part means. Does that mean except if they
or except then they
...
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.
Consider:
struct A<T>(T);
unsafe impl<T: Copy> Send for A<T> {}
fn assert_send<T: Send>() {}
fn main() {
assert_send::<A<u8>>();
assert_send::<A<String>>();
}
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.
So the compiler would have done this (and does so if we comment out our unsafe impl
):
unsafe impl Send for A<String> {}
// as part of:
unsafe impl Send for A<T> where T: Send {}
But our unsafe impl
tells the compiler to disregard its auto trait
rules and instead use our "rule" (impl
), i.e. we tell the compiler that it is not safe to Send
values of type A<T>
unless T: Copy
?
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.
Yep, pretty much.
@Centril I think this is ready for merging now. |
Yep; Thanks! |
Update books ## nomicon 1 commits in f1ff93b66844493a7b03101c7df66ac958c62418..c02e0e7754a76886e55b976a3a4fac20100cd35d 2019-02-26 13:37:28 -0500 to 2019-03-25 16:52:56 -0400 - dropck: The drop order is now defined (rust-lang/nomicon#113) ## reference 3 commits in 27ad493..98f90ff 2019-03-26 02:06:15 +0100 to 2019-04-06 09:29:08 -0700 - Document repr packed(N). (rust-lang/reference#553) - Fix broken link in glossary. (rust-lang/reference#558) - Typo fixes (rust-lang/reference#556) ## embedded-book 2 commits in 07fd3880ea0874d82b1d9ed30ad3427ec98b4e8a..7989c723607ef5b13b57208022259e6c771e11d0 2019-03-27 15:40:52 +0000 to 2019-04-04 12:14:37 +0000 - fix rust-embedded/book#182 (rust-embedded/book#183) - Add openocd to list of installable packages (rust-embedded/book#179)
Update books ## nomicon 1 commits in f1ff93b66844493a7b03101c7df66ac958c62418..c02e0e7754a76886e55b976a3a4fac20100cd35d 2019-02-26 13:37:28 -0500 to 2019-03-25 16:52:56 -0400 - dropck: The drop order is now defined (rust-lang/nomicon#113) ## reference 3 commits in 27ad493..98f90ff 2019-03-26 02:06:15 +0100 to 2019-04-06 09:29:08 -0700 - Document repr packed(N). (rust-lang/reference#553) - Fix broken link in glossary. (rust-lang/reference#558) - Typo fixes (rust-lang/reference#556) ## embedded-book 2 commits in 07fd3880ea0874d82b1d9ed30ad3427ec98b4e8a..7989c723607ef5b13b57208022259e6c771e11d0 2019-03-27 15:40:52 +0000 to 2019-04-04 12:14:37 +0000 - fix rust-embedded/book#182 (rust-embedded/book#183) - Add openocd to list of installable packages (rust-embedded/book#179)
Fixes various typos.