Skip to content

Commit 6ab95bd

Browse files
committed
s/deriving/derives in Comments/Docs
There are a large number of places that incorrectly refer to deriving in comments, instead of derives. Fixes #20984
1 parent 89c4e37 commit 6ab95bd

File tree

18 files changed

+38
-38
lines changed

18 files changed

+38
-38
lines changed

src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2430,7 +2430,7 @@ There are three different types of inline attributes:
24302430
* `#[inline(always)]` asks the compiler to always perform an inline expansion.
24312431
* `#[inline(never)]` asks the compiler to never perform an inline expansion.
24322432

2433-
### Derive
2433+
### `derive`
24342434

24352435
The `derive` attribute allows certain traits to be automatically implemented
24362436
for data structures. For example, the following will create an `impl` for the

src/etc/generate-deriving-span-tests.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
"""
1414
This script creates a pile of compile-fail tests check that all the
15-
derivings have spans that point to the fields, rather than the
16-
#[deriving(...)] line.
15+
derives have spans that point to the fields, rather than the
16+
#[derive(...)] line.
1717
1818
sample usage: src/etc/generate-deriving-span-tests.py
1919
"""
@@ -46,29 +46,29 @@
4646
"""
4747

4848
ENUM_STRING = """
49-
#[deriving({traits})]
49+
#[derive({traits})]
5050
enum Enum {{
5151
A(
5252
Error {errors}
5353
)
5454
}}
5555
"""
5656
ENUM_STRUCT_VARIANT_STRING = """
57-
#[deriving({traits})]
57+
#[derive({traits})]
5858
enum Enum {{
5959
A {{
6060
x: Error {errors}
6161
}}
6262
}}
6363
"""
6464
STRUCT_STRING = """
65-
#[deriving({traits})]
65+
#[derive({traits})]
6666
struct Struct {{
6767
x: Error {errors}
6868
}}
6969
"""
7070
STRUCT_TUPLE_STRING = """
71-
#[deriving({traits})]
71+
#[derive({traits})]
7272
struct Struct(
7373
Error {errors}
7474
);
@@ -80,14 +80,14 @@ def create_test_case(type, trait, super_traits, number_of_errors):
8080
string = [ENUM_STRING, ENUM_STRUCT_VARIANT_STRING, STRUCT_STRING, STRUCT_TUPLE_STRING][type]
8181
all_traits = ','.join([trait] + super_traits)
8282
super_traits = ','.join(super_traits)
83-
error_deriving = '#[deriving(%s)]' % super_traits if super_traits else ''
83+
error_deriving = '#[derive(%s)]' % super_traits if super_traits else ''
8484

8585
errors = '\n'.join('//~%s ERROR' % ('^' * n) for n in range(error_count))
8686
code = string.format(traits = all_traits, errors = errors)
8787
return TEMPLATE.format(year = YEAR, error_deriving=error_deriving, code = code)
8888

8989
def write_file(name, string):
90-
test_file = os.path.join(TEST_DIR, 'deriving-span-%s.rs' % name)
90+
test_file = os.path.join(TEST_DIR, 'derives-span-%s.rs' % name)
9191

9292
# set write permission if file exists, so it can be changed
9393
if os.path.exists(test_file):

src/etc/unicode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
392392
use core::slice;
393393
394394
#[allow(non_camel_case_types)]
395-
#[deriving(Clone)]
395+
#[derive(Clone)]
396396
pub enum GraphemeCat {
397397
""")
398398
for cat in grapheme_cats + ["Any"]:

src/libcollections/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ pub fn fixme_14344_be_sure_to_link_to_collections() {}
102102
mod std {
103103
pub use core::fmt; // necessary for panic!()
104104
pub use core::option; // necessary for panic!()
105-
pub use core::clone; // deriving(Clone)
106-
pub use core::cmp; // deriving(Eq, Ord, etc.)
107-
pub use core::marker; // deriving(Copy)
108-
pub use core::hash; // deriving(Hash)
105+
pub use core::clone; // derive(Clone)
106+
pub use core::cmp; // derive(Eq, Ord, etc.)
107+
pub use core::marker; // derive(Copy)
108+
pub use core::hash; // derive(Hash)
109109
}
110110

111111
#[cfg(test)]

src/librustc_back/svh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ mod svh_visitor {
156156
StrictVersionHashVisitor { st: st }
157157
}
158158

159-
// To off-load the bulk of the hash-computation on deriving(Hash),
159+
// To off-load the bulk of the hash-computation on #[derive(Hash)],
160160
// we define a set of enums corresponding to the content that our
161161
// crate visitor will encounter as it traverses the ast.
162162
//

src/libstd/fmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
//! - `fmt::Show` implementations should be implemented for **all** public types.
226226
//! Output will typically represent the internal state as faithfully as possible.
227227
//! The purpose of the `Show` trait is to facilitate debugging Rust code. In
228-
//! most cases, using `#[deriving(Show)]` is sufficient and recommended.
228+
//! most cases, using `#[derive(Show)]` is sufficient and recommended.
229229
//!
230230
//! Some examples of the output from both traits:
231231
//!

src/libsyntax/ext/deriving/clone.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ fn cs_clone(
8080
EnumNonMatchingCollapsed (..) => {
8181
cx.span_bug(trait_span,
8282
&format!("non-matching enum variants in \
83-
`deriving({})`", name)[])
83+
`derive({})`", name)[])
8484
}
8585
StaticEnum(..) | StaticStruct(..) => {
8686
cx.span_bug(trait_span,
87-
&format!("static method in `deriving({})`", name)[])
87+
&format!("static method in `derive({})`", name)[])
8888
}
8989
}
9090

@@ -101,7 +101,7 @@ fn cs_clone(
101101
None => {
102102
cx.span_bug(trait_span,
103103
&format!("unnamed field in normal struct in \
104-
`deriving({})`", name)[])
104+
`derive({})`", name)[])
105105
}
106106
};
107107
cx.field_imm(field.span, ident, subcall(field))

src/libsyntax/ext/deriving/cmp/eq.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub fn expand_deriving_eq<F>(cx: &mut ExtCtxt,
3232
|cx, span, subexpr, self_f, other_fs| {
3333
let other_f = match other_fs {
3434
[ref o_f] => o_f,
35-
_ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialEq)`")
35+
_ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialEq)`")
3636
};
3737

3838
let eq = cx.expr_binary(span, ast::BiEq, self_f, other_f.clone());
@@ -49,7 +49,7 @@ pub fn expand_deriving_eq<F>(cx: &mut ExtCtxt,
4949
|cx, span, subexpr, self_f, other_fs| {
5050
let other_f = match other_fs {
5151
[ref o_f] => o_f,
52-
_ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialEq)`")
52+
_ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialEq)`")
5353
};
5454

5555
let eq = cx.expr_binary(span, ast::BiNe, self_f, other_f.clone());

src/libsyntax/ext/deriving/cmp/ord.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
152152
let new = {
153153
let other_f = match other_fs {
154154
[ref o_f] => o_f,
155-
_ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`"),
155+
_ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`"),
156156
};
157157

158158
let args = vec![
@@ -176,7 +176,7 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
176176
equals_expr.clone(),
177177
box |cx, span, (self_args, tag_tuple), _non_self_args| {
178178
if self_args.len() != 2 {
179-
cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`")
179+
cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`")
180180
} else {
181181
some_ordering_collapsed(cx, span, PartialCmpOp, tag_tuple)
182182
}
@@ -210,7 +210,7 @@ fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt,
210210
*/
211211
let other_f = match other_fs {
212212
[ref o_f] => o_f,
213-
_ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`")
213+
_ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`")
214214
};
215215

216216
let cmp = cx.expr_binary(span, op, self_f.clone(), other_f.clone());
@@ -224,7 +224,7 @@ fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt,
224224
cx.expr_bool(span, equal),
225225
box |cx, span, (self_args, tag_tuple), _non_self_args| {
226226
if self_args.len() != 2 {
227-
cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`")
227+
cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`")
228228
} else {
229229
let op = match (less, equal) {
230230
(true, true) => LeOp, (true, false) => LtOp,

src/libsyntax/ext/deriving/cmp/totaleq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub fn expand_deriving_totaleq<F>(cx: &mut ExtCtxt,
3232
let block = cx.block(span, stmts, None);
3333
cx.expr_block(block)
3434
},
35-
box |cx, sp, _, _| cx.span_bug(sp, "non matching enums in deriving(Eq)?"),
35+
box |cx, sp, _, _| cx.span_bug(sp, "non matching enums in derive(Eq)?"),
3636
cx,
3737
span,
3838
substr)

0 commit comments

Comments
 (0)