Skip to content

Commit afdd233

Browse files
committed
---
yaml --- r: 81285 b: refs/heads/snap-stage3 c: a8ba31d h: refs/heads/master i: 81283: 8d44c79 v: v3
1 parent 1467654 commit afdd233

Some content is hidden

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

69 files changed

+498
-510
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: aaf6cc3a841095a95a9c74a6a2a3709dffd7a4e9
4+
refs/heads/snap-stage3: a8ba31dbf3e7d80a069bc486a35eff8357282b68
55
refs/heads/try: 70152ff55722878cde684ee6462c14c65f2c4729
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libstd/at_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ pub mod raw {
236236
let alloc = n * (*ty).size;
237237
let total_size = alloc + sys::size_of::<Vec<()>>();
238238
if alloc / (*ty).size != n || total_size < alloc {
239-
fail!("vector size is too large: %u", n);
239+
fail2!("vector size is too large: {}", n);
240240
}
241241
(*ptr) = local_realloc(*ptr as *(), total_size) as *mut Box<Vec<()>>;
242242
(**ptr).data.alloc = alloc;

branches/snap-stage3/src/libstd/c_str.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl CString {
116116
///
117117
/// Fails if the CString is null.
118118
pub fn with_ref<T>(&self, f: &fn(*libc::c_char) -> T) -> T {
119-
if self.buf.is_null() { fail!("CString is null!"); }
119+
if self.buf.is_null() { fail2!("CString is null!"); }
120120
f(self.buf)
121121
}
122122

@@ -126,7 +126,7 @@ impl CString {
126126
///
127127
/// Fails if the CString is null.
128128
pub fn with_mut_ref<T>(&mut self, f: &fn(*mut libc::c_char) -> T) -> T {
129-
if self.buf.is_null() { fail!("CString is null!"); }
129+
if self.buf.is_null() { fail2!("CString is null!"); }
130130
f(unsafe { cast::transmute_mut_unsafe(self.buf) })
131131
}
132132

@@ -152,7 +152,7 @@ impl CString {
152152
/// Fails if the CString is null.
153153
#[inline]
154154
pub fn as_bytes<'a>(&'a self) -> &'a [u8] {
155-
if self.buf.is_null() { fail!("CString is null!"); }
155+
if self.buf.is_null() { fail2!("CString is null!"); }
156156
unsafe {
157157
cast::transmute((self.buf, self.len() + 1))
158158
}
@@ -273,7 +273,7 @@ impl<'self> ToCStr for &'self [u8] {
273273
do self.as_imm_buf |self_buf, self_len| {
274274
let buf = libc::malloc(self_len as libc::size_t + 1) as *mut u8;
275275
if buf.is_null() {
276-
fail!("failed to allocate memory!");
276+
fail2!("failed to allocate memory!");
277277
}
278278

279279
ptr::copy_memory(buf, self_buf, self_len);

branches/snap-stage3/src/libstd/cell.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl<T> Cell<T> {
4444
pub fn take(&self) -> T {
4545
let this = unsafe { transmute_mut(self) };
4646
if this.is_empty() {
47-
fail!("attempt to take an empty cell");
47+
fail2!("attempt to take an empty cell");
4848
}
4949

5050
this.value.take_unwrap()
@@ -60,7 +60,7 @@ impl<T> Cell<T> {
6060
pub fn put_back(&self, value: T) {
6161
let this = unsafe { transmute_mut(self) };
6262
if !this.is_empty() {
63-
fail!("attempt to put a value back into a full cell");
63+
fail2!("attempt to put a value back into a full cell");
6464
}
6565
this.value = Some(value);
6666
}

branches/snap-stage3/src/libstd/char.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ pub fn is_digit_radix(c: char, radix: uint) -> bool {
187187
#[inline]
188188
pub fn to_digit(c: char, radix: uint) -> Option<uint> {
189189
if radix > 36 {
190-
fail!("to_digit: radix %? is to high (maximum 36)", radix);
190+
fail2!("to_digit: radix {} is to high (maximum 36)", radix);
191191
}
192192
let val = match c {
193193
'0' .. '9' => c as uint - ('0' as uint),
@@ -214,7 +214,7 @@ pub fn to_digit(c: char, radix: uint) -> Option<uint> {
214214
#[inline]
215215
pub fn from_digit(num: uint, radix: uint) -> Option<char> {
216216
if radix > 36 {
217-
fail!("from_digit: radix %? is to high (maximum 36)", num);
217+
fail2!("from_digit: radix {} is to high (maximum 36)", num);
218218
}
219219
if num < radix {
220220
unsafe {
@@ -342,7 +342,7 @@ pub fn len_utf8_bytes(c: char) -> uint {
342342
_ if code < MAX_TWO_B => 2u,
343343
_ if code < MAX_THREE_B => 3u,
344344
_ if code < MAX_FOUR_B => 4u,
345-
_ => fail!("invalid character!"),
345+
_ => fail2!("invalid character!"),
346346
}
347347
}
348348

branches/snap-stage3/src/libstd/condition.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ do my_error::cond.trap(|raised_int| {
5656
Condition handling is useful in cases where propagating errors is either to
5757
cumbersome or just not necessary in the first place. It should also be noted,
5858
though, that if there is not handler installed when a condition is raised, then
59-
the task invokes `fail!()` and will terminate.
59+
the task invokes `fail2!()` and will terminate.
6060
6161
## More Info
6262
@@ -127,20 +127,20 @@ impl<T, U> Condition<T, U> {
127127
/// If a handler is found, its return value is returned, otherwise this
128128
/// function will not return.
129129
pub fn raise(&self, t: T) -> U {
130-
let msg = fmt!("Unhandled condition: %s: %?", self.name, t);
131-
self.raise_default(t, || fail!(msg.clone()))
130+
let msg = format!("Unhandled condition: {}: {:?}", self.name, t);
131+
self.raise_default(t, || fail2!("{}", msg.clone()))
132132
}
133133

134134
/// Performs the same functionality as `raise`, except that when no handler
135135
/// is found the `default` argument is called instead of failing the task.
136136
pub fn raise_default(&self, t: T, default: &fn() -> U) -> U {
137137
match local_data::pop(self.key) {
138138
None => {
139-
debug!("Condition.raise: found no handler");
139+
debug2!("Condition.raise: found no handler");
140140
default()
141141
}
142142
Some(handler) => {
143-
debug!("Condition.raise: found handler");
143+
debug2!("Condition.raise: found handler");
144144
match handler.prev {
145145
None => {}
146146
Some(hp) => local_data::set(self.key, hp)
@@ -183,7 +183,7 @@ impl<'self, T, U> Trap<'self, T, U> {
183183
/// ```
184184
pub fn inside<V>(&self, inner: &'self fn() -> V) -> V {
185185
let _g = Guard { cond: self.cond };
186-
debug!("Trap: pushing handler to TLS");
186+
debug2!("Trap: pushing handler to TLS");
187187
local_data::set(self.cond.key, self.handler);
188188
inner()
189189
}
@@ -197,7 +197,7 @@ struct Guard<'self, T, U> {
197197
#[unsafe_destructor]
198198
impl<'self, T, U> Drop for Guard<'self, T, U> {
199199
fn drop(&mut self) {
200-
debug!("Guard: popping handler from TLS");
200+
debug2!("Guard: popping handler from TLS");
201201
let curr = local_data::pop(self.cond.key);
202202
match curr {
203203
None => {}
@@ -216,20 +216,20 @@ mod test {
216216
}
217217

218218
fn trouble(i: int) {
219-
debug!("trouble: raising condition");
219+
debug2!("trouble: raising condition");
220220
let j = sadness::cond.raise(i);
221-
debug!("trouble: handler recovered with %d", j);
221+
debug2!("trouble: handler recovered with {}", j);
222222
}
223223

224224
fn nested_trap_test_inner() {
225225
let mut inner_trapped = false;
226226

227227
do sadness::cond.trap(|_j| {
228-
debug!("nested_trap_test_inner: in handler");
228+
debug2!("nested_trap_test_inner: in handler");
229229
inner_trapped = true;
230230
0
231231
}).inside {
232-
debug!("nested_trap_test_inner: in protected block");
232+
debug2!("nested_trap_test_inner: in protected block");
233233
trouble(1);
234234
}
235235

@@ -241,10 +241,10 @@ mod test {
241241
let mut outer_trapped = false;
242242

243243
do sadness::cond.trap(|_j| {
244-
debug!("nested_trap_test_outer: in handler");
244+
debug2!("nested_trap_test_outer: in handler");
245245
outer_trapped = true; 0
246246
}).inside {
247-
debug!("nested_guard_test_outer: in protected block");
247+
debug2!("nested_guard_test_outer: in protected block");
248248
nested_trap_test_inner();
249249
trouble(1);
250250
}
@@ -256,13 +256,13 @@ mod test {
256256
let mut inner_trapped = false;
257257

258258
do sadness::cond.trap(|_j| {
259-
debug!("nested_reraise_trap_test_inner: in handler");
259+
debug2!("nested_reraise_trap_test_inner: in handler");
260260
inner_trapped = true;
261261
let i = 10;
262-
debug!("nested_reraise_trap_test_inner: handler re-raising");
262+
debug2!("nested_reraise_trap_test_inner: handler re-raising");
263263
sadness::cond.raise(i)
264264
}).inside {
265-
debug!("nested_reraise_trap_test_inner: in protected block");
265+
debug2!("nested_reraise_trap_test_inner: in protected block");
266266
trouble(1);
267267
}
268268

@@ -274,10 +274,10 @@ mod test {
274274
let mut outer_trapped = false;
275275

276276
do sadness::cond.trap(|_j| {
277-
debug!("nested_reraise_trap_test_outer: in handler");
277+
debug2!("nested_reraise_trap_test_outer: in handler");
278278
outer_trapped = true; 0
279279
}).inside {
280-
debug!("nested_reraise_trap_test_outer: in protected block");
280+
debug2!("nested_reraise_trap_test_outer: in protected block");
281281
nested_reraise_trap_test_inner();
282282
}
283283

@@ -289,10 +289,10 @@ mod test {
289289
let mut trapped = false;
290290

291291
do sadness::cond.trap(|j| {
292-
debug!("test_default: in handler");
292+
debug2!("test_default: in handler");
293293
sadness::cond.raise_default(j, || { trapped=true; 5 })
294294
}).inside {
295-
debug!("test_default: in protected block");
295+
debug2!("test_default: in protected block");
296296
trouble(1);
297297
}
298298

branches/snap-stage3/src/libstd/either.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<L, R> Either<L, R> {
7878
pub fn expect_left(self, reason: &str) -> L {
7979
match self {
8080
Left(x) => x,
81-
Right(_) => fail!(reason.to_owned())
81+
Right(_) => fail2!("{}", reason.to_owned())
8282
}
8383
}
8484

@@ -94,7 +94,7 @@ impl<L, R> Either<L, R> {
9494
pub fn expect_right(self, reason: &str) -> R {
9595
match self {
9696
Right(x) => x,
97-
Left(_) => fail!(reason.to_owned())
97+
Left(_) => fail2!("{}", reason.to_owned())
9898
}
9999
}
100100

branches/snap-stage3/src/libstd/fmt/parse.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl<'self> Parser<'self> {
234234
Some((_, c @ '#')) | Some((_, c @ '{')) |
235235
Some((_, c @ '\\')) | Some((_, c @ '}')) => { c }
236236
Some((_, c)) => {
237-
self.err(fmt!("invalid escape character `%c`", c));
237+
self.err(format!("invalid escape character `{}`", c));
238238
c
239239
}
240240
None => {
@@ -378,7 +378,7 @@ impl<'self> Parser<'self> {
378378
return None;
379379
}
380380
method => {
381-
self.err(fmt!("unknown method: `%s`", method));
381+
self.err(format!("unknown method: `{}`", method));
382382
return None;
383383
}
384384
}
@@ -448,8 +448,8 @@ impl<'self> Parser<'self> {
448448
Some((_, 'f')) => {
449449
let word = self.word();
450450
if word != "offset" {
451-
self.err(fmt!("expected `offset`, found `%s`",
452-
word));
451+
self.err(format!("expected `offset`, found `{}`",
452+
word));
453453
} else {
454454
if !self.consume(':') {
455455
self.err(~"`offset` must be followed by `:`");
@@ -490,7 +490,8 @@ impl<'self> Parser<'self> {
490490
"few" => Left(Few),
491491
"many" => Left(Many),
492492
word => {
493-
self.err(fmt!("unexpected plural selector `%s`", word));
493+
self.err(format!("unexpected plural selector `{}`",
494+
word));
494495
if word == "" {
495496
break
496497
} else {

branches/snap-stage3/src/libstd/hash.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,18 +493,18 @@ mod tests {
493493
}
494494

495495
while t < 64 {
496-
debug!("siphash test %?", t);
496+
debug2!("siphash test {}", t);
497497
let vec = u8to64_le!(vecs[t], 0);
498498
let out = Bytes(buf.as_slice()).hash_keyed(k0, k1);
499-
debug!("got %?, expected %?", out, vec);
499+
debug2!("got {:?}, expected {:?}", out, vec);
500500
assert_eq!(vec, out);
501501

502502
stream_full.reset();
503503
stream_full.input(buf);
504504
let f = stream_full.result_str();
505505
let i = stream_inc.result_str();
506506
let v = to_hex_str(&vecs[t]);
507-
debug!("%d: (%s) => inc=%s full=%s", t, v, i, f);
507+
debug2!("{}: ({}) => inc={} full={}", t, v, i, f);
508508

509509
assert!(f == i && f == v);
510510

branches/snap-stage3/src/libstd/hashmap.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl<K:Hash + Eq,V> HashMap<K, V> {
179179
fn value_for_bucket<'a>(&'a self, idx: uint) -> &'a V {
180180
match self.buckets[idx] {
181181
Some(ref bkt) => &bkt.value,
182-
None => fail!("HashMap::find: internal logic error"),
182+
None => fail2!("HashMap::find: internal logic error"),
183183
}
184184
}
185185

@@ -196,7 +196,7 @@ impl<K:Hash + Eq,V> HashMap<K, V> {
196196
/// True if there was no previous entry with that key
197197
fn insert_internal(&mut self, hash: uint, k: K, v: V) -> Option<V> {
198198
match self.bucket_for_key_with_hash(hash, &k) {
199-
TableFull => { fail!("Internal logic error"); }
199+
TableFull => { fail2!("Internal logic error"); }
200200
FoundHole(idx) => {
201201
self.buckets[idx] = Some(Bucket{hash: hash, key: k,
202202
value: v});
@@ -205,7 +205,7 @@ impl<K:Hash + Eq,V> HashMap<K, V> {
205205
}
206206
FoundEntry(idx) => {
207207
match self.buckets[idx] {
208-
None => { fail!("insert_internal: Internal logic error") }
208+
None => { fail2!("insert_internal: Internal logic error") }
209209
Some(ref mut b) => {
210210
b.hash = hash;
211211
b.key = k;
@@ -374,7 +374,7 @@ impl<K: Hash + Eq, V> HashMap<K, V> {
374374

375375
let hash = k.hash_keyed(self.k0, self.k1) as uint;
376376
let idx = match self.bucket_for_key_with_hash(hash, &k) {
377-
TableFull => fail!("Internal logic error"),
377+
TableFull => fail2!("Internal logic error"),
378378
FoundEntry(idx) => { found(&k, self.mut_value_for_bucket(idx), a); idx }
379379
FoundHole(idx) => {
380380
let v = not_found(&k, a);
@@ -413,7 +413,7 @@ impl<K: Hash + Eq, V> HashMap<K, V> {
413413
pub fn get<'a>(&'a self, k: &K) -> &'a V {
414414
match self.find(k) {
415415
Some(v) => v,
416-
None => fail!("No entry found for key: %?", k),
416+
None => fail2!("No entry found for key: {:?}", k),
417417
}
418418
}
419419

@@ -422,7 +422,7 @@ impl<K: Hash + Eq, V> HashMap<K, V> {
422422
pub fn get_mut<'a>(&'a mut self, k: &K) -> &'a mut V {
423423
match self.find_mut(k) {
424424
Some(v) => v,
425-
None => fail!("No entry found for key: %?", k),
425+
None => fail2!("No entry found for key: {:?}", k),
426426
}
427427
}
428428

@@ -826,7 +826,7 @@ mod test_map {
826826
assert!(m.insert(5, 14));
827827
let new = 100;
828828
match m.find_mut(&5) {
829-
None => fail!(), Some(x) => *x = new
829+
None => fail2!(), Some(x) => *x = new
830830
}
831831
assert_eq!(m.find(&5), Some(&new));
832832
}
@@ -943,7 +943,7 @@ mod test_map {
943943
assert!(m.find(&1).is_none());
944944
m.insert(1, 2);
945945
match m.find(&1) {
946-
None => fail!(),
946+
None => fail2!(),
947947
Some(v) => assert!(*v == 2)
948948
}
949949
}

0 commit comments

Comments
 (0)