@@ -603,7 +603,7 @@ mod b {
603
603
```
604
604
605
605
* Paths starting with the keyword ` super ` begin resolution relative to the
606
- parent module. Each further identifier must resolve to an item.
606
+ parent module. Each further identifier must resolve to an item
607
607
608
608
``` rust
609
609
mod a {
@@ -985,7 +985,7 @@ top of [modules](#modules) and [blocks](#blocks).
985
985
986
986
Use declarations support a number of convenient shortcuts:
987
987
988
- * Rebinding the target name as a new local name, using the syntax ` use p::q::r as x; `
988
+ * Rebinding the target name as a new local name, using the syntax ` use p::q::r as x; ` .
989
989
* Simultaneously binding a list of paths differing only in their final element,
990
990
using the glob-like brace syntax ` use a::b::{c,d,e,f}; `
991
991
* Binding all paths matching a given prefix, using the asterisk wildcard syntax
@@ -1091,7 +1091,7 @@ set of *input* [*slots*](#memory-slots) as parameters, through which the caller
1091
1091
passes arguments into the function, and an * output* [ * slot* ] ( #memory-slots )
1092
1092
through which the function passes results back to the caller.
1093
1093
1094
- A function may also be copied into a first- class * value* , in which case the
1094
+ A function may also be copied into a first class * value* , in which case the
1095
1095
value has the corresponding [ * function type* ] ( #function-types ) , and can be used
1096
1096
otherwise exactly as a function item (with a minor additional cost of calling
1097
1097
the function indirectly).
@@ -1224,7 +1224,7 @@ the guarantee that these issues are never caused by safe code.
1224
1224
* A value other than ` false ` (0) or ` true ` (1) in a ` bool `
1225
1225
* A discriminant in an ` enum ` not included in the type definition
1226
1226
* A value in a ` char ` which is a surrogate or above ` char::MAX `
1227
- * Non -UTF-8 byte sequences in a ` str `
1227
+ * non -UTF-8 byte sequences in a ` str `
1228
1228
* Unwinding into Rust from foreign code or unwinding from Rust into foreign
1229
1229
code. Rust's failure system is not compatible with exception handling in
1230
1230
other languages. Unwinding must be caught and handled at FFI boundaries.
@@ -1827,7 +1827,7 @@ accesses in two cases:
1827
1827
1828
1828
These two cases are surprisingly powerful for creating module hierarchies
1829
1829
exposing public APIs while hiding internal implementation details. To help
1830
- explain, here's a few use cases and what they would entail:
1830
+ explain, here's a few use cases and what they would entail.
1831
1831
1832
1832
* A library developer needs to expose functionality to crates which link
1833
1833
against their library. As a consequence of the first case, this means that
@@ -1858,7 +1858,7 @@ import/expression is only valid if the destination is in the current visibility
1858
1858
scope.
1859
1859
1860
1860
Here's an example of a program which exemplifies the three cases outlined
1861
- above:
1861
+ above.
1862
1862
1863
1863
```
1864
1864
// This module is private, meaning that no external crate can access this
@@ -2117,13 +2117,6 @@ macro scope.
2117
2117
destructors from being run twice. Destructors might be run multiple times on
2118
2118
the same object with this attribute.
2119
2119
- ` doc ` - Doc comments such as ` /// foo ` are equivalent to ` #[doc = "foo"] ` .
2120
- - ` rustc_on_unimplemented ` - Write a custom note to be shown along with the error
2121
- when the trait is found to be unimplemented on a type.
2122
- You may use format arguments like ` {T} ` , ` {A} ` to correspond to the
2123
- types at the point of use corresponding to the type parameters of the
2124
- trait of the same name. ` {Self} ` will be replaced with the type that is supposed
2125
- to implement the trait but doesn't. To use this, the ` on_unimplemented ` feature gate
2126
- must be enabled.
2127
2120
2128
2121
### Conditional compilation
2129
2122
@@ -2170,7 +2163,7 @@ arbitrarily complex configurations through nesting.
2170
2163
The following configurations must be defined by the implementation:
2171
2164
2172
2165
* ` target_arch = "..." ` . Target CPU architecture, such as ` "x86" ` , ` "x86_64" `
2173
- ` "mips" ` , ` "powerpc" ` , ` " arm"` , or ` "aarch64" ` .
2166
+ ` "mips" ` , ` "arm" ` , or ` "aarch64" ` .
2174
2167
* ` target_endian = "..." ` . Endianness of the target CPU, either ` "little" ` or
2175
2168
` "big" ` .
2176
2169
* ` target_family = "..." ` . Operating system family of the target, e. g.
@@ -2220,7 +2213,7 @@ mod m1 {
2220
2213
```
2221
2214
2222
2215
This example shows how one can use ` allow ` and ` warn ` to toggle a particular
2223
- check on and off:
2216
+ check on and off.
2224
2217
2225
2218
``` {.ignore}
2226
2219
#[warn(missing_docs)]
@@ -2242,7 +2235,7 @@ mod m2{
2242
2235
```
2243
2236
2244
2237
This example shows how one can use ` forbid ` to disallow uses of ` allow ` for
2245
- that lint check:
2238
+ that lint check.
2246
2239
2247
2240
``` {.ignore}
2248
2241
#[forbid(missing_docs)]
@@ -2325,9 +2318,9 @@ These language items are traits:
2325
2318
* ` ord `
2326
2319
: Elements have a partial ordering.
2327
2320
* ` deref `
2328
- : ` * ` can be applied, yielding a reference to another type.
2321
+ : ` * ` can be applied, yielding a reference to another type
2329
2322
* ` deref_mut `
2330
- : ` * ` can be applied, yielding a mutable reference to another type.
2323
+ : ` * ` can be applied, yielding a mutable reference to another type
2331
2324
2332
2325
These are functions:
2333
2326
@@ -2348,7 +2341,7 @@ These are functions:
2348
2341
* ` type_id `
2349
2342
: The type returned by the ` type_id ` intrinsic.
2350
2343
* ` unsafe `
2351
- : A type whose contents can be mutated through an immutable reference.
2344
+ : A type whose contents can be mutated through an immutable reference
2352
2345
2353
2346
#### Marker types
2354
2347
@@ -2357,11 +2350,11 @@ These types help drive the compiler's analysis
2357
2350
* ` begin_unwind `
2358
2351
: ___ Needs filling in___
2359
2352
* ` no_copy_bound `
2360
- : This type does not implement "copy", even if eligible.
2353
+ : This type does not implement "copy", even if eligible
2361
2354
* ` no_send_bound `
2362
- : This type does not implement "send", even if eligible.
2355
+ : This type does not implement "send", even if eligible
2363
2356
* ` no_sync_bound `
2364
- : This type does not implement "sync", even if eligible.
2357
+ : This type does not implement "sync", even if eligible
2365
2358
* ` eh_personality `
2366
2359
: ___ Needs filling in___
2367
2360
* ` exchange_free `
@@ -2383,11 +2376,11 @@ These types help drive the compiler's analysis
2383
2376
* ` iterator `
2384
2377
: ___ Needs filling in___
2385
2378
* ` contravariant_lifetime `
2386
- : The lifetime parameter should be considered contravariant.
2379
+ : The lifetime parameter should be considered contravariant
2387
2380
* ` covariant_lifetime `
2388
- : The lifetime parameter should be considered covariant.
2381
+ : The lifetime parameter should be considered covariant
2389
2382
* ` invariant_lifetime `
2390
- : The lifetime parameter should be considered invariant.
2383
+ : The lifetime parameter should be considered invariant
2391
2384
* ` malloc `
2392
2385
: Allocate memory on the managed heap.
2393
2386
* ` owned_box `
@@ -2397,11 +2390,11 @@ These types help drive the compiler's analysis
2397
2390
* ` start `
2398
2391
: ___ Needs filling in___
2399
2392
* ` contravariant_type `
2400
- : The type parameter should be considered contravariant.
2393
+ : The type parameter should be considered contravariant
2401
2394
* ` covariant_type `
2402
- : The type parameter should be considered covariant.
2395
+ : The type parameter should be considered covariant
2403
2396
* ` invariant_type `
2404
- : The type parameter should be considered invariant.
2397
+ : The type parameter should be considered invariant
2405
2398
* ` ty_desc `
2406
2399
: ___ Needs filling in___
2407
2400
@@ -2432,15 +2425,15 @@ There are three different types of inline attributes:
2432
2425
* ` #[inline(always)] ` asks the compiler to always perform an inline expansion.
2433
2426
* ` #[inline(never)] ` asks the compiler to never perform an inline expansion.
2434
2427
2435
- ### Derive
2428
+ ### Deriving
2436
2429
2437
- The ` derive ` attribute allows certain traits to be automatically implemented
2430
+ The ` deriving ` attribute allows certain traits to be automatically implemented
2438
2431
for data structures. For example, the following will create an ` impl ` for the
2439
2432
` PartialEq ` and ` Clone ` traits for ` Foo ` , the type parameter ` T ` will be given
2440
2433
the ` PartialEq ` or ` Clone ` constraints for the appropriate ` impl ` :
2441
2434
2442
2435
```
2443
- #[derive (PartialEq, Clone)]
2436
+ #[deriving (PartialEq, Clone)]
2444
2437
struct Foo<T> {
2445
2438
a: int,
2446
2439
b: T
@@ -2462,7 +2455,7 @@ impl<T: PartialEq> PartialEq for Foo<T> {
2462
2455
}
2463
2456
```
2464
2457
2465
- Supported traits for ` derive ` are:
2458
+ Supported traits for ` deriving ` are:
2466
2459
2467
2460
* Comparison traits: ` PartialEq ` , ` Eq ` , ` PartialOrd ` , ` Ord ` .
2468
2461
* Serialization: ` Encodable ` , ` Decodable ` . These require ` serialize ` .
@@ -2928,13 +2921,13 @@ automatically dereferenced to make the field access possible.
2928
2921
``` {.ebnf .gram}
2929
2922
array_expr : '[' "mut" ? vec_elems? ']' ;
2930
2923
2931
- array_elems : [expr [',' expr]*] | [expr ';' expr] ;
2924
+ array_elems : [expr [',' expr]*] | [expr ',' ".." expr] ;
2932
2925
```
2933
2926
2934
2927
An [ array] ( #array,-and-slice-types ) _ expression_ is written by enclosing zero
2935
2928
or more comma-separated expressions of uniform type in square brackets.
2936
2929
2937
- In the ` [expr ';' expr] ` form, the expression after the ` ';' ` must be a
2930
+ In the ` [expr ',' ".." expr] ` form, the expression after the ` ".." ` must be a
2938
2931
constant expression that can be evaluated at compile time, such as a
2939
2932
[ literal] ( #literals ) or a [ static item] ( #static-items ) .
2940
2933
@@ -3226,11 +3219,11 @@ the simplest and least-expensive form (analogous to a ```|| { }``` expression),
3226
3219
the lambda expression captures its environment by reference, effectively
3227
3220
borrowing pointers to all outer variables mentioned inside the function.
3228
3221
Alternately, the compiler may infer that a lambda expression should copy or
3229
- move values (depending on their type) from the environment into the lambda
3222
+ move values (depending on their type. ) from the environment into the lambda
3230
3223
expression's captured environment.
3231
3224
3232
3225
In this example, we define a function ` ten_times ` that takes a higher-order
3233
- function argument, and call it with a lambda expression as an argument:
3226
+ function argument, and call it with a lambda expression as an argument.
3234
3227
3235
3228
```
3236
3229
fn ten_times<F>(f: F) where F: Fn(int) {
@@ -3668,14 +3661,14 @@ within an object along with one byte past the end.
3668
3661
The types ` char ` and ` str ` hold textual data.
3669
3662
3670
3663
A value of type ` char ` is a [ Unicode scalar value] (
3671
- http://www.unicode.org/glossary/#unicode_scalar_value ) (i.e . a code point that
3664
+ http://www.unicode.org/glossary/#unicode_scalar_value ) (ie . a code point that
3672
3665
is not a surrogate), represented as a 32-bit unsigned word in the 0x0000 to
3673
3666
0xD7FF or 0xE000 to 0x10FFFF range. A ` [char] ` array is effectively an UCS-4 /
3674
3667
UTF-32 string.
3675
3668
3676
3669
A value of type ` str ` is a Unicode string, represented as an array of 8-bit
3677
3670
unsigned bytes holding a sequence of UTF-8 codepoints. Since ` str ` is of
3678
- unknown size, it is not a _ first- class_ type, but can only be instantiated
3671
+ unknown size, it is not a _ first class_ type, but can only be instantiated
3679
3672
through a pointer type, such as ` &str ` or ` String ` .
3680
3673
3681
3674
### Tuple types
@@ -3705,7 +3698,7 @@ assert!(b != "world");
3705
3698
3706
3699
Rust has two different types for a list of items:
3707
3700
3708
- * ` [T; N] ` , an 'array'.
3701
+ * ` [T .. N] ` , an 'array'
3709
3702
* ` &[T] ` , a 'slice'.
3710
3703
3711
3704
An array has a fixed size, and can be allocated on either the stack or the
@@ -3717,9 +3710,9 @@ to, it borrows it.
3717
3710
An example of each kind:
3718
3711
3719
3712
``` {rust}
3720
- let vec: Vec<i32> = vec![1, 2, 3];
3721
- let arr: [i32 ; 3] = [1, 2, 3];
3722
- let s: &[i32] = vec.as_slice();
3713
+ let vec: Vec<int> = vec![1, 2, 3];
3714
+ let arr: [int ; 3] = [1, 2, 3];
3715
+ let s: &[int] = vec.as_slice();
3723
3716
```
3724
3717
3725
3718
As you can see, the ` vec! ` macro allows you to create a ` Vec<T> ` easily. The
@@ -3805,7 +3798,7 @@ enum List<T> {
3805
3798
Cons(T, Box<List<T>>)
3806
3799
}
3807
3800
3808
- let a: List<i32 > = List::Cons(7, Box::new(List::Cons(13, Box::new(List::Nil))));
3801
+ let a: List<int > = List::Cons(7, Box::new(List::Cons(13, Box::new(List::Nil))));
3809
3802
```
3810
3803
3811
3804
### Pointer types
0 commit comments