Skip to content

Commit a6835dd

Browse files
committed
auto merge of #8842 : jfager/rust/remove-iter-module, r=pnkfelix
Moves the Times trait to num while the question of whether it should exist at all gets hashed out as a completely separate question.
2 parents 58c3fa9 + dc30005 commit a6835dd

File tree

9 files changed

+21
-36
lines changed

9 files changed

+21
-36
lines changed

src/libstd/iter.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/libstd/num/num.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,19 @@ pub trait Signed: Num
8080

8181
pub trait Unsigned: Num {}
8282

83+
/// Times trait
84+
///
85+
/// ~~~ {.rust}
86+
/// use num::Times;
87+
/// let ten = 10 as uint;
88+
/// let mut accum = 0;
89+
/// do ten.times { accum += 1; }
90+
/// ~~~
91+
///
92+
pub trait Times {
93+
fn times(&self, it: &fn());
94+
}
95+
8396
pub trait Integer: Num
8497
+ Orderable
8598
+ Div<Self,Self>

src/libstd/num/uint.rs

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

1111
//! Operations and constants for `uint`
1212
13-
use iter;
13+
use num;
1414
use sys;
1515

1616
pub use self::generated::*;
@@ -70,7 +70,7 @@ pub fn div_round(x: uint, y: uint) -> uint {
7070
///
7171
pub fn div_floor(x: uint, y: uint) -> uint { return x / y; }
7272

73-
impl iter::Times for uint {
73+
impl num::Times for uint {
7474
#[inline]
7575
///
7676
/// A convenience form for basic repetition. Given a uint `x`,
@@ -162,7 +162,7 @@ fn test_div() {
162162

163163
#[test]
164164
pub fn test_times() {
165-
use iter::Times;
165+
use num::Times;
166166
let ten = 10 as uint;
167167
let mut accum = 0;
168168
do ten.times { accum += 1; }

src/libstd/prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub use cmp::{Eq, ApproxEq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Great
4949
pub use char::Char;
5050
pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
5151
pub use hash::Hash;
52-
pub use iter::Times;
52+
pub use num::Times;
5353
pub use iterator::{FromIterator, Extendable};
5454
pub use iterator::{Iterator, DoubleEndedIterator, RandomAccessIterator, ClonableIterator};
5555
pub use iterator::{OrdIterator, MutableDoubleEndedIterator};

src/libstd/rt/comm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ mod test {
718718
use option::*;
719719
use rt::test::*;
720720
use cell::Cell;
721-
use iter::Times;
721+
use num::Times;
722722
use rt::util;
723723

724724
#[test]

src/libstd/rt/sched.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ mod test {
11141114
#[test]
11151115
fn multithreading() {
11161116
use rt::comm::*;
1117-
use iter::Times;
1117+
use num::Times;
11181118
use vec::OwnedVector;
11191119
use container::Container;
11201120

src/libstd/select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub fn select2<TA, A: SelectPort<TA>, TB, B: SelectPort<TB>>(mut a: A, mut b: B)
126126
mod test {
127127
use super::*;
128128
use clone::Clone;
129-
use iter::Times;
129+
use num::Times;
130130
use option::*;
131131
use rt::comm::*;
132132
use rt::test::*;

src/libstd/std.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ pub mod borrow;
140140
pub mod from_str;
141141
#[path = "num/num.rs"]
142142
pub mod num;
143-
pub mod iter;
144143
pub mod iterator;
145144
pub mod to_str;
146145
pub mod to_bytes;
@@ -220,4 +219,3 @@ mod std {
220219
pub use fmt;
221220
pub use to_bytes;
222221
}
223-

src/libstd/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use char;
2121
use char::Char;
2222
use clone::{Clone, DeepClone};
2323
use container::{Container, Mutable};
24-
use iter::Times;
24+
use num::Times;
2525
use iterator::{Iterator, FromIterator, Extendable};
2626
use iterator::{Filter, AdditiveIterator, Map};
2727
use iterator::{Invert, DoubleEndedIterator};

0 commit comments

Comments
 (0)