Skip to content

Commit 4dc7436

Browse files
steveklabnikManishearth
authored andcommitted
types
1 parent 2586d51 commit 4dc7436

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/types.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ A `struct` *type* is a heterogeneous product of other types, called the
131131
or the *struct* types of the Lisp family.
132132

133133
New instances of a `struct` can be constructed with a [struct
134-
expression](#struct-expressions).
134+
expression](expressions.html#struct-expressions).
135135

136136
The memory layout of a `struct` is undefined by default to allow for compiler
137137
optimizations like field reordering, but it can be fixed with the
@@ -140,37 +140,37 @@ a corresponding struct *expression*; the resulting `struct` value will always
140140
have the same memory layout.
141141

142142
The fields of a `struct` may be qualified by [visibility
143-
modifiers](#visibility-and-privacy), to allow access to data in a
143+
modifiers](visibility-and-privacy.html), to allow access to data in a
144144
struct outside a module.
145145

146146
A _tuple struct_ type is just like a struct type, except that the fields are
147147
anonymous.
148148

149149
A _unit-like struct_ type is like a struct type, except that it has no
150150
fields. The one value constructed by the associated [struct
151-
expression](#struct-expressions) is the only value that inhabits such a
151+
expression](expressions.html#struct-expressions) is the only value that inhabits such a
152152
type.
153153

154154
## Enumerated types
155155

156156
An *enumerated type* is a nominal, heterogeneous disjoint union type, denoted
157-
by the name of an [`enum` item](#enumerations). [^enumtype]
157+
by the name of an [`enum` item](items.html#enumerations). [^enumtype]
158158

159159
[^enumtype]: The `enum` type is analogous to a `data` constructor declaration in
160160
ML, or a *pick ADT* in Limbo.
161161

162-
An [`enum` item](#enumerations) declares both the type and a number of *variant
162+
An [`enum` item](items.html#enumerations) declares both the type and a number of *variant
163163
constructors*, each of which is independently named and takes an optional tuple
164164
of arguments.
165165

166166
New instances of an `enum` can be constructed by calling one of the variant
167-
constructors, in a [call expression](#call-expressions).
167+
constructors, in a [call expression](expressions.html#call-expressions).
168168

169169
Any `enum` value consumes as much memory as the largest variant constructor for
170170
its corresponding `enum` type.
171171

172172
Enum types cannot be denoted *structurally* as types, but must be denoted by
173-
named reference to an [`enum` item](#enumerations).
173+
named reference to an [`enum` item](items.html#enumerations).
174174

175175
## Recursive types
176176

@@ -180,7 +180,7 @@ constructor or `struct` field may refer, directly or indirectly, to the
180180
enclosing `enum` or `struct` type itself. Such recursion has restrictions:
181181

182182
* Recursive types must include a nominal type in the recursion
183-
(not mere [type definitions](grammar.html#type-definitions),
183+
(not mere [type definitions](../grammar.html#type-definitions),
184184
or other structural types such as [arrays](#array-and-slice-types) or [tuples](#tuple-types)).
185185
* A recursive `enum` item must have at least one non-recursive constructor
186186
(in order to give the recursion a basis case).
@@ -222,7 +222,7 @@ varieties of pointer in Rust:
222222
for example `*const i32` means a raw pointer to a 32-bit integer.
223223
Copying or dropping a raw pointer has no effect on the lifecycle of any
224224
other value. Dereferencing a raw pointer or converting it to any other
225-
pointer type is an [`unsafe` operation](#unsafe-functions).
225+
pointer type is an [`unsafe` operation](unsafe-functions.html).
226226
Raw pointers are generally discouraged in Rust code;
227227
they exist to support interoperability with foreign code,
228228
and writing performance-critical or low-level functions.
@@ -268,8 +268,8 @@ messages to indicate "the unique fn type for the function `foo`".
268268

269269
## Closure types
270270

271-
A [lambda expression](#lambda-expressions) produces a closure value with
272-
a unique, anonymous type that cannot be written out.
271+
A [lambda expression](expressions.html#lambda-expressions) produces a closure
272+
value with a unique, anonymous type that cannot be written out.
273273

274274
Depending on the requirements of the closure, its type implements one or
275275
more of the closure traits:

0 commit comments

Comments
 (0)