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

+1-1
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

+8-8
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

+1-1
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

+4-4
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

+1-1
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

+1-1
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

+3-3
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

+2-2
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

+4-4
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

+1-1
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)

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
108108
let new = {
109109
let other_f = match other_fs {
110110
[ref o_f] => o_f,
111-
_ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`"),
111+
_ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`"),
112112
};
113113

114114
let args = vec![
@@ -132,7 +132,7 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
132132
cx.expr_path(equals_path.clone()),
133133
box |cx, span, (self_args, tag_tuple), _non_self_args| {
134134
if self_args.len() != 2 {
135-
cx.span_bug(span, "not exactly 2 arguments in `deriving(Ord)`")
135+
cx.span_bug(span, "not exactly 2 arguments in `derives(Ord)`")
136136
} else {
137137
ordering_collapsed(cx, span, tag_tuple)
138138
}

src/libsyntax/ext/deriving/decodable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ fn decodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
173173
cx.lambda_expr_1(trait_span, result, blkarg)
174174
))
175175
}
176-
_ => cx.bug("expected StaticEnum or StaticStruct in deriving(Decodable)")
176+
_ => cx.bug("expected StaticEnum or StaticStruct in derive(Decodable)")
177177
};
178178
}
179179

src/libsyntax/ext/deriving/default.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ fn default_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructur
8181
// let compilation continue
8282
cx.expr_uint(trait_span, 0)
8383
}
84-
_ => cx.span_bug(trait_span, "Non-static method in `deriving(Default)`")
84+
_ => cx.span_bug(trait_span, "Non-static method in `derive(Default)`")
8585
};
8686
}

src/libsyntax/ext/deriving/encodable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,6 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
276276
cx.expr_block(cx.block(trait_span, vec!(me), Some(ret)))
277277
}
278278

279-
_ => cx.bug("expected Struct or EnumMatching in deriving(Encodable)")
279+
_ => cx.bug("expected Struct or EnumMatching in derive(Encodable)")
280280
};
281281
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ impl<'a> TraitDef<'a> {
11911191
to_set.expn_id = cx.codemap().record_expansion(codemap::ExpnInfo {
11921192
call_site: to_set,
11931193
callee: codemap::NameAndSpan {
1194-
name: format!("deriving({})", trait_name),
1194+
name: format!("derive({})", trait_name),
11951195
format: codemap::MacroAttribute,
11961196
span: Some(self.span)
11971197
}

src/libsyntax/ext/deriving/generic/ty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ impl<'a> Ty<'a> {
182182
Literal(ref p) => {
183183
p.to_path(cx, span, self_ty, self_generics)
184184
}
185-
Ptr(..) => { cx.span_bug(span, "pointer in a path in generic `deriving`") }
186-
Tuple(..) => { cx.span_bug(span, "tuple in a path in generic `deriving`") }
185+
Ptr(..) => { cx.span_bug(span, "pointer in a path in generic `derive`") }
186+
Tuple(..) => { cx.span_bug(span, "tuple in a path in generic `derive`") }
187187
}
188188
}
189189
}

src/libsyntax/ext/deriving/primitive.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub fn expand_deriving_from_primitive<F>(cx: &mut ExtCtxt,
7474
fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P<Expr> {
7575
let n = match substr.nonself_args {
7676
[ref n] => n,
77-
_ => cx.span_bug(trait_span, "incorrect number of arguments in `deriving(FromPrimitive)`")
77+
_ => cx.span_bug(trait_span, "incorrect number of arguments in `derive(FromPrimitive)`")
7878
};
7979

8080
match *substr.fields {
@@ -144,6 +144,6 @@ fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure
144144

145145
cx.expr_match(trait_span, n.clone(), arms)
146146
}
147-
_ => cx.span_bug(trait_span, "expected StaticEnum in deriving(FromPrimitive)")
147+
_ => cx.span_bug(trait_span, "expected StaticEnum in derive(FromPrimitive)")
148148
}
149149
}

src/libsyntax/ext/deriving/rand.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub fn expand_deriving_rand<F>(cx: &mut ExtCtxt,
5757
fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P<Expr> {
5858
let rng = match substr.nonself_args {
5959
[ref rng] => rng,
60-
_ => cx.bug("Incorrect number of arguments to `rand` in `deriving(Rand)`")
60+
_ => cx.bug("Incorrect number of arguments to `rand` in `derive(Rand)`")
6161
};
6262
let rand_ident = vec!(
6363
cx.ident_of("std"),
@@ -131,7 +131,7 @@ fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure)
131131
let block = cx.block(trait_span, vec!( let_statement ), Some(match_expr));
132132
cx.expr_block(block)
133133
}
134-
_ => cx.bug("Non-static method in `deriving(Rand)`")
134+
_ => cx.bug("Non-static method in `derive(Rand)`")
135135
};
136136

137137
fn rand_thing<F>(cx: &mut ExtCtxt,

0 commit comments

Comments
 (0)