1
Fork 0

More test fixes

This commit is contained in:
Alex Crichton 2015-01-06 16:16:35 -08:00
parent 24ccb34266
commit a64000820f
64 changed files with 227 additions and 187 deletions

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
#![crate_type = "bin"] #![crate_type = "bin"]
#![feature(phase, slicing_syntax, globs, unboxed_closures)] #![feature(slicing_syntax, unboxed_closures)]
#![deny(warnings)] #![deny(warnings)]

View file

@ -167,10 +167,10 @@ fn parse_version(header: &[u8]) -> Result<Version, ParseError> {
let version = parse_version(&[1, 2, 3, 4]); let version = parse_version(&[1, 2, 3, 4]);
match version { match version {
Ok(v) => { Ok(v) => {
println!("working with version: {}", v); println!("working with version: {:?}", v);
} }
Err(e) => { Err(e) => {
println!("error parsing header: {}", e); println!("error parsing header: {:?}", e);
} }
} }
``` ```

View file

@ -42,7 +42,7 @@ the pattern in the above code:
# let input_1 = T::SpecialA(0); # let input_1 = T::SpecialA(0);
# let input_2 = T::SpecialA(0); # let input_2 = T::SpecialA(0);
macro_rules! early_return { macro_rules! early_return {
($inp:expr $sp:path) => ( // invoke it like `(input_5 SpecialE)` ($inp:expr, $sp:path) => ( // invoke it like `(input_5 SpecialE)`
match $inp { match $inp {
$sp(x) => { return x; } $sp(x) => { return x; }
_ => {} _ => {}
@ -50,9 +50,9 @@ macro_rules! early_return {
); );
} }
// ... // ...
early_return!(input_1 T::SpecialA); early_return!(input_1, T::SpecialA);
// ... // ...
early_return!(input_2 T::SpecialB); early_return!(input_2, T::SpecialB);
# return 0; # return 0;
# } # }
# fn main() {} # fn main() {}

View file

@ -620,7 +620,7 @@ enum List<T> {
fn main() { fn main() {
let list: List<int> = List::Cons(1, box List::Cons(2, box List::Cons(3, box List::Nil))); let list: List<int> = List::Cons(1, box List::Cons(2, box List::Cons(3, box List::Nil)));
println!("{}", list); println!("{:?}", list);
} }
``` ```

View file

@ -41,7 +41,7 @@
//! let five = five.clone(); //! let five = five.clone();
//! //!
//! Thread::spawn(move || { //! Thread::spawn(move || {
//! println!("{}", five); //! println!("{:?}", five);
//! }); //! });
//! } //! }
//! ``` //! ```

View file

@ -65,7 +65,7 @@
#![no_std] #![no_std]
#![allow(unknown_features)] #![allow(unknown_features)]
#![feature(lang_items, phase, unsafe_destructor)] #![feature(lang_items, unsafe_destructor)]
#[macro_use] #[macro_use]
extern crate core; extern crate core;

View file

@ -143,17 +143,17 @@ static FALSE: bool = false;
/// bv.set(3, true); /// bv.set(3, true);
/// bv.set(5, true); /// bv.set(5, true);
/// bv.set(7, true); /// bv.set(7, true);
/// println!("{}", bv.to_string()); /// println!("{:?}", bv);
/// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count()); /// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count());
/// ///
/// // flip all values in bitvector, producing non-primes less than 10 /// // flip all values in bitvector, producing non-primes less than 10
/// bv.negate(); /// bv.negate();
/// println!("{}", bv.to_string()); /// println!("{:?}", bv);
/// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count()); /// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count());
/// ///
/// // reset bitvector to empty /// // reset bitvector to empty
/// bv.clear(); /// bv.clear();
/// println!("{}", bv.to_string()); /// println!("{:?}", bv);
/// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count()); /// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count());
/// ``` /// ```
#[stable] #[stable]
@ -1881,10 +1881,10 @@ mod tests {
#[test] #[test]
fn test_to_str() { fn test_to_str() {
let zerolen = Bitv::new(); let zerolen = Bitv::new();
assert_eq!(zerolen.to_string(), ""); assert_eq!(format!("{:?}", zerolen), "");
let eightbits = Bitv::from_elem(8u, false); let eightbits = Bitv::from_elem(8u, false);
assert_eq!(eightbits.to_string(), "00000000") assert_eq!(format!("{:?}", eightbits), "00000000")
} }
#[test] #[test]
@ -1910,7 +1910,7 @@ mod tests {
let mut b = Bitv::from_elem(2, false); let mut b = Bitv::from_elem(2, false);
b.set(0, true); b.set(0, true);
b.set(1, false); b.set(1, false);
assert_eq!(b.to_string(), "10"); assert_eq!(format!("{:?}", b), "10");
assert!(!b.none() && !b.all()); assert!(!b.none() && !b.all());
} }
@ -2245,7 +2245,7 @@ mod tests {
fn test_from_bytes() { fn test_from_bytes() {
let bitv = Bitv::from_bytes(&[0b10110110, 0b00000000, 0b11111111]); let bitv = Bitv::from_bytes(&[0b10110110, 0b00000000, 0b11111111]);
let str = concat!("10110110", "00000000", "11111111"); let str = concat!("10110110", "00000000", "11111111");
assert_eq!(bitv.to_string(), str); assert_eq!(format!("{:?}", bitv), str);
} }
#[test] #[test]
@ -2264,7 +2264,7 @@ mod tests {
fn test_from_bools() { fn test_from_bools() {
let bools = vec![true, false, true, true]; let bools = vec![true, false, true, true];
let bitv: Bitv = bools.iter().map(|n| *n).collect(); let bitv: Bitv = bools.iter().map(|n| *n).collect();
assert_eq!(bitv.to_string(), "1011"); assert_eq!(format!("{:?}", bitv), "1011");
} }
#[test] #[test]
@ -2622,7 +2622,7 @@ mod bitv_set_test {
s.insert(10); s.insert(10);
s.insert(50); s.insert(50);
s.insert(2); s.insert(2);
assert_eq!("{1, 2, 10, 50}", s.to_string()); assert_eq!("BitvSet {1u, 2u, 10u, 50u}", format!("{:?}", s));
} }
#[test] #[test]

View file

@ -1347,7 +1347,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// ///
/// // count the number of occurrences of letters in the vec /// // count the number of occurrences of letters in the vec
/// for x in vec!["a","b","a","c","a","b"].iter() { /// for x in vec!["a","b","a","c","a","b"].iter() {
/// match count.entry(x) { /// match count.entry(*x) {
/// Entry::Vacant(view) => { /// Entry::Vacant(view) => {
/// view.insert(1); /// view.insert(1);
/// }, /// },

View file

@ -842,9 +842,9 @@ mod test {
set.insert(1); set.insert(1);
set.insert(2); set.insert(2);
let set_str = format!("{}", set); let set_str = format!("{:?}", set);
assert!(set_str == "{1, 2}"); assert_eq!(set_str, "BTreeSet {1i, 2i}");
assert_eq!(format!("{}", empty), "{}"); assert_eq!(format!("{:?}", empty), "BTreeSet {}");
} }
} }

View file

@ -1018,12 +1018,12 @@ mod tests {
#[test] #[test]
fn test_show() { fn test_show() {
let list: DList<int> = range(0i, 10).collect(); let list: DList<int> = range(0i, 10).collect();
assert!(list.to_string() == "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"); assert_eq!(format!("{:?}", list), "DList [0i, 1i, 2i, 3i, 4i, 5i, 6i, 7i, 8i, 9i]");
let list: DList<&str> = vec!["just", "one", "test", "more"].iter() let list: DList<&str> = vec!["just", "one", "test", "more"].iter()
.map(|&s| s) .map(|&s| s)
.collect(); .collect();
assert!(list.to_string() == "[just, one, test, more]"); assert_eq!(format!("{:?}", list), "DList [\"just\", \"one\", \"test\", \"more\"]");
} }
#[cfg(test)] #[cfg(test)]

View file

@ -24,6 +24,7 @@
#![allow(unknown_features)] #![allow(unknown_features)]
#![feature(unsafe_destructor, slicing_syntax)] #![feature(unsafe_destructor, slicing_syntax)]
#![feature(old_impl_check)] #![feature(old_impl_check)]
#![feature(unboxed_closures)]
#![no_std] #![no_std]
#[macro_use] #[macro_use]

View file

@ -1648,21 +1648,15 @@ mod tests {
assert_eq!(d.len(), 3u); assert_eq!(d.len(), 3u);
d.push_back(137); d.push_back(137);
assert_eq!(d.len(), 4u); assert_eq!(d.len(), 4u);
debug!("{}", d.front());
assert_eq!(*d.front().unwrap(), 42); assert_eq!(*d.front().unwrap(), 42);
debug!("{}", d.back());
assert_eq!(*d.back().unwrap(), 137); assert_eq!(*d.back().unwrap(), 137);
let mut i = d.pop_front(); let mut i = d.pop_front();
debug!("{}", i);
assert_eq!(i, Some(42)); assert_eq!(i, Some(42));
i = d.pop_back(); i = d.pop_back();
debug!("{}", i);
assert_eq!(i, Some(137)); assert_eq!(i, Some(137));
i = d.pop_back(); i = d.pop_back();
debug!("{}", i);
assert_eq!(i, Some(137)); assert_eq!(i, Some(137));
i = d.pop_back(); i = d.pop_back();
debug!("{}", i);
assert_eq!(i, Some(17)); assert_eq!(i, Some(17));
assert_eq!(d.len(), 0u); assert_eq!(d.len(), 0u);
d.push_back(3); d.push_back(3);
@ -2308,12 +2302,12 @@ mod tests {
#[test] #[test]
fn test_show() { fn test_show() {
let ringbuf: RingBuf<int> = range(0i, 10).collect(); let ringbuf: RingBuf<int> = range(0i, 10).collect();
assert!(format!("{}", ringbuf) == "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"); assert_eq!(format!("{:?}", ringbuf), "RingBuf [0i, 1i, 2i, 3i, 4i, 5i, 6i, 7i, 8i, 9i]");
let ringbuf: RingBuf<&str> = vec!["just", "one", "test", "more"].iter() let ringbuf: RingBuf<&str> = vec!["just", "one", "test", "more"].iter()
.map(|&s| s) .map(|&s| s)
.collect(); .collect();
assert!(format!("{}", ringbuf) == "[just, one, test, more]"); assert_eq!(format!("{:?}", ringbuf), "RingBuf [\"just\", \"one\", \"test\", \"more\"]");
} }
#[test] #[test]

View file

@ -922,7 +922,6 @@ pub trait ToString {
} }
#[cfg(stage0)] #[cfg(stage0)]
//NOTE(stage0): remove after stage0 snapshot
impl<T: fmt::Show> ToString for T { impl<T: fmt::Show> ToString for T {
fn to_string(&self) -> String { fn to_string(&self) -> String {
use core::fmt::Writer; use core::fmt::Writer;

View file

@ -1448,14 +1448,23 @@ impl<T> Default for Vec<T> {
} }
#[experimental = "waiting on Show stability"] #[experimental = "waiting on Show stability"]
impl<T:fmt::Show> fmt::Show for Vec<T> { impl<T: fmt::Show> fmt::Show for Vec<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Show::fmt(self.as_slice(), f) fmt::Show::fmt(self.as_slice(), f)
} }
} }
#[cfg(stage0)]
#[experimental = "waiting on Show stability"] #[experimental = "waiting on Show stability"]
impl<T:fmt::String> fmt::String for Vec<T> { impl<T: fmt::Show> fmt::String for Vec<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(self.as_slice(), f)
}
}
#[cfg(not(stage0))]
#[experimental = "waiting on Show stability"]
impl<T: fmt::String> fmt::String for Vec<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(self.as_slice(), f) fmt::String::fmt(self.as_slice(), f)
} }

View file

@ -46,10 +46,10 @@
//! // different type: just print it out unadorned. //! // different type: just print it out unadorned.
//! match value_any.downcast_ref::<String>() { //! match value_any.downcast_ref::<String>() {
//! Some(as_string) => { //! Some(as_string) => {
//! println!("String ({}): {:?}", as_string.len(), as_string); //! println!("String ({}): {}", as_string.len(), as_string);
//! } //! }
//! None => { //! None => {
//! println!("{}", value); //! println!("{:?}", value);
//! } //! }
//! } //! }
//! } //! }

View file

@ -213,15 +213,12 @@ pub struct Arguments<'a> {
args: &'a [Argument<'a>], args: &'a [Argument<'a>],
} }
#[cfg(stage0)]
//FIXME: remove after stage0 snapshot
impl<'a> Show for Arguments<'a> { impl<'a> Show for Arguments<'a> {
fn fmt(&self, fmt: &mut Formatter) -> Result { fn fmt(&self, fmt: &mut Formatter) -> Result {
write(fmt.buf, *self) String::fmt(self, fmt)
} }
} }
#[cfg(not(stage0))]
impl<'a> String for Arguments<'a> { impl<'a> String for Arguments<'a> {
fn fmt(&self, fmt: &mut Formatter) -> Result { fn fmt(&self, fmt: &mut Formatter) -> Result {
write(fmt.buf, *self) write(fmt.buf, *self)
@ -799,10 +796,15 @@ floating! { f64 }
impl<T> Show for *const T { impl<T> Show for *const T {
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) } fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
} }
impl<T> String for *const T {
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
}
impl<T> Show for *mut T { impl<T> Show for *mut T {
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) } fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
} }
impl<T> String for *mut T {
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
}
macro_rules! peel { macro_rules! peel {
($name:ident, $($other:ident,)*) => (tuple! { $($other,)* }) ($name:ident, $($other:ident,)*) => (tuple! { $($other,)* })
@ -861,8 +863,12 @@ impl<T: Show> Show for [T] {
} }
} }
impl<T: String> String for [T] { #[cfg(stage0)]
impl<T: Show> String for [T] {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 {
try!(write!(f, "["));
}
let mut is_first = true; let mut is_first = true;
for x in self.iter() { for x in self.iter() {
if is_first { if is_first {
@ -870,7 +876,31 @@ impl<T: String> String for [T] {
} else { } else {
try!(write!(f, ", ")); try!(write!(f, ", "));
} }
try!(String::fmt(x, f)) try!(write!(f, "{}", *x))
}
if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 {
try!(write!(f, "]"));
}
Ok(())
}
}
#[cfg(not(stage0))]
impl<T: String> String for [T] {
fn fmt(&self, f: &mut Formatter) -> Result {
if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 {
try!(write!(f, "["));
}
let mut is_first = true;
for x in self.iter() {
if is_first {
is_first = false;
} else {
try!(write!(f, ", "));
}
try!(write!(f, "{}", *x))
}
if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 {
try!(write!(f, "]"));
} }
Ok(()) Ok(())
} }
@ -882,6 +912,12 @@ impl Show for () {
} }
} }
impl String for () {
fn fmt(&self, f: &mut Formatter) -> Result {
f.pad("()")
}
}
impl<T: Copy + Show> Show for Cell<T> { impl<T: Copy + Show> Show for Cell<T> {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
write!(f, "Cell {{ value: {:?} }}", self.get()) write!(f, "Cell {{ value: {:?} }}", self.get())

View file

@ -182,8 +182,8 @@ macro_rules! writeln {
($dst:expr, $fmt:expr) => ( ($dst:expr, $fmt:expr) => (
write!($dst, concat!($fmt, "\n")) write!($dst, concat!($fmt, "\n"))
); );
($dst:expr, $fmt:expr, $($arg:expr),*) => ( ($dst:expr, $fmt:expr, $($arg:tt)*) => (
write!($dst, concat!($fmt, "\n"), $($arg,)*) write!($dst, concat!($fmt, "\n"), $($arg)*)
); );
} }

View file

@ -51,8 +51,8 @@
//! } //! }
//! } //! }
//! fn main() { //! fn main() {
//! println!("{}", Point {x: 1, y: 0} + Point {x: 2, y: 3}); //! println!("{:?}", Point {x: 1, y: 0} + Point {x: 2, y: 3});
//! println!("{}", Point {x: 1, y: 0} - Point {x: 2, y: 3}); //! println!("{:?}", Point {x: 1, y: 0} - Point {x: 2, y: 3});
//! } //! }
//! ``` //! ```
//! //!

View file

@ -238,7 +238,7 @@ impl<T> Option<T> {
/// // First, cast `Option<String>` to `Option<&String>` with `as_ref`, /// // First, cast `Option<String>` to `Option<&String>` with `as_ref`,
/// // then consume *that* with `map`, leaving `num_as_str` on the stack. /// // then consume *that* with `map`, leaving `num_as_str` on the stack.
/// let num_as_int: Option<uint> = num_as_str.as_ref().map(|n| n.len()); /// let num_as_int: Option<uint> = num_as_str.as_ref().map(|n| n.len());
/// println!("still can print num_as_str: {}", num_as_str); /// println!("still can print num_as_str: {:?}", num_as_str);
/// ``` /// ```
#[inline] #[inline]
#[stable] #[stable]

View file

@ -25,7 +25,7 @@
//! use std::simd::f32x4; //! use std::simd::f32x4;
//! let a = f32x4(40.0, 41.0, 42.0, 43.0); //! let a = f32x4(40.0, 41.0, 42.0, 43.0);
//! let b = f32x4(1.0, 1.1, 3.4, 9.8); //! let b = f32x4(1.0, 1.1, 3.4, 9.8);
//! println!("{}", a + b); //! println!("{:?}", a + b);
//! } //! }
//! ``` //! ```
//! //!

View file

@ -140,7 +140,7 @@ pub trait Rng : Sized {
/// ///
/// let mut v = [0u8; 13579]; /// let mut v = [0u8; 13579];
/// thread_rng().fill_bytes(&mut v); /// thread_rng().fill_bytes(&mut v);
/// println!("{}", v.as_slice()); /// println!("{:?}", v.as_slice());
/// ``` /// ```
fn fill_bytes(&mut self, dest: &mut [u8]) { fn fill_bytes(&mut self, dest: &mut [u8]) {
// this could, in theory, be done by transmuting dest to a // this could, in theory, be done by transmuting dest to a
@ -176,7 +176,7 @@ pub trait Rng : Sized {
/// let mut rng = thread_rng(); /// let mut rng = thread_rng();
/// let x: uint = rng.gen(); /// let x: uint = rng.gen();
/// println!("{}", x); /// println!("{}", x);
/// println!("{}", rng.gen::<(f64, bool)>()); /// println!("{:?}", rng.gen::<(f64, bool)>());
/// ``` /// ```
#[inline(always)] #[inline(always)]
fn gen<T: Rand>(&mut self) -> T { fn gen<T: Rand>(&mut self) -> T {
@ -194,8 +194,8 @@ pub trait Rng : Sized {
/// let mut rng = thread_rng(); /// let mut rng = thread_rng();
/// let x = rng.gen_iter::<uint>().take(10).collect::<Vec<uint>>(); /// let x = rng.gen_iter::<uint>().take(10).collect::<Vec<uint>>();
/// println!("{}", x); /// println!("{}", x);
/// println!("{}", rng.gen_iter::<(f64, bool)>().take(5) /// println!("{:?}", rng.gen_iter::<(f64, bool)>().take(5)
/// .collect::<Vec<(f64, bool)>>()); /// .collect::<Vec<(f64, bool)>>());
/// ``` /// ```
fn gen_iter<'a, T: Rand>(&'a mut self) -> Generator<'a, T, Self> { fn gen_iter<'a, T: Rand>(&'a mut self) -> Generator<'a, T, Self> {
Generator { rng: self } Generator { rng: self }
@ -268,7 +268,7 @@ pub trait Rng : Sized {
/// ///
/// let choices = [1i, 2, 4, 8, 16, 32]; /// let choices = [1i, 2, 4, 8, 16, 32];
/// let mut rng = thread_rng(); /// let mut rng = thread_rng();
/// println!("{}", rng.choose(&choices)); /// println!("{:?}", rng.choose(&choices));
/// # // uncomment when slicing syntax is stable /// # // uncomment when slicing syntax is stable
/// //assert_eq!(rng.choose(choices.index(&(0..0))), None); /// //assert_eq!(rng.choose(choices.index(&(0..0))), None);
/// ``` /// ```

View file

@ -12,7 +12,7 @@ macro_rules! regex {
($re:expr) => ( ($re:expr) => (
match ::regex::Regex::new($re) { match ::regex::Regex::new($re) {
Ok(re) => re, Ok(re) => re,
Err(err) => panic!("{}", err), Err(err) => panic!("{:?}", err),
} }
); );
} }

View file

@ -162,7 +162,7 @@ macro_rules! mat {
sgot = &sgot[..expected.len()] sgot = &sgot[..expected.len()]
} }
if expected != sgot { if expected != sgot {
panic!("For RE '{}' against '{}', expected '{}' but got '{}'", panic!("For RE '{}' against '{}', expected '{:?}' but got '{:?}'",
$re, text, expected, sgot); $re, text, expected, sgot);
} }
} }

View file

@ -204,7 +204,7 @@ impl<'a> CrateReader<'a> {
match i.node { match i.node {
ast::ViewItemExternCrate(ident, ref path_opt, id) => { ast::ViewItemExternCrate(ident, ref path_opt, id) => {
let ident = token::get_ident(ident); let ident = token::get_ident(ident);
debug!("resolving extern crate stmt. ident: {} path_opt: {}", debug!("resolving extern crate stmt. ident: {} path_opt: {:?}",
ident, path_opt); ident, path_opt);
let name = match *path_opt { let name = match *path_opt {
Some((ref path_str, _)) => { Some((ref path_str, _)) => {

View file

@ -419,7 +419,7 @@ mod test {
graph.each_incoming_edge(start_index, |edge_index, edge| { graph.each_incoming_edge(start_index, |edge_index, edge| {
assert!(graph.edge_data(edge_index) == &edge.data); assert!(graph.edge_data(edge_index) == &edge.data);
assert!(counter < expected_incoming.len()); assert!(counter < expected_incoming.len());
debug!("counter={} expected={} edge_index={} edge={}", debug!("counter={:?} expected={:?} edge_index={:?} edge={:?}",
counter, expected_incoming[counter], edge_index, edge); counter, expected_incoming[counter], edge_index, edge);
match expected_incoming[counter] { match expected_incoming[counter] {
(ref e, ref n) => { (ref e, ref n) => {
@ -437,7 +437,7 @@ mod test {
graph.each_outgoing_edge(start_index, |edge_index, edge| { graph.each_outgoing_edge(start_index, |edge_index, edge| {
assert!(graph.edge_data(edge_index) == &edge.data); assert!(graph.edge_data(edge_index) == &edge.data);
assert!(counter < expected_outgoing.len()); assert!(counter < expected_outgoing.len());
debug!("counter={} expected={} edge_index={} edge={}", debug!("counter={:?} expected={:?} edge_index={:?} edge={:?}",
counter, expected_outgoing[counter], edge_index, edge); counter, expected_outgoing[counter], edge_index, edge);
match expected_outgoing[counter] { match expected_outgoing[counter] {
(ref e, ref n) => { (ref e, ref n) => {

View file

@ -1726,7 +1726,7 @@ impl fmt::Show for RegionVid {
impl<'tcx> fmt::Show for FnSig<'tcx> { impl<'tcx> fmt::Show for FnSig<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "({}; variadic: {})->{}", self.inputs, self.variadic, self.output) write!(f, "({:?}; variadic: {})->{:?}", self.inputs, self.variadic, self.output)
} }
} }

View file

@ -418,7 +418,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
self.ty_to_string(t_glb)); self.ty_to_string(t_glb));
match self.glb().tys(t1, t2) { match self.glb().tys(t1, t2) {
Err(e) => { Err(e) => {
panic!("unexpected error computing LUB: {}", e) panic!("unexpected error computing LUB: {:?}", e)
} }
Ok(t) => { Ok(t) => {
self.assert_eq(t, t_glb); self.assert_eq(t, t_glb);
@ -841,7 +841,7 @@ fn walk_ty_skip_subtree() {
let mut walker = uniq_ty.walk(); let mut walker = uniq_ty.walk();
while let Some(t) = walker.next() { while let Some(t) = walker.next() {
debug!("walked to {}", t); debug!("walked to {:?}", t);
let (expected_ty, skip) = expected.pop().unwrap(); let (expected_ty, skip) = expected.pop().unwrap();
assert_eq!(t, expected_ty); assert_eq!(t, expected_ty);
if skip { walker.skip_current_subtree(); } if skip { walker.skip_current_subtree(); }

View file

@ -446,7 +446,7 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
for pass in config.passes.iter() { for pass in config.passes.iter() {
let pass = CString::from_slice(pass.as_bytes()); let pass = CString::from_slice(pass.as_bytes());
if !llvm::LLVMRustAddPass(mpm, pass.as_ptr()) { if !llvm::LLVMRustAddPass(mpm, pass.as_ptr()) {
cgcx.handler.warn(format!("unknown pass {}, ignoring", cgcx.handler.warn(format!("unknown pass {:?}, ignoring",
pass).as_slice()); pass).as_slice());
} }
} }

View file

@ -195,7 +195,7 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
ast::PatRegion(ref inner, mutbl) => { ast::PatRegion(ref inner, mutbl) => {
let inner_ty = fcx.infcx().next_ty_var(); let inner_ty = fcx.infcx().next_ty_var();
// SNAP b2085d9 remove this `if`-`else` entirely after next snapshot // SNAP 340ac04 remove this `if`-`else` entirely after next snapshot
let mutbl = if mutbl == ast::MutImmutable { let mutbl = if mutbl == ast::MutImmutable {
ty::deref(fcx.infcx().shallow_resolve(expected), true) ty::deref(fcx.infcx().shallow_resolve(expected), true)
.map(|mt| mt.mutbl).unwrap_or(ast::MutImmutable) .map(|mt| mt.mutbl).unwrap_or(ast::MutImmutable)

View file

@ -176,8 +176,6 @@ impl TocBuilder {
} }
} }
//NOTE(stage0): remove impl after snapshot
#[cfg(stage0)]
impl fmt::Show for Toc { impl fmt::Show for Toc {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(self, f) fmt::String::fmt(self, f)

View file

@ -2005,7 +2005,7 @@ macro_rules! expect {
match $e { match $e {
Json::Null => Ok(()), Json::Null => Ok(()),
other => Err(ExpectedError("Null".to_string(), other => Err(ExpectedError("Null".to_string(),
format!("{:?}", other))) format!("{}", other)))
} }
}); });
($e:expr, $t:ident) => ({ ($e:expr, $t:ident) => ({
@ -2013,7 +2013,7 @@ macro_rules! expect {
Json::$t(v) => Ok(v), Json::$t(v) => Ok(v),
other => { other => {
Err(ExpectedError(stringify!($t).to_string(), Err(ExpectedError(stringify!($t).to_string(),
format!("{:?}", other))) format!("{}", other)))
} }
} }
}) })
@ -2025,20 +2025,20 @@ macro_rules! read_primitive {
match self.pop() { match self.pop() {
Json::I64(f) => match num::cast(f) { Json::I64(f) => match num::cast(f) {
Some(f) => Ok(f), Some(f) => Ok(f),
None => Err(ExpectedError("Number".to_string(), format!("{:?}", f))), None => Err(ExpectedError("Number".to_string(), format!("{}", f))),
}, },
Json::U64(f) => match num::cast(f) { Json::U64(f) => match num::cast(f) {
Some(f) => Ok(f), Some(f) => Ok(f),
None => Err(ExpectedError("Number".to_string(), format!("{:?}", f))), None => Err(ExpectedError("Number".to_string(), format!("{}", f))),
}, },
Json::F64(f) => Err(ExpectedError("Integer".to_string(), format!("{:?}", f))), Json::F64(f) => Err(ExpectedError("Integer".to_string(), format!("{}", f))),
// re: #12967.. a type w/ numeric keys (ie HashMap<uint, V> etc) // re: #12967.. a type w/ numeric keys (ie HashMap<uint, V> etc)
// is going to have a string here, as per JSON spec. // is going to have a string here, as per JSON spec.
Json::String(s) => match s.parse() { Json::String(s) => match s.parse() {
Some(f) => Ok(f), Some(f) => Ok(f),
None => Err(ExpectedError("Number".to_string(), s)), None => Err(ExpectedError("Number".to_string(), s)),
}, },
value => Err(ExpectedError("Number".to_string(), format!("{:?}", value))), value => Err(ExpectedError("Number".to_string(), format!("{}", value))),
} }
} }
} }
@ -2078,7 +2078,7 @@ impl ::Decoder for Decoder {
} }
}, },
Json::Null => Ok(f64::NAN), Json::Null => Ok(f64::NAN),
value => Err(ExpectedError("Number".to_string(), format!("{:?}", value))) value => Err(ExpectedError("Number".to_string(), format!("{}", value)))
} }
} }
@ -2096,7 +2096,7 @@ impl ::Decoder for Decoder {
_ => () _ => ()
} }
} }
Err(ExpectedError("single character string".to_string(), format!("{:?}", s))) Err(ExpectedError("single character string".to_string(), format!("{}", s)))
} }
fn read_str(&mut self) -> DecodeResult<string::String> { fn read_str(&mut self) -> DecodeResult<string::String> {
@ -2119,7 +2119,7 @@ impl ::Decoder for Decoder {
let n = match o.remove(&"variant".to_string()) { let n = match o.remove(&"variant".to_string()) {
Some(Json::String(s)) => s, Some(Json::String(s)) => s,
Some(val) => { Some(val) => {
return Err(ExpectedError("String".to_string(), format!("{:?}", val))) return Err(ExpectedError("String".to_string(), format!("{}", val)))
} }
None => { None => {
return Err(MissingFieldError("variant".to_string())) return Err(MissingFieldError("variant".to_string()))
@ -2132,7 +2132,7 @@ impl ::Decoder for Decoder {
} }
}, },
Some(val) => { Some(val) => {
return Err(ExpectedError("Array".to_string(), format!("{:?}", val))) return Err(ExpectedError("Array".to_string(), format!("{}", val)))
} }
None => { None => {
return Err(MissingFieldError("fields".to_string())) return Err(MissingFieldError("fields".to_string()))
@ -2141,7 +2141,7 @@ impl ::Decoder for Decoder {
n n
} }
json => { json => {
return Err(ExpectedError("String or Object".to_string(), format!("{:?}", json))) return Err(ExpectedError("String or Object".to_string(), format!("{}", json)))
} }
}; };
let idx = match names.iter().position(|n| *n == name.index(&FullRange)) { let idx = match names.iter().position(|n| *n == name.index(&FullRange)) {
@ -2911,7 +2911,8 @@ mod tests {
assert_eq!(v, i64::MAX); assert_eq!(v, i64::MAX);
let res: DecodeResult<i64> = super::decode("765.25252"); let res: DecodeResult<i64> = super::decode("765.25252");
assert_eq!(res, Err(ExpectedError("Integer".to_string(), "765.25252".to_string()))); assert_eq!(res, Err(ExpectedError("Integer".to_string(),
"765.25252".to_string())));
} }
#[test] #[test]

View file

@ -71,7 +71,7 @@
/// let mut flags = FLAG_A | FLAG_B; /// let mut flags = FLAG_A | FLAG_B;
/// flags.clear(); /// flags.clear();
/// assert!(flags.is_empty()); /// assert!(flags.is_empty());
/// assert_eq!(format!("{}", flags).as_slice(), "hi!"); /// assert_eq!(format!("{:?}", flags).as_slice(), "hi!");
/// } /// }
/// ``` /// ```
/// ///

View file

@ -1894,7 +1894,8 @@ mod test_map {
let map_str = format!("{:?}", map); let map_str = format!("{:?}", map);
assert!(map_str == "HashMap {1i: 2i, 3i: 4i}" || map_str == "{3i: 4i, 1i: 2i}"); assert!(map_str == "HashMap {1i: 2i, 3i: 4i}" ||
map_str == "HashMap {3i: 4i, 1i: 2i}");
assert_eq!(format!("{:?}", empty), "HashMap {}"); assert_eq!(format!("{:?}", empty), "HashMap {}");
} }

View file

@ -1130,7 +1130,7 @@ mod test_set {
let set_str = format!("{:?}", set); let set_str = format!("{:?}", set);
assert!(set_str == "HashSet {1i, 2i}" || set_str == "{2i, 1i}"); assert!(set_str == "HashSet {1i, 2i}" || set_str == "HashSet {2i, 1i}");
assert_eq!(format!("{:?}", empty), "HashSet {}"); assert_eq!(format!("{:?}", empty), "HashSet {}");
} }

View file

@ -230,9 +230,9 @@
//! Some examples of the output from both traits: //! Some examples of the output from both traits:
//! //!
//! ``` //! ```
//! assert_eq(format!("{} {:?}", 3i32, 4i32), "3 4i32"); //! assert_eq!(format!("{} {:?}", 3i32, 4i32), "3 4i32");
//! assert_eq(format!("{} {:?}", 'a', 'b'), "a 'b'"); //! assert_eq!(format!("{} {:?}", 'a', 'b'), "a 'b'");
//! assert_eq(format!("{} {:?}", "foo\n", "bar\n"), "foo\n \"bar\\n\""); //! assert_eq!(format!("{} {:?}", "foo\n", "bar\n"), "foo\n \"bar\\n\"");
//! ``` //! ```
//! //!
//! ### Related macros //! ### Related macros

View file

@ -107,7 +107,7 @@ impl File {
/// ///
/// let file = match File::open_mode(&p, Open, ReadWrite) { /// let file = match File::open_mode(&p, Open, ReadWrite) {
/// Ok(f) => f, /// Ok(f) => f,
/// Err(e) => panic!("file error: {:?}", e), /// Err(e) => panic!("file error: {}", e),
/// }; /// };
/// // do some stuff with that file /// // do some stuff with that file
/// ///
@ -156,7 +156,7 @@ impl File {
}) })
} }
}).update_err("couldn't open path as file", |e| { }).update_err("couldn't open path as file", |e| {
format!("{:?}; path={:?}; mode={}; access={}", e, path.display(), format!("{}; path={:?}; mode={}; access={}", e, path.display(),
mode_string(mode), access_string(access)) mode_string(mode), access_string(access))
}) })
} }
@ -211,7 +211,7 @@ impl File {
pub fn fsync(&mut self) -> IoResult<()> { pub fn fsync(&mut self) -> IoResult<()> {
self.fd.fsync() self.fd.fsync()
.update_err("couldn't fsync file", .update_err("couldn't fsync file",
|e| format!("{:?}; path={:?}", e, self.path.display())) |e| format!("{}; path={:?}", e, self.path.display()))
} }
/// This function is similar to `fsync`, except that it may not synchronize /// This function is similar to `fsync`, except that it may not synchronize
@ -221,7 +221,7 @@ impl File {
pub fn datasync(&mut self) -> IoResult<()> { pub fn datasync(&mut self) -> IoResult<()> {
self.fd.datasync() self.fd.datasync()
.update_err("couldn't datasync file", .update_err("couldn't datasync file",
|e| format!("{:?}; path={:?}", e, self.path.display())) |e| format!("{}; path={:?}", e, self.path.display()))
} }
/// Either truncates or extends the underlying file, updating the size of /// Either truncates or extends the underlying file, updating the size of
@ -235,7 +235,7 @@ impl File {
pub fn truncate(&mut self, size: i64) -> IoResult<()> { pub fn truncate(&mut self, size: i64) -> IoResult<()> {
self.fd.truncate(size) self.fd.truncate(size)
.update_err("couldn't truncate file", |e| .update_err("couldn't truncate file", |e|
format!("{:?}; path={:?}; size={:?}", e, self.path.display(), size)) format!("{}; path={:?}; size={:?}", e, self.path.display(), size))
} }
/// Returns true if the stream has reached the end of the file. /// Returns true if the stream has reached the end of the file.
@ -255,7 +255,7 @@ impl File {
pub fn stat(&self) -> IoResult<FileStat> { pub fn stat(&self) -> IoResult<FileStat> {
self.fd.fstat() self.fd.fstat()
.update_err("couldn't fstat file", |e| .update_err("couldn't fstat file", |e|
format!("{:?}; path={:?}", e, self.path.display())) format!("{}; path={:?}", e, self.path.display()))
} }
} }
@ -283,7 +283,7 @@ impl File {
pub fn unlink(path: &Path) -> IoResult<()> { pub fn unlink(path: &Path) -> IoResult<()> {
fs_imp::unlink(path) fs_imp::unlink(path)
.update_err("couldn't unlink path", |e| .update_err("couldn't unlink path", |e|
format!("{:?}; path={:?}", e, path.display())) format!("{}; path={:?}", e, path.display()))
} }
/// Given a path, query the file system to get information about a file, /// Given a path, query the file system to get information about a file,
@ -310,7 +310,7 @@ pub fn unlink(path: &Path) -> IoResult<()> {
pub fn stat(path: &Path) -> IoResult<FileStat> { pub fn stat(path: &Path) -> IoResult<FileStat> {
fs_imp::stat(path) fs_imp::stat(path)
.update_err("couldn't stat path", |e| .update_err("couldn't stat path", |e|
format!("{:?}; path={:?}", e, path.display())) format!("{}; path={:?}", e, path.display()))
} }
/// Perform the same operation as the `stat` function, except that this /// Perform the same operation as the `stat` function, except that this
@ -324,7 +324,7 @@ pub fn stat(path: &Path) -> IoResult<FileStat> {
pub fn lstat(path: &Path) -> IoResult<FileStat> { pub fn lstat(path: &Path) -> IoResult<FileStat> {
fs_imp::lstat(path) fs_imp::lstat(path)
.update_err("couldn't lstat path", |e| .update_err("couldn't lstat path", |e|
format!("{:?}; path={:?}", e, path.display())) format!("{}; path={:?}", e, path.display()))
} }
/// Rename a file or directory to a new name. /// Rename a file or directory to a new name.
@ -346,7 +346,7 @@ pub fn lstat(path: &Path) -> IoResult<FileStat> {
pub fn rename(from: &Path, to: &Path) -> IoResult<()> { pub fn rename(from: &Path, to: &Path) -> IoResult<()> {
fs_imp::rename(from, to) fs_imp::rename(from, to)
.update_err("couldn't rename path", |e| .update_err("couldn't rename path", |e|
format!("{:?}; from={:?}; to={:?}", e, from.display(), to.display())) format!("{}; from={:?}; to={:?}", e, from.display(), to.display()))
} }
/// Copies the contents of one file to another. This function will also /// Copies the contents of one file to another. This function will also
@ -380,7 +380,7 @@ pub fn rename(from: &Path, to: &Path) -> IoResult<()> {
pub fn copy(from: &Path, to: &Path) -> IoResult<()> { pub fn copy(from: &Path, to: &Path) -> IoResult<()> {
fn update_err<T>(result: IoResult<T>, from: &Path, to: &Path) -> IoResult<T> { fn update_err<T>(result: IoResult<T>, from: &Path, to: &Path) -> IoResult<T> {
result.update_err("couldn't copy path", |e| { result.update_err("couldn't copy path", |e| {
format!("{:?}; from={:?}; to={:?}", e, from.display(), to.display()) format!("{}; from={:?}; to={:?}", e, from.display(), to.display())
}) })
} }
@ -424,14 +424,14 @@ pub fn copy(from: &Path, to: &Path) -> IoResult<()> {
pub fn chmod(path: &Path, mode: io::FilePermission) -> IoResult<()> { pub fn chmod(path: &Path, mode: io::FilePermission) -> IoResult<()> {
fs_imp::chmod(path, mode.bits() as uint) fs_imp::chmod(path, mode.bits() as uint)
.update_err("couldn't chmod path", |e| .update_err("couldn't chmod path", |e|
format!("{:?}; path={:?}; mode={:?}", e, path.display(), mode)) format!("{}; path={:?}; mode={:?}", e, path.display(), mode))
} }
/// Change the user and group owners of a file at the specified path. /// Change the user and group owners of a file at the specified path.
pub fn chown(path: &Path, uid: int, gid: int) -> IoResult<()> { pub fn chown(path: &Path, uid: int, gid: int) -> IoResult<()> {
fs_imp::chown(path, uid, gid) fs_imp::chown(path, uid, gid)
.update_err("couldn't chown path", |e| .update_err("couldn't chown path", |e|
format!("{:?}; path={:?}; uid={:?}; gid={:?}", e, path.display(), uid, gid)) format!("{}; path={:?}; uid={}; gid={}", e, path.display(), uid, gid))
} }
/// Creates a new hard link on the filesystem. The `dst` path will be a /// Creates a new hard link on the filesystem. The `dst` path will be a
@ -440,7 +440,7 @@ pub fn chown(path: &Path, uid: int, gid: int) -> IoResult<()> {
pub fn link(src: &Path, dst: &Path) -> IoResult<()> { pub fn link(src: &Path, dst: &Path) -> IoResult<()> {
fs_imp::link(src, dst) fs_imp::link(src, dst)
.update_err("couldn't link path", |e| .update_err("couldn't link path", |e|
format!("{:?}; src={:?}; dest={:?}", e, src.display(), dst.display())) format!("{}; src={:?}; dest={:?}", e, src.display(), dst.display()))
} }
/// Creates a new symbolic link on the filesystem. The `dst` path will be a /// Creates a new symbolic link on the filesystem. The `dst` path will be a
@ -448,7 +448,7 @@ pub fn link(src: &Path, dst: &Path) -> IoResult<()> {
pub fn symlink(src: &Path, dst: &Path) -> IoResult<()> { pub fn symlink(src: &Path, dst: &Path) -> IoResult<()> {
fs_imp::symlink(src, dst) fs_imp::symlink(src, dst)
.update_err("couldn't symlink path", |e| .update_err("couldn't symlink path", |e|
format!("{:?}; src={:?}; dest={:?}", e, src.display(), dst.display())) format!("{}; src={:?}; dest={:?}", e, src.display(), dst.display()))
} }
/// Reads a symlink, returning the file that the symlink points to. /// Reads a symlink, returning the file that the symlink points to.
@ -460,7 +460,7 @@ pub fn symlink(src: &Path, dst: &Path) -> IoResult<()> {
pub fn readlink(path: &Path) -> IoResult<Path> { pub fn readlink(path: &Path) -> IoResult<Path> {
fs_imp::readlink(path) fs_imp::readlink(path)
.update_err("couldn't resolve symlink for path", |e| .update_err("couldn't resolve symlink for path", |e|
format!("{:?}; path={:?}", e, path.display())) format!("{}; path={:?}", e, path.display()))
} }
/// Create a new, empty directory at the provided path /// Create a new, empty directory at the provided path
@ -483,7 +483,7 @@ pub fn readlink(path: &Path) -> IoResult<Path> {
pub fn mkdir(path: &Path, mode: FilePermission) -> IoResult<()> { pub fn mkdir(path: &Path, mode: FilePermission) -> IoResult<()> {
fs_imp::mkdir(path, mode.bits() as uint) fs_imp::mkdir(path, mode.bits() as uint)
.update_err("couldn't create directory", |e| .update_err("couldn't create directory", |e|
format!("{:?}; path={:?}; mode={:?}", e, path.display(), mode)) format!("{}; path={:?}; mode={:?}", e, path.display(), mode))
} }
/// Remove an existing, empty directory /// Remove an existing, empty directory
@ -505,7 +505,7 @@ pub fn mkdir(path: &Path, mode: FilePermission) -> IoResult<()> {
pub fn rmdir(path: &Path) -> IoResult<()> { pub fn rmdir(path: &Path) -> IoResult<()> {
fs_imp::rmdir(path) fs_imp::rmdir(path)
.update_err("couldn't remove directory", |e| .update_err("couldn't remove directory", |e|
format!("{:?}; path={:?}", e, path.display())) format!("{}; path={:?}", e, path.display()))
} }
/// Retrieve a vector containing all entries within a provided directory /// Retrieve a vector containing all entries within a provided directory
@ -545,7 +545,7 @@ pub fn rmdir(path: &Path) -> IoResult<()> {
pub fn readdir(path: &Path) -> IoResult<Vec<Path>> { pub fn readdir(path: &Path) -> IoResult<Vec<Path>> {
fs_imp::readdir(path) fs_imp::readdir(path)
.update_err("couldn't read directory", .update_err("couldn't read directory",
|e| format!("{:?}; path={:?}", e, path.display())) |e| format!("{}; path={:?}", e, path.display()))
} }
/// Returns an iterator that will recursively walk the directory structure /// Returns an iterator that will recursively walk the directory structure
@ -555,7 +555,7 @@ pub fn readdir(path: &Path) -> IoResult<Vec<Path>> {
pub fn walk_dir(path: &Path) -> IoResult<Directories> { pub fn walk_dir(path: &Path) -> IoResult<Directories> {
Ok(Directories { Ok(Directories {
stack: try!(readdir(path).update_err("couldn't walk directory", stack: try!(readdir(path).update_err("couldn't walk directory",
|e| format!("{:?}; path={:?}", e, path.display()))) |e| format!("{}; path={:?}", e, path.display())))
}) })
} }
@ -605,7 +605,7 @@ pub fn mkdir_recursive(path: &Path, mode: FilePermission) -> IoResult<()> {
let result = mkdir(&curpath, mode) let result = mkdir(&curpath, mode)
.update_err("couldn't recursively mkdir", .update_err("couldn't recursively mkdir",
|e| format!("{:?}; path={:?}", e, path.display())); |e| format!("{}; path={:?}", e, path.display()));
match result { match result {
Err(mkdir_err) => { Err(mkdir_err) => {
@ -632,7 +632,7 @@ pub fn rmdir_recursive(path: &Path) -> IoResult<()> {
rm_stack.push(path.clone()); rm_stack.push(path.clone());
fn rmdir_failed(err: &IoError, path: &Path) -> String { fn rmdir_failed(err: &IoError, path: &Path) -> String {
format!("rmdir_recursive failed; path={:?}; cause={:?}", format!("rmdir_recursive failed; path={:?}; cause={}",
path.display(), err) path.display(), err)
} }
@ -692,14 +692,14 @@ pub fn rmdir_recursive(path: &Path) -> IoResult<()> {
pub fn change_file_times(path: &Path, atime: u64, mtime: u64) -> IoResult<()> { pub fn change_file_times(path: &Path, atime: u64, mtime: u64) -> IoResult<()> {
fs_imp::utime(path, atime, mtime) fs_imp::utime(path, atime, mtime)
.update_err("couldn't change_file_times", |e| .update_err("couldn't change_file_times", |e|
format!("{:?}; path={:?}", e, path.display())) format!("{}; path={:?}", e, path.display()))
} }
impl Reader for File { impl Reader for File {
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
fn update_err<T>(result: IoResult<T>, file: &File) -> IoResult<T> { fn update_err<T>(result: IoResult<T>, file: &File) -> IoResult<T> {
result.update_err("couldn't read file", result.update_err("couldn't read file",
|e| format!("{:?}; path={:?}", |e| format!("{}; path={:?}",
e, file.path.display())) e, file.path.display()))
} }
@ -722,7 +722,7 @@ impl Writer for File {
fn write(&mut self, buf: &[u8]) -> IoResult<()> { fn write(&mut self, buf: &[u8]) -> IoResult<()> {
self.fd.write(buf) self.fd.write(buf)
.update_err("couldn't write to file", .update_err("couldn't write to file",
|e| format!("{:?}; path={:?}", e, self.path.display())) |e| format!("{}; path={:?}", e, self.path.display()))
} }
} }
@ -730,7 +730,7 @@ impl Seek for File {
fn tell(&self) -> IoResult<u64> { fn tell(&self) -> IoResult<u64> {
self.fd.tell() self.fd.tell()
.update_err("couldn't retrieve file cursor (`tell`)", .update_err("couldn't retrieve file cursor (`tell`)",
|e| format!("{:?}; path={:?}", e, self.path.display())) |e| format!("{}; path={:?}", e, self.path.display()))
} }
fn seek(&mut self, pos: i64, style: SeekStyle) -> IoResult<()> { fn seek(&mut self, pos: i64, style: SeekStyle) -> IoResult<()> {
@ -743,7 +743,7 @@ impl Seek for File {
Err(e) => Err(e), Err(e) => Err(e),
}; };
err.update_err("couldn't seek in file", err.update_err("couldn't seek in file",
|e| format!("{:?}; path={:?}", e, self.path.display())) |e| format!("{}; path={:?}", e, self.path.display()))
} }
} }
@ -840,7 +840,7 @@ mod test {
match $e { match $e {
Ok(_) => panic!("Unexpected success. Should've been: {:?}", $s), Ok(_) => panic!("Unexpected success. Should've been: {:?}", $s),
Err(ref err) => assert!(err.to_string().contains($s.as_slice()), Err(ref err) => assert!(err.to_string().contains($s.as_slice()),
format!("`{:?}` did not contain `{:?}`", err, $s)) format!("`{}` did not contain `{}`", err, $s))
} }
) } ) }

View file

@ -662,7 +662,7 @@ mod test {
Ok(..) => panic!(), Ok(..) => panic!(),
Err(ref e) => { Err(ref e) => {
assert!(e.kind == NotConnected || e.kind == EndOfFile, assert!(e.kind == NotConnected || e.kind == EndOfFile,
"unknown kind: {}", e.kind); "unknown kind: {:?}", e.kind);
} }
} }
} }
@ -686,7 +686,7 @@ mod test {
Ok(..) => panic!(), Ok(..) => panic!(),
Err(ref e) => { Err(ref e) => {
assert!(e.kind == NotConnected || e.kind == EndOfFile, assert!(e.kind == NotConnected || e.kind == EndOfFile,
"unknown kind: {}", e.kind); "unknown kind: {:?}", e.kind);
} }
} }
} }
@ -999,7 +999,7 @@ mod test {
Ok(..) => panic!(), Ok(..) => panic!(),
Err(e) => { Err(e) => {
assert!(e.kind == ConnectionRefused || e.kind == OtherIoError, assert!(e.kind == ConnectionRefused || e.kind == OtherIoError,
"unknown error: {} {}", e, e.kind); "unknown error: {} {:?}", e, e.kind);
} }
} }
} }

View file

@ -105,7 +105,7 @@
#![allow(unknown_features)] #![allow(unknown_features)]
#![feature(linkage, thread_local, asm)] #![feature(linkage, thread_local, asm)]
#![feature(phase, lang_items, unsafe_destructor)] #![feature(lang_items, unsafe_destructor)]
#![feature(slicing_syntax, unboxed_closures)] #![feature(slicing_syntax, unboxed_closures)]
#![feature(old_impl_check)] #![feature(old_impl_check)]
#![cfg_attr(stage0, allow(unused_attributes))] #![cfg_attr(stage0, allow(unused_attributes))]

View file

@ -371,7 +371,7 @@ pub mod builtin {
/// ///
/// ``` /// ```
#[macro_export] #[macro_export]
macro_rules! format_args { ($fmt:expr $($args:tt)*) => ({ macro_rules! format_args { ($fmt:expr, $($args:tt)*) => ({
/* compiler built-in */ /* compiler built-in */
}) } }) }
@ -407,7 +407,7 @@ pub mod builtin {
/// ///
/// ```rust /// ```rust
/// let key: Option<&'static str> = option_env!("SECRET_KEY"); /// let key: Option<&'static str> = option_env!("SECRET_KEY");
/// println!("the secret key might be: {}", key); /// println!("the secret key might be: {:?}", key);
/// ``` /// ```
#[macro_export] #[macro_export]
macro_rules! option_env { ($name:expr) => ({ /* compiler built-in */ }) } macro_rules! option_env { ($name:expr) => ({ /* compiler built-in */ }) }

View file

@ -1622,7 +1622,7 @@ mod tests {
os::MapOption::MapWritable os::MapOption::MapWritable
]) { ]) {
Ok(chunk) => chunk, Ok(chunk) => chunk,
Err(msg) => panic!("{}", msg) Err(msg) => panic!("{:?}", msg)
}; };
assert!(chunk.len >= 16); assert!(chunk.len >= 16);

View file

@ -1150,7 +1150,7 @@ mod tests {
let comps = path.components().collect::<Vec<&[u8]>>(); let comps = path.components().collect::<Vec<&[u8]>>();
let exp: &[&str] = &$exp; let exp: &[&str] = &$exp;
let exps = exp.iter().map(|x| x.as_bytes()).collect::<Vec<&[u8]>>(); let exps = exp.iter().map(|x| x.as_bytes()).collect::<Vec<&[u8]>>();
assert_eq!(comps, exprs); assert_eq!(comps, exps);
let comps = path.components().rev().collect::<Vec<&[u8]>>(); let comps = path.components().rev().collect::<Vec<&[u8]>>();
let exps = exps.into_iter().rev().collect::<Vec<&[u8]>>(); let exps = exps.into_iter().rev().collect::<Vec<&[u8]>>();
assert_eq!(comps, exps); assert_eq!(comps, exps);

View file

@ -1740,8 +1740,8 @@ mod tests {
let path = Path::new(pstr); let path = Path::new(pstr);
let arg = $arg; let arg = $arg;
let res = path.$op(arg); let res = path.$op(arg);
let exp = $res; let exp = Path::new($res);
assert_eq!(Path::new($path).$op($arg), $res); assert_eq!(res, exp);
} }
) )
} }
@ -1920,8 +1920,7 @@ mod tests {
{ {
let path = Path::new($path); let path = Path::new($path);
let (abs, vol, cwd, rel) = ($abs, $vol, $cwd, $rel); let (abs, vol, cwd, rel) = ($abs, $vol, $cwd, $rel);
let b = path.is_absolute(); assert_eq!(path.is_absolute(), abs);
assert_eq!(path.is_absolute(), asb);
assert_eq!(is_vol_relative(&path), vol); assert_eq!(is_vol_relative(&path), vol);
assert_eq!(is_cwd_relative(&path), cwd); assert_eq!(is_cwd_relative(&path), cwd);
assert_eq!(path.is_relative(), rel); assert_eq!(path.is_relative(), rel);
@ -1955,7 +1954,7 @@ mod tests {
let dest = Path::new($dest); let dest = Path::new($dest);
let exp = $exp; let exp = $exp;
let res = path.is_ancestor_of(&dest); let res = path.is_ancestor_of(&dest);
assert_eq!(Path::new($path).is_ancestor_of(Path::new($dest)), $exp); assert_eq!(res, exp);
} }
) )
} }
@ -2084,7 +2083,7 @@ mod tests {
macro_rules! t { macro_rules! t {
(s: $path:expr, $other:expr, $exp:expr) => ( (s: $path:expr, $other:expr, $exp:expr) => (
{ {
assert_eq!(Path::new($path).path_relative_from(Path::new($other)) assert_eq!(Path::new($path).path_relative_from(&Path::new($other))
.as_ref().and_then(|x| x.as_str()), $exp); .as_ref().and_then(|x| x.as_str()), $exp);
} }
) )

View file

@ -71,7 +71,7 @@
//! use std::rand; //! use std::rand;
//! //!
//! let tuple = rand::random::<(f64, char)>(); //! let tuple = rand::random::<(f64, char)>();
//! println!("{}", tuple) //! println!("{:?}", tuple)
//! ``` //! ```
//! //!
//! ## Monte Carlo estimation of π //! ## Monte Carlo estimation of π

View file

@ -481,7 +481,7 @@ impl<T> UnsafeFlavor<T> for Receiver<T> {
/// // Do some useful work for awhile /// // Do some useful work for awhile
/// ///
/// // Let's see what that answer was /// // Let's see what that answer was
/// println!("{}", rx.recv().unwrap()); /// println!("{:?}", rx.recv().unwrap());
/// ``` /// ```
#[stable] #[stable]
pub fn channel<T: Send>() -> (Sender<T>, Receiver<T>) { pub fn channel<T: Send>() -> (Sender<T>, Receiver<T>) {

View file

@ -196,7 +196,7 @@ pub mod compat {
/// they are used to be passed to the real function if available. /// they are used to be passed to the real function if available.
macro_rules! compat_fn { macro_rules! compat_fn {
($module:ident::$symbol:ident($($argname:ident: $argtype:ty),*) ($module:ident::$symbol:ident($($argname:ident: $argtype:ty),*)
-> $rettype:ty $fallback:block) => ( -> $rettype:ty { $fallback:expr }) => (
#[inline(always)] #[inline(always)]
pub unsafe fn $symbol($($argname: $argtype),*) -> $rettype { pub unsafe fn $symbol($($argname: $argtype),*) -> $rettype {
static mut ptr: extern "system" fn($($argname: $argtype),*) -> $rettype = thunk; static mut ptr: extern "system" fn($($argname: $argtype),*) -> $rettype = thunk;
@ -211,14 +211,11 @@ pub mod compat {
} }
} }
extern "system" fn fallback($($argname: $argtype),*) -> $rettype $fallback extern "system" fn fallback($($argname: $argtype),*)
-> $rettype { $fallback }
::intrinsics::atomic_load_relaxed(&ptr)($($argname),*) ::intrinsics::atomic_load_relaxed(&ptr)($($argname),*)
} }
);
($module:ident::$symbol:ident($($argname:ident: $argtype:ty),*) $fallback:block) => (
compat_fn!($module::$symbol($($argname: $argtype),*) -> () $fallback)
) )
} }
@ -236,20 +233,22 @@ pub mod compat {
fn SetLastError(dwErrCode: DWORD); fn SetLastError(dwErrCode: DWORD);
} }
compat_fn! { kernel32::CreateSymbolicLinkW(_lpSymlinkFileName: LPCWSTR, compat_fn! {
_lpTargetFileName: LPCWSTR, kernel32::CreateSymbolicLinkW(_lpSymlinkFileName: LPCWSTR,
_dwFlags: DWORD) -> BOOLEAN { _lpTargetFileName: LPCWSTR,
unsafe { SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); } _dwFlags: DWORD) -> BOOLEAN {
0 unsafe { SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); 0 }
} } }
}
compat_fn! { kernel32::GetFinalPathNameByHandleW(_hFile: HANDLE, compat_fn! {
_lpszFilePath: LPCWSTR, kernel32::GetFinalPathNameByHandleW(_hFile: HANDLE,
_cchFilePath: DWORD, _lpszFilePath: LPCWSTR,
_dwFlags: DWORD) -> DWORD { _cchFilePath: DWORD,
unsafe { SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); } _dwFlags: DWORD) -> DWORD {
0 unsafe { SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); 0 }
} } }
}
} }
} }

View file

@ -62,7 +62,7 @@ pub unsafe fn create(stack: uint, p: Thunk) -> rust_thread {
if ret as uint == 0 { if ret as uint == 0 {
// be sure to not leak the closure // be sure to not leak the closure
let _p: Box<Thunk> = mem::transmute(arg); let _p: Box<Thunk> = mem::transmute(arg);
panic!("failed to spawn native thread: {}", ret); panic!("failed to spawn native thread: {:?}", ret);
} }
return ret; return ret;
} }

View file

@ -103,26 +103,26 @@ impl Ident {
//NOTE(stage0): remove after snapshot //NOTE(stage0): remove after snapshot
impl fmt::Show for Ident { impl fmt::Show for Ident {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(self, f) write!(f, "{}#{}", self.name, self.ctxt)
} }
} }
impl fmt::String for Ident { impl fmt::String for Ident {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}#{}", self.name, self.ctxt) fmt::String::fmt(&self.name, f)
} }
} }
impl fmt::Show for Name { impl fmt::Show for Name {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(self, f) let Name(nm) = *self;
write!(f, "{:?}({})", token::get_name(*self).get(), nm)
} }
} }
impl fmt::String for Name { impl fmt::String for Name {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let Name(nm) = *self; fmt::String::fmt(token::get_name(*self).get(), f)
write!(f, "\"{}\"({})", token::get_name(*self).get(), nm)
} }
} }

View file

@ -836,20 +836,20 @@ mod test {
ast::TtToken(_, token::Ident(name, token::Plain))] ast::TtToken(_, token::Ident(name, token::Plain))]
if first_delimed.delim == token::Paren if first_delimed.delim == token::Paren
&& name.as_str() == "a" => {}, && name.as_str() == "a" => {},
_ => panic!("value 3: {}", **first_delimed), _ => panic!("value 3: {:?}", **first_delimed),
} }
match second_delimed.tts.index(&FullRange) { match second_delimed.tts.index(&FullRange) {
[ast::TtToken(_, token::Dollar), [ast::TtToken(_, token::Dollar),
ast::TtToken(_, token::Ident(name, token::Plain))] ast::TtToken(_, token::Ident(name, token::Plain))]
if second_delimed.delim == token::Paren if second_delimed.delim == token::Paren
&& name.as_str() == "a" => {}, && name.as_str() == "a" => {},
_ => panic!("value 4: {}", **second_delimed), _ => panic!("value 4: {:?}", **second_delimed),
} }
}, },
_ => panic!("value 2: {}", **macro_delimed), _ => panic!("value 2: {:?}", **macro_delimed),
} }
}, },
_ => panic!("value: {}",tts), _ => panic!("value: {:?}",tts),
} }
} }

View file

@ -91,11 +91,7 @@ pub mod stats;
// colons. This way if some test runner wants to arrange the tests // colons. This way if some test runner wants to arrange the tests
// hierarchically it may. // hierarchically it may.
<<<<<<< HEAD #[derive(Clone, PartialEq, Eq, Hash, Show)]
#[derive(Clone, PartialEq, Eq, Hash)]
=======
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
>>>>>>> core: split into fmt::Show and fmt::String
pub enum TestName { pub enum TestName {
StaticTestName(&'static str), StaticTestName(&'static str),
DynTestName(String) DynTestName(String)

View file

@ -49,7 +49,7 @@ fn print_complements() {
let all = [Blue, Red, Yellow]; let all = [Blue, Red, Yellow];
for aa in all.iter() { for aa in all.iter() {
for bb in all.iter() { for bb in all.iter() {
println!("{} + {} -> {}", *aa, *bb, transform(*aa, *bb)); println!("{:?} + {:?} -> {:?}", *aa, *bb, transform(*aa, *bb));
} }
} }
} }
@ -84,7 +84,7 @@ fn show_color_list(set: Vec<Color>) -> String {
let mut out = String::new(); let mut out = String::new();
for col in set.iter() { for col in set.iter() {
out.push(' '); out.push(' ');
out.push_str(col.to_string().as_slice()); out.push_str(format!("{:?}", col).as_slice());
} }
out out
} }
@ -170,7 +170,7 @@ fn creature(
} }
} }
// log creatures met and evil clones of self // log creatures met and evil clones of self
let report = format!("{}{}", creatures_met, Number(evil_clones_met)); let report = format!("{}{:?}", creatures_met, Number(evil_clones_met));
to_rendezvous_log.send(report).unwrap(); to_rendezvous_log.send(report).unwrap();
} }
@ -225,7 +225,7 @@ fn rendezvous(nn: uint, set: Vec<Color>) {
} }
// print the total number of creatures met // print the total number of creatures met
println!("{}\n", Number(creatures_met)); println!("{:?}\n", Number(creatures_met));
} }
fn main() { fn main() {

View file

@ -241,7 +241,7 @@ fn parallel<'a, I, T, F>(mut iter: I, f: F)
// boundary. // boundary.
let f = Racy(&f as *const F as *const uint); let f = Racy(&f as *const F as *const uint);
let raw = Racy(chunk.repr()); let raw = Racy(chunk.repr());
Thread::spawn(move|| { Thread::scoped(move|| {
let f = f.0 as *const F; let f = f.0 as *const F;
unsafe { (*f)(mem::transmute(raw.0)) } unsafe { (*f)(mem::transmute(raw.0)) }
}) })

View file

@ -128,7 +128,7 @@ fn parallel<T, F>(v: &mut [T], f: F)
// boundary. // boundary.
let f = Racy(&f as *const _ as *const uint); let f = Racy(&f as *const _ as *const uint);
let raw = Racy(chunk.repr()); let raw = Racy(chunk.repr());
Thread::spawn(move|| { Thread::scoped(move|| {
let f = f.0 as *const F; let f = f.0 as *const F;
unsafe { (*f)(i * size, mem::transmute(raw.0)) } unsafe { (*f)(i * size, mem::transmute(raw.0)) }
}) })

View file

@ -13,7 +13,7 @@ fn main() {
// (separate lines to ensure the spans are accurate) // (separate lines to ensure the spans are accurate)
// SNAP b2085d9 uncomment this after the next snapshot // SNAP 340ac04 uncomment this after the next snapshot
// NOTE(stage0) just in case tidy doesn't check snap's in tests // NOTE(stage0) just in case tidy doesn't check snap's in tests
// let &_ // ~ ERROR expected `&mut isize`, found `&_` // let &_ // ~ ERROR expected `&mut isize`, found `&_`
// = foo; // = foo;

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
fn equal<T>(_: &T, _: &T) -> bool where int : Eq { fn equal<T>(_: &T, _: &T) -> bool where int : Eq {
true //~^ ERROR cannot bound type `int`, where clause bounds may only be attached true //~^ ERROR cannot bound type `isize`, where clause bounds may only be attached
} }
// This should be fine involves a type parameter. // This should be fine involves a type parameter.
@ -17,22 +17,24 @@ fn test<T: Eq>() -> bool where Option<T> : Eq {}
// This should be rejected as well. // This should be rejected as well.
fn test2() -> bool where Option<int> : Eq {} fn test2() -> bool where Option<int> : Eq {}
//~^ ERROR cannot bound type `core::option::Option<isize>`, where clause bounds
#[derive(PartialEq)] #[derive(PartialEq)]
//~^ ERROR cannot bound type `int`, where clause bounds //~^ ERROR cannot bound type `isize`, where clause bounds
enum Foo<T> where int : Eq { MkFoo } enum Foo<T> where int : Eq { MkFoo }
//~^ ERROR cannot bound type `isize`, where clause bounds
fn test3<T: Eq>() -> bool where Option<Foo<T>> : Eq {} fn test3<T: Eq>() -> bool where Option<Foo<T>> : Eq {}
fn test4() -> bool where Option<Foo<int>> : Eq {} fn test4() -> bool where Option<Foo<int>> : Eq {}
//~^ ERROR cannot bound type `core::option::Option<Foo<int>>`, where clause bounds //~^ ERROR cannot bound type `core::option::Option<Foo<isize>>`, where clause bounds
trait Baz<T> where int : Eq { trait Baz<T> where int : Eq {
fn baz() where String : Eq; fn baz() where String : Eq;
} }
impl Baz<int> for int where int : Eq { impl Baz<int> for int where int : Eq {
//~^ ERROR cannot bound type `int`, where clause bounds //~^ ERROR cannot bound type `isize`, where clause bounds
fn baz() where String : Eq {} fn baz() where String : Eq {}
} }

View file

@ -32,14 +32,14 @@
// lldb-command:run // lldb-command:run
// lldb-command:print int_int // lldb-command:print int_int
// lldb-check:[...]$0 = AGenericStruct<int, int> { key: 0, value: 1 } // lldb-check:[...]$0 = AGenericStruct<isize, isize> { key: 0, value: 1 }
// lldb-command:print int_float // lldb-command:print int_float
// lldb-check:[...]$1 = AGenericStruct<int, f64> { key: 2, value: 3.5 } // lldb-check:[...]$1 = AGenericStruct<isize, f64> { key: 2, value: 3.5 }
// lldb-command:print float_int // lldb-command:print float_int
// lldb-check:[...]$2 = AGenericStruct<f64, int> { key: 4.5, value: 5 } // lldb-check:[...]$2 = AGenericStruct<f64, isize> { key: 4.5, value: 5 }
// lldb-command:print float_int_float // lldb-command:print float_int_float
// lldb-check:[...]$3 = AGenericStruct<f64, generic-struct::AGenericStruct<int, f64>> { key: 6.5, value: AGenericStruct<int, f64> { key: 7, value: 8.5 } } // lldb-check:[...]$3 = AGenericStruct<f64, generic-struct::AGenericStruct<isize, f64>> { key: 6.5, value: AGenericStruct<isize, f64> { key: 7, value: 8.5 } }
#![omit_gdb_pretty_printer_section] #![omit_gdb_pretty_printer_section]

View file

@ -30,12 +30,13 @@ impl Index<uint> for T {
type Output = Show + 'static; type Output = Show + 'static;
fn index<'a>(&'a self, idx: &uint) -> &'a (Show + 'static) { fn index<'a>(&'a self, idx: &uint) -> &'a (Show + 'static) {
static x: uint = 42; static X: uint = 42;
&x &X as &(Show + 'static)
} }
} }
fn main() { fn main() {
assert_eq!(&S[0], "hello"); assert_eq!(&S[0], "hello");
assert_eq!(format!("{:?}", &T[0]), "42u"); &T[0];
// let x = &x as &Show;
} }

View file

@ -10,6 +10,7 @@
// A test of the macro system. Can we do HTML literals? // A test of the macro system. Can we do HTML literals?
// ignore-test FIXME #20673
/* /*

View file

@ -82,8 +82,9 @@ pub fn main() {
t!(format!("{}", 5i + 5i), "10"); t!(format!("{}", 5i + 5i), "10");
t!(format!("{:#4}", C), "☃123"); t!(format!("{:#4}", C), "☃123");
let a: &fmt::Show = &1i; // FIXME(#20676)
t!(format!("{:?}", a), "1i"); // let a: &fmt::Show = &1i;
// t!(format!("{:?}", a), "1i");
// Formatting strings and their arguments // Formatting strings and their arguments

View file

@ -37,11 +37,13 @@ fn main() {
let args = os::args(); let args = os::args();
let args = args.as_slice(); let args = args.as_slice();
if args.len() > 1 && args[1].as_slice() == "recurse" { if args.len() > 1 && args[1].as_slice() == "recurse" {
let _t = Thread::spawn(recurse); let _t = Thread::scoped(recurse);
} else { } else {
let recurse = Command::new(args[0].as_slice()).arg("recurse").output().unwrap(); let recurse = Command::new(args[0].as_slice()).arg("recurse").output().unwrap();
assert!(!recurse.status.success()); assert!(!recurse.status.success());
let error = String::from_utf8_lossy(recurse.error.as_slice()); let error = String::from_utf8_lossy(recurse.error.as_slice());
println!("wut");
println!("`{}`", error);
assert!(error.as_slice().contains("has overflowed its stack")); assert!(error.as_slice().contains("has overflowed its stack"));
} }
} }

View file

@ -9,11 +9,11 @@
// except according to those terms. // except according to those terms.
pub fn main() { pub fn main() {
assert_eq!((vec!(0i, 1)).to_string(), "0, 1".to_string()); assert_eq!((vec!(0i, 1)).to_string(), "[0, 1]".to_string());
let foo = vec!(3i, 4); let foo = vec!(3i, 4);
let bar: &[int] = &[4, 5]; let bar: &[int] = &[4, 5];
assert_eq!(foo.to_string(), "3, 4".to_string()); assert_eq!(foo.to_string(), "[3, 4]".to_string());
assert_eq!(bar.to_string(), "4, 5".to_string()); assert_eq!(bar.to_string(), "[4, 5]".to_string());
} }