From 6ab95bdd62095429139f1b24717cbf0e5aa4a235 Mon Sep 17 00:00:00 2001 From: Earl St Sauver Date: Mon, 12 Jan 2015 02:02:38 -0800 Subject: 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 --- src/libsyntax/ext/deriving/clone.rs | 6 +++--- src/libsyntax/ext/deriving/cmp/eq.rs | 4 ++-- src/libsyntax/ext/deriving/cmp/ord.rs | 8 ++++---- src/libsyntax/ext/deriving/cmp/totaleq.rs | 2 +- src/libsyntax/ext/deriving/cmp/totalord.rs | 4 ++-- src/libsyntax/ext/deriving/decodable.rs | 2 +- src/libsyntax/ext/deriving/default.rs | 2 +- src/libsyntax/ext/deriving/encodable.rs | 2 +- src/libsyntax/ext/deriving/generic/mod.rs | 2 +- src/libsyntax/ext/deriving/generic/ty.rs | 4 ++-- src/libsyntax/ext/deriving/primitive.rs | 4 ++-- src/libsyntax/ext/deriving/rand.rs | 4 ++-- 12 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ext/deriving/clone.rs b/src/libsyntax/ext/deriving/clone.rs index 784a92b9a0e..6498e8d2d58 100644 --- a/src/libsyntax/ext/deriving/clone.rs +++ b/src/libsyntax/ext/deriving/clone.rs @@ -80,11 +80,11 @@ fn cs_clone( EnumNonMatchingCollapsed (..) => { cx.span_bug(trait_span, &format!("non-matching enum variants in \ - `deriving({})`", name)[]) + `derive({})`", name)[]) } StaticEnum(..) | StaticStruct(..) => { cx.span_bug(trait_span, - &format!("static method in `deriving({})`", name)[]) + &format!("static method in `derive({})`", name)[]) } } @@ -101,7 +101,7 @@ fn cs_clone( None => { cx.span_bug(trait_span, &format!("unnamed field in normal struct in \ - `deriving({})`", name)[]) + `derive({})`", name)[]) } }; cx.field_imm(field.span, ident, subcall(field)) diff --git a/src/libsyntax/ext/deriving/cmp/eq.rs b/src/libsyntax/ext/deriving/cmp/eq.rs index 7cb7ee3d355..c550c26c745 100644 --- a/src/libsyntax/ext/deriving/cmp/eq.rs +++ b/src/libsyntax/ext/deriving/cmp/eq.rs @@ -32,7 +32,7 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt, |cx, span, subexpr, self_f, other_fs| { let other_f = match other_fs { [ref o_f] => o_f, - _ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialEq)`") + _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialEq)`") }; let eq = cx.expr_binary(span, ast::BiEq, self_f, other_f.clone()); @@ -49,7 +49,7 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt, |cx, span, subexpr, self_f, other_fs| { let other_f = match other_fs { [ref o_f] => o_f, - _ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialEq)`") + _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialEq)`") }; let eq = cx.expr_binary(span, ast::BiNe, self_f, other_f.clone()); diff --git a/src/libsyntax/ext/deriving/cmp/ord.rs b/src/libsyntax/ext/deriving/cmp/ord.rs index c126238be82..9f1850145b6 100644 --- a/src/libsyntax/ext/deriving/cmp/ord.rs +++ b/src/libsyntax/ext/deriving/cmp/ord.rs @@ -152,7 +152,7 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span, let new = { let other_f = match other_fs { [ref o_f] => o_f, - _ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`"), + _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`"), }; let args = vec![ @@ -176,7 +176,7 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span, equals_expr.clone(), box |cx, span, (self_args, tag_tuple), _non_self_args| { if self_args.len() != 2 { - cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`") + cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`") } else { some_ordering_collapsed(cx, span, PartialCmpOp, tag_tuple) } @@ -210,7 +210,7 @@ fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt, */ let other_f = match other_fs { [ref o_f] => o_f, - _ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`") + _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`") }; 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, cx.expr_bool(span, equal), box |cx, span, (self_args, tag_tuple), _non_self_args| { if self_args.len() != 2 { - cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`") + cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`") } else { let op = match (less, equal) { (true, true) => LeOp, (true, false) => LtOp, diff --git a/src/libsyntax/ext/deriving/cmp/totaleq.rs b/src/libsyntax/ext/deriving/cmp/totaleq.rs index cdb36ede65d..9a2af6a3e0b 100644 --- a/src/libsyntax/ext/deriving/cmp/totaleq.rs +++ b/src/libsyntax/ext/deriving/cmp/totaleq.rs @@ -32,7 +32,7 @@ pub fn expand_deriving_totaleq(cx: &mut ExtCtxt, let block = cx.block(span, stmts, None); cx.expr_block(block) }, - box |cx, sp, _, _| cx.span_bug(sp, "non matching enums in deriving(Eq)?"), + box |cx, sp, _, _| cx.span_bug(sp, "non matching enums in derive(Eq)?"), cx, span, substr) diff --git a/src/libsyntax/ext/deriving/cmp/totalord.rs b/src/libsyntax/ext/deriving/cmp/totalord.rs index 10ecc86bda5..29d327142a6 100644 --- a/src/libsyntax/ext/deriving/cmp/totalord.rs +++ b/src/libsyntax/ext/deriving/cmp/totalord.rs @@ -108,7 +108,7 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span, let new = { let other_f = match other_fs { [ref o_f] => o_f, - _ => cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`"), + _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`"), }; let args = vec![ @@ -132,7 +132,7 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span, cx.expr_path(equals_path.clone()), box |cx, span, (self_args, tag_tuple), _non_self_args| { if self_args.len() != 2 { - cx.span_bug(span, "not exactly 2 arguments in `deriving(Ord)`") + cx.span_bug(span, "not exactly 2 arguments in `derives(Ord)`") } else { ordering_collapsed(cx, span, tag_tuple) } diff --git a/src/libsyntax/ext/deriving/decodable.rs b/src/libsyntax/ext/deriving/decodable.rs index f73023ddd1e..8edbf018f22 100644 --- a/src/libsyntax/ext/deriving/decodable.rs +++ b/src/libsyntax/ext/deriving/decodable.rs @@ -173,7 +173,7 @@ fn decodable_substructure(cx: &mut ExtCtxt, trait_span: Span, cx.lambda_expr_1(trait_span, result, blkarg) )) } - _ => cx.bug("expected StaticEnum or StaticStruct in deriving(Decodable)") + _ => cx.bug("expected StaticEnum or StaticStruct in derive(Decodable)") }; } diff --git a/src/libsyntax/ext/deriving/default.rs b/src/libsyntax/ext/deriving/default.rs index 047c4fef3c4..36c3f2c0ccb 100644 --- a/src/libsyntax/ext/deriving/default.rs +++ b/src/libsyntax/ext/deriving/default.rs @@ -81,6 +81,6 @@ fn default_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructur // let compilation continue cx.expr_uint(trait_span, 0) } - _ => cx.span_bug(trait_span, "Non-static method in `deriving(Default)`") + _ => cx.span_bug(trait_span, "Non-static method in `derive(Default)`") }; } diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs index 616390467f0..801ae213a7b 100644 --- a/src/libsyntax/ext/deriving/encodable.rs +++ b/src/libsyntax/ext/deriving/encodable.rs @@ -276,6 +276,6 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span, cx.expr_block(cx.block(trait_span, vec!(me), Some(ret))) } - _ => cx.bug("expected Struct or EnumMatching in deriving(Encodable)") + _ => cx.bug("expected Struct or EnumMatching in derive(Encodable)") }; } diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index 161b27d7abb..293e4befd3b 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -1191,7 +1191,7 @@ impl<'a> TraitDef<'a> { to_set.expn_id = cx.codemap().record_expansion(codemap::ExpnInfo { call_site: to_set, callee: codemap::NameAndSpan { - name: format!("deriving({})", trait_name), + name: format!("derive({})", trait_name), format: codemap::MacroAttribute, span: Some(self.span) } diff --git a/src/libsyntax/ext/deriving/generic/ty.rs b/src/libsyntax/ext/deriving/generic/ty.rs index a236fa33eb1..5e6a9c91ce0 100644 --- a/src/libsyntax/ext/deriving/generic/ty.rs +++ b/src/libsyntax/ext/deriving/generic/ty.rs @@ -182,8 +182,8 @@ impl<'a> Ty<'a> { Literal(ref p) => { p.to_path(cx, span, self_ty, self_generics) } - Ptr(..) => { cx.span_bug(span, "pointer in a path in generic `deriving`") } - Tuple(..) => { cx.span_bug(span, "tuple in a path in generic `deriving`") } + Ptr(..) => { cx.span_bug(span, "pointer in a path in generic `derive`") } + Tuple(..) => { cx.span_bug(span, "tuple in a path in generic `derive`") } } } } diff --git a/src/libsyntax/ext/deriving/primitive.rs b/src/libsyntax/ext/deriving/primitive.rs index d36bb2cd1c2..c45fe1ceb20 100644 --- a/src/libsyntax/ext/deriving/primitive.rs +++ b/src/libsyntax/ext/deriving/primitive.rs @@ -74,7 +74,7 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt, fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P { let n = match substr.nonself_args { [ref n] => n, - _ => cx.span_bug(trait_span, "incorrect number of arguments in `deriving(FromPrimitive)`") + _ => cx.span_bug(trait_span, "incorrect number of arguments in `derive(FromPrimitive)`") }; match *substr.fields { @@ -144,6 +144,6 @@ fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure cx.expr_match(trait_span, n.clone(), arms) } - _ => cx.span_bug(trait_span, "expected StaticEnum in deriving(FromPrimitive)") + _ => cx.span_bug(trait_span, "expected StaticEnum in derive(FromPrimitive)") } } diff --git a/src/libsyntax/ext/deriving/rand.rs b/src/libsyntax/ext/deriving/rand.rs index 1359cada673..b5435896791 100644 --- a/src/libsyntax/ext/deriving/rand.rs +++ b/src/libsyntax/ext/deriving/rand.rs @@ -57,7 +57,7 @@ pub fn expand_deriving_rand(cx: &mut ExtCtxt, fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P { let rng = match substr.nonself_args { [ref rng] => rng, - _ => cx.bug("Incorrect number of arguments to `rand` in `deriving(Rand)`") + _ => cx.bug("Incorrect number of arguments to `rand` in `derive(Rand)`") }; let rand_ident = vec!( cx.ident_of("std"), @@ -131,7 +131,7 @@ fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) let block = cx.block(trait_span, vec!( let_statement ), Some(match_expr)); cx.expr_block(block) } - _ => cx.bug("Non-static method in `deriving(Rand)`") + _ => cx.bug("Non-static method in `derive(Rand)`") }; fn rand_thing(cx: &mut ExtCtxt, -- cgit 1.4.1-3-g733a5 From b6b8880f0ec3f057dc56320f6886be173a8f0d8e Mon Sep 17 00:00:00 2001 From: Ryan Levick Date: Sun, 18 Jan 2015 00:49:50 +0100 Subject: Improve the error message when source file cannot be read Contribution from @look! --- src/libsyntax/parse/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index f1f547ba0c7..10fb0a73cec 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -253,9 +253,10 @@ pub fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option) let bytes = match File::open(path).read_to_end() { Ok(bytes) => bytes, Err(e) => { - err(&format!("couldn't read {:?}: {:?}", + let error_msg = e.desc; + err(&format!("couldn't read {:?}: {}", path.display(), - e)[]); + error_msg)[]); unreachable!() } }; -- cgit 1.4.1-3-g733a5 From 631896dc1996d239a532b0ce02d5fe886660149e Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 20 Jan 2015 12:35:51 -0800 Subject: Test fixes and rebase conflicts --- src/doc/reference.md | 10 +++++----- src/libsyntax/parse/mod.rs | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/libsyntax') diff --git a/src/doc/reference.md b/src/doc/reference.md index a1954bfdbc8..d3af4ab1c74 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -485,7 +485,7 @@ Examples of integer literals of various forms: ``` 123is; // type isize 123us; // type usize -123_us // type usize +123_us; // type usize 0xff_u8; // type u8 0o70_i16; // type i16 0b1111_1111_1001_0000_i32; // type i32 @@ -1500,11 +1500,11 @@ Constants should in general be preferred over statics, unless large amounts of data are being stored, or single-address and mutability properties are required. ``` -use std::sync::atomic::{AtomicUint, Ordering, ATOMIC_USIZE_INIT};; +use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; // Note that ATOMIC_USIZE_INIT is a *const*, but it may be used to initialize a // static. This static can be modified, so it is not placed in read-only memory. -static COUNTER: AtomicUint = ATOMIC_USIZE_INIT; +static COUNTER: AtomicUsize = ATOMIC_USIZE_INIT; // This table is a candidate to be placed in read-only memory. static TABLE: &'static [usize] = &[1, 2, 3, /* ... */]; @@ -3437,8 +3437,8 @@ fn is_symmetric(list: &[u32]) -> bool { } fn main() { - let sym = &[0us, 1, 4, 2, 4, 1, 0]; - let not_sym = &[0us, 1, 7, 2, 4, 1, 0]; + let sym = &[0, 1, 4, 2, 4, 1, 0]; + let not_sym = &[0, 1, 7, 2, 4, 1, 0]; assert!(is_symmetric(sym)); assert!(!is_symmetric(not_sym)); } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 8a5a0b0fce7..dd376fe9e10 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -253,10 +253,8 @@ pub fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option) let bytes = match File::open(path).read_to_end() { Ok(bytes) => bytes, Err(e) => { - let error_msg = e.desc; err(&format!("couldn't read {:?}: {}", - path.display(), - error_msg)[]); + path.display(), e)[]); unreachable!() } }; -- cgit 1.4.1-3-g733a5