]> git.lizzy.rs Git - rust.git/commitdiff
Fix syntax::ext::deriving{,::*} docs formatting.
authorChris Morgan <me@chrismorgan.info>
Thu, 27 Feb 2014 05:30:28 +0000 (16:30 +1100)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 28 Feb 2014 05:04:03 +0000 (21:04 -0800)
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.

src/libsyntax/ext/deriving/decodable.rs
src/libsyntax/ext/deriving/encodable.rs
src/libsyntax/ext/deriving/generic.rs
src/libsyntax/ext/deriving/mod.rs

index 623e8ef766c698159f8ea01dd514eda22a04e1eb..7aaa66cbfb5de9cbfac5e10dd4e97c33a5271a1b 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 /*!
-The compiler code necessary for #[deriving(Decodable)]. See
+The compiler code necessary for `#[deriving(Decodable)]`. See
 encodable.rs for more.
 */
 
index 2bc661ff27a4513b7d5b7c25591b02191d3c35aa..ae23013b7ccc67550a7b3e01c2710b4dae59cec8 100644 (file)
 
 /*!
 
-The compiler code necessary to implement the #[deriving(Encodable)]
-(and Decodable, in decodable.rs) extension.  The idea here is that
-type-defining items may be tagged with #[deriving(Encodable,
-Decodable)].
+The compiler code necessary to implement the `#[deriving(Encodable)]`
+(and `Decodable`, in decodable.rs) extension.  The idea here is that
+type-defining items may be tagged with `#[deriving(Encodable, Decodable)]`.
 
 For example, a type like:
 
 ```ignore
-    #[deriving(Encodable, Decodable)]
-    struct Node {id: uint}
+#[deriving(Encodable, Decodable)]
+struct Node { id: uint }
 ```
 
 would generate two implementations like:
 
+```ignore
 impl<S:serialize::Encoder> Encodable<S> for Node {
     fn encode(&self, s: &S) {
         s.emit_struct("Node", 1, || {
@@ -41,13 +41,14 @@ fn decode(d: &D) -> Node {
         })
     }
 }
+```
 
 Other interesting scenarios are whe the item has type parameters or
 references other non-built-in types.  A type definition like:
 
 ```ignore
-    #[deriving(Encodable, Decodable)]
-    struct spanned<T> {node: T, span: Span}
+#[deriving(Encodable, Decodable)]
+struct spanned<T> { node: T, span: Span }
 ```
 
 would yield functions like:
index ded80295320f02bd65298a32aaa23adf65ff6a8f..24d4efb1b0e68bcc57f7dd44c70107564ab6ea6b 100644 (file)
@@ -16,6 +16,7 @@
 variants, as well as creating the method and impl ast instances.
 
 Supported features (fairly exhaustive):
+
 - Methods taking any number of parameters of any type, and returning
   any type, other than vectors, bottom and closures.
 - Generating `impl`s for types with type parameters and lifetimes
@@ -59,7 +60,7 @@
 an identifier in the source code. For example, the `x`s in the
 following snippet
 
-~~~notrust
+```rust
 struct A { x : int }
 
 struct B(int);
@@ -68,7 +69,7 @@ enum C {
     C0(int),
     C1 { x: int }
 }
-~~~
+```
 
 The `int`s in `B` and `C0` don't have an identifier, so the
 `Option<ident>`s would be `None` for them.
@@ -83,7 +84,7 @@ enum C {
 
 The following simplified `Eq` is used for in-code examples:
 
-~~~notrust
+```rust
 trait Eq {
     fn eq(&self, other: &Self);
 }
@@ -92,7 +93,7 @@ fn eq(&self, other: &int) -> bool {
         *self == *other
     }
 }
-~~~
+```
 
 Some examples of the values of `SubstructureFields` follow, using the
 above `Eq`, `A`, `B` and `C`.
index 9c823449d2141590f5e89c917bbdd1efaa60b093..28f039f0818123b4bd7491a0da8b22fe67e88d0e 100644 (file)
@@ -9,10 +9,10 @@
 // except according to those terms.
 
 /*!
-The compiler code necessary to implement the #[deriving] extensions.
+The compiler code necessary to implement the `#[deriving]` extensions.
 
 
-FIXME (#2810)--Hygiene. Search for "__" strings (in other files too).
+FIXME (#2810): hygiene. Search for "__" strings (in other files too).
 We also assume "extra" is the standard library, and "std" is the core
 library.