Skip to content

Commit 8c59ec0

Browse files
author
Jorge Aparicio
committed
unicode: fix fallout
1 parent 3fdd4b3 commit 8c59ec0

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

src/libunicode/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
html_playground_url = "http://play.rust-lang.org/")]
3030
#![no_std]
3131
#![feature(globs, macro_rules, slicing_syntax, unboxed_closures)]
32+
#![feature(associated_types)]
3233

3334
extern crate core;
3435

src/libunicode/u_str.rs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ pub struct GraphemeIndices<'a> {
105105
iter: Graphemes<'a>,
106106
}
107107

108-
impl<'a> Iterator<(uint, &'a str)> for GraphemeIndices<'a> {
108+
impl<'a> Iterator for GraphemeIndices<'a> {
109+
type Item = (uint, &'a str);
110+
109111
#[inline]
110112
fn next(&mut self) -> Option<(uint, &'a str)> {
111113
self.iter.next().map(|s| (s.as_ptr() as uint - self.start_offset, s))
@@ -117,7 +119,7 @@ impl<'a> Iterator<(uint, &'a str)> for GraphemeIndices<'a> {
117119
}
118120
}
119121

120-
impl<'a> DoubleEndedIterator<(uint, &'a str)> for GraphemeIndices<'a> {
122+
impl<'a> DoubleEndedIterator for GraphemeIndices<'a> {
121123
#[inline]
122124
fn next_back(&mut self) -> Option<(uint, &'a str)> {
123125
self.iter.next_back().map(|s| (s.as_ptr() as uint - self.start_offset, s))
@@ -145,7 +147,9 @@ enum GraphemeState {
145147
Regional,
146148
}
147149

148-
impl<'a> Iterator<&'a str> for Graphemes<'a> {
150+
impl<'a> Iterator for Graphemes<'a> {
151+
type Item = &'a str;
152+
149153
#[inline]
150154
fn size_hint(&self) -> (uint, Option<uint>) {
151155
let slen = self.string.len();
@@ -251,7 +255,7 @@ impl<'a> Iterator<&'a str> for Graphemes<'a> {
251255
}
252256
}
253257

254-
impl<'a> DoubleEndedIterator<&'a str> for Graphemes<'a> {
258+
impl<'a> DoubleEndedIterator for Graphemes<'a> {
255259
#[inline]
256260
fn next_back(&mut self) -> Option<&'a str> {
257261
use tables::grapheme as gr;
@@ -428,7 +432,9 @@ impl Utf16Item {
428432
}
429433
}
430434

431-
impl<'a> Iterator<Utf16Item> for Utf16Items<'a> {
435+
impl<'a> Iterator for Utf16Items<'a> {
436+
type Item = Utf16Item;
437+
432438
fn next(&mut self) -> Option<Utf16Item> {
433439
let u = match self.iter.next() {
434440
Some(u) => *u,
@@ -505,12 +511,14 @@ pub struct Utf16Encoder<I> {
505511

506512
impl<I> Utf16Encoder<I> {
507513
/// Create an UTF-16 encoder from any `char` iterator.
508-
pub fn new(chars: I) -> Utf16Encoder<I> where I: Iterator<char> {
514+
pub fn new(chars: I) -> Utf16Encoder<I> where I: Iterator<Item=char> {
509515
Utf16Encoder { chars: chars, extra: 0 }
510516
}
511517
}
512518

513-
impl<I> Iterator<u16> for Utf16Encoder<I> where I: Iterator<char> {
519+
impl<I> Iterator for Utf16Encoder<I> where I: Iterator<Item=char> {
520+
type Item = u16;
521+
514522
#[inline]
515523
fn next(&mut self) -> Option<u16> {
516524
if self.extra != 0 {
@@ -537,9 +545,11 @@ impl<I> Iterator<u16> for Utf16Encoder<I> where I: Iterator<char> {
537545
}
538546
}
539547

540-
impl<'a> Iterator<&'a str> for Words<'a> {
548+
impl<'a> Iterator for Words<'a> {
549+
type Item = &'a str;
550+
541551
fn next(&mut self) -> Option<&'a str> { self.inner.next() }
542552
}
543-
impl<'a> DoubleEndedIterator<&'a str> for Words<'a> {
553+
impl<'a> DoubleEndedIterator for Words<'a> {
544554
fn next_back(&mut self) -> Option<&'a str> { self.inner.next_back() }
545555
}

0 commit comments

Comments
 (0)