Skip to content

Commit 4f4ae53

Browse files
author
Jorge Aparicio
committed
fix rpass/cfail tests
1 parent 3bf24d6 commit 4f4ae53

12 files changed

+39
-18
lines changed

src/test/auxiliary/issue-16643.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
#![crate_type = "lib"]
12+
#![feature(associated_types)]
1213

1314
pub struct TreeBuilder<H>;
1415

@@ -20,7 +21,9 @@ impl<H> TreeBuilder<H> {
2021
}
2122
}
2223

23-
impl<H> Iterator<H> for TreeBuilder<H> {
24+
impl<H> Iterator for TreeBuilder<H> {
25+
type Item = H;
26+
2427
fn next(&mut self) -> Option<H> {
2528
None
2629
}

src/test/auxiliary/nested_item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl<T> Foo {
2626

2727
// issue 8134
2828
pub struct Parser<T>;
29-
impl<T: std::iter::Iterator<char>> Parser<T> {
29+
impl<T: std::iter::Iterator<Item=char>> Parser<T> {
3030
fn in_doctype(&mut self) {
3131
static DOCTYPEPattern: [char; 6] = ['O', 'C', 'T', 'Y', 'P', 'E'];
3232
}

src/test/compile-fail/issue-13058.rs

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

1111
use std::iter::{Range,range};
1212

13-
trait Itble<'r, T, I: Iterator<T>> { fn iter(&'r self) -> I; }
13+
trait Itble<'r, T, I: Iterator<Item=T>> { fn iter(&'r self) -> I; }
1414

1515
impl<'r> Itble<'r, uint, Range<uint>> for (uint, uint) {
1616
fn iter(&'r self) -> Range<uint> {
@@ -19,8 +19,8 @@ impl<'r> Itble<'r, uint, Range<uint>> for (uint, uint) {
1919
}
2020
}
2121

22-
fn check<'r, I: Iterator<uint>, T: Itble<'r, uint, I>>(cont: &T) -> bool
23-
//~^ HELP as shown: fn check<'r, I: Iterator<uint>, T: Itble<'r, uint, I>>(cont: &'r T) -> bool
22+
fn check<'r, I: Iterator<Item=uint>, T: Itble<'r, uint, I>>(cont: &T) -> bool
23+
//~^ HELP as shown: fn check<'r, I: Iterator<Item = uint>, T: Itble<'r, uint, I>>(cont: &'r T)
2424
{
2525
let cont_iter = cont.iter();
2626
//~^ ERROR cannot infer an appropriate lifetime for autoref due to conflicting requirements

src/test/compile-fail/issue-13853.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ trait Node {
1313
}
1414

1515
trait Graph<N: Node> {
16-
fn nodes<'a, I: Iterator<&'a N>>(&'a self) -> I;
16+
fn nodes<'a, I: Iterator<Item=&'a N>>(&'a self) -> I;
1717
}
1818

1919
impl<N: Node> Graph<N> for Vec<N> {
20-
fn nodes<'a, I: Iterator<&'a N>>(&self) -> I {
20+
fn nodes<'a, I: Iterator<Item=&'a N>>(&self) -> I {
2121
self.iter() //~ ERROR mismatched types
2222
}
2323
}

src/test/compile-fail/lifetime-inference-give-expl-lifetime-param-2.rs

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

1313
use std::iter::{Range,range};
1414

15-
trait Itble<'r, T, I: Iterator<T>> { fn iter(&'r self) -> I; }
15+
trait Itble<'r, T, I: Iterator<Item=T>> { fn iter(&'r self) -> I; }
1616

1717
impl<'r> Itble<'r, uint, Range<uint>> for (uint, uint) {
1818
fn iter(&'r self) -> Range<uint> {
@@ -21,8 +21,8 @@ impl<'r> Itble<'r, uint, Range<uint>> for (uint, uint) {
2121
}
2222
}
2323

24-
fn check<'r, I: Iterator<uint>, T: Itble<'r, uint, I>>(cont: &T) -> bool {
25-
//~^ HELP: consider using an explicit lifetime parameter as shown: fn check<'r, I: Iterator<uint>, T: Itble<'r, uint, I>>(cont: &'r T) -> bool
24+
fn check<'r, I: Iterator<Item=uint>, T: Itble<'r, uint, I>>(cont: &T) -> bool {
25+
//~^ HELP: consider using an explicit lifetime parameter as shown: fn check<'r, I: Iterator<Item = uint>, T: Itble<'r, uint, I>>(cont: &'r T)
2626
let cont_iter = cont.iter(); //~ ERROR: cannot infer
2727
let result = cont_iter.fold(Some(0u16), |state, val| {
2828
state.map_or(None, |mask| {

src/test/compile-fail/static-reference-to-fn-2.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(associated_types)]
12+
1113
struct StateMachineIter<'a> {
1214
statefn: &'a StateMachineFunc<'a>
1315
}
1416

1517
type StateMachineFunc<'a> = fn(&mut StateMachineIter<'a>) -> Option<&'static str>;
1618

17-
impl<'a> Iterator<&'static str> for StateMachineIter<'a> {
19+
impl<'a> Iterator for StateMachineIter<'a> {
20+
type Item = &'static str;
21+
1822
fn next(&mut self) -> Option<&'static str> {
1923
return (*self.statefn)(self);
2024
}

src/test/run-pass/issue-13167.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(associated_types)]
12+
1113
use std::slice;
1214

1315
pub struct PhfMapEntries<'a, T: 'a> {
1416
iter: slice::Iter<'a, (&'static str, T)>,
1517
}
1618

17-
impl<'a, T> Iterator<(&'static str, &'a T)> for PhfMapEntries<'a, T> {
19+
impl<'a, T> Iterator for PhfMapEntries<'a, T> {
20+
type Item = (&'static str, &'a T);
21+
1822
fn next(&mut self) -> Option<(&'static str, &'a T)> {
1923
self.iter.by_ref().map(|&(key, ref value)| (key, value)).next()
2024
}

src/test/run-pass/issue-13204.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// lifetime parameters defined on the method bound correctly.
1313

1414
pub trait Foo {
15-
fn bar<'a, I: Iterator<&'a ()>>(&self, it: I) -> uint {
15+
fn bar<'a, I: Iterator<Item=&'a ()>>(&self, it: I) -> uint {
1616
let mut xs = it.filter(|_| true);
1717
xs.count()
1818
}

src/test/run-pass/issue-14919.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(associated_types)]
12+
1113
trait Matcher {
1214
fn next_match(&mut self) -> Option<(uint, uint)>;
1315
}
@@ -40,7 +42,9 @@ struct MatchIndices<M> {
4042
matcher: M
4143
}
4244

43-
impl<M: Matcher> Iterator<(uint, uint)> for MatchIndices<M> {
45+
impl<M: Matcher> Iterator for MatchIndices<M> {
46+
type Item = (uint, uint);
47+
4448
fn next(&mut self) -> Option<(uint, uint)> {
4549
self.matcher.next_match()
4650
}

src/test/run-pass/issue-16596.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(associated_types)]
12+
1113
trait MatrixRow {}
1214

1315
struct Mat;
@@ -18,7 +20,9 @@ struct Rows<M: MatrixRow> {
1820
mat: M,
1921
}
2022

21-
impl<'a> Iterator<()> for Rows<&'a Mat> {
23+
impl<'a> Iterator for Rows<&'a Mat> {
24+
type Item = ();
25+
2226
fn next(&mut self) -> Option<()> {
2327
unimplemented!()
2428
}

src/test/run-pass/regions-no-bound-in-argument-cleanup.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(unsafe_destructor)]
11+
#![feature(associated_types, unsafe_destructor)]
1212

1313
pub struct Foo<T>;
1414

15-
impl<T> Iterator<T> for Foo<T> {
15+
impl<T> Iterator for Foo<T> {
16+
type Item = T;
17+
1618
fn next(&mut self) -> Option<T> {
1719
None
1820
}

src/test/run-pass/where-clauses-lifetimes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn foo<'a, I>(mut it: I) where I: Iterator<&'a int> {}
11+
fn foo<'a, I>(mut it: I) where I: Iterator<Item=&'a int> {}
1212

1313
fn main() {
1414
foo([1i, 2].iter());

0 commit comments

Comments
 (0)