Skip to content

Commit 4b359e3

Browse files
committed
More test fixes!
1 parent ee9921a commit 4b359e3

Some content is hidden

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

42 files changed

+50
-328
lines changed

src/libcollections/dlist.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,7 @@ mod tests {
10661066
}
10671067

10681068
#[allow(deprecated)]
1069+
#[test]
10691070
fn test_append() {
10701071
{
10711072
let mut m = DList::new();

src/libcore/iter.rs

-157
Original file line numberDiff line numberDiff line change
@@ -1171,134 +1171,6 @@ impl_multiplicative! { uint, 1 }
11711171
impl_multiplicative! { f32, 1.0 }
11721172
impl_multiplicative! { f64, 1.0 }
11731173

1174-
<<<<<<< HEAD
1175-
=======
1176-
/// A trait for iterators over elements which can be compared to one another.
1177-
#[unstable = "recently renamed for new extension trait conventions"]
1178-
pub trait IteratorOrdExt<A> {
1179-
/// Consumes the entire iterator to return the maximum element.
1180-
///
1181-
/// # Example
1182-
///
1183-
/// ```rust
1184-
/// let a = [1i, 2, 3, 4, 5];
1185-
/// assert!(a.iter().max().unwrap() == &5);
1186-
/// ```
1187-
fn max(self) -> Option<A>;
1188-
1189-
/// Consumes the entire iterator to return the minimum element.
1190-
///
1191-
/// # Example
1192-
///
1193-
/// ```rust
1194-
/// let a = [1i, 2, 3, 4, 5];
1195-
/// assert!(a.iter().min().unwrap() == &1);
1196-
/// ```
1197-
fn min(self) -> Option<A>;
1198-
1199-
/// `min_max` finds the minimum and maximum elements in the iterator.
1200-
///
1201-
/// The return type `MinMaxResult` is an enum of three variants:
1202-
///
1203-
/// - `NoElements` if the iterator is empty.
1204-
/// - `OneElement(x)` if the iterator has exactly one element.
1205-
/// - `MinMax(x, y)` is returned otherwise, where `x <= y`. Two
1206-
/// values are equal if and only if there is more than one
1207-
/// element in the iterator and all elements are equal.
1208-
///
1209-
/// On an iterator of length `n`, `min_max` does `1.5 * n` comparisons,
1210-
/// and so is faster than calling `min` and `max` separately which does `2 * n` comparisons.
1211-
///
1212-
/// # Example
1213-
///
1214-
/// ```rust
1215-
/// use std::iter::MinMaxResult::{NoElements, OneElement, MinMax};
1216-
///
1217-
/// let v: [int; 0] = [];
1218-
/// assert_eq!(v.iter().min_max(), NoElements);
1219-
///
1220-
/// let v = [1i];
1221-
/// assert!(v.iter().min_max() == OneElement(&1));
1222-
///
1223-
/// let v = [1i, 2, 3, 4, 5];
1224-
/// assert!(v.iter().min_max() == MinMax(&1, &5));
1225-
///
1226-
/// let v = [1i, 2, 3, 4, 5, 6];
1227-
/// assert!(v.iter().min_max() == MinMax(&1, &6));
1228-
///
1229-
/// let v = [1i, 1, 1, 1];
1230-
/// assert!(v.iter().min_max() == MinMax(&1, &1));
1231-
/// ```
1232-
fn min_max(self) -> MinMaxResult<A>;
1233-
}
1234-
1235-
#[unstable = "trait is unstable"]
1236-
impl<T, I> IteratorOrdExt<T> for I where I: Iterator<Item=T>, T: Ord {
1237-
#[inline]
1238-
fn max(self) -> Option<T> {
1239-
self.fold(None, |max, x| {
1240-
match max {
1241-
None => Some(x),
1242-
Some(y) => Some(cmp::max(x, y))
1243-
}
1244-
})
1245-
}
1246-
1247-
#[inline]
1248-
fn min(self) -> Option<T> {
1249-
self.fold(None, |min, x| {
1250-
match min {
1251-
None => Some(x),
1252-
Some(y) => Some(cmp::min(x, y))
1253-
}
1254-
})
1255-
}
1256-
1257-
fn min_max(mut self) -> MinMaxResult<T> {
1258-
let (mut min, mut max) = match self.next() {
1259-
None => return NoElements,
1260-
Some(x) => {
1261-
match self.next() {
1262-
None => return OneElement(x),
1263-
Some(y) => if x < y {(x, y)} else {(y,x)}
1264-
}
1265-
}
1266-
};
1267-
1268-
loop {
1269-
// `first` and `second` are the two next elements we want to look at.
1270-
// We first compare `first` and `second` (#1). The smaller one is then compared to
1271-
// current minimum (#2). The larger one is compared to current maximum (#3). This
1272-
// way we do 3 comparisons for 2 elements.
1273-
let first = match self.next() {
1274-
None => break,
1275-
Some(x) => x
1276-
};
1277-
let second = match self.next() {
1278-
None => {
1279-
if first < min {
1280-
min = first;
1281-
} else if first > max {
1282-
max = first;
1283-
}
1284-
break;
1285-
}
1286-
Some(x) => x
1287-
};
1288-
if first < second {
1289-
if first < min {min = first;}
1290-
if max < second {max = second;}
1291-
} else {
1292-
if second < min {min = second;}
1293-
if max < first {max = first;}
1294-
}
1295-
}
1296-
1297-
MinMax(min, max)
1298-
}
1299-
}
1300-
1301-
>>>>>>> parent of f031671... Remove i suffix in docs
13021174
/// `MinMaxResult` is an enum returned by `min_max`. See `IteratorOrdExt::min_max` for more detail.
13031175
#[derive(Clone, PartialEq, Show)]
13041176
#[unstable = "unclear whether such a fine-grained result is widely useful"]
@@ -1386,35 +1258,6 @@ impl<T, D, I> ExactSizeIterator for Cloned<I> where
13861258
I: ExactSizeIterator + Iterator<Item=D>,
13871259
{}
13881260

1389-
<<<<<<< HEAD
1390-
=======
1391-
#[unstable = "recently renamed for extension trait conventions"]
1392-
/// An extension trait for cloneable iterators.
1393-
pub trait CloneIteratorExt {
1394-
/// Repeats an iterator endlessly
1395-
///
1396-
/// # Example
1397-
///
1398-
/// ```rust
1399-
/// use std::iter::{CloneIteratorExt, count};
1400-
///
1401-
/// let a = count(1i,1i).take(1);
1402-
/// let mut cy = a.cycle();
1403-
/// assert_eq!(cy.next(), Some(1));
1404-
/// assert_eq!(cy.next(), Some(1));
1405-
/// ```
1406-
#[stable]
1407-
fn cycle(self) -> Cycle<Self>;
1408-
}
1409-
1410-
impl<I> CloneIteratorExt for I where I: Iterator + Clone {
1411-
#[inline]
1412-
fn cycle(self) -> Cycle<I> {
1413-
Cycle{orig: self.clone(), iter: self}
1414-
}
1415-
}
1416-
1417-
>>>>>>> parent of f031671... Remove i suffix in docs
14181261
/// An iterator that repeats endlessly
14191262
#[derive(Clone, Copy)]
14201263
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]

src/libcoretest/iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ fn test_range_step_inclusive() {
769769
#[test]
770770
fn test_reverse() {
771771
let mut ys = [1i, 2, 3, 4, 5];
772-
ys.iter_mut().reverse_();
772+
ys.iter_mut().reverse_in_place();
773773
assert!(ys == [5, 4, 3, 2, 1]);
774774
}
775775

src/libgraphviz/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ pub fn render_opts<'a, N:Clone+'a, E:Clone+'a, G:Labeller<'a,N,E>+GraphWalk<'a,N
587587
mod tests {
588588
use self::NodeLabels::*;
589589
use super::{Id, Labeller, Nodes, Edges, GraphWalk, render};
590-
use super::LabelText::{mod, LabelStr, EscStr};
590+
use super::LabelText::{self, LabelStr, EscStr};
591591
use std::io::IoResult;
592592
use std::borrow::IntoCow;
593593
use std::iter::repeat;

src/librand/chacha.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const CHACHA_ROUNDS: uint = 20; // Cryptographically secure from 8 upwards as of
2727
///
2828
/// [1]: D. J. Bernstein, [*ChaCha, a variant of
2929
/// Salsa20*](http://cr.yp.to/chacha.html)
30-
#[deriving(Copy, Clone)]
30+
#[derive(Copy, Clone)]
3131
pub struct ChaChaRng {
3232
buffer: [u32; STATE_WORDS], // Internal buffer of output
3333
state: [u32; STATE_WORDS], // Initial state
@@ -284,7 +284,7 @@ mod test {
284284

285285
#[test]
286286
fn test_rng_clone() {
287-
let seed : &[_] = &[0u32, ..8];
287+
let seed : &[_] = &[0u32; 8];
288288
let mut rng: ChaChaRng = SeedableRng::from_seed(seed);
289289
let mut clone = rng.clone();
290290
for _ in range(0u, 16) {

src/librand/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ pub trait SeedableRng<Seed>: Rng {
403403
/// RNGs"](http://www.jstatsoft.org/v08/i14/paper). *Journal of
404404
/// Statistical Software*. Vol. 8 (Issue 14).
405405
#[allow(missing_copy_implementations)]
406-
#[deriving(Clone)]
406+
#[derive(Clone)]
407407
pub struct XorShiftRng {
408408
x: u32,
409409
y: u32,

src/librustc/middle/infer/region_inference/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use super::cres;
2222
use super::{RegionVariableOrigin, SubregionOrigin, TypeTrace, MiscVariable};
2323

2424
use middle::region;
25-
use middle::ty::{mod, Ty};
25+
use middle::ty::{self, Ty};
2626
use middle::ty::{BoundRegion, FreeRegion, Region, RegionVid};
2727
use middle::ty::{ReEmpty, ReStatic, ReInfer, ReFree, ReEarlyBound};
2828
use middle::ty::{ReLateBound, ReScope, ReVar, ReSkolemized, BrFresh};
@@ -69,7 +69,7 @@ pub enum Verify<'tcx> {
6969
VerifyGenericBound(GenericKind<'tcx>, SubregionOrigin<'tcx>, Region, Vec<Region>),
7070
}
7171

72-
#[deriving(Clone, Show, PartialEq, Eq)]
72+
#[derive(Clone, Show, PartialEq, Eq)]
7373
pub enum GenericKind<'tcx> {
7474
Param(ty::ParamTy),
7575
Projection(ty::ProjectionTy<'tcx>),

src/librustc_trans/back/write.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use syntax::codemap;
2222
use syntax::diagnostic;
2323
use syntax::diagnostic::{Emitter, Handler, Level, mk_handler};
2424

25-
use std::ffi::{mod, CString};
25+
use std::ffi::{self, CString};
2626
use std::io::Command;
2727
use std::io::fs;
2828
use std::iter::Unfold;
@@ -32,7 +32,7 @@ use std::mem;
3232
use std::sync::{Arc, Mutex};
3333
use std::sync::mpsc::channel;
3434
use std::thread;
35-
use libc::{mod, c_uint, c_int, c_void};
35+
use libc::{self, c_uint, c_int, c_void};
3636

3737
#[derive(Clone, Copy, PartialEq, PartialOrd, Ord, Eq)]
3838
pub enum OutputType {

src/librustc_trans/trans/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ use util::nodemap::NodeMap;
8888

8989
use arena::TypedArena;
9090
use libc::{c_uint, uint64_t};
91-
use std::ffi::{mod, CString};
91+
use std::ffi::{self, CString};
9292
use std::cell::{Cell, RefCell};
9393
use std::collections::HashSet;
9494
use std::mem;

src/librustc_typeck/check/_match.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
195195
ast::PatRegion(ref inner, mutbl) => {
196196
let inner_ty = fcx.infcx().next_ty_var();
197197

198-
// SNAP c894171 remove this `if`-`else` entirely after next snapshot
198+
// SNAP b2085d9 remove this `if`-`else` entirely after next snapshot
199199
let mutbl = if mutbl == ast::MutImmutable {
200200
ty::deref(fcx.infcx().shallow_resolve(expected), true)
201-
.map(|mt| mt.mutbl).unwrap_or(ast::MutImmutable);
201+
.map(|mt| mt.mutbl).unwrap_or(ast::MutImmutable)
202202
} else {
203203
mutbl
204204
};

src/librustc_typeck/check/regionck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ use middle::region::CodeExtent;
9292
use middle::traits;
9393
use middle::ty::{ReScope};
9494
use middle::ty::{self, Ty, MethodCall};
95-
use middle::infer::{mod, GenericKind};
95+
use middle::infer::{self, GenericKind};
9696
use middle::pat_util;
9797
use util::ppaux::{ty_to_string, Repr};
9898

src/libserialize/json_stage0.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2298,7 +2298,7 @@ impl ::Decoder<DecoderError> for Decoder {
22982298
}
22992299

23002300
/// A trait for converting values to JSON
2301-
pub trait ToJson for Sized? {
2301+
pub trait ToJson {
23022302
/// Converts the value of `self` to an instance of JSON
23032303
fn to_json(&self) -> Json;
23042304
}

src/libserialize/serialize_stage0.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ pub trait Decoder<E> {
172172
fn error(&mut self, err: &str) -> E;
173173
}
174174

175-
pub trait Encodable<S:Encoder<E>, E> for Sized? {
175+
pub trait Encodable<S:Encoder<E>, E> {
176176
fn encode(&self, s: &mut S) -> Result<(), E>;
177177
}
178178

src/libstd/dynamic_lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ impl DynamicLibrary {
128128
// This function should have a lifetime constraint of 'a on
129129
// T but that feature is still unimplemented
130130

131+
let raw_string = CString::from_slice(symbol.as_bytes());
131132
let maybe_symbol_value = dl::check_for_errors_in(|| {
132-
let raw_string = CString::from_slice(symbol.as_bytes());
133133
dl::symbol(self.handle, raw_string.as_ptr())
134134
});
135135

src/libstd/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,6 @@ pub mod num;
253253

254254
/* Runtime and platform support */
255255

256-
pub mod thread_local; // first for macros
257-
258256
#[cfg_attr(stage0, macro_escape)]
259257
#[cfg_attr(not(stage0), macro_use)]
260258
pub mod thread_local;

src/libstd/rand/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ pub mod reader;
245245

246246
/// The standard RNG. This is designed to be efficient on the current
247247
/// platform.
248-
#[deriving(Copy, Clone)]
248+
#[derive(Copy, Clone)]
249249
pub struct StdRng {
250250
rng: IsaacWordRng,
251251
}
@@ -322,7 +322,7 @@ static THREAD_RNG_RESEED_THRESHOLD: uint = 32_768;
322322
type ThreadRngInner = reseeding::ReseedingRng<StdRng, ThreadRngReseeder>;
323323

324324
/// The thread-local RNG.
325-
#[deriving(Clone)]
325+
#[derive(Clone)]
326326
pub struct ThreadRng {
327327
rng: Rc<RefCell<ThreadRngInner>>,
328328
}

src/libstd/sys/windows/process.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -466,19 +466,17 @@ fn free_handle(handle: *mut ()) {
466466

467467
#[cfg(test)]
468468
mod tests {
469-
use c_str::ToCStr;
469+
use prelude::v1::*;
470+
use str;
471+
use ffi::CString;
472+
use super::make_command_line;
470473

471474
#[test]
472475
fn test_make_command_line() {
473-
use prelude::v1::*;
474-
use str;
475-
use c_str::CString;
476-
use super::make_command_line;
477-
478476
fn test_wrapper(prog: &str, args: &[&str]) -> String {
479-
make_command_line(&prog.to_c_str(),
477+
make_command_line(&CString::from_slice(prog.as_bytes()),
480478
args.iter()
481-
.map(|a| a.to_c_str())
479+
.map(|a| CString::from_slice(a.as_bytes()))
482480
.collect::<Vec<CString>>()
483481
.as_slice())
484482
}

src/libsyntax/feature_gate.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
267267
}
268268
}
269269

270-
ast::ItemImpl(_, polarity, _, _, _, ref items) => {
270+
ast::ItemImpl(_, polarity, _, _, _, _) => {
271271
match polarity {
272272
ast::ImplPolarity::Negative => {
273273
self.gate_feature("optin_builtin_traits",
@@ -294,18 +294,6 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
294294
i.span,
295295
"the new orphan check rules will eventually be strictly enforced");
296296
}
297-
298-
for item in items.iter() {
299-
match *item {
300-
ast::MethodImplItem(_) => {}
301-
ast::TypeImplItem(ref typedef) => {
302-
self.gate_feature("associated_types",
303-
typedef.span,
304-
"associated types are \
305-
experimental")
306-
}
307-
}
308-
}
309297
}
310298

311299
_ => {}

0 commit comments

Comments
 (0)