Skip to content

Commit 87c3ee8

Browse files
committed
rollup merge of rust-lang#21457: alexcrichton/issue-21436
Conflicts: src/liballoc/boxed.rs src/librustc/middle/traits/error_reporting.rs src/libstd/sync/mpsc/mod.rs
2 parents e4b81d2 + 3cb9fa2 commit 87c3ee8

File tree

136 files changed

+763
-706
lines changed

Some content is hidden

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

136 files changed

+763
-706
lines changed

src/compiletest/common.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::fmt;
1313
use std::str::FromStr;
1414
use regex::Regex;
1515

16-
#[derive(Clone, PartialEq)]
16+
#[derive(Clone, PartialEq, Debug)]
1717
pub enum Mode {
1818
CompileFail,
1919
RunFail,
@@ -43,9 +43,9 @@ impl FromStr for Mode {
4343
}
4444
}
4545

46-
impl fmt::String for Mode {
46+
impl fmt::Display for Mode {
4747
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
48-
fmt::String::fmt(match *self {
48+
fmt::Display::fmt(match *self {
4949
CompileFail => "compile-fail",
5050
RunFail => "run-fail",
5151
RunPass => "run-pass",
@@ -58,12 +58,6 @@ impl fmt::String for Mode {
5858
}
5959
}
6060

61-
impl fmt::Show for Mode {
62-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
63-
fmt::String::fmt(self, f)
64-
}
65-
}
66-
6761
#[derive(Clone)]
6862
pub struct Config {
6963
// The library paths required for running the compiler

src/compiletest/runtest.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
548548

549549
// Add line breakpoints
550550
for line in breakpoint_lines.iter() {
551-
script_str.push_str(&format!("break '{:?}':{}\n",
551+
script_str.push_str(&format!("break '{}':{}\n",
552552
testfile.filename_display(),
553553
*line)[]);
554554
}
@@ -751,7 +751,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
751751
status: status,
752752
stdout: out,
753753
stderr: err,
754-
cmdline: format!("{}", cmd)
754+
cmdline: format!("{:?}", cmd)
755755
};
756756
}
757757
}
@@ -954,7 +954,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
954954
}
955955

956956
let prefixes = expected_errors.iter().map(|ee| {
957-
format!("{:?}:{}:", testfile.display(), ee.line)
957+
format!("{}:{}:", testfile.display(), ee.line)
958958
}).collect::<Vec<String> >();
959959

960960
#[cfg(windows)]

src/liballoc/arc.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ use core::prelude::*;
7272
use core::atomic;
7373
use core::atomic::Ordering::{Relaxed, Release, Acquire, SeqCst};
7474
use core::borrow::BorrowFrom;
75-
use core::fmt::{self, Show};
75+
use core::fmt;
7676
use core::cmp::{Ordering};
7777
use core::default::Default;
7878
use core::mem::{min_align_of, size_of};
@@ -578,16 +578,17 @@ impl<T: Ord> Ord for Arc<T> {
578578
#[stable]
579579
impl<T: Eq> Eq for Arc<T> {}
580580

581-
impl<T: fmt::Show> fmt::Show for Arc<T> {
581+
#[stable]
582+
impl<T: fmt::Display> fmt::Display for Arc<T> {
582583
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
583-
write!(f, "Arc({:?})", (**self))
584+
fmt::Display::fmt(&**self, f)
584585
}
585586
}
586587

587588
#[stable]
588-
impl<T: fmt::String> fmt::String for Arc<T> {
589+
impl<T: fmt::Debug> fmt::Debug for Arc<T> {
589590
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
590-
fmt::String::fmt(&**self, f)
591+
fmt::Debug::fmt(&**self, f)
591592
}
592593
}
593594

@@ -806,7 +807,7 @@ mod tests {
806807
#[test]
807808
fn show_arc() {
808809
let a = Arc::new(5u32);
809-
assert!(format!("{:?}", a) == "Arc(5u32)")
810+
assert_eq!(format!("{:?}", a), "5");
810811
}
811812

812813
// Make sure deriving works with Arc<T>

src/liballoc/boxed.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@ use core::any::Any;
1616
use core::clone::Clone;
1717
use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering};
1818
use core::default::Default;
19+
use core::error::{Error, FromError};
1920
use core::fmt;
2021
use core::hash::{self, Hash};
2122
use core::iter::Iterator;
2223
use core::marker::Sized;
2324
use core::mem;
25+
use core::ops::{Deref, DerefMut};
2426
use core::option::Option;
2527
use core::ptr::Unique;
2628
use core::raw::TraitObject;
27-
use core::result::Result;
2829
use core::result::Result::{Ok, Err};
29-
use core::ops::{Deref, DerefMut};
30+
use core::result::Result;
3031

3132
/// A value that represents the global exchange heap. This is the default
3233
/// place that the `box` keyword allocates into when no place is supplied.
@@ -157,20 +158,22 @@ impl BoxAny for Box<Any> {
157158
}
158159
}
159160

160-
impl<T: ?Sized + fmt::Show> fmt::Show for Box<T> {
161+
#[stable]
162+
impl<T: fmt::Display + ?Sized> fmt::Display for Box<T> {
161163
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
162-
write!(f, "Box({:?})", &**self)
164+
fmt::Display::fmt(&**self, f)
163165
}
164166
}
165167

166168
#[stable]
167-
impl<T: ?Sized + fmt::String> fmt::String for Box<T> {
169+
impl<T: fmt::Debug + ?Sized> fmt::Debug for Box<T> {
168170
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
169-
fmt::String::fmt(&**self, f)
171+
fmt::Debug::fmt(&**self, f)
170172
}
171173
}
172174

173-
impl fmt::Show for Box<Any> {
175+
#[stable]
176+
impl fmt::Debug for Box<Any> {
174177
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
175178
f.pad("Box<Any>")
176179
}
@@ -201,3 +204,9 @@ impl<'a, T> Iterator for Box<Iterator<Item=T> + 'a> {
201204
(**self).size_hint()
202205
}
203206
}
207+
208+
impl<'a, E: Error + 'a> FromError<E> for Box<Error + 'a> {
209+
fn from_error(err: E) -> Box<Error + 'a> {
210+
Box::new(err)
211+
}
212+
}

src/liballoc/rc.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -606,17 +606,17 @@ impl<S: hash::Hasher, T: Hash<S>> Hash<S> for Rc<T> {
606606
}
607607
}
608608

609-
#[unstable = "Show is experimental."]
610-
impl<T: fmt::Show> fmt::Show for Rc<T> {
609+
#[stable]
610+
impl<T: fmt::Display> fmt::Display for Rc<T> {
611611
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
612-
write!(f, "Rc({:?})", **self)
612+
fmt::Display::fmt(&**self, f)
613613
}
614614
}
615615

616616
#[stable]
617-
impl<T: fmt::String> fmt::String for Rc<T> {
617+
impl<T: fmt::Debug> fmt::Debug for Rc<T> {
618618
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
619-
fmt::String::fmt(&**self, f)
619+
fmt::Debug::fmt(&**self, f)
620620
}
621621
}
622622

@@ -737,8 +737,8 @@ impl<T> Clone for Weak<T> {
737737
}
738738
}
739739

740-
#[unstable = "Show is experimental."]
741-
impl<T: fmt::Show> fmt::Show for Weak<T> {
740+
#[stable]
741+
impl<T: fmt::Debug> fmt::Debug for Weak<T> {
742742
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
743743
write!(f, "(Weak)")
744744
}
@@ -1013,7 +1013,7 @@ mod tests {
10131013
#[test]
10141014
fn test_show() {
10151015
let foo = Rc::new(75u);
1016-
assert!(format!("{:?}", foo) == "Rc(75u)")
1016+
assert_eq!(format!("{:?}", foo), "75");
10171017
}
10181018

10191019
}

src/libcollections/bit.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ impl Ord for Bitv {
972972
}
973973

974974
#[stable]
975-
impl fmt::Show for Bitv {
975+
impl fmt::Debug for Bitv {
976976
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
977977
for bit in self.iter() {
978978
try!(write!(fmt, "{}", if bit { 1u32 } else { 0u32 }));
@@ -1727,7 +1727,7 @@ impl BitvSet {
17271727
}
17281728
}
17291729

1730-
impl fmt::Show for BitvSet {
1730+
impl fmt::Debug for BitvSet {
17311731
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
17321732
try!(write!(fmt, "BitvSet {{"));
17331733
let mut first = true;
@@ -2622,7 +2622,7 @@ mod bitv_set_test {
26222622
s.insert(10);
26232623
s.insert(50);
26242624
s.insert(2);
2625-
assert_eq!("BitvSet {1u, 2u, 10u, 50u}", format!("{:?}", s));
2625+
assert_eq!("BitvSet {1, 2, 10, 50}", format!("{:?}", s));
26262626
}
26272627

26282628
#[test]

src/libcollections/btree/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use core::prelude::*;
2222
use core::borrow::BorrowFrom;
2323
use core::cmp::Ordering;
2424
use core::default::Default;
25-
use core::fmt::Show;
25+
use core::fmt::Debug;
2626
use core::hash::{Hash, Hasher};
2727
use core::iter::{Map, FromIterator};
2828
use core::ops::{Index, IndexMut};
@@ -871,7 +871,7 @@ impl<K: Ord, V: Ord> Ord for BTreeMap<K, V> {
871871
}
872872

873873
#[stable]
874-
impl<K: Show, V: Show> Show for BTreeMap<K, V> {
874+
impl<K: Debug, V: Debug> Debug for BTreeMap<K, V> {
875875
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
876876
try!(write!(f, "BTreeMap {{"));
877877

src/libcollections/btree/set.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use core::prelude::*;
1616
use core::borrow::BorrowFrom;
1717
use core::cmp::Ordering::{self, Less, Greater, Equal};
1818
use core::default::Default;
19-
use core::fmt::Show;
19+
use core::fmt::Debug;
2020
use core::fmt;
2121
use core::iter::{Peekable, Map, FromIterator};
2222
use core::ops::{BitOr, BitAnd, BitXor, Sub};
@@ -589,7 +589,7 @@ impl<'a, 'b, T: Ord + Clone> BitOr<&'b BTreeSet<T>> for &'a BTreeSet<T> {
589589
}
590590

591591
#[stable]
592-
impl<T: Show> Show for BTreeSet<T> {
592+
impl<T: Debug> Debug for BTreeSet<T> {
593593
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
594594
try!(write!(f, "BTreeSet {{"));
595595

@@ -889,7 +889,7 @@ mod test {
889889

890890
let set_str = format!("{:?}", set);
891891

892-
assert_eq!(set_str, "BTreeSet {1i, 2i}");
892+
assert_eq!(set_str, "BTreeSet {1, 2}");
893893
assert_eq!(format!("{:?}", empty), "BTreeSet {}");
894894
}
895895
}

src/libcollections/dlist.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ impl<A: Clone> Clone for DList<A> {
874874
}
875875

876876
#[stable]
877-
impl<A: fmt::Show> fmt::Show for DList<A> {
877+
impl<A: fmt::Debug> fmt::Debug for DList<A> {
878878
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
879879
try!(write!(f, "DList ["));
880880

@@ -1333,7 +1333,7 @@ mod tests {
13331333
#[test]
13341334
fn test_show() {
13351335
let list: DList<int> = range(0i, 10).collect();
1336-
assert_eq!(format!("{:?}", list), "DList [0i, 1i, 2i, 3i, 4i, 5i, 6i, 7i, 8i, 9i]");
1336+
assert_eq!(format!("{:?}", list), "DList [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]");
13371337

13381338
let list: DList<&str> = vec!["just", "one", "test", "more"].iter()
13391339
.map(|&s| s)

src/libcollections/enum_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub struct EnumSet<E> {
3131

3232
impl<E> Copy for EnumSet<E> {}
3333

34-
impl<E:CLike+fmt::Show> fmt::Show for EnumSet<E> {
34+
impl<E:CLike + fmt::Debug> fmt::Debug for EnumSet<E> {
3535
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
3636
try!(write!(fmt, "EnumSet {{"));
3737
let mut first = true;

src/libcollections/ring_buf.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,7 @@ impl<A> Extend<A> for RingBuf<A> {
16111611
}
16121612

16131613
#[stable]
1614-
impl<T: fmt::Show> fmt::Show for RingBuf<T> {
1614+
impl<T: fmt::Debug> fmt::Debug for RingBuf<T> {
16151615
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
16161616
try!(write!(f, "RingBuf ["));
16171617

@@ -1630,7 +1630,7 @@ mod tests {
16301630
use self::Taggypar::*;
16311631
use prelude::*;
16321632
use core::iter;
1633-
use std::fmt::Show;
1633+
use std::fmt::Debug;
16341634
use std::hash::{self, SipHasher};
16351635
use test::Bencher;
16361636
use test;
@@ -1678,7 +1678,7 @@ mod tests {
16781678
}
16791679

16801680
#[cfg(test)]
1681-
fn test_parameterized<T:Clone + PartialEq + Show>(a: T, b: T, c: T, d: T) {
1681+
fn test_parameterized<T:Clone + PartialEq + Debug>(a: T, b: T, c: T, d: T) {
16821682
let mut deq = RingBuf::new();
16831683
assert_eq!(deq.len(), 0);
16841684
deq.push_front(a.clone());
@@ -2302,7 +2302,7 @@ mod tests {
23022302
#[test]
23032303
fn test_show() {
23042304
let ringbuf: RingBuf<int> = range(0i, 10).collect();
2305-
assert_eq!(format!("{:?}", ringbuf), "RingBuf [0i, 1i, 2i, 3i, 4i, 5i, 6i, 7i, 8i, 9i]");
2305+
assert_eq!(format!("{:?}", ringbuf), "RingBuf [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]");
23062306

23072307
let ringbuf: RingBuf<&str> = vec!["just", "one", "test", "more"].iter()
23082308
.map(|&s| s)

src/libcollections/slice.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,19 +2480,19 @@ mod tests {
24802480
}
24812481
let empty: Vec<int> = vec![];
24822482
test_show_vec!(empty, "[]");
2483-
test_show_vec!(vec![1i], "[1i]");
2484-
test_show_vec!(vec![1i, 2, 3], "[1i, 2i, 3i]");
2483+
test_show_vec!(vec![1i], "[1]");
2484+
test_show_vec!(vec![1i, 2, 3], "[1, 2, 3]");
24852485
test_show_vec!(vec![vec![], vec![1u], vec![1u, 1u]],
2486-
"[[], [1u], [1u, 1u]]");
2486+
"[[], [1], [1, 1]]");
24872487

24882488
let empty_mut: &mut [int] = &mut[];
24892489
test_show_vec!(empty_mut, "[]");
24902490
let v: &mut[int] = &mut[1];
2491-
test_show_vec!(v, "[1i]");
2491+
test_show_vec!(v, "[1]");
24922492
let v: &mut[int] = &mut[1, 2, 3];
2493-
test_show_vec!(v, "[1i, 2i, 3i]");
2493+
test_show_vec!(v, "[1, 2, 3]");
24942494
let v: &mut [&mut[uint]] = &mut[&mut[], &mut[1u], &mut[1u, 1u]];
2495-
test_show_vec!(v, "[[], [1u], [1u, 1u]]");
2495+
test_show_vec!(v, "[[], [1], [1, 1]]");
24962496
}
24972497

24982498
#[test]

0 commit comments

Comments
 (0)