Skip to content

Commit abd046b

Browse files
committed
Highlighting in types.md
1 parent c268823 commit abd046b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/types.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pattern-matching or by using `N` directly as a field to access the
7575

7676
An example of a tuple type and its use:
7777

78-
```
78+
```rust
7979
type Pair<'a> = (i32, &'a str);
8080
let p: Pair<'static> = (10, "ten");
8181
let (a, b) = p;
@@ -104,7 +104,7 @@ to, it borrows it.
104104

105105
Examples:
106106

107-
```{rust}
107+
```rust
108108
// A stack-allocated array
109109
let array: [i32; 3] = [1, 2, 3];
110110

@@ -191,7 +191,7 @@ enclosing `enum` or `struct` type itself. Such recursion has restrictions:
191191

192192
An example of a *recursive* type and its use:
193193

194-
```
194+
```rust
195195
enum List<T> {
196196
Nil,
197197
Cons(T, Box<List<T>>)
@@ -238,7 +238,7 @@ or `extern`), a sequence of input types and an output type.
238238

239239
An example of a `fn` type:
240240

241-
```
241+
```rust
242242
fn add(x: i32, y: i32) -> i32 {
243243
x + y
244244
}
@@ -256,7 +256,7 @@ Internal to the compiler, there are also function types that are specific to a p
256256
function item. In the following snippet, for example, the internal types of the functions
257257
`foo` and `bar` are different, despite the fact that they have the same signature:
258258

259-
```
259+
```rust
260260
fn foo() { }
261261
fn bar() { }
262262
```
@@ -319,7 +319,7 @@ implementation of `R`, and the pointer value of `E`.
319319

320320
An example of a trait object:
321321

322-
```
322+
```rust
323323
trait Printable {
324324
fn stringify(&self) -> String;
325325
}
@@ -345,7 +345,7 @@ type signature of `print`, and the cast expression in `main`.
345345
Within the body of an item that has type parameter declarations, the names of
346346
its type parameters are types:
347347

348-
```ignore
348+
```rust,ignore
349349
fn to_vec<A: Clone>(xs: &[A]) -> Vec<A> {
350350
if xs.is_empty() {
351351
return vec![];
@@ -366,7 +366,7 @@ The special type `Self` has a meaning within traits and impls. In a trait defini
366366
to an implicit type parameter representing the "implementing" type. In an impl,
367367
it is an alias for the implementing type. For example, in:
368368

369-
```
369+
```rust
370370
pub trait From<T> {
371371
fn from(T) -> Self;
372372
}
@@ -381,7 +381,7 @@ impl From<i32> for String {
381381
The notation `Self` in the impl refers to the implementing type: `String`. In another
382382
example:
383383

384-
```
384+
```rust
385385
trait Printable {
386386
fn make_string(&self) -> String;
387387
}

0 commit comments

Comments
 (0)