diff --git a/src/doc/guide-strings.md b/src/doc/guide-strings.md index 1c7cb1a3b4eb9..071c9ff013c59 100644 --- a/src/doc/guide-strings.md +++ b/src/doc/guide-strings.md @@ -155,7 +155,7 @@ println!("{}", s[0]); This does not compile. This is on purpose. In the world of UTF-8, direct indexing is basically never what you want to do. The reason is that each character can be a variable number of bytes. This means that you have to iterate -through the characters anyway, which is a O(n) operation. +through the characters anyway, which is an O(n) operation. There's 3 basic levels of unicode (and its encodings): diff --git a/src/doc/reference.md b/src/doc/reference.md index d05705562d27a..58d8476d4f957 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -2526,7 +2526,7 @@ The currently implemented features of the reference compiler are: * `plugin_registrar` - Indicates that a crate has [compiler plugins][plugin] that it wants to load. As with `phase`, the implementation is - in need of a overhaul, and it is not clear that plugins + in need of an overhaul, and it is not clear that plugins defined using this will continue to work. * `quote` - Allows use of the `quote_*!` family of macros, which are @@ -2583,7 +2583,7 @@ there isn't a parser error first). The directive in this case is no longer necessary, and it's likely that existing code will break if the feature isn't removed. -If a unknown feature is found in a directive, it results in a compiler error. +If an unknown feature is found in a directive, it results in a compiler error. An unknown feature is one which has never been recognized by the compiler. # Statements and expressions @@ -2685,7 +2685,7 @@ When an lvalue is evaluated in an _lvalue context_, it denotes a memory location; when evaluated in an _rvalue context_, it denotes the value held _in_ that memory location. -When an rvalue is used in lvalue context, a temporary un-named lvalue is +When an rvalue is used in an lvalue context, a temporary un-named lvalue is created and used instead. A temporary's lifetime equals the largest lifetime of any reference that points to it. @@ -2833,7 +2833,7 @@ foo().x; ``` A field access is an [lvalue](#lvalues,-rvalues-and-temporaries) referring to -the value of that field. When the type providing the field inherits mutabilty, +the value of that field. When the type providing the field inherits mutability, it can be [assigned](#assignment-expressions) to. Also, if the type of the expression to the left of the dot is a pointer, it is @@ -3321,7 +3321,7 @@ between `_` and `..` is that the pattern `C(_)` is only type-correct if `C` has exactly one argument, while the pattern `C(..)` is type-correct for any enum variant `C`, regardless of how many arguments `C` has. -Used inside a array pattern, `..` stands for any number of elements, when the +Used inside an array pattern, `..` stands for any number of elements, when the `advanced_slice_patterns` feature gate is turned on. This wildcard can be used at most once for a given array, which implies that it cannot be used to specifically match elements that are at an unknown distance from both ends of a @@ -3584,7 +3584,7 @@ is not a surrogate), represented as a 32-bit unsigned word in the 0x0000 to 0xD7FF or 0xE000 to 0x10FFFF range. A `[char]` array is effectively an UCS-4 / UTF-32 string. -A value of type `str` is a Unicode string, represented as a array of 8-bit +A value of type `str` is a Unicode string, represented as an array of 8-bit unsigned bytes holding a sequence of UTF-8 codepoints. Since `str` is of unknown size, it is not a _first class_ type, but can only be instantiated through a pointer type, such as `&str` or `String`.