mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-15 16:33:49 +00:00
rollup merge of #20632: gchp/reference
I noticed that the `deriving` keyword is deprecated and that `derive` is the replacement. This updates the reference (and other docs) to remove the use `deriving`.
This commit is contained in:
commit
855c3e5af5
@ -2432,15 +2432,15 @@ There are three different types of inline attributes:
|
||||
* `#[inline(always)]` asks the compiler to always perform an inline expansion.
|
||||
* `#[inline(never)]` asks the compiler to never perform an inline expansion.
|
||||
|
||||
### Deriving
|
||||
### Derive
|
||||
|
||||
The `deriving` attribute allows certain traits to be automatically implemented
|
||||
The `derive` attribute allows certain traits to be automatically implemented
|
||||
for data structures. For example, the following will create an `impl` for the
|
||||
`PartialEq` and `Clone` traits for `Foo`, the type parameter `T` will be given
|
||||
the `PartialEq` or `Clone` constraints for the appropriate `impl`:
|
||||
|
||||
```
|
||||
#[deriving(PartialEq, Clone)]
|
||||
#[derive(PartialEq, Clone)]
|
||||
struct Foo<T> {
|
||||
a: int,
|
||||
b: T
|
||||
@ -2462,7 +2462,7 @@ impl<T: PartialEq> PartialEq for Foo<T> {
|
||||
}
|
||||
```
|
||||
|
||||
Supported traits for `deriving` are:
|
||||
Supported traits for `derive` are:
|
||||
|
||||
* Comparison traits: `PartialEq`, `Eq`, `PartialOrd`, `Ord`.
|
||||
* Serialization: `Encodable`, `Decodable`. These require `serialize`.
|
||||
|
@ -198,7 +198,7 @@ Rustdoc also supplies some extra sugar for helping with some tedious
|
||||
documentation examples. If a line is prefixed with `# `, then the line
|
||||
will not show up in the HTML documentation, but it will be used when
|
||||
testing the code block (NB. the space after the `#` is required, so
|
||||
that one can still write things like `#[deriving(Eq)]`).
|
||||
that one can still write things like `#[derive(Eq)]`).
|
||||
|
||||
~~~md
|
||||
```
|
||||
|
@ -126,7 +126,7 @@ The advantages over a simple `fn(&str) -> uint` are:
|
||||
a way to define new literal syntax for any data type.
|
||||
|
||||
In addition to procedural macros, you can define new
|
||||
[`deriving`](../reference.html#deriving)-like attributes and other kinds of
|
||||
[`derive`](../reference.html#derive)-like attributes and other kinds of
|
||||
extensions. See
|
||||
[`Registry::register_syntax_extension`](../rustc/plugin/registry/struct.Registry.html#method.register_syntax_extension)
|
||||
and the [`SyntaxExtension`
|
||||
|
Loading…
Reference in New Issue
Block a user