Skip to content

Commit 629746c

Browse files
committed
---
yaml --- r: 83951 b: refs/heads/dist-snap c: dc9b3ff h: refs/heads/master i: 83949: eff0919 83947: c43132c 83943: fd2475e 83935: f089898 v: v3
1 parent ebbb393 commit 629746c

File tree

17 files changed

+99
-88
lines changed

17 files changed

+99
-88
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 0983ebe5310d4eb6d289f636f7ed0536c08bbc0e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 376d5d6aae9a448a0f58a9a98e8dcec9eeeaece7
9+
refs/heads/dist-snap: dc9b3ff1b30c10aaf60d40fd9845d9bf69ae2c2e
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/etc/vim/syntax/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ syn region rustDeriving start="deriving(" end=")" contains=rustTrait
9595
" Number literals
9696
syn match rustNumber display "\<[0-9][0-9_]*\>"
9797
syn match rustNumber display "\<[0-9][0-9_]*\(u\|u8\|u16\|u32\|u64\)\>"
98-
syn match rustNumber display "\<[0-9][0-9_]*\(i\|i8\|i16\|i32\|i64\)\>"
98+
syn match rustNumber display "\<[0-9][0-9_]*\(i8\|i16\|i32\|i64\)\>"
9999

100100
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\>"
101101
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\(u\|u8\|u16\|u32\|u64\)\>"

branches/dist-snap/src/librustc/front/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use front::config;
1717
use std::vec;
1818
use syntax::ast_util::*;
1919
use syntax::attr;
20-
use syntax::codemap::{dummy_sp, span, ExpnInfo, NameAndSpan};
20+
use syntax::codemap::{dummy_sp, span, ExpandedFrom, CallInfo, NameAndSpan};
2121
use syntax::codemap;
2222
use syntax::ext::base::ExtCtxt;
2323
use syntax::fold;
@@ -72,13 +72,13 @@ fn generate_test_harness(sess: session::Session,
7272
};
7373

7474
let ext_cx = cx.ext_cx;
75-
ext_cx.bt_push(ExpnInfo {
75+
ext_cx.bt_push(ExpandedFrom(CallInfo {
7676
call_site: dummy_sp(),
7777
callee: NameAndSpan {
7878
name: @"test",
7979
span: None
8080
}
81-
});
81+
}));
8282

8383
let precursor = @fold::AstFoldFns {
8484
fold_crate: fold::wrap(|a,b| fold_crate(cx, a, b) ),

branches/dist-snap/src/librustc/middle/lint.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,10 @@ fn lint_unused_mut() -> visit::vt<@mut Context> {
966966
visit_fn_decl(cx, &tm.decl);
967967
visit::visit_ty_method(tm, (cx, vt));
968968
},
969+
visit_struct_method: |sm, (cx, vt)| {
970+
visit_fn_decl(cx, &sm.decl);
971+
visit::visit_struct_method(sm, (cx, vt));
972+
},
969973
visit_trait_method: |tm, (cx, vt)| {
970974
match *tm {
971975
ast::required(ref tm) => visit_fn_decl(cx, &tm.decl),
@@ -1045,6 +1049,14 @@ fn lint_missing_doc() -> visit::vt<@mut Context> {
10451049
}
10461050

10471051
visit::mk_vt(@visit::Visitor {
1052+
visit_struct_method: |m, (cx, vt)| {
1053+
if m.vis == ast::public {
1054+
check_attrs(cx, m.attrs, m.span,
1055+
"missing documentation for a method");
1056+
}
1057+
visit::visit_struct_method(m, (cx, vt));
1058+
},
1059+
10481060
visit_ty_method: |m, (cx, vt)| {
10491061
// All ty_method objects are linted about because they're part of a
10501062
// trait (no visibility)

branches/dist-snap/src/librustc/util/enum_set.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ impl<E:CLike> Iterator<E> for EnumSetIterator<E> {
125125
Some(elem)
126126
}
127127

128-
fn size_hint(&self) -> (Option<uint>, Option<uint>) {
129-
let exact = Some(self.bits.population_count());
130-
(exact, exact)
128+
fn size_hint(&self) -> (uint, Option<uint>) {
129+
let exact = self.bits.population_count();
130+
(exact, Some(exact))
131131
}
132132
}
133133

branches/dist-snap/src/libstd/iterator.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub trait Iterator<A> {
4343
/// Return a lower bound and upper bound on the remaining length of the iterator.
4444
///
4545
/// The common use case for the estimate is pre-allocating space to store the results.
46-
fn size_hint(&self) -> (Option<uint>, Option<uint>) { (None, None) }
46+
fn size_hint(&self) -> (uint, Option<uint>) { (0, None) }
4747
}
4848

4949
/// Iterator adaptors provided for every `Iterator` implementation. The adaptor objects are also
@@ -684,16 +684,11 @@ impl<A, T: Iterator<A>, U: Iterator<A>> Iterator<A> for ChainIterator<A, T, U> {
684684
}
685685

686686
#[inline]
687-
fn size_hint(&self) -> (Option<uint>, Option<uint>) {
687+
fn size_hint(&self) -> (uint, Option<uint>) {
688688
let (a_lower, a_upper) = self.a.size_hint();
689689
let (b_lower, b_upper) = self.b.size_hint();
690690

691-
let lower = match (a_lower, b_lower) {
692-
(Some(x), Some(y)) => Some(x + y),
693-
(Some(x), None) => Some(x),
694-
(None, Some(y)) => Some(y),
695-
(None, None) => None
696-
};
691+
let lower = a_lower + b_lower;
697692

698693
let upper = match (a_upper, b_upper) {
699694
(Some(x), Some(y)) => Some(x + y),
@@ -737,7 +732,7 @@ impl<'self, A, B, T: Iterator<A>> Iterator<B> for MapIterator<'self, A, B, T> {
737732
}
738733

739734
#[inline]
740-
fn size_hint(&self) -> (Option<uint>, Option<uint>) {
735+
fn size_hint(&self) -> (uint, Option<uint>) {
741736
self.iter.size_hint()
742737
}
743738
}
@@ -762,9 +757,9 @@ impl<'self, A, T: Iterator<A>> Iterator<A> for FilterIterator<'self, A, T> {
762757
}
763758

764759
#[inline]
765-
fn size_hint(&self) -> (Option<uint>, Option<uint>) {
760+
fn size_hint(&self) -> (uint, Option<uint>) {
766761
let (_, upper) = self.iter.size_hint();
767-
(None, upper) // can't know a lower bound, due to the predicate
762+
(0, upper) // can't know a lower bound, due to the predicate
768763
}
769764
}
770765

@@ -787,9 +782,9 @@ impl<'self, A, B, T: Iterator<A>> Iterator<B> for FilterMapIterator<'self, A, B,
787782
}
788783

789784
#[inline]
790-
fn size_hint(&self) -> (Option<uint>, Option<uint>) {
785+
fn size_hint(&self) -> (uint, Option<uint>) {
791786
let (_, upper) = self.iter.size_hint();
792-
(None, upper) // can't know a lower bound, due to the predicate
787+
(0, upper) // can't know a lower bound, due to the predicate
793788
}
794789
}
795790

branches/dist-snap/src/libstd/vec.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,14 +2024,14 @@ macro_rules! iterator {
20242024
}
20252025

20262026
#[inline]
2027-
fn size_hint(&self) -> (Option<uint>, Option<uint>) {
2027+
fn size_hint(&self) -> (uint, Option<uint>) {
20282028
let diff = if $step > 0 {
20292029
(self.end as uint) - (self.ptr as uint)
20302030
} else {
20312031
(self.ptr as uint) - (self.end as uint)
20322032
};
2033-
let exact = Some(diff / size_of::<$elem>());
2034-
(exact, exact)
2033+
let exact = diff / size_of::<$elem>();
2034+
(exact, Some(exact))
20352035
}
20362036
}
20372037
}
@@ -2132,7 +2132,7 @@ impl<A, T: Iterator<A>> FromIterator<A, T> for ~[A] {
21322132
impl<A, T: Iterator<A>> FromIterator<A, T> for ~[A] {
21332133
pub fn from_iterator(iterator: &mut T) -> ~[A] {
21342134
let (lower, _) = iterator.size_hint();
2135-
let mut xs = with_capacity(lower.get_or_zero());
2135+
let mut xs = with_capacity(lower);
21362136
for iterator.advance |x| {
21372137
xs.push(x);
21382138
}
@@ -2968,28 +2968,28 @@ mod tests {
29682968
use iterator::*;
29692969
let xs = [1, 2, 5, 10, 11];
29702970
let mut it = xs.iter();
2971-
assert_eq!(it.size_hint(), (Some(5), Some(5)));
2971+
assert_eq!(it.size_hint(), (5, Some(5)));
29722972
assert_eq!(it.next().unwrap(), &1);
2973-
assert_eq!(it.size_hint(), (Some(4), Some(4)));
2973+
assert_eq!(it.size_hint(), (4, Some(4)));
29742974
assert_eq!(it.next().unwrap(), &2);
2975-
assert_eq!(it.size_hint(), (Some(3), Some(3)));
2975+
assert_eq!(it.size_hint(), (3, Some(3)));
29762976
assert_eq!(it.next().unwrap(), &5);
2977-
assert_eq!(it.size_hint(), (Some(2), Some(2)));
2977+
assert_eq!(it.size_hint(), (2, Some(2)));
29782978
assert_eq!(it.next().unwrap(), &10);
2979-
assert_eq!(it.size_hint(), (Some(1), Some(1)));
2979+
assert_eq!(it.size_hint(), (1, Some(1)));
29802980
assert_eq!(it.next().unwrap(), &11);
2981-
assert_eq!(it.size_hint(), (Some(0), Some(0)));
2981+
assert_eq!(it.size_hint(), (0, Some(0)));
29822982
assert!(it.next().is_none());
29832983
}
29842984

29852985
#[test]
29862986
fn test_iter_size_hints() {
29872987
use iterator::*;
29882988
let mut xs = [1, 2, 5, 10, 11];
2989-
assert_eq!(xs.iter().size_hint(), (Some(5), Some(5)));
2990-
assert_eq!(xs.rev_iter().size_hint(), (Some(5), Some(5)));
2991-
assert_eq!(xs.mut_iter().size_hint(), (Some(5), Some(5)));
2992-
assert_eq!(xs.mut_rev_iter().size_hint(), (Some(5), Some(5)));
2989+
assert_eq!(xs.iter().size_hint(), (5, Some(5)));
2990+
assert_eq!(xs.rev_iter().size_hint(), (5, Some(5)));
2991+
assert_eq!(xs.mut_iter().size_hint(), (5, Some(5)));
2992+
assert_eq!(xs.mut_rev_iter().size_hint(), (5, Some(5)));
29932993
}
29942994

29952995
#[test]

branches/dist-snap/src/libsyntax/codemap.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,18 @@ pub struct FileMapAndBytePos {fm: @FileMap, pos: BytePos}
174174
#[deriving(IterBytes)]
175175
pub struct NameAndSpan {name: @str, span: Option<span>}
176176

177-
/// Extra information for tracking macro expansion of spans
178177
#[deriving(IterBytes)]
179-
pub struct ExpnInfo {
178+
pub struct CallInfo {
180179
call_site: span,
181180
callee: NameAndSpan
182181
}
183182

183+
/// Extra information for tracking macro expansion of spans
184+
#[deriving(IterBytes)]
185+
pub enum ExpnInfo {
186+
ExpandedFrom(CallInfo)
187+
}
188+
184189
pub type FileName = @str;
185190

186191
pub struct FileLines

branches/dist-snap/src/libsyntax/ext/base.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
use ast;
1212
use ast::Name;
1313
use codemap;
14-
use codemap::{CodeMap, span, ExpnInfo};
14+
use codemap::{CodeMap, span, ExpnInfo, ExpandedFrom};
15+
use codemap::CallInfo;
1516
use diagnostic::span_handler;
1617
use ext;
1718
use parse;
@@ -242,7 +243,7 @@ impl ExtCtxt {
242243
pub fn cfg(&self) -> ast::crate_cfg { copy self.cfg }
243244
pub fn call_site(&self) -> span {
244245
match *self.backtrace {
245-
Some(@ExpnInfo {call_site: cs, _}) => cs,
246+
Some(@ExpandedFrom(CallInfo {call_site: cs, _})) => cs,
246247
None => self.bug("missing top span")
247248
}
248249
}
@@ -253,19 +254,21 @@ impl ExtCtxt {
253254
pub fn mod_path(&self) -> ~[ast::ident] { copy *self.mod_path }
254255
pub fn bt_push(&self, ei: codemap::ExpnInfo) {
255256
match ei {
256-
ExpnInfo {call_site: cs, callee: ref callee} => {
257+
ExpandedFrom(CallInfo {call_site: cs, callee: ref callee}) => {
257258
*self.backtrace =
258-
Some(@ExpnInfo {
259+
Some(@ExpandedFrom(CallInfo {
259260
call_site: span {lo: cs.lo, hi: cs.hi,
260261
expn_info: *self.backtrace},
261-
callee: copy *callee});
262+
callee: copy *callee}));
262263
}
263264
}
264265
}
265266
pub fn bt_pop(&self) {
266267
match *self.backtrace {
267-
Some(@ExpnInfo {
268-
call_site: span {expn_info: prev, _}, _}) => {
268+
Some(@ExpandedFrom(
269+
CallInfo {
270+
call_site: span {expn_info: prev, _}, _
271+
})) => {
269272
*self.backtrace = prev
270273
}
271274
_ => self.bug("tried to pop without a push")

branches/dist-snap/src/libsyntax/ext/expand.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use ast;
1616
use ast_util::{new_rename, new_mark, resolve};
1717
use attr;
1818
use codemap;
19-
use codemap::{span, ExpnInfo, NameAndSpan, spanned};
19+
use codemap::{span, CallInfo, ExpandedFrom, NameAndSpan, spanned};
2020
use ext::base::*;
2121
use fold::*;
2222
use parse;
@@ -60,13 +60,13 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
6060
expander: exp,
6161
span: exp_sp
6262
}))) => {
63-
cx.bt_push(ExpnInfo {
63+
cx.bt_push(ExpandedFrom(CallInfo {
6464
call_site: s,
6565
callee: NameAndSpan {
6666
name: extnamestr,
6767
span: exp_sp,
6868
},
69-
});
69+
}));
7070

7171
let expanded = match exp(cx, mac.span, *tts) {
7272
MRExpr(e) => e,
@@ -131,13 +131,13 @@ pub fn expand_mod_items(extsbox: @mut SyntaxEnv,
131131

132132
match (*extsbox).find(&intern(mname)) {
133133
Some(@SE(ItemDecorator(dec_fn))) => {
134-
cx.bt_push(ExpnInfo {
134+
cx.bt_push(ExpandedFrom(CallInfo {
135135
call_site: attr.span,
136136
callee: NameAndSpan {
137137
name: mname,
138138
span: None
139139
}
140-
});
140+
}));
141141
let r = dec_fn(cx, attr.span, attr.node.value, items);
142142
cx.bt_pop();
143143
r
@@ -227,13 +227,13 @@ pub fn expand_item_mac(extsbox: @mut SyntaxEnv,
227227
given '%s'", extnamestr,
228228
ident_to_str(&it.ident)));
229229
}
230-
cx.bt_push(ExpnInfo {
230+
cx.bt_push(ExpandedFrom(CallInfo {
231231
call_site: it.span,
232232
callee: NameAndSpan {
233233
name: extnamestr,
234234
span: expand.span
235235
}
236-
});
236+
}));
237237
((*expand).expander)(cx, it.span, tts)
238238
}
239239
Some(@SE(IdentTT(ref expand))) => {
@@ -242,13 +242,13 @@ pub fn expand_item_mac(extsbox: @mut SyntaxEnv,
242242
fmt!("macro %s! expects an ident argument",
243243
extnamestr));
244244
}
245-
cx.bt_push(ExpnInfo {
245+
cx.bt_push(ExpandedFrom(CallInfo {
246246
call_site: it.span,
247247
callee: NameAndSpan {
248248
name: extnamestr,
249249
span: expand.span
250250
}
251-
});
251+
}));
252252
((*expand).expander)(cx, it.span, it.ident, tts)
253253
}
254254
_ => cx.span_fatal(
@@ -319,10 +319,10 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv,
319319

320320
Some(@SE(NormalTT(
321321
SyntaxExpanderTT{expander: exp, span: exp_sp}))) => {
322-
cx.bt_push(ExpnInfo {
322+
cx.bt_push(ExpandedFrom(CallInfo {
323323
call_site: sp,
324324
callee: NameAndSpan { name: extnamestr, span: exp_sp }
325-
});
325+
}));
326326
let expanded = match exp(cx, mac.span, tts) {
327327
MRExpr(e) =>
328328
@codemap::spanned { node: stmt_expr(e, cx.next_id()),

branches/dist-snap/src/libsyntax/ext/source_util.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
use ast;
1212
use codemap;
13-
use codemap::{Pos, span};
14-
use codemap::{ExpnInfo, NameAndSpan};
13+
use codemap::{Pos, ExpandedFrom, span};
14+
use codemap::{CallInfo, NameAndSpan};
1515
use ext::base::*;
1616
use ext::base;
1717
use ext::build::AstBuilder;
@@ -117,14 +117,14 @@ pub fn expand_include_bin(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
117117
// recur along an ExpnInfo chain to find the original expression
118118
fn topmost_expn_info(expn_info: @codemap::ExpnInfo) -> @codemap::ExpnInfo {
119119
match *expn_info {
120-
ExpnInfo { call_site: ref call_site, _ } => {
120+
ExpandedFrom(CallInfo { call_site: ref call_site, _ }) => {
121121
match call_site.expn_info {
122122
Some(next_expn_info) => {
123123
match *next_expn_info {
124-
ExpnInfo {
124+
ExpandedFrom(CallInfo {
125125
callee: NameAndSpan { name: ref name, _ },
126126
_
127-
} => {
127+
}) => {
128128
// Don't recurse into file using "include!"
129129
if "include" == *name {
130130
expn_info

0 commit comments

Comments
 (0)