From 29216ad292690d4330ef8ca5d9ffdd8803d1b234 Mon Sep 17 00:00:00 2001 From: Artem Varaksa Date: Thu, 28 Mar 2019 17:08:57 +0300 Subject: [PATCH 1/9] Fix wrong path in `expressions/operator-expr.md` --- src/expressions/operator-expr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/expressions/operator-expr.md b/src/expressions/operator-expr.md index 05468277d..951ce7a3f 100644 --- a/src/expressions/operator-expr.md +++ b/src/expressions/operator-expr.md @@ -93,7 +93,7 @@ Dereferencing a raw pointer requires `unsafe`. On non-pointer types `*x` is equivalent to `*std::ops::Deref::deref(&x)` in an [immutable place expression context](expressions.html#mutability) and -`*std::ops::Deref::deref_mut(&mut x)` in a mutable place expression context. +`*std::ops::DerefMut::deref_mut(&mut x)` in a mutable place expression context. ```rust let x = &7; From 9ce6eca3137387abf96cc3f40edb6c5fd33721f7 Mon Sep 17 00:00:00 2001 From: Artem Varaksa Date: Thu, 28 Mar 2019 17:19:54 +0300 Subject: [PATCH 2/9] Fix typo: `Nones` -> `None`s --- src/expressions/operator-expr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/expressions/operator-expr.md b/src/expressions/operator-expr.md index 951ce7a3f..65abf9cbe 100644 --- a/src/expressions/operator-expr.md +++ b/src/expressions/operator-expr.md @@ -131,7 +131,7 @@ println!("{:?}", res); # assert!(res.is_err()) ``` -When applied to values of the `Option` type, it propagates `Nones`. If the +When applied to values of the `Option` type, it propagates `None`s. If the value is `None`, then it will return `None`. If applied to `Some(x)`, then it will unwrap the value to evaluate to `x`. From 5f87524c5dc9713e9095b898fc13bbfc4bcf2981 Mon Sep 17 00:00:00 2001 From: Artem Varaksa Date: Thu, 28 Mar 2019 18:23:16 +0300 Subject: [PATCH 3/9] Fix typo in `expressions/match-expr.md` --- src/expressions/match-expr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/expressions/match-expr.md b/src/expressions/match-expr.md index a5ccf6829..eb672fac6 100644 --- a/src/expressions/match-expr.md +++ b/src/expressions/match-expr.md @@ -113,7 +113,7 @@ let message = match maybe_digit { ``` > Note: Multiple matches using the `|` operator can cause the pattern guard and -> and side effects it has to execute multiple times. For example: +> the side effects it has to execute multiple times. For example: > > ```rust > # use std::cell::Cell; From 633541c74c546fa44a60c3860402aac41d843e64 Mon Sep 17 00:00:00 2001 From: Artem Varaksa Date: Thu, 28 Mar 2019 19:21:25 +0300 Subject: [PATCH 4/9] `?sized` -> `?Sized` --- src/types/trait-object.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/trait-object.md b/src/types/trait-object.md index eb31a1bbd..e909d1c1c 100644 --- a/src/types/trait-object.md +++ b/src/types/trait-object.md @@ -17,7 +17,7 @@ of the base trait. Trait objects are written as the optional keyword `dyn` followed by a set of trait bounds, but with the following restrictions on the trait bounds. All traits except the first trait must be auto traits, there may not be more than -one lifetime, and opt-out bounds (e.g. `?sized`) are not allowed. Furthermore, +one lifetime, and opt-out bounds (e.g. `?Sized`) are not allowed. Furthermore, paths to traits may be parenthesized. For example, given a trait `Trait`, the following are all trait objects: From 83766c898ddf6eec4272b62320d1f875f616c666 Mon Sep 17 00:00:00 2001 From: Artem Varaksa Date: Thu, 28 Mar 2019 19:47:51 +0300 Subject: [PATCH 5/9] Annotate code block in type-layout.md with `rust` Syntax is not highlighted in --- src/type-layout.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/type-layout.md b/src/type-layout.md index 82ee95e56..b0efe3ffc 100644 --- a/src/type-layout.md +++ b/src/type-layout.md @@ -205,7 +205,7 @@ The union will have a size of the maximum size of all of its fields rounded to its alignment, and an alignment of the maximum alignment of all of its fields. These maximums may come from different fields. -``` +```rust #[repr(C)] union Union { f1: u16, From 4209521fa1ecb9b296380abd559706713e26399e Mon Sep 17 00:00:00 2001 From: Artem Varaksa Date: Thu, 28 Mar 2019 20:09:14 +0300 Subject: [PATCH 6/9] Fixes in type-coercions.md --- src/type-coercions.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/type-coercions.md b/src/type-coercions.md index c8719aee4..5977ed109 100644 --- a/src/type-coercions.md +++ b/src/type-coercions.md @@ -96,7 +96,7 @@ Coercion is allowed between the following types: * `T_1` to `T_3` where `T_1` coerces to `T_2` and `T_2` coerces to `T_3` (*transitive case*) - Note that this is not fully supported yet + Note that this is not fully supported yet. * `&mut T` to `&T` @@ -158,8 +158,8 @@ cases where other coercions are not, as described above. They can still happen anywhere else a coercion can occur. Two traits, [`Unsize`] and [`CoerceUnsized`], are used -to assist in this process and expose it for library use. The compiler following -coercions are built-in and, if `T` can be coerced to `U` with one of the, then +to assist in this process and expose it for library use. The following +coercions are compiler built-ins and, if `T` can be coerced to `U` with one of them, then the compiler will provide an implementation of `Unsize` for `T`: * `[T; n]` to `[T]`. @@ -182,5 +182,5 @@ unsized coercion to `Foo`. > has been stabilized, the traits themselves are not yet stable and therefore > can't be used directly in stable Rust. -[Unsize]: ../std/marker/trait.Unsize.html -[CoerceUnsized]: ../std/ops/trait.CoerceUnsized.html +[`Unsize`]: ../std/marker/trait.Unsize.html +[`CoerceUnsized`]: ../std/ops/trait.CoerceUnsized.html From be7851d4cb82c40b5267274eee12c50b48070e79 Mon Sep 17 00:00:00 2001 From: Artem Varaksa Date: Thu, 28 Mar 2019 20:33:54 +0300 Subject: [PATCH 7/9] `an` -> `a` in special-types-and-traits.md --- src/special-types-and-traits.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/special-types-and-traits.md b/src/special-types-and-traits.md index 6d803a0aa..5cd095601 100644 --- a/src/special-types-and-traits.md +++ b/src/special-types-and-traits.md @@ -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 meet the requisite trait bounds. For instance, the standard library implements From fb595f1d68b1cb12b470dc614d855586ca81c6dc Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 28 Mar 2019 20:35:32 +0300 Subject: [PATCH 8/9] Apply suggestions from code review Co-Authored-By: u32i64 --- src/type-coercions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/type-coercions.md b/src/type-coercions.md index 5977ed109..5b2fcb964 100644 --- a/src/type-coercions.md +++ b/src/type-coercions.md @@ -159,8 +159,8 @@ anywhere else a coercion can occur. Two traits, [`Unsize`] and [`CoerceUnsized`], are used to assist in this process and expose it for library use. The following -coercions are compiler built-ins and, if `T` can be coerced to `U` with one of them, then -the compiler will provide an implementation of `Unsize` for `T`: +coercions are built-ins and, if `T` can be coerced to `U` with one of them, then +an implementation of `Unsize` for `T` will be provided: * `[T; n]` to `[T]`. From f5ebab235e25c3cdd8bcb3f6d5311f076f571cba Mon Sep 17 00:00:00 2001 From: Artem Varaksa Date: Thu, 28 Mar 2019 20:52:33 +0300 Subject: [PATCH 9/9] Add missing [`if` expression] link --- src/variables.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/variables.md b/src/variables.md index f6589e394..eaddee4b5 100644 --- a/src/variables.md +++ b/src/variables.md @@ -41,3 +41,5 @@ fn initialization_example() { // uninit_after_if; // err: use of possibly uninitialized `uninit_after_if` } ``` + +[`if` expression]: expressions/if-expr.html#if-expressions