Skip to content

Commit 5a64de8

Browse files
committed
---
yaml --- r: 149279 b: refs/heads/try2 c: bf6abf8 h: refs/heads/master i: 149277: a3ecc47 149275: a01e8ff 149271: 68c5893 149263: 87f6a66 149247: 20e2686 v: v3
1 parent b2cf04a commit 5a64de8

File tree

9 files changed

+48
-30
lines changed

9 files changed

+48
-30
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 6fe775e2b5eaa77dd49c1d9a234c67d52e5f9087
8+
refs/heads/try2: bf6abf8cb3d1e169c1baab8d266bd43c58dfbcc6
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/main.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ CFG_VERSION_WIN = $(subst -pre,,$(CFG_RELEASE))
4545
# and include all of the .d files in one fell swoop.
4646
ALL_OBJ_FILES :=
4747

48-
ifneq ($(NO_MKFILE_DEPS),)
48+
ifneq ($(NO_MAKEFILE_DEPS),)
4949
MKFILE_DEPS :=
5050
else
5151
MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR)mk/,*)

branches/try2/mk/tests.mk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ endif
174174
check: cleantestlibs cleantmptestlogs tidy all check-stage2
175175
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
176176

177+
check-notidy: cleantestlibs cleantmptestlogs all check-stage2
178+
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
179+
180+
check-full: cleantestlibs cleantmptestlogs tidy \
181+
all check-stage1 check-stage2 check-stage3
182+
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
183+
184+
check-test: cleantestlibs cleantmptestlogs all check-stage2-rfail
185+
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
186+
177187
check-lite: cleantestlibs cleantmptestlogs \
178188
$(foreach crate,$(TARGET_CRATES),check-stage2-$(crate)) \
179189
check-stage2-rpass \

branches/try2/src/libstd/comm/shared.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
/// module. You'll also note that the implementation of the shared and stream
1919
/// channels are quite similar, and this is no coincidence!
2020
21-
use cmp;
2221
use int;
2322
use iter::Iterator;
2423
use kinds::Send;
@@ -36,9 +35,6 @@ use mpsc = sync::mpsc_queue;
3635

3736
static DISCONNECTED: int = int::MIN;
3837
static FUDGE: int = 1024;
39-
#[cfg(test)]
40-
static MAX_STEALS: int = 5;
41-
#[cfg(not(test))]
4238
static MAX_STEALS: int = 1 << 20;
4339

4440
pub struct Packet<T> {
@@ -311,11 +307,7 @@ impl<T: Send> Packet<T> {
311307
DISCONNECTED => {
312308
self.cnt.store(DISCONNECTED, atomics::SeqCst);
313309
}
314-
n => {
315-
let m = cmp::min(n, self.steals);
316-
self.steals -= m;
317-
self.cnt.fetch_add(n - m, atomics::SeqCst);
318-
}
310+
n => { self.steals -= n; }
319311
}
320312
assert!(self.steals >= 0);
321313
}

branches/try2/src/libstd/comm/stream.rs

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
/// High level implementation details can be found in the comment of the parent
1818
/// module.
1919
20-
use cmp;
2120
use comm::Port;
2221
use int;
2322
use iter::Iterator;
@@ -33,9 +32,6 @@ use sync::atomics;
3332
use vec::OwnedVector;
3433

3534
static DISCONNECTED: int = int::MIN;
36-
#[cfg(test)]
37-
static MAX_STEALS: int = 5;
38-
#[cfg(not(test))]
3935
static MAX_STEALS: int = 1 << 20;
4036

4137
pub struct Packet<T> {
@@ -202,28 +198,19 @@ impl<T: Send> Packet<T> {
202198
pub fn try_recv(&mut self) -> Result<T, Failure<T>> {
203199
match self.queue.pop() {
204200
// If we stole some data, record to that effect (this will be
205-
// factored into cnt later on).
206-
//
207-
// Note that we don't allow steals to grow without bound in order to
208-
// prevent eventual overflow of either steals or cnt as an overflow
209-
// would have catastrophic results. Sometimes, steals > cnt, but
210-
// other times cnt > steals, so we don't know the relation between
211-
// steals and cnt. This code path is executed only rarely, so we do
212-
// a pretty slow operation, of swapping 0 into cnt, taking steals
213-
// down as much as possible (without going negative), and then
214-
// adding back in whatever we couldn't factor into steals.
201+
// factored into cnt later on). Note that we don't allow steals to
202+
// grow without bound in order to prevent eventual overflow of
203+
// either steals or cnt as an overflow would have catastrophic
204+
// results. Also note that we don't unconditionally set steals to 0
205+
// because it can be true that steals > cnt.
215206
Some(data) => {
216207
self.steals += 1;
217208
if self.steals > MAX_STEALS {
218209
match self.cnt.swap(0, atomics::SeqCst) {
219210
DISCONNECTED => {
220211
self.cnt.store(DISCONNECTED, atomics::SeqCst);
221212
}
222-
n => {
223-
let m = cmp::min(n, self.steals);
224-
self.steals -= m;
225-
self.cnt.fetch_add(n - m, atomics::SeqCst);
226-
}
213+
n => { self.steals -= n; }
227214
}
228215
assert!(self.steals >= 0);
229216
}

branches/try2/src/libstd/num/f32.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,7 @@ impl num::FromStrRadix for f32 {
867867
#[cfg(test)]
868868
mod tests {
869869
use f32::*;
870+
use prelude::*;
870871

871872
use num::*;
872873
use num;

branches/try2/src/libstd/num/f64.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,7 @@ impl num::FromStrRadix for f64 {
869869
#[cfg(test)]
870870
mod tests {
871871
use f64::*;
872+
use prelude::*;
872873

873874
use num::*;
874875
use num;

branches/try2/src/libstd/task.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ use rt::task::Task;
6565
use str::{Str, SendStr, IntoMaybeOwned};
6666

6767
#[cfg(test)] use any::{AnyOwnExt, AnyRefExt};
68+
#[cfg(test)] use ptr;
6869
#[cfg(test)] use result;
6970

7071
/// Indicates the manner in which a task exited.

branches/try2/src/libstd/tuple.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
use clone::Clone;
1616
#[cfg(not(test))] use cmp::*;
1717
#[cfg(not(test))] use default::Default;
18+
use fmt;
19+
use result::{Ok, Err};
1820

1921
/// Method extensions to pairs where both types satisfy the `Clone` bound
2022
pub trait CloneableTuple<T, U> {
@@ -176,6 +178,12 @@ macro_rules! tuple_impls {
176178
($({ let x: $T = Default::default(); x},)+)
177179
}
178180
}
181+
182+
impl<$($T: fmt::Show),+> fmt::Show for ($($T,)+) {
183+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
184+
write_tuple!(f.buf, $(self.$get_ref_fn()),+)
185+
}
186+
}
179187
)+
180188
}
181189
}
@@ -202,6 +210,17 @@ macro_rules! lexical_cmp {
202210
($a:expr, $b:expr) => { ($a).cmp($b) };
203211
}
204212

213+
macro_rules! write_tuple {
214+
($buf:expr, $x:expr) => (
215+
write!($buf, "({},)", *$x)
216+
);
217+
($buf:expr, $hd:expr, $($tl:expr),+) => ({
218+
if_ok!(write!($buf, "("));
219+
if_ok!(write!($buf, "{}", *$hd));
220+
$(if_ok!(write!($buf, ", {}", *$tl));)+
221+
write!($buf, ")")
222+
});
223+
}
205224

206225
tuple_impls! {
207226
(Tuple1, ImmutableTuple1) {
@@ -422,4 +441,11 @@ mod tests {
422441
assert_eq!(small.cmp(&big), Less);
423442
assert_eq!(big.cmp(&small), Greater);
424443
}
444+
445+
#[test]
446+
fn test_show() {
447+
assert_eq!(format!("{}", (1,)), ~"(1,)");
448+
assert_eq!(format!("{}", (1, true)), ~"(1, true)");
449+
assert_eq!(format!("{}", (1, ~"hi", true)), ~"(1, hi, true)");
450+
}
425451
}

0 commit comments

Comments
 (0)