rollup merge of #20481: seanmonstar/fmt-show-string
Conflicts: src/compiletest/runtest.rs src/libcore/fmt/mod.rs src/libfmt_macros/lib.rs src/libregex/parse.rs src/librustc/middle/cfg/construct.rs src/librustc/middle/dataflow.rs src/librustc/middle/infer/higher_ranked/mod.rs src/librustc/middle/ty.rs src/librustc_back/archive.rs src/librustc_borrowck/borrowck/fragments.rs src/librustc_borrowck/borrowck/gather_loans/mod.rs src/librustc_resolve/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/save/mod.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/callee.rs src/librustc_trans/trans/common.rs src/librustc_trans/trans/consts.rs src/librustc_trans/trans/controlflow.rs src/librustc_trans/trans/debuginfo.rs src/librustc_trans/trans/expr.rs src/librustc_trans/trans/monomorphize.rs src/librustc_typeck/astconv.rs src/librustc_typeck/check/method/mod.rs src/librustc_typeck/check/mod.rs src/librustc_typeck/check/regionck.rs src/librustc_typeck/collect.rs src/libsyntax/ext/format.rs src/libsyntax/ext/source_util.rs src/libsyntax/ext/tt/transcribe.rs src/libsyntax/parse/mod.rs src/libsyntax/parse/token.rs src/test/run-pass/issue-8898.rs
This commit is contained in:
commit
5c3ddcb15d
252 changed files with 2703 additions and 2072 deletions
|
|
@ -17,7 +17,7 @@ pub mod kitty {
|
|||
pub name : String,
|
||||
}
|
||||
|
||||
impl fmt::Show for cat {
|
||||
impl fmt::String for cat {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.name)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ pub fn main() {
|
|||
}
|
||||
}
|
||||
let z = tail[0].clone();
|
||||
println!("{}", z);
|
||||
println!("{:?}", z);
|
||||
}
|
||||
_ => {
|
||||
unreachable!();
|
||||
|
|
|
|||
|
|
@ -27,5 +27,5 @@ fn main() {
|
|||
let x = foo(10);
|
||||
let _y = x.clone();
|
||||
//~^ ERROR does not implement any method in scope
|
||||
println!("{}", x);
|
||||
println!("{:?}", x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ fn main() {
|
|||
|
||||
// bad syntax of the format string
|
||||
|
||||
format!("{"); //~ ERROR: expected `}` but string was terminated
|
||||
format!("{"); //~ ERROR: expected `'}'` but string was terminated
|
||||
|
||||
format!("foo } bar"); //~ ERROR: unmatched `}` found
|
||||
format!("foo }"); //~ ERROR: unmatched `}` found
|
||||
|
|
|
|||
|
|
@ -27,5 +27,5 @@ impl Something for X {
|
|||
|
||||
fn main() {
|
||||
let arr = &["one", "two", "three"];
|
||||
println!("{}", Something::yay(None::<X>, arr));
|
||||
println!("{:?}", Something::yay(None::<X>, arr));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ struct Shower<T> {
|
|||
impl<T: fmt::Show> ops::Fn<(), ()> for Shower<T> {
|
||||
fn call(&self, _args: ()) {
|
||||
//~^ ERROR `call` has an incompatible type for trait: expected "rust-call" fn, found "Rust" fn
|
||||
println!("{}", self.x);
|
||||
println!("{:?}", self.x);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,8 +123,8 @@ fn str_to_direction(to_parse: &str) -> RoomDirection {
|
|||
fn main() {
|
||||
let mut player = Player::new("Test player");
|
||||
let mut room = Room::new("A test room");
|
||||
println!("Made a player: {}", player);
|
||||
println!("Direction parse: {}", str_to_direction("east"));
|
||||
println!("Made a player: {:?}", player);
|
||||
println!("Direction parse: {:?}", str_to_direction("east"));
|
||||
match player.attemptTraverse(&room, "west") {
|
||||
Ok(_) => println!("Was able to move west"),
|
||||
Err(msg) => println!("Not able to move west: {}", msg)
|
||||
|
|
|
|||
|
|
@ -8,5 +8,5 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() { format!("{}", None); }
|
||||
fn main() { format!("{:?}", None); }
|
||||
//~^ ERROR type annotations required
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
fn main() {
|
||||
// Unconstrained type:
|
||||
format!("{}", None);
|
||||
format!("{:?}", None);
|
||||
//~^ ERROR type annotations required
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@ extern {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
println!("{}", foo);
|
||||
println!("{:?}", foo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ fn main() {
|
|||
let mut buff = [0u8; 16];
|
||||
match f.read(&mut buff) {
|
||||
Ok(cnt) => println!("read this many bytes: {}", cnt),
|
||||
Err(IoError{ kind: EndOfFile, .. }) => println!("Got end of file: {}", EndOfFile.to_string()),
|
||||
Err(IoError{ kind: EndOfFile, .. }) => println!("Got end of file: {:?}", EndOfFile),
|
||||
//~^ ERROR variable `EndOfFile` should have a snake case name such as `end_of_file`
|
||||
//~^^ WARN `EndOfFile` is named the same as one of the variants of the type `std::io::IoErrorKind`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn send<T:Send + std::fmt::Show>(ch: _chan<T>, data: T) {
|
||||
println!("{}", ch);
|
||||
println!("{}", data);
|
||||
println!("{:?}", ch);
|
||||
println!("{:?}", data);
|
||||
panic!();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,6 @@ fn main() {
|
|||
//~^ ERROR `core::kinds::Send` is not implemented
|
||||
//~^^ ERROR `core::kinds::Send` is not implemented
|
||||
let y = x;
|
||||
println!("{}", y);
|
||||
println!("{:?}", y);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,5 +42,5 @@ fn foo(i:int) -> foo {
|
|||
fn main() {
|
||||
let x = foo(10);
|
||||
let _y = x.clone(); //~ ERROR does not implement any method in scope
|
||||
println!("{}", x);
|
||||
println!("{:?}", x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,6 @@ fn main() {
|
|||
let foo = Foo { bar: 1, baz: 10 };
|
||||
unsafe {
|
||||
let oof: Oof = mem::transmute(foo);
|
||||
println!("{}", oof);
|
||||
println!("{:?}", oof);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ fn state_iter() -> StateMachineIter<'static> {
|
|||
|
||||
fn main() {
|
||||
let mut it = state_iter();
|
||||
println!("{}",it.next());
|
||||
println!("{}",it.next());
|
||||
println!("{}",it.next());
|
||||
println!("{}",it.next());
|
||||
println!("{}",it.next());
|
||||
println!("{:?}",it.next());
|
||||
println!("{:?}",it.next());
|
||||
println!("{:?}",it.next());
|
||||
println!("{:?}",it.next());
|
||||
println!("{:?}",it.next());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,5 +20,5 @@ impl Drop for r {
|
|||
fn main() {
|
||||
let i = box r { b: true };
|
||||
let _j = i.clone(); //~ ERROR not implement
|
||||
println!("{}", i);
|
||||
println!("{:?}", i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,6 @@ fn main() {
|
|||
f(clone(&r1), clone(&r2));
|
||||
//~^ ERROR the trait `core::clone::Clone` is not implemented for the type
|
||||
//~^^ ERROR the trait `core::clone::Clone` is not implemented for the type
|
||||
println!("{}", (r2, i1.get()));
|
||||
println!("{}", (r1, i2.get()));
|
||||
println!("{:?}", (r2, i1.get()));
|
||||
println!("{:?}", (r1, i2.get()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ struct Number {
|
|||
n: i64
|
||||
}
|
||||
|
||||
impl fmt::Show for Number {
|
||||
impl fmt::String for Number {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.n)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,5 +25,5 @@ fn main() {
|
|||
let j = vec!(r(1));
|
||||
let k = i + j;
|
||||
//~^ ERROR binary operation `+` cannot be applied to type
|
||||
println!("{}", j);
|
||||
println!("{:?}", j);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern:assertion failed: `(left == right) && (right == left)` (left: `14`, right: `15`)
|
||||
// error-pattern:assertion failed: `(left == right) && (right == left)` (left: `14i`, right: `15i`)
|
||||
|
||||
fn main() {
|
||||
assert_eq!(14i,15i);
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ pub fn main() {
|
|||
add_int(&mut *ints, 44);
|
||||
|
||||
iter_ints(&*ints, |i| {
|
||||
println!("int = {}", *i);
|
||||
println!("int = {:?}", *i);
|
||||
true
|
||||
});
|
||||
|
||||
println!("ints={}", ints);
|
||||
println!("ints={:?}", ints);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ fn cat(in_x : uint, in_y : int, in_name: String) -> cat {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Show for cat {
|
||||
impl fmt::String for cat {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.name)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ extern crate log;
|
|||
|
||||
pub fn main() {
|
||||
// only panics if println! evaluates its argument.
|
||||
debug!("{}", { if true { panic!() } });
|
||||
debug!("{:?}", { if true { panic!() } });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
pub fn main() {
|
||||
// exits early if println! evaluates its arguments, otherwise it
|
||||
// will hit the panic.
|
||||
println!("{}", { if true { return; } });
|
||||
println!("{:?}", { if true { return; } });
|
||||
|
||||
panic!();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,5 +15,5 @@ pub fn main() {
|
|||
}
|
||||
|
||||
let f = Foo { foo: 10 };
|
||||
format!("{}", f);
|
||||
format!("{:?}", f);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,16 +38,25 @@ impl fmt::Show for Custom {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
assert_eq!(B::B1.to_string(), "B1".to_string());
|
||||
assert_eq!(B::B2.to_string(), "B2".to_string());
|
||||
assert_eq!(C::C1(3).to_string(), "C1(3)".to_string());
|
||||
assert_eq!(C::C2(B::B2).to_string(), "C2(B2)".to_string());
|
||||
assert_eq!(D::D1{ a: 2 }.to_string(), "D1 { a: 2 }".to_string());
|
||||
assert_eq!(E.to_string(), "E".to_string());
|
||||
assert_eq!(F(3).to_string(), "F(3)".to_string());
|
||||
assert_eq!(G(3, 4).to_string(), "G(3, 4)".to_string());
|
||||
assert_eq!(G(3, 4).to_string(), "G(3, 4)".to_string());
|
||||
assert_eq!(I{ a: 2, b: 4 }.to_string(), "I { a: 2, b: 4 }".to_string());
|
||||
assert_eq!(J(Custom).to_string(), "J(yay)".to_string());
|
||||
trait ToShow {
|
||||
fn to_show(&self) -> String;
|
||||
}
|
||||
|
||||
impl<T: fmt::Show> ToShow for T {
|
||||
fn to_show(&self) -> String {
|
||||
format!("{:?}", self)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
assert_eq!(B::B1.to_show(), "B1".to_string());
|
||||
assert_eq!(B::B2.to_show(), "B2".to_string());
|
||||
assert_eq!(C::C1(3).to_show(), "C1(3i)".to_string());
|
||||
assert_eq!(C::C2(B::B2).to_show(), "C2(B2)".to_string());
|
||||
assert_eq!(D::D1{ a: 2 }.to_show(), "D1 { a: 2i }".to_string());
|
||||
assert_eq!(E.to_show(), "E".to_string());
|
||||
assert_eq!(F(3).to_show(), "F(3i)".to_string());
|
||||
assert_eq!(G(3, 4).to_show(), "G(3i, 4i)".to_string());
|
||||
assert_eq!(I{ a: 2, b: 4 }.to_show(), "I { a: 2i, b: 4i }".to_string());
|
||||
assert_eq!(J(Custom).to_show(), "J(yay)".to_string());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,15 +26,15 @@ enum Enum {
|
|||
|
||||
macro_rules! t {
|
||||
($x:expr, $expected:expr) => {
|
||||
assert_eq!(format!("{}", $x), $expected.to_string())
|
||||
assert_eq!(format!("{:?}", $x), $expected.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
t!(Unit, "Unit");
|
||||
t!(Tuple(1, 2), "Tuple(1, 2)");
|
||||
t!(Struct { x: 1, y: 2 }, "Struct { x: 1, y: 2 }");
|
||||
t!(Tuple(1, 2), "Tuple(1i, 2u)");
|
||||
t!(Struct { x: 1, y: 2 }, "Struct { x: 1i, y: 2u }");
|
||||
t!(Enum::Nullary, "Nullary");
|
||||
t!(Enum::Variant(1, 2), "Variant(1, 2)");
|
||||
t!(Enum::StructVariant { x: 1, y: 2 }, "StructVariant { x: 1, y: 2 }");
|
||||
t!(Enum::Variant(1, 2), "Variant(1i, 2u)");
|
||||
t!(Enum::StructVariant { x: 1, y: 2 }, "StructVariant { x: 1i, y: 2u }");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,5 +37,5 @@ impl Index<uint> for T {
|
|||
|
||||
fn main() {
|
||||
assert_eq!(&S[0], "hello");
|
||||
assert_eq!(format!("{}", &T[0]).as_slice(), "42");
|
||||
assert_eq!(format!("{:?}", &T[0]), "42u");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ macro_rules! check {
|
|||
assert_eq!(size_of::<E>(), size_of::<$t>());
|
||||
assert_eq!(E::V as $t, $v as $t);
|
||||
assert_eq!(C as $t, $v as $t);
|
||||
assert_eq!(format!("{}", E::V), "V".to_string());
|
||||
assert_eq!(format!("{}", C), "V".to_string());
|
||||
assert_eq!(format!("{:?}", E::V), "V".to_string());
|
||||
assert_eq!(format!("{:?}", C), "V".to_string());
|
||||
}
|
||||
}
|
||||
$m::check();
|
||||
|
|
|
|||
|
|
@ -17,5 +17,5 @@ struct Foo {
|
|||
pub fn main() {
|
||||
let a = Foo { x: 1, y: 2 };
|
||||
let c = Foo { x: 4, .. a};
|
||||
println!("{}", c);
|
||||
println!("{:?}", c);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ impl fmt::UpperHex for B {
|
|||
f.write_str("adios")
|
||||
}
|
||||
}
|
||||
impl fmt::Show for C {
|
||||
impl fmt::String for C {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.pad_integral(true, "☃", "123")
|
||||
}
|
||||
|
|
@ -58,9 +58,12 @@ pub fn main() {
|
|||
t!(format!("{}", true), "true");
|
||||
t!(format!("{}", '☃'), "☃");
|
||||
t!(format!("{}", 10i), "10");
|
||||
t!(format!("{}", 10i), "10");
|
||||
t!(format!("{}", 10u), "10");
|
||||
t!(format!("{:?}", true), "true");
|
||||
t!(format!("{:?}", '☃'), "'\\u{2603}'");
|
||||
t!(format!("{:?}", 10i), "10i");
|
||||
t!(format!("{:?}", 10u), "10u");
|
||||
t!(format!("{:?}", "true"), "\"true\"");
|
||||
t!(format!("{:?}", "foo\nbar"), "\"foo\\nbar\"");
|
||||
t!(format!("{:o}", 10u), "12");
|
||||
t!(format!("{:x}", 10u), "a");
|
||||
t!(format!("{:X}", 10u), "A");
|
||||
|
|
@ -80,7 +83,8 @@ pub fn main() {
|
|||
t!(format!("{:#4}", C), "☃123");
|
||||
|
||||
let a: &fmt::Show = &1i;
|
||||
t!(format!("{}", a), "1");
|
||||
t!(format!("{:?}", a), "1i");
|
||||
|
||||
|
||||
// Formatting strings and their arguments
|
||||
t!(format!("{}", "a"), "a");
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ enum Foo<'s> {
|
|||
|
||||
fn f(arr: &[&Foo]) {
|
||||
for &f in arr.iter() {
|
||||
println!("{}", f);
|
||||
println!("{:?}", f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,5 +30,5 @@ pub fn main () {
|
|||
|
||||
let mut p = process::Command::new(args[0].as_slice());
|
||||
p.arg("child").stdout(process::Ignored).stderr(process::Ignored);
|
||||
println!("{}", p.spawn().unwrap().wait());
|
||||
println!("{:?}", p.spawn().unwrap().wait());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ impl T<int> for Empty {
|
|||
}
|
||||
|
||||
fn do_something_with(a : &mut T<int>) {
|
||||
println!("{}", a.next())
|
||||
println!("{:?}", a.next())
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@
|
|||
|
||||
fn main() {
|
||||
fn test() -> Box<std::any::Any + 'static> { box 1i }
|
||||
println!("{}", test())
|
||||
println!("{:?}", test())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,5 +26,5 @@ fn do_stuff<R: Repro>(r: R) -> String {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
assert_eq!("MyStruct".to_string(), do_stuff(|: s: MyStruct| format!("{}", s)));
|
||||
assert_eq!("MyStruct".to_string(), do_stuff(|: s: MyStruct| format!("{:?}", s)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,5 +15,5 @@ use std::collections::HashMap;
|
|||
pub fn main() {
|
||||
let mut m = HashMap::new();
|
||||
m.insert(b"foo".to_vec(), b"bar".to_vec());
|
||||
println!("{}", m);
|
||||
println!("{:?}", m);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
struct LifetimeStruct<'a>;
|
||||
|
||||
fn main() {
|
||||
takes_hrtb_closure(|&mut: lts| println!("{}", lts));
|
||||
takes_hrtb_closure(|&mut: lts| println!("{:?}", lts));
|
||||
}
|
||||
|
||||
fn takes_hrtb_closure<F: for<'a>FnMut(LifetimeStruct<'a>)>(mut f: F) {
|
||||
|
|
|
|||
|
|
@ -25,5 +25,5 @@ impl Trait for int {}
|
|||
fn main() {
|
||||
let a = Foo { foo: 12i };
|
||||
let b = Bar { bar: 12i };
|
||||
println!("{} {}", a, b);
|
||||
println!("{:?} {:?}", a, b);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@
|
|||
// except according to those terms.
|
||||
|
||||
pub fn main() {
|
||||
println!("{}", ("hi there!", "you"));
|
||||
println!("{:?}", ("hi there!", "you"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,6 @@ pub fn main()
|
|||
"foo".to_string(),
|
||||
"foo".to_string(), "foo".to_string(), "foo".to_string(),
|
||||
"foo".to_string());
|
||||
let v = format!("{}", u); // this is the line that causes the seg fault
|
||||
let v = format!("{:?}", u); // this is the line that causes the seg fault
|
||||
assert!(v.len() > 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,6 @@ pub fn main() {
|
|||
let mut table = HashMap::new();
|
||||
table.insert("one".to_string(), 1i);
|
||||
table.insert("two".to_string(), 2i);
|
||||
assert!(check_strs(table.to_string().as_slice(), "{one: 1, two: 2}") ||
|
||||
check_strs(table.to_string().as_slice(), "{two: 2, one: 1}"));
|
||||
assert!(check_strs(format!("{:?}", table).as_slice(), "HashMap {\"one\": 1i, \"two\": 2i}") ||
|
||||
check_strs(format!("{:?}", table).as_slice(), "HashMap {\"two\": 2i, \"one\": 1i}"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ impl AsciiArt {
|
|||
|
||||
// Allows AsciiArt to be converted to a string using the libcore ToString trait.
|
||||
// Note that the %s fmt! specifier will not call this automatically.
|
||||
impl fmt::Show for AsciiArt {
|
||||
impl fmt::String for AsciiArt {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
// Convert each line into a string.
|
||||
let lines = self.lines.iter()
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ struct S {
|
|||
|
||||
impl T for S {
|
||||
fn print(&self) {
|
||||
println!("{}", self);
|
||||
println!("{:?}", self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
trait X {
|
||||
fn call<T: std::fmt::Show>(&self, x: &T);
|
||||
fn default_method<T: std::fmt::Show>(&self, x: &T) {
|
||||
println!("X::default_method {}", x);
|
||||
println!("X::default_method {:?}", x);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ struct Z<T> {
|
|||
|
||||
impl X for Y {
|
||||
fn call<T: std::fmt::Show>(&self, x: &T) {
|
||||
println!("X::call {} {}", self, x);
|
||||
println!("X::call {:?} {:?}", self, x);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,6 @@ pub fn main() {
|
|||
let sa = A { a: 100 };
|
||||
let sb = B { b: 200, pa: &sa };
|
||||
|
||||
println!("sa is {}", sa);
|
||||
println!("sb is {}", sb);
|
||||
println!("sa is {:?}", sa);
|
||||
println!("sb is {:?}", sb);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#![feature(slicing_syntax)]
|
||||
|
||||
fn assert_repr_eq<T: std::fmt::Show>(obj : T, expected : String) {
|
||||
assert_eq!(expected, format!("{}", obj));
|
||||
assert_eq!(expected, format!("{:?}", obj));
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
@ -20,7 +20,7 @@ pub fn main() {
|
|||
let x = [(), ()];
|
||||
let slice = &x[0..1];
|
||||
|
||||
assert_repr_eq(&abc[], "[1, 2, 3]".to_string());
|
||||
assert_repr_eq(&abc[], "[1i, 2i, 3i]".to_string());
|
||||
assert_repr_eq(&tf[], "[true, false]".to_string());
|
||||
assert_repr_eq(&x[], "[(), ()]".to_string());
|
||||
assert_repr_eq(slice, "[()]".to_string());
|
||||
|
|
|
|||
|
|
@ -15,19 +15,19 @@ enum foo {
|
|||
}
|
||||
|
||||
fn check_log<T: std::fmt::Show>(exp: String, v: T) {
|
||||
assert_eq!(exp, format!("{}", v));
|
||||
assert_eq!(exp, format!("{:?}", v));
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let mut x = Some(foo::a(22u));
|
||||
let exp = "Some(a(22))".to_string();
|
||||
let act = format!("{}", x);
|
||||
let exp = "Some(a(22u))".to_string();
|
||||
let act = format!("{:?}", x);
|
||||
assert_eq!(act, exp);
|
||||
check_log(exp, x);
|
||||
|
||||
x = None;
|
||||
let exp = "None".to_string();
|
||||
let act = format!("{}", x);
|
||||
let act = format!("{:?}", x);
|
||||
assert_eq!(act, exp);
|
||||
check_log(exp, x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ enum bar {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
assert_eq!("a(22)".to_string(), format!("{}", foo::a(22u)));
|
||||
assert_eq!("c".to_string(), format!("{}", foo::c));
|
||||
assert_eq!("d".to_string(), format!("{}", bar::d));
|
||||
assert_eq!("a(22u)".to_string(), format!("{:?}", foo::a(22u)));
|
||||
assert_eq!("c".to_string(), format!("{:?}", foo::c));
|
||||
assert_eq!("d".to_string(), format!("{:?}", bar::d));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ enum Numbers {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
println!("{}", 1i);
|
||||
println!("{}", 2.0f64);
|
||||
println!("{}", Numbers::Three);
|
||||
println!("{}", vec!(4i));
|
||||
println!("{:?}", 1i);
|
||||
println!("{:?}", 2.0f64);
|
||||
println!("{:?}", Numbers::Three);
|
||||
println!("{:?}", vec!(4i));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ impl fmt::Show for Foo {
|
|||
pub fn main() {
|
||||
Thread::spawn(move|| {
|
||||
let mut f = Foo(Cell::new(0));
|
||||
println!("{}", f);
|
||||
println!("{:?}", f);
|
||||
let Foo(ref mut f) = f;
|
||||
assert!(f.get() == 1);
|
||||
}).join().ok().unwrap();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ struct Thingy {
|
|||
|
||||
impl fmt::Show for Thingy {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{{ x: {}, y: {} }}", self.x, self.y)
|
||||
write!(f, "{{ x: {:?}, y: {:?} }}", self.x, self.y)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -27,11 +27,11 @@ struct PolymorphicThingy<T> {
|
|||
|
||||
impl<T:fmt::Show> fmt::Show for PolymorphicThingy<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.x)
|
||||
write!(f, "{:?}", self.x)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
println!("{}", Thingy { x: 1, y: 2 }.to_string());
|
||||
println!("{}", PolymorphicThingy { x: Thingy { x: 1, y: 2 } }.to_string());
|
||||
println!("{:?}", Thingy { x: 1, y: 2 });
|
||||
println!("{:?}", PolymorphicThingy { x: Thingy { x: 1, y: 2 } });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ impl<K: PartialEq + std::fmt::Show, V:Clone> Index<K> for AssociationList<K,V> {
|
|||
return &pair.value
|
||||
}
|
||||
}
|
||||
panic!("No value found for key: {}", index);
|
||||
panic!("No value found for key: {:?}", index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,11 +53,11 @@ pub fn main() {
|
|||
let x = Outer {c8: 22u8, t: Inner {c64: 44u32}};
|
||||
|
||||
// Send it through the shape code
|
||||
let y = format!("{}", x);
|
||||
let y = format!("{:?}", x);
|
||||
|
||||
println!("align inner = {}", rusti::min_align_of::<Inner>());
|
||||
println!("size outer = {}", mem::size_of::<Outer>());
|
||||
println!("y = {}", y);
|
||||
println!("align inner = {:?}", rusti::min_align_of::<Inner>());
|
||||
println!("size outer = {:?}", mem::size_of::<Outer>());
|
||||
println!("y = {:?}", y);
|
||||
|
||||
// per clang/gcc the alignment of `inner` is 4 on x86.
|
||||
assert_eq!(rusti::min_align_of::<Inner>(), m::align());
|
||||
|
|
@ -66,6 +66,6 @@ pub fn main() {
|
|||
// because `inner`s alignment was 4.
|
||||
assert_eq!(mem::size_of::<Outer>(), m::size());
|
||||
|
||||
assert_eq!(y, "Outer { c8: 22, t: Inner { c64: 44 } }".to_string());
|
||||
assert_eq!(y, "Outer { c8: 22u8, t: Inner { c64: 44u32 } }".to_string());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,11 +82,11 @@ pub fn main() {
|
|||
unsafe {
|
||||
let x = Outer {c8: 22u8, t: Inner {c64: 44u64}};
|
||||
|
||||
let y = format!("{}", x);
|
||||
let y = format!("{:?}", x);
|
||||
|
||||
println!("align inner = {}", rusti::min_align_of::<Inner>());
|
||||
println!("size outer = {}", mem::size_of::<Outer>());
|
||||
println!("y = {}", y);
|
||||
println!("align inner = {:?}", rusti::min_align_of::<Inner>());
|
||||
println!("size outer = {:?}", mem::size_of::<Outer>());
|
||||
println!("y = {:?}", y);
|
||||
|
||||
// per clang/gcc the alignment of `Inner` is 4 on x86.
|
||||
assert_eq!(rusti::min_align_of::<Inner>(), m::m::align());
|
||||
|
|
@ -95,6 +95,6 @@ pub fn main() {
|
|||
// because `Inner`s alignment was 4.
|
||||
assert_eq!(mem::size_of::<Outer>(), m::m::size());
|
||||
|
||||
assert_eq!(y, "Outer { c8: 22, t: Inner { c64: 44 } }".to_string());
|
||||
assert_eq!(y, "Outer { c8: 22u8, t: Inner { c64: 44u64 } }".to_string());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ pub fn main() {
|
|||
let a = r(i);
|
||||
let b = (a, 10i);
|
||||
let (c, _d) = b;
|
||||
println!("{}", c);
|
||||
println!("{:?}", c);
|
||||
}
|
||||
assert_eq!(i.get(), 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ fn start(argc: int, argv: *const *const u8) -> int {
|
|||
|
||||
fn pass(output: ProcessOutput) {
|
||||
if !output.status.success() {
|
||||
println!("{}", str::from_utf8(output.output.as_slice()));
|
||||
println!("{}", str::from_utf8(output.error.as_slice()));
|
||||
println!("{:?}", str::from_utf8(output.output.as_slice()));
|
||||
println!("{:?}", str::from_utf8(output.error.as_slice()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@
|
|||
struct Foo(Box<[u8]>);
|
||||
|
||||
pub fn main() {
|
||||
println!("{}", Foo(box [0, 1, 2]));
|
||||
println!("{:?}", Foo(box [0, 1, 2]));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ macro_rules! check {
|
|||
static S: $t = $e;
|
||||
let v: $t = $e;
|
||||
assert_eq!(S, v);
|
||||
assert_eq!(format!("{}", v).as_slice(), $s);
|
||||
assert_eq!(format!("{}", S).as_slice(), $s);
|
||||
assert_eq!(format!("{:?}", v).as_slice(), $s);
|
||||
assert_eq!(format!("{:?}", S).as_slice(), $s);
|
||||
});*
|
||||
}}
|
||||
}
|
||||
|
|
@ -29,14 +29,14 @@ macro_rules! check {
|
|||
pub fn main() {
|
||||
check!(Option<u8>, 2,
|
||||
None, "None",
|
||||
Some(129u8), "Some(129)");
|
||||
Some(129u8), "Some(129u8)");
|
||||
check!(Option<i16>, 4,
|
||||
None, "None",
|
||||
Some(-20000i16), "Some(-20000)");
|
||||
Some(-20000i16), "Some(-20000i16)");
|
||||
check!(Either<u8, i8>, 2,
|
||||
Either::Left(132u8), "Left(132)",
|
||||
Either::Right(-32i8), "Right(-32)");
|
||||
Either::Left(132u8), "Left(132u8)",
|
||||
Either::Right(-32i8), "Right(-32i8)");
|
||||
check!(Either<u8, i16>, 4,
|
||||
Either::Left(132u8), "Left(132)",
|
||||
Either::Right(-20000i16), "Right(-20000)");
|
||||
Either::Left(132u8), "Left(132u8)",
|
||||
Either::Right(-20000i16), "Right(-20000i16)");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,208 +12,208 @@ extern crate libc;
|
|||
|
||||
pub fn main() {
|
||||
let f = 1u as *const libc::FILE;
|
||||
println!("{}", f as int);
|
||||
println!("{}", f as uint);
|
||||
println!("{}", f as i8);
|
||||
println!("{}", f as i16);
|
||||
println!("{}", f as i32);
|
||||
println!("{}", f as i64);
|
||||
println!("{}", f as u8);
|
||||
println!("{}", f as u16);
|
||||
println!("{}", f as u32);
|
||||
println!("{}", f as u64);
|
||||
println!("{:?}", f as int);
|
||||
println!("{:?}", f as uint);
|
||||
println!("{:?}", f as i8);
|
||||
println!("{:?}", f as i16);
|
||||
println!("{:?}", f as i32);
|
||||
println!("{:?}", f as i64);
|
||||
println!("{:?}", f as u8);
|
||||
println!("{:?}", f as u16);
|
||||
println!("{:?}", f as u32);
|
||||
println!("{:?}", f as u64);
|
||||
|
||||
println!("{}", 1 as int);
|
||||
println!("{}", 1 as uint);
|
||||
println!("{}", 1 as *const libc::FILE);
|
||||
println!("{}", 1 as i8);
|
||||
println!("{}", 1 as i16);
|
||||
println!("{}", 1 as i32);
|
||||
println!("{}", 1 as i64);
|
||||
println!("{}", 1 as u8);
|
||||
println!("{}", 1 as u16);
|
||||
println!("{}", 1 as u32);
|
||||
println!("{}", 1 as u64);
|
||||
println!("{}", 1i as f32);
|
||||
println!("{}", 1i as f64);
|
||||
println!("{:?}", 1 as int);
|
||||
println!("{:?}", 1 as uint);
|
||||
println!("{:?}", 1 as *const libc::FILE);
|
||||
println!("{:?}", 1 as i8);
|
||||
println!("{:?}", 1 as i16);
|
||||
println!("{:?}", 1 as i32);
|
||||
println!("{:?}", 1 as i64);
|
||||
println!("{:?}", 1 as u8);
|
||||
println!("{:?}", 1 as u16);
|
||||
println!("{:?}", 1 as u32);
|
||||
println!("{:?}", 1 as u64);
|
||||
println!("{:?}", 1i as f32);
|
||||
println!("{:?}", 1i as f64);
|
||||
|
||||
println!("{}", 1u as int);
|
||||
println!("{}", 1u as uint);
|
||||
println!("{}", 1u as *const libc::FILE);
|
||||
println!("{}", 1u as i8);
|
||||
println!("{}", 1u as i16);
|
||||
println!("{}", 1u as i32);
|
||||
println!("{}", 1u as i64);
|
||||
println!("{}", 1u as u8);
|
||||
println!("{}", 1u as u16);
|
||||
println!("{}", 1u as u32);
|
||||
println!("{}", 1u as u64);
|
||||
println!("{}", 1u as f32);
|
||||
println!("{}", 1u as f64);
|
||||
println!("{:?}", 1u as int);
|
||||
println!("{:?}", 1u as uint);
|
||||
println!("{:?}", 1u as *const libc::FILE);
|
||||
println!("{:?}", 1u as i8);
|
||||
println!("{:?}", 1u as i16);
|
||||
println!("{:?}", 1u as i32);
|
||||
println!("{:?}", 1u as i64);
|
||||
println!("{:?}", 1u as u8);
|
||||
println!("{:?}", 1u as u16);
|
||||
println!("{:?}", 1u as u32);
|
||||
println!("{:?}", 1u as u64);
|
||||
println!("{:?}", 1u as f32);
|
||||
println!("{:?}", 1u as f64);
|
||||
|
||||
println!("{}", 1i8 as int);
|
||||
println!("{}", 1i8 as uint);
|
||||
println!("{}", 1i8 as *const libc::FILE);
|
||||
println!("{}", 1i8 as i8);
|
||||
println!("{}", 1i8 as i16);
|
||||
println!("{}", 1i8 as i32);
|
||||
println!("{}", 1i8 as i64);
|
||||
println!("{}", 1i8 as u8);
|
||||
println!("{}", 1i8 as u16);
|
||||
println!("{}", 1i8 as u32);
|
||||
println!("{}", 1i8 as u64);
|
||||
println!("{}", 1i8 as f32);
|
||||
println!("{}", 1i8 as f64);
|
||||
println!("{:?}", 1i8 as int);
|
||||
println!("{:?}", 1i8 as uint);
|
||||
println!("{:?}", 1i8 as *const libc::FILE);
|
||||
println!("{:?}", 1i8 as i8);
|
||||
println!("{:?}", 1i8 as i16);
|
||||
println!("{:?}", 1i8 as i32);
|
||||
println!("{:?}", 1i8 as i64);
|
||||
println!("{:?}", 1i8 as u8);
|
||||
println!("{:?}", 1i8 as u16);
|
||||
println!("{:?}", 1i8 as u32);
|
||||
println!("{:?}", 1i8 as u64);
|
||||
println!("{:?}", 1i8 as f32);
|
||||
println!("{:?}", 1i8 as f64);
|
||||
|
||||
println!("{}", 1u8 as int);
|
||||
println!("{}", 1u8 as uint);
|
||||
println!("{}", 1u8 as *const libc::FILE);
|
||||
println!("{}", 1u8 as i8);
|
||||
println!("{}", 1u8 as i16);
|
||||
println!("{}", 1u8 as i32);
|
||||
println!("{}", 1u8 as i64);
|
||||
println!("{}", 1u8 as u8);
|
||||
println!("{}", 1u8 as u16);
|
||||
println!("{}", 1u8 as u32);
|
||||
println!("{}", 1u8 as u64);
|
||||
println!("{}", 1u8 as f32);
|
||||
println!("{}", 1u8 as f64);
|
||||
println!("{:?}", 1u8 as int);
|
||||
println!("{:?}", 1u8 as uint);
|
||||
println!("{:?}", 1u8 as *const libc::FILE);
|
||||
println!("{:?}", 1u8 as i8);
|
||||
println!("{:?}", 1u8 as i16);
|
||||
println!("{:?}", 1u8 as i32);
|
||||
println!("{:?}", 1u8 as i64);
|
||||
println!("{:?}", 1u8 as u8);
|
||||
println!("{:?}", 1u8 as u16);
|
||||
println!("{:?}", 1u8 as u32);
|
||||
println!("{:?}", 1u8 as u64);
|
||||
println!("{:?}", 1u8 as f32);
|
||||
println!("{:?}", 1u8 as f64);
|
||||
|
||||
println!("{}", 1i16 as int);
|
||||
println!("{}", 1i16 as uint);
|
||||
println!("{}", 1i16 as *const libc::FILE);
|
||||
println!("{}", 1i16 as i8);
|
||||
println!("{}", 1i16 as i16);
|
||||
println!("{}", 1i16 as i32);
|
||||
println!("{}", 1i16 as i64);
|
||||
println!("{}", 1i16 as u8);
|
||||
println!("{}", 1i16 as u16);
|
||||
println!("{}", 1i16 as u32);
|
||||
println!("{}", 1i16 as u64);
|
||||
println!("{}", 1i16 as f32);
|
||||
println!("{}", 1i16 as f64);
|
||||
println!("{:?}", 1i16 as int);
|
||||
println!("{:?}", 1i16 as uint);
|
||||
println!("{:?}", 1i16 as *const libc::FILE);
|
||||
println!("{:?}", 1i16 as i8);
|
||||
println!("{:?}", 1i16 as i16);
|
||||
println!("{:?}", 1i16 as i32);
|
||||
println!("{:?}", 1i16 as i64);
|
||||
println!("{:?}", 1i16 as u8);
|
||||
println!("{:?}", 1i16 as u16);
|
||||
println!("{:?}", 1i16 as u32);
|
||||
println!("{:?}", 1i16 as u64);
|
||||
println!("{:?}", 1i16 as f32);
|
||||
println!("{:?}", 1i16 as f64);
|
||||
|
||||
println!("{}", 1u16 as int);
|
||||
println!("{}", 1u16 as uint);
|
||||
println!("{}", 1u16 as *const libc::FILE);
|
||||
println!("{}", 1u16 as i8);
|
||||
println!("{}", 1u16 as i16);
|
||||
println!("{}", 1u16 as i32);
|
||||
println!("{}", 1u16 as i64);
|
||||
println!("{}", 1u16 as u8);
|
||||
println!("{}", 1u16 as u16);
|
||||
println!("{}", 1u16 as u32);
|
||||
println!("{}", 1u16 as u64);
|
||||
println!("{}", 1u16 as f32);
|
||||
println!("{}", 1u16 as f64);
|
||||
println!("{:?}", 1u16 as int);
|
||||
println!("{:?}", 1u16 as uint);
|
||||
println!("{:?}", 1u16 as *const libc::FILE);
|
||||
println!("{:?}", 1u16 as i8);
|
||||
println!("{:?}", 1u16 as i16);
|
||||
println!("{:?}", 1u16 as i32);
|
||||
println!("{:?}", 1u16 as i64);
|
||||
println!("{:?}", 1u16 as u8);
|
||||
println!("{:?}", 1u16 as u16);
|
||||
println!("{:?}", 1u16 as u32);
|
||||
println!("{:?}", 1u16 as u64);
|
||||
println!("{:?}", 1u16 as f32);
|
||||
println!("{:?}", 1u16 as f64);
|
||||
|
||||
println!("{}", 1i32 as int);
|
||||
println!("{}", 1i32 as uint);
|
||||
println!("{}", 1i32 as *const libc::FILE);
|
||||
println!("{}", 1i32 as i8);
|
||||
println!("{}", 1i32 as i16);
|
||||
println!("{}", 1i32 as i32);
|
||||
println!("{}", 1i32 as i64);
|
||||
println!("{}", 1i32 as u8);
|
||||
println!("{}", 1i32 as u16);
|
||||
println!("{}", 1i32 as u32);
|
||||
println!("{}", 1i32 as u64);
|
||||
println!("{}", 1i32 as f32);
|
||||
println!("{}", 1i32 as f64);
|
||||
println!("{:?}", 1i32 as int);
|
||||
println!("{:?}", 1i32 as uint);
|
||||
println!("{:?}", 1i32 as *const libc::FILE);
|
||||
println!("{:?}", 1i32 as i8);
|
||||
println!("{:?}", 1i32 as i16);
|
||||
println!("{:?}", 1i32 as i32);
|
||||
println!("{:?}", 1i32 as i64);
|
||||
println!("{:?}", 1i32 as u8);
|
||||
println!("{:?}", 1i32 as u16);
|
||||
println!("{:?}", 1i32 as u32);
|
||||
println!("{:?}", 1i32 as u64);
|
||||
println!("{:?}", 1i32 as f32);
|
||||
println!("{:?}", 1i32 as f64);
|
||||
|
||||
println!("{}", 1u32 as int);
|
||||
println!("{}", 1u32 as uint);
|
||||
println!("{}", 1u32 as *const libc::FILE);
|
||||
println!("{}", 1u32 as i8);
|
||||
println!("{}", 1u32 as i16);
|
||||
println!("{}", 1u32 as i32);
|
||||
println!("{}", 1u32 as i64);
|
||||
println!("{}", 1u32 as u8);
|
||||
println!("{}", 1u32 as u16);
|
||||
println!("{}", 1u32 as u32);
|
||||
println!("{}", 1u32 as u64);
|
||||
println!("{}", 1u32 as f32);
|
||||
println!("{}", 1u32 as f64);
|
||||
println!("{:?}", 1u32 as int);
|
||||
println!("{:?}", 1u32 as uint);
|
||||
println!("{:?}", 1u32 as *const libc::FILE);
|
||||
println!("{:?}", 1u32 as i8);
|
||||
println!("{:?}", 1u32 as i16);
|
||||
println!("{:?}", 1u32 as i32);
|
||||
println!("{:?}", 1u32 as i64);
|
||||
println!("{:?}", 1u32 as u8);
|
||||
println!("{:?}", 1u32 as u16);
|
||||
println!("{:?}", 1u32 as u32);
|
||||
println!("{:?}", 1u32 as u64);
|
||||
println!("{:?}", 1u32 as f32);
|
||||
println!("{:?}", 1u32 as f64);
|
||||
|
||||
println!("{}", 1i64 as int);
|
||||
println!("{}", 1i64 as uint);
|
||||
println!("{}", 1i64 as *const libc::FILE);
|
||||
println!("{}", 1i64 as i8);
|
||||
println!("{}", 1i64 as i16);
|
||||
println!("{}", 1i64 as i32);
|
||||
println!("{}", 1i64 as i64);
|
||||
println!("{}", 1i64 as u8);
|
||||
println!("{}", 1i64 as u16);
|
||||
println!("{}", 1i64 as u32);
|
||||
println!("{}", 1i64 as u64);
|
||||
println!("{}", 1i64 as f32);
|
||||
println!("{}", 1i64 as f64);
|
||||
println!("{:?}", 1i64 as int);
|
||||
println!("{:?}", 1i64 as uint);
|
||||
println!("{:?}", 1i64 as *const libc::FILE);
|
||||
println!("{:?}", 1i64 as i8);
|
||||
println!("{:?}", 1i64 as i16);
|
||||
println!("{:?}", 1i64 as i32);
|
||||
println!("{:?}", 1i64 as i64);
|
||||
println!("{:?}", 1i64 as u8);
|
||||
println!("{:?}", 1i64 as u16);
|
||||
println!("{:?}", 1i64 as u32);
|
||||
println!("{:?}", 1i64 as u64);
|
||||
println!("{:?}", 1i64 as f32);
|
||||
println!("{:?}", 1i64 as f64);
|
||||
|
||||
println!("{}", 1u64 as int);
|
||||
println!("{}", 1u64 as uint);
|
||||
println!("{}", 1u64 as *const libc::FILE);
|
||||
println!("{}", 1u64 as i8);
|
||||
println!("{}", 1u64 as i16);
|
||||
println!("{}", 1u64 as i32);
|
||||
println!("{}", 1u64 as i64);
|
||||
println!("{}", 1u64 as u8);
|
||||
println!("{}", 1u64 as u16);
|
||||
println!("{}", 1u64 as u32);
|
||||
println!("{}", 1u64 as u64);
|
||||
println!("{}", 1u64 as f32);
|
||||
println!("{}", 1u64 as f64);
|
||||
println!("{:?}", 1u64 as int);
|
||||
println!("{:?}", 1u64 as uint);
|
||||
println!("{:?}", 1u64 as *const libc::FILE);
|
||||
println!("{:?}", 1u64 as i8);
|
||||
println!("{:?}", 1u64 as i16);
|
||||
println!("{:?}", 1u64 as i32);
|
||||
println!("{:?}", 1u64 as i64);
|
||||
println!("{:?}", 1u64 as u8);
|
||||
println!("{:?}", 1u64 as u16);
|
||||
println!("{:?}", 1u64 as u32);
|
||||
println!("{:?}", 1u64 as u64);
|
||||
println!("{:?}", 1u64 as f32);
|
||||
println!("{:?}", 1u64 as f64);
|
||||
|
||||
println!("{}", 1u64 as int);
|
||||
println!("{}", 1u64 as uint);
|
||||
println!("{}", 1u64 as *const libc::FILE);
|
||||
println!("{}", 1u64 as i8);
|
||||
println!("{}", 1u64 as i16);
|
||||
println!("{}", 1u64 as i32);
|
||||
println!("{}", 1u64 as i64);
|
||||
println!("{}", 1u64 as u8);
|
||||
println!("{}", 1u64 as u16);
|
||||
println!("{}", 1u64 as u32);
|
||||
println!("{}", 1u64 as u64);
|
||||
println!("{}", 1u64 as f32);
|
||||
println!("{}", 1u64 as f64);
|
||||
println!("{:?}", 1u64 as int);
|
||||
println!("{:?}", 1u64 as uint);
|
||||
println!("{:?}", 1u64 as *const libc::FILE);
|
||||
println!("{:?}", 1u64 as i8);
|
||||
println!("{:?}", 1u64 as i16);
|
||||
println!("{:?}", 1u64 as i32);
|
||||
println!("{:?}", 1u64 as i64);
|
||||
println!("{:?}", 1u64 as u8);
|
||||
println!("{:?}", 1u64 as u16);
|
||||
println!("{:?}", 1u64 as u32);
|
||||
println!("{:?}", 1u64 as u64);
|
||||
println!("{:?}", 1u64 as f32);
|
||||
println!("{:?}", 1u64 as f64);
|
||||
|
||||
println!("{}", true as int);
|
||||
println!("{}", true as uint);
|
||||
println!("{}", true as *const libc::FILE);
|
||||
println!("{}", true as i8);
|
||||
println!("{}", true as i16);
|
||||
println!("{}", true as i32);
|
||||
println!("{}", true as i64);
|
||||
println!("{}", true as u8);
|
||||
println!("{}", true as u16);
|
||||
println!("{}", true as u32);
|
||||
println!("{}", true as u64);
|
||||
println!("{}", true as f32);
|
||||
println!("{}", true as f64);
|
||||
println!("{:?}", true as int);
|
||||
println!("{:?}", true as uint);
|
||||
println!("{:?}", true as *const libc::FILE);
|
||||
println!("{:?}", true as i8);
|
||||
println!("{:?}", true as i16);
|
||||
println!("{:?}", true as i32);
|
||||
println!("{:?}", true as i64);
|
||||
println!("{:?}", true as u8);
|
||||
println!("{:?}", true as u16);
|
||||
println!("{:?}", true as u32);
|
||||
println!("{:?}", true as u64);
|
||||
println!("{:?}", true as f32);
|
||||
println!("{:?}", true as f64);
|
||||
|
||||
println!("{}", 1f32 as int);
|
||||
println!("{}", 1f32 as uint);
|
||||
println!("{}", 1f32 as i8);
|
||||
println!("{}", 1f32 as i16);
|
||||
println!("{}", 1f32 as i32);
|
||||
println!("{}", 1f32 as i64);
|
||||
println!("{}", 1f32 as u8);
|
||||
println!("{}", 1f32 as u16);
|
||||
println!("{}", 1f32 as u32);
|
||||
println!("{}", 1f32 as u64);
|
||||
println!("{}", 1f32 as f32);
|
||||
println!("{}", 1f32 as f64);
|
||||
println!("{:?}", 1f32 as int);
|
||||
println!("{:?}", 1f32 as uint);
|
||||
println!("{:?}", 1f32 as i8);
|
||||
println!("{:?}", 1f32 as i16);
|
||||
println!("{:?}", 1f32 as i32);
|
||||
println!("{:?}", 1f32 as i64);
|
||||
println!("{:?}", 1f32 as u8);
|
||||
println!("{:?}", 1f32 as u16);
|
||||
println!("{:?}", 1f32 as u32);
|
||||
println!("{:?}", 1f32 as u64);
|
||||
println!("{:?}", 1f32 as f32);
|
||||
println!("{:?}", 1f32 as f64);
|
||||
|
||||
println!("{}", 1f64 as int);
|
||||
println!("{}", 1f64 as uint);
|
||||
println!("{}", 1f64 as i8);
|
||||
println!("{}", 1f64 as i16);
|
||||
println!("{}", 1f64 as i32);
|
||||
println!("{}", 1f64 as i64);
|
||||
println!("{}", 1f64 as u8);
|
||||
println!("{}", 1f64 as u16);
|
||||
println!("{}", 1f64 as u32);
|
||||
println!("{}", 1f64 as u64);
|
||||
println!("{}", 1f64 as f32);
|
||||
println!("{}", 1f64 as f64);
|
||||
println!("{:?}", 1f64 as int);
|
||||
println!("{:?}", 1f64 as uint);
|
||||
println!("{:?}", 1f64 as i8);
|
||||
println!("{:?}", 1f64 as i16);
|
||||
println!("{:?}", 1f64 as i32);
|
||||
println!("{:?}", 1f64 as i64);
|
||||
println!("{:?}", 1f64 as u8);
|
||||
println!("{:?}", 1f64 as u16);
|
||||
println!("{:?}", 1f64 as u32);
|
||||
println!("{:?}", 1f64 as u64);
|
||||
println!("{:?}", 1f64 as f32);
|
||||
println!("{:?}", 1f64 as f64);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ struct t_rec {
|
|||
|
||||
pub fn main() {
|
||||
let x = t_rec {c8: 22u8, t: a_tag::a_tag_var(44u64)};
|
||||
let y = format!("{}", x);
|
||||
println!("y = {}", y);
|
||||
assert_eq!(y, "t_rec { c8: 22, t: a_tag_var(44) }".to_string());
|
||||
let y = format!("{:?}", x);
|
||||
println!("y = {:?}", y);
|
||||
assert_eq!(y, "t_rec { c8: 22u8, t: a_tag_var(44u64) }".to_string());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ enum color {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
let act = format!("{}", color::red);
|
||||
let act = format!("{:?}", color::red);
|
||||
println!("{}", act);
|
||||
assert_eq!("red".to_string(), act);
|
||||
assert_eq!("green".to_string(), format!("{}", color::green));
|
||||
assert_eq!("white".to_string(), format!("{}", color::white));
|
||||
assert_eq!("green".to_string(), format!("{:?}", color::green));
|
||||
assert_eq!("white".to_string(), format!("{:?}", color::white));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,5 +19,5 @@ pub fn main() {
|
|||
let (tx, rx) = channel();
|
||||
tx.send(42i);
|
||||
let r = rx.recv();
|
||||
println!("{}", r);
|
||||
println!("{:?}", r);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@ struct Foo(int, int);
|
|||
|
||||
pub fn main() {
|
||||
let x = Foo(1, 2);
|
||||
println!("{}", x);
|
||||
println!("{:?}", x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@
|
|||
// except according to those terms.
|
||||
|
||||
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 bar: &[int] = &[4, 5];
|
||||
|
||||
assert_eq!(foo.to_string(), "[3, 4]".to_string());
|
||||
assert_eq!(bar.to_string(), "[4, 5]".to_string());
|
||||
assert_eq!(foo.to_string(), "3, 4".to_string());
|
||||
assert_eq!(bar.to_string(), "4, 5".to_string());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue