@@ -75,7 +75,6 @@ for referring to a type. It may refer to:
75
75
* The [ never] type.
76
76
* [ Macros] which expand to a type expression.
77
77
78
-
79
78
### Parenthesized types
80
79
81
80
> _ ParenthesizedType_ :\
@@ -93,46 +92,6 @@ require this disambiguation use the [_TypeNoBounds_] rule instead of
93
92
type T <'a > = & 'a (dyn Any + Send );
94
93
```
95
94
96
- ### Inferred type
97
- > ** <sup >Syntax</sup >** \
98
- > _ InferredType_ : ` _ `
99
-
100
- The inferred type asks the compiler to infer the type if possible based on the
101
- surrounding information available. It cannot be used in item signatures. It is
102
- often used in generic arguments:
103
-
104
- ``` rust
105
- let x : Vec <_ > = (0 .. 10 ). collect ();
106
- ```
107
-
108
- <!--
109
- What else should be said here?
110
- The only documentation I am aware of is https://rust-lang-nursery.github.io/rustc-guide/type-inference.html
111
- There should be a broader discussion of type inference somewhere.
112
- -->
113
-
114
-
115
- ### Type parameters
116
-
117
- Within the body of an item that has type parameter declarations, the names of
118
- its type parameters are types:
119
-
120
- ``` rust
121
- fn to_vec <A : Clone >(xs : & [A ]) -> Vec <A > {
122
- if xs . is_empty () {
123
- return vec! [];
124
- }
125
- let first : A = xs [0 ]. clone ();
126
- let mut rest : Vec <A > = to_vec (& xs [1 .. ]);
127
- rest . insert (0 , first );
128
- rest
129
- }
130
- ```
131
-
132
- Here, ` first ` has type ` A ` , referring to ` to_vec ` 's ` A ` type parameter; and
133
- ` rest ` has type ` Vec<A> ` , a vector with element type ` A ` .
134
-
135
-
136
95
## Recursive types
137
96
138
97
Nominal types &mdash ; [ structs] , [ enumerations] and [ unions] &mdash ; may be
@@ -164,7 +123,7 @@ let a: List<i32> = List::Cons(7, Box::new(List::Cons(13, Box::new(List::Nil))));
164
123
[ _BareFunctionType_ ] : types/function-pointer.html
165
124
[ _ImplTraitTypeOneBound_ ] : types/impl-trait.html
166
125
[ _ImplTraitType_ ] : types/impl-trait.html
167
- [ _InferredType_ ] : types.html#inferred-type
126
+ [ _InferredType_ ] : types/inferred .html
168
127
[ _MacroInvocation_ ] : macros.html#macro-invocation
169
128
[ _NeverType_ ] : types/never.html
170
129
[ _ParenthesizedType_ ] : types.html#parenthesized-types
@@ -202,7 +161,7 @@ let a: List<i32> = List::Cons(7, Box::new(List::Cons(13, Box::new(List::Nil))));
202
161
[ arrays ] : types/array.html
203
162
[ enumerations ] : types/enum.html
204
163
[ function pointer ] : types/function-pointer.html
205
- [ inferred type ] : types.html#inferred-type
164
+ [ inferred type ] : types/inferred .html
206
165
[ item ] : items.html
207
166
[ never ] : types/never.html
208
167
[ pointer types ] : types/pointer.html
@@ -215,5 +174,5 @@ let a: List<i32> = List::Cons(7, Box::new(List::Cons(13, Box::new(List::Nil))));
215
174
[ type alias ] : items/type-aliases.html
216
175
[ type aliases ] : items/type-aliases.html
217
176
[ type boundaries ] : trait-bounds.html
218
- [ type parameters ] : #type- parameters
177
+ [ type parameters ] : types/ parameters.html
219
178
[ unions ] : types/union.html
0 commit comments