Skip to content

Commit 165f30f

Browse files
committed
---
yaml --- r: 173990 b: refs/heads/batch c: d52398e h: refs/heads/master v: v3
1 parent de530c7 commit 165f30f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+729
-426
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/issue-18208-method-dispatch-2: 9e1eae4fb9b6527315b4441cf8a0f5ca911d1671
3030
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
32-
refs/heads/batch: 89f1848b556971a4278f2b2385137ca6c9e07094
32+
refs/heads/batch: d52398ef8cd93c6089ceacb176ae0dbe213d301e
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 44a287e6eb22ec3c2a687fc156813577464017f7
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928

branches/batch/src/libcollections/slice.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,7 @@ mod tests {
16311631
#[test]
16321632
fn test_slice_from() {
16331633
let vec: &[int] = &[1, 2, 3, 4];
1634-
assert_eq!(&vec[0..], vec);
1634+
assert_eq!(&vec[], vec);
16351635
let b: &[int] = &[3, 4];
16361636
assert_eq!(&vec[2..], b);
16371637
let b: &[int] = &[];
@@ -1641,11 +1641,11 @@ mod tests {
16411641
#[test]
16421642
fn test_slice_to() {
16431643
let vec: &[int] = &[1, 2, 3, 4];
1644-
assert_eq!(&vec[0..4], vec);
1644+
assert_eq!(&vec[..4], vec);
16451645
let b: &[int] = &[1, 2];
1646-
assert_eq!(&vec[0..2], b);
1646+
assert_eq!(&vec[..2], b);
16471647
let b: &[int] = &[];
1648-
assert_eq!(&vec[0..0], b);
1648+
assert_eq!(&vec[..0], b);
16491649
}
16501650

16511651

@@ -2538,15 +2538,15 @@ mod tests {
25382538
let (left, right) = values.split_at_mut(2);
25392539
{
25402540
let left: &[_] = left;
2541-
assert!(left[0..left.len()] == [1, 2][]);
2541+
assert!(left[..left.len()] == [1, 2][]);
25422542
}
25432543
for p in left.iter_mut() {
25442544
*p += 1;
25452545
}
25462546

25472547
{
25482548
let right: &[_] = right;
2549-
assert!(right[0..right.len()] == [3, 4, 5][]);
2549+
assert!(right[..right.len()] == [3, 4, 5][]);
25502550
}
25512551
for p in right.iter_mut() {
25522552
*p += 2;

branches/batch/src/libcollections/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ pub trait StrExt: Index<FullRange, Output = str> {
807807
/// out of bounds.
808808
///
809809
/// See also `slice`, `slice_from` and `slice_chars`.
810-
#[unstable = "use slice notation [0..a] instead"]
810+
#[unstable = "use slice notation [..a] instead"]
811811
fn slice_to(&self, end: uint) -> &str {
812812
core_str::StrExt::slice_to(&self[], end)
813813
}

branches/batch/src/libcollections/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl String {
168168

169169
if i > 0 {
170170
unsafe {
171-
res.as_mut_vec().push_all(&v[0..i])
171+
res.as_mut_vec().push_all(&v[..i])
172172
};
173173
}
174174

branches/batch/src/libcore/fmt/float.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,5 +332,5 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(
332332
}
333333
}
334334

335-
f(unsafe { str::from_utf8_unchecked(&buf[0..end]) })
335+
f(unsafe { str::from_utf8_unchecked(&buf[..end]) })
336336
}

branches/batch/src/libcore/fmt/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ impl<'a> Formatter<'a> {
449449
for c in sign.into_iter() {
450450
let mut b = [0; 4];
451451
let n = c.encode_utf8(&mut b).unwrap_or(0);
452-
let b = unsafe { str::from_utf8_unchecked(&b[0..n]) };
452+
let b = unsafe { str::from_utf8_unchecked(&b[..n]) };
453453
try!(f.buf.write_str(b));
454454
}
455455
if prefixed { f.buf.write_str(prefix) }
@@ -692,7 +692,7 @@ impl String for char {
692692
fn fmt(&self, f: &mut Formatter) -> Result {
693693
let mut utf8 = [0u8; 4];
694694
let amt = self.encode_utf8(&mut utf8).unwrap_or(0);
695-
let s: &str = unsafe { mem::transmute(&utf8[0..amt]) };
695+
let s: &str = unsafe { mem::transmute(&utf8[..amt]) };
696696
String::fmt(s, f)
697697
}
698698
}

branches/batch/src/libcore/slice.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl<T> SliceExt for [T] {
159159

160160
#[inline]
161161
fn split_at(&self, mid: uint) -> (&[T], &[T]) {
162-
(&self[0..mid], &self[mid..])
162+
(&self[..mid], &self[mid..])
163163
}
164164

165165
#[inline]
@@ -240,7 +240,7 @@ impl<T> SliceExt for [T] {
240240

241241
#[inline]
242242
fn init(&self) -> &[T] {
243-
&self[0..(self.len() - 1)]
243+
&self[..(self.len() - 1)]
244244
}
245245

246246
#[inline]
@@ -443,7 +443,7 @@ impl<T> SliceExt for [T] {
443443
#[inline]
444444
fn starts_with(&self, needle: &[T]) -> bool where T: PartialEq {
445445
let n = needle.len();
446-
self.len() >= n && needle == &self[0..n]
446+
self.len() >= n && needle == &self[..n]
447447
}
448448

449449
#[inline]
@@ -972,7 +972,7 @@ impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool {
972972
match self.v.iter().position(|x| (self.pred)(x)) {
973973
None => self.finish(),
974974
Some(idx) => {
975-
let ret = Some(&self.v[0..idx]);
975+
let ret = Some(&self.v[..idx]);
976976
self.v = &self.v[(idx + 1)..];
977977
ret
978978
}
@@ -999,7 +999,7 @@ impl<'a, T, P> DoubleEndedIterator for Split<'a, T, P> where P: FnMut(&T) -> boo
999999
None => self.finish(),
10001000
Some(idx) => {
10011001
let ret = Some(&self.v[(idx + 1)..]);
1002-
self.v = &self.v[0..idx];
1002+
self.v = &self.v[..idx];
10031003
ret
10041004
}
10051005
}
@@ -1195,7 +1195,7 @@ impl<'a, T> Iterator for Windows<'a, T> {
11951195
if self.size > self.v.len() {
11961196
None
11971197
} else {
1198-
let ret = Some(&self.v[0..self.size]);
1198+
let ret = Some(&self.v[..self.size]);
11991199
self.v = &self.v[1..];
12001200
ret
12011201
}

branches/batch/src/libcore/str/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,10 +701,10 @@ impl TwoWaySearcher {
701701
//
702702
// What's going on is we have some critical factorization (u, v) of the
703703
// needle, and we want to determine whether u is a suffix of
704-
// &v[0..period]. If it is, we use "Algorithm CP1". Otherwise we use
704+
// &v[..period]. If it is, we use "Algorithm CP1". Otherwise we use
705705
// "Algorithm CP2", which is optimized for when the period of the needle
706706
// is large.
707-
if &needle[0..crit_pos] == &needle[period.. period + crit_pos] {
707+
if &needle[..crit_pos] == &needle[period.. period + crit_pos] {
708708
TwoWaySearcher {
709709
crit_pos: crit_pos,
710710
period: period,
@@ -1412,7 +1412,7 @@ impl StrExt for str {
14121412
#[inline]
14131413
fn starts_with(&self, needle: &str) -> bool {
14141414
let n = needle.len();
1415-
self.len() >= n && needle.as_bytes() == &self.as_bytes()[0..n]
1415+
self.len() >= n && needle.as_bytes() == &self.as_bytes()[..n]
14161416
}
14171417

14181418
#[inline]

branches/batch/src/libcoretest/char.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ fn test_encode_utf8() {
167167
fn check(input: char, expect: &[u8]) {
168168
let mut buf = [0u8; 4];
169169
let n = input.encode_utf8(buf.as_mut_slice()).unwrap_or(0);
170-
assert_eq!(&buf[0..n], expect);
170+
assert_eq!(&buf[..n], expect);
171171
}
172172

173173
check('x', &[0x78]);
@@ -181,7 +181,7 @@ fn test_encode_utf16() {
181181
fn check(input: char, expect: &[u16]) {
182182
let mut buf = [0u16; 2];
183183
let n = input.encode_utf16(buf.as_mut_slice()).unwrap_or(0);
184-
assert_eq!(&buf[0..n], expect);
184+
assert_eq!(&buf[..n], expect);
185185
}
186186

187187
check('x', &[0x0078]);

branches/batch/src/libcoretest/iter.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -288,39 +288,39 @@ fn test_iterator_len() {
288288
let v: &[_] = &[0i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
289289
assert_eq!(v[..4].iter().count(), 4);
290290
assert_eq!(v[..10].iter().count(), 10);
291-
assert_eq!(v[0..0].iter().count(), 0);
291+
assert_eq!(v[..0].iter().count(), 0);
292292
}
293293

294294
#[test]
295295
fn test_iterator_sum() {
296296
let v: &[_] = &[0i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
297297
assert_eq!(v[..4].iter().map(|&x| x).sum(), 6);
298298
assert_eq!(v.iter().map(|&x| x).sum(), 55);
299-
assert_eq!(v[0..0].iter().map(|&x| x).sum(), 0);
299+
assert_eq!(v[..0].iter().map(|&x| x).sum(), 0);
300300
}
301301

302302
#[test]
303303
fn test_iterator_product() {
304304
let v: &[_] = &[0i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
305-
assert_eq!(v[0..4].iter().map(|&x| x).product(), 0);
305+
assert_eq!(v[..4].iter().map(|&x| x).product(), 0);
306306
assert_eq!(v[1..5].iter().map(|&x| x).product(), 24);
307-
assert_eq!(v[0..0].iter().map(|&x| x).product(), 1);
307+
assert_eq!(v[..0].iter().map(|&x| x).product(), 1);
308308
}
309309

310310
#[test]
311311
fn test_iterator_max() {
312312
let v: &[_] = &[0i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
313-
assert_eq!(v[0..4].iter().map(|&x| x).max(), Some(3));
313+
assert_eq!(v[..4].iter().map(|&x| x).max(), Some(3));
314314
assert_eq!(v.iter().map(|&x| x).max(), Some(10));
315-
assert_eq!(v[0..0].iter().map(|&x| x).max(), None);
315+
assert_eq!(v[..0].iter().map(|&x| x).max(), None);
316316
}
317317

318318
#[test]
319319
fn test_iterator_min() {
320320
let v: &[_] = &[0i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
321-
assert_eq!(v[0..4].iter().map(|&x| x).min(), Some(0));
321+
assert_eq!(v[..4].iter().map(|&x| x).min(), Some(0));
322322
assert_eq!(v.iter().map(|&x| x).min(), Some(0));
323-
assert_eq!(v[0..0].iter().map(|&x| x).min(), None);
323+
assert_eq!(v[..0].iter().map(|&x| x).min(), None);
324324
}
325325

326326
#[test]
@@ -373,7 +373,7 @@ fn test_all() {
373373
assert!(v.iter().all(|&x| x < 10));
374374
assert!(!v.iter().all(|&x| x % 2 == 0));
375375
assert!(!v.iter().all(|&x| x > 100));
376-
assert!(v[0..0].iter().all(|_| panic!()));
376+
assert!(v[..0].iter().all(|_| panic!()));
377377
}
378378

379379
#[test]
@@ -382,7 +382,7 @@ fn test_any() {
382382
assert!(v.iter().any(|&x| x < 10));
383383
assert!(v.iter().any(|&x| x % 2 == 0));
384384
assert!(!v.iter().any(|&x| x > 100));
385-
assert!(!v[0..0].iter().any(|_| panic!()));
385+
assert!(!v[..0].iter().any(|_| panic!()));
386386
}
387387

388388
#[test]

branches/batch/src/libfmt_macros/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl<'a> Parser<'a> {
286286
flags: 0,
287287
precision: CountImplied,
288288
width: CountImplied,
289-
ty: &self.input[0..0],
289+
ty: &self.input[..0],
290290
};
291291
if !self.consume(':') { return spec }
292292

@@ -395,7 +395,7 @@ impl<'a> Parser<'a> {
395395
self.cur.next();
396396
pos
397397
}
398-
Some(..) | None => { return &self.input[0..0]; }
398+
Some(..) | None => { return &self.input[..0]; }
399399
};
400400
let mut end;
401401
loop {

branches/batch/src/librand/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,7 @@ pub trait Rng : Sized {
270270
/// let choices = [1i, 2, 4, 8, 16, 32];
271271
/// let mut rng = thread_rng();
272272
/// println!("{:?}", rng.choose(&choices));
273-
/// # // uncomment when slicing syntax is stable
274-
/// //assert_eq!(rng.choose(&choices[0..0]), None);
273+
/// assert_eq!(rng.choose(&choices[..0]), None);
275274
/// ```
276275
fn choose<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T> {
277276
if values.is_empty() {

branches/batch/src/librbml/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl Writer for SeekableMemWriter {
9595
// there (left), and what will be appended on the end (right)
9696
let cap = self.buf.len() - self.pos;
9797
let (left, right) = if cap <= buf.len() {
98-
(&buf[0..cap], &buf[cap..])
98+
(&buf[..cap], &buf[cap..])
9999
} else {
100100
let result: (_, &[_]) = (buf, &[]);
101101
result

branches/batch/src/librustc/lint/builtin.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,9 +774,8 @@ impl LintPass for UnusedResults {
774774
warned |= check_must_use(cx, &it.attrs[], s.span);
775775
}
776776
} else {
777-
csearch::get_item_attrs(&cx.sess().cstore, did, |attrs| {
778-
warned |= check_must_use(cx, &attrs[], s.span);
779-
});
777+
let attrs = csearch::get_item_attrs(&cx.sess().cstore, did);
778+
warned |= check_must_use(cx, &attrs[], s.span);
780779
}
781780
}
782781
_ => {}

branches/batch/src/librustc/metadata/csearch.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,11 @@ pub fn get_methods_if_impl(cstore: &cstore::CStore,
203203
decoder::get_methods_if_impl(cstore.intr.clone(), &*cdata, def.node)
204204
}
205205

206-
pub fn get_item_attrs<F>(cstore: &cstore::CStore,
207-
def_id: ast::DefId,
208-
f: F) where
209-
F: FnOnce(Vec<ast::Attribute>),
210-
{
206+
pub fn get_item_attrs(cstore: &cstore::CStore,
207+
def_id: ast::DefId)
208+
-> Vec<ast::Attribute> {
211209
let cdata = cstore.get_crate_data(def_id.krate);
212-
decoder::get_item_attrs(&*cdata, def_id.node, f)
210+
decoder::get_item_attrs(&*cdata, def_id.node)
213211
}
214212

215213
pub fn get_struct_fields(cstore: &cstore::CStore,

branches/batch/src/librustc/metadata/decoder.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,18 +1025,16 @@ pub fn get_tuple_struct_definition_if_ctor(cdata: Cmd,
10251025
ret
10261026
}
10271027

1028-
pub fn get_item_attrs<F>(cdata: Cmd,
1029-
orig_node_id: ast::NodeId,
1030-
f: F) where
1031-
F: FnOnce(Vec<ast::Attribute>),
1032-
{
1028+
pub fn get_item_attrs(cdata: Cmd,
1029+
orig_node_id: ast::NodeId)
1030+
-> Vec<ast::Attribute> {
10331031
// The attributes for a tuple struct are attached to the definition, not the ctor;
10341032
// we assume that someone passing in a tuple struct ctor is actually wanting to
10351033
// look at the definition
10361034
let node_id = get_tuple_struct_definition_if_ctor(cdata, orig_node_id);
10371035
let node_id = node_id.map(|x| x.node).unwrap_or(orig_node_id);
10381036
let item = lookup_item(node_id, cdata.data());
1039-
f(get_attributes(item));
1037+
get_attributes(item)
10401038
}
10411039

10421040
pub fn get_struct_field_attrs(cdata: Cmd) -> HashMap<ast::NodeId, Vec<ast::Attribute>> {

branches/batch/src/librustc/metadata/filesearch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl<'a> FileSearch<'a> {
5454

5555
debug!("filesearch: searching lib path");
5656
let tlib_path = make_target_lib_path(self.sysroot,
57-
self.triple);
57+
self.triple);
5858
if !visited_dirs.contains(tlib_path.as_vec()) {
5959
match f(&tlib_path) {
6060
FileMatches => found = true,

branches/batch/src/librustc/middle/check_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
926926
}
927927
};
928928
head.map(|mut head| {
929-
head.push_all(&r[0..col]);
929+
head.push_all(&r[..col]);
930930
head.push_all(&r[(col + 1)..]);
931931
head
932932
})

branches/batch/src/librustc/middle/traits/error_reporting.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
7070
span: Span) -> Option<String> {
7171
let def_id = trait_ref.def_id;
7272
let mut report = None;
73-
ty::each_attr(infcx.tcx, def_id, |item| {
73+
for item in ty::get_attrs(infcx.tcx, def_id).iter() {
7474
if item.check_name("rustc_on_unimplemented") {
7575
let err_sp = if item.meta().span == DUMMY_SP {
7676
span
@@ -136,11 +136,9 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
136136
eg `#[rustc_on_unimplemented = \"foo\"]`",
137137
trait_str).as_slice());
138138
}
139-
false
140-
} else {
141-
true
139+
break;
142140
}
143-
});
141+
}
144142
report
145143
}
146144

branches/batch/src/librustc/middle/traits/select.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,14 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11861186
.is_ok()
11871187
})
11881188
}
1189+
(&BuiltinCandidate(_), &ParamCandidate(_)) => {
1190+
// If we have a where-clause like `Option<K> : Send`,
1191+
// then we wind up in a situation where there is a
1192+
// default rule (`Option<K>:Send if K:Send) and the
1193+
// where-clause that both seem applicable. Just take
1194+
// the where-clause in that case.
1195+
true
1196+
}
11891197
(&ProjectionCandidate, &ParamCandidate(_)) => {
11901198
// FIXME(#20297) -- this gives where clauses precedent
11911199
// over projections. Really these are just two means

0 commit comments

Comments
 (0)