Skip to content

Commit 7460403

Browse files
committed
Fix syntax::ext::deriving{,::*} docs formatting.
The most significant fix is for `syntax::ext::deriving::encodable`, where one of the blocks of code, auspiciously containing `<S>` (recall that Markdown allows arbitrary HTML to be contained inside it), was not formatted as a code block, with a fun but messy effect.
1 parent 780adff commit 7460403

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

src/libsyntax/ext/deriving/decodable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
/*!
12-
The compiler code necessary for #[deriving(Decodable)]. See
12+
The compiler code necessary for `#[deriving(Decodable)]`. See
1313
encodable.rs for more.
1414
*/
1515

src/libsyntax/ext/deriving/encodable.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@
1010

1111
/*!
1212
13-
The compiler code necessary to implement the #[deriving(Encodable)]
14-
(and Decodable, in decodable.rs) extension. The idea here is that
15-
type-defining items may be tagged with #[deriving(Encodable,
16-
Decodable)].
13+
The compiler code necessary to implement the `#[deriving(Encodable)]`
14+
(and `Decodable`, in decodable.rs) extension. The idea here is that
15+
type-defining items may be tagged with `#[deriving(Encodable, Decodable)]`.
1716
1817
For example, a type like:
1918
2019
```ignore
21-
#[deriving(Encodable, Decodable)]
22-
struct Node {id: uint}
20+
#[deriving(Encodable, Decodable)]
21+
struct Node { id: uint }
2322
```
2423
2524
would generate two implementations like:
2625
26+
```ignore
2727
impl<S:serialize::Encoder> Encodable<S> for Node {
2828
fn encode(&self, s: &S) {
2929
s.emit_struct("Node", 1, || {
@@ -41,13 +41,14 @@ impl<D:Decoder> Decodable for node_id {
4141
})
4242
}
4343
}
44+
```
4445
4546
Other interesting scenarios are whe the item has type parameters or
4647
references other non-built-in types. A type definition like:
4748
4849
```ignore
49-
#[deriving(Encodable, Decodable)]
50-
struct spanned<T> {node: T, span: Span}
50+
#[deriving(Encodable, Decodable)]
51+
struct spanned<T> { node: T, span: Span }
5152
```
5253
5354
would yield functions like:

src/libsyntax/ext/deriving/generic.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ access to the fields of the 4 different sorts of structs and enum
1616
variants, as well as creating the method and impl ast instances.
1717
1818
Supported features (fairly exhaustive):
19+
1920
- Methods taking any number of parameters of any type, and returning
2021
any type, other than vectors, bottom and closures.
2122
- Generating `impl`s for types with type parameters and lifetimes
@@ -59,7 +60,7 @@ associated with. It is only not `None` when the associated field has
5960
an identifier in the source code. For example, the `x`s in the
6061
following snippet
6162
62-
~~~notrust
63+
```rust
6364
struct A { x : int }
6465
6566
struct B(int);
@@ -68,7 +69,7 @@ enum C {
6869
C0(int),
6970
C1 { x: int }
7071
}
71-
~~~
72+
```
7273
7374
The `int`s in `B` and `C0` don't have an identifier, so the
7475
`Option<ident>`s would be `None` for them.
@@ -83,7 +84,7 @@ variants, it is represented as a count of 0.
8384
8485
The following simplified `Eq` is used for in-code examples:
8586
86-
~~~notrust
87+
```rust
8788
trait Eq {
8889
fn eq(&self, other: &Self);
8990
}
@@ -92,7 +93,7 @@ impl Eq for int {
9293
*self == *other
9394
}
9495
}
95-
~~~
96+
```
9697
9798
Some examples of the values of `SubstructureFields` follow, using the
9899
above `Eq`, `A`, `B` and `C`.

src/libsyntax/ext/deriving/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
// except according to those terms.
1010

1111
/*!
12-
The compiler code necessary to implement the #[deriving] extensions.
12+
The compiler code necessary to implement the `#[deriving]` extensions.
1313
1414
15-
FIXME (#2810)--Hygiene. Search for "__" strings (in other files too).
15+
FIXME (#2810): hygiene. Search for "__" strings (in other files too).
1616
We also assume "extra" is the standard library, and "std" is the core
1717
library.
1818

0 commit comments

Comments
 (0)