fn test() {
let v: int;
v = 1; //~ NOTE prior assignment occurs here
- info!("v=%d", v);
+ info2!("v={}", v);
v = 2; //~ ERROR re-assignment of immutable variable
- info!("v=%d", v);
+ info2!("v={}", v);
}
fn main() {
fn main() {
let nyan : cat = cat(52u, 99);
- nyan.speak = || info!("meow"); //~ ERROR attempted to take value of method
+ nyan.speak = || info2!("meow"); //~ ERROR attempted to take value of method
}
let a: clam = clam{x: @1, y: @2};
let b: clam = clam{x: @10, y: @20};
let z: int = a.x + b.y; //~ ERROR binary operation + cannot be applied to type `@int`
- info!(z);
+ info2!("{:?}", z);
assert_eq!(z, 21);
let forty: fish = fish{a: @40};
let two: fish = fish{a: @2};
let answer: int = forty.a + two.a; //~ ERROR binary operation + cannot be applied to type `@int`
- info!(answer);
+ info2!("{:?}", answer);
assert_eq!(answer, 42);
}
// Tests that a function with a ! annotation always actually fails
fn bad_bang(i: uint) -> ! {
- if i < 0u { } else { fail!(); }
+ if i < 0u { } else { fail2!(); }
//~^ ERROR expected `!` but found `()`
}
// error-pattern:expected `~str` but found `int`
static i: ~str = 10i;
-fn main() { info!(i); }
+fn main() { info2!("{:?}", i); }
impl Drop for X {
fn drop(&mut self) {
- error!("destructor runs");
+ error2!("destructor runs");
}
}
let x = Some(X { x: () });
match x {
Some(ref _y @ _z) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
- None => fail!()
+ None => fail2!()
}
}
impl Drop for X {
fn drop(&mut self) {
- error!("destructor runs");
+ error2!("destructor runs");
}
}
let x = Some((X { x: () }, X { x: () }));
match x {
Some((ref _y, _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
- None => fail!()
+ None => fail2!()
}
}
impl Drop for X {
fn drop(&mut self) {
- error!("destructor runs");
+ error2!("destructor runs");
}
}
let x = some2(X { x: () }, X { x: () });
match x {
some2(ref _y, _z) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
- none2 => fail!()
+ none2 => fail2!()
}
}
impl Drop for X {
fn drop(&mut self) {
- error!("destructor runs");
+ error2!("destructor runs");
}
}
let x = Some((X { x: () }, X { x: () }));
match x {
Some((_y, ref _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
- None => fail!()
+ None => fail2!()
}
}
let x = Some(p);
c.send(false);
match x {
- Some(z) if z.recv() => { fail!() }, //~ ERROR cannot bind by-move into a pattern guard
+ Some(z) if z.recv() => { fail2!() }, //~ ERROR cannot bind by-move into a pattern guard
Some(z) => { assert!(!z.recv()); },
- None => fail!()
+ None => fail2!()
}
}
impl Drop for X {
fn drop(&mut self) {
- error!("destructor runs");
+ error2!("destructor runs");
}
}
let x = Some(X { x: () });
match x {
Some(_y @ ref _z) => { }, //~ ERROR cannot bind by-move with sub-bindings
- None => fail!()
+ None => fail2!()
}
}
fn main() {
let x = compute1();
- info!(x);
+ info2!("{:?}", x);
assert_eq!(x, -4f);
}
fn main() {
let i = 8;
- let f = coerce(|| error!(i) );
+ let f = coerce(|| error2!("{:?}", i) );
f();
}
fn main() {
let red: color = rgb(255, 0, 0);
match red {
- rgb(r, g, b) => { info!("rgb"); }
- hsl(h, s, l) => { info!("hsl"); }
+ rgb(r, g, b) => { info2!("rgb"); }
+ hsl(h, s, l) => { info2!("hsl"); }
}
}
let a = match y {
Y(ref mut a, _) => a,
- X => fail!()
+ X => fail2!()
};
let b = match y {
Y(_, ref mut b) => b,
- X => fail!()
+ X => fail2!()
};
*a += 1;
let a = match y {
Y(ref mut a, _) => a,
- X => fail!()
+ X => fail2!()
};
let b = match y {
Y(ref mut b, _) => b, //~ ERROR cannot borrow
- X => fail!()
+ X => fail2!()
};
*a += 1;
p[0] = 5; //~ ERROR cannot assign
- info!("%d", *q);
+ info2!("{}", *q);
}
fn borrow(_x: &[int], _f: &fn()) {}
x = X(Left((0,0))); //~ ERROR cannot assign to `x`
(*f)()
},
- _ => fail!()
+ _ => fail2!()
}
}
}
int2: int,
}
-fn make_foo() -> ~Foo { fail!() }
+fn make_foo() -> ~Foo { fail2!() }
fn borrow_same_field_twice_mut_mut() {
let mut foo = make_foo();
int2: int,
}
-fn make_foo() -> Foo { fail!() }
+fn make_foo() -> Foo { fail2!() }
fn borrow_same_field_twice_mut_mut() {
let mut foo = make_foo();
impl<'self> Drop for defer<'self> {
fn drop(&mut self) {
unsafe {
- error!("%?", self.x);
+ error2!("{:?}", self.x);
}
}
}
fn borrow(_v: &int) {}
fn borrow_mut(_v: &mut int) {}
-fn cond() -> bool { fail!() }
-fn for_func(_f: &fn() -> bool) { fail!() }
-fn produce<T>() -> T { fail!(); }
+fn cond() -> bool { fail2!() }
+fn for_func(_f: &fn() -> bool) { fail2!() }
+fn produce<T>() -> T { fail2!(); }
fn inc(v: &mut ~int) {
*v = ~(**v + 1);
fn borrow(_v: &int) {}
fn borrow_mut(_v: &mut int) {}
-fn cond() -> bool { fail!() }
-fn produce<T>() -> T { fail!(); }
+fn cond() -> bool { fail2!() }
+fn produce<T>() -> T { fail2!(); }
fn inc(v: &mut ~int) {
*v = ~(**v + 1);
#[allow(unused_variable)];
#[allow(dead_assignment)];
-fn cond() -> bool { fail!() }
+fn cond() -> bool { fail2!() }
fn link<'a>(v: &'a uint, w: &mut &'a uint) -> bool { *w = v; true }
fn separate_arms() {
fn borrow(_v: &int) {}
fn borrow_mut(_v: &mut int) {}
-fn cond() -> bool { fail!() }
-fn for_func(_f: &fn() -> bool) { fail!() }
-fn produce<T>() -> T { fail!(); }
+fn cond() -> bool { fail2!() }
+fn for_func(_f: &fn() -> bool) { fail2!() }
+fn produce<T>() -> T { fail2!(); }
fn inc(v: &mut ~int) {
*v = ~(**v + 1);
let v = ~3;
let _w = &v;
do task::spawn {
- info!("v=%d", *v);
+ info2!("v={}", *v);
//~^ ERROR cannot move `v` into closure
}
let v = ~3;
let _w = &v;
task::spawn(|| {
- info!("v=%d", *v);
+ info2!("v={}", *v);
//~^ ERROR cannot move
});
}
*x = Right(1.0);
*z
}
- _ => fail!()
+ _ => fail2!()
}
}
}
}
let z = tail[0].clone();
- info!(fmt!("%?", z));
+ info2!("{:?}", z);
}
_ => {
unreachable!();
let x: int = 3;
let y: &mut int = &mut x; //~ ERROR cannot borrow
*y = 5;
- info!(*y);
+ info2!("{:?}", *y);
}
Some(ref m) => { //~ ERROR borrowed value does not live long enough
msg = m;
},
- None => { fail!() }
+ None => { fail2!() }
}
println(*msg);
}
let vec = ~[1, 2, 3, 4];
let tail = match vec {
[_, ..tail] => tail, //~ ERROR does not live long enough
- _ => fail!("a")
+ _ => fail2!("a")
};
tail
}
let vec = ~[1, 2, 3, 4];
let init = match vec {
[..init, _] => init, //~ ERROR does not live long enough
- _ => fail!("b")
+ _ => fail2!("b")
};
init
}
let vec = ~[1, 2, 3, 4];
let slice = match vec {
[_, ..slice, _] => slice, //~ ERROR does not live long enough
- _ => fail!("c")
+ _ => fail2!("c")
};
slice
}
[~ref _a] => {
vec[0] = ~4; //~ ERROR cannot assign to `(*vec)[]` because it is borrowed
}
- _ => fail!("foo")
+ _ => fail2!("foo")
}
}
let vec = ~[1, 2, 3, 4];
let tail = match vec {
[_a, ..tail] => &tail[0], //~ ERROR borrowed value does not live long enough
- _ => fail!("foo")
+ _ => fail2!("foo")
};
tail
}
impl cat {
pub fn eat(&self) -> bool {
if self.how_hungry > 0 {
- error!("OM NOM NOM");
+ error2!("OM NOM NOM");
self.how_hungry -= 2;
return true;
}
else {
- error!("Not hungry!");
+ error2!("Not hungry!");
return false;
}
}
impl cat {
fn meow(&self) {
- error!("Meow");
+ error2!("Meow");
self.meows += 1;
if self.meows % 5 == 0 {
self.how_hungry += 1;
impl cat {
fn sleep(&self) { loop{} }
fn meow(&self) {
- error!("Meow");
+ error2!("Meow");
meows += 1u; //~ ERROR unresolved name
sleep(); //~ ERROR unresolved name
}
fn main() {
// Type inference didn't use to be able to handle this:
- foo(|| fail!());
+ foo(|| fail2!());
foo(|| 22); //~ ERROR mismatched types
}
let x = foo(10);
let _y = x.clone();
//~^ ERROR does not implement any method in scope
- error!(x);
+ error2!("{:?}", x);
}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- debug!("%s %s", 3); //~ ERROR: not enough arguments
-}
fn main() {
match *1 { //~ ERROR: cannot be dereferenced
- _ => { fail!(); }
+ _ => { fail2!(); }
}
}
+++ /dev/null
-use std::str;
-
-fn main() {
- let v = ~"test";
- let sslice = v.slice(0, v.len());
- //~^ ERROR borrowed value does not live long enough
- fail!(sslice);
-}
impl Drop for X {
fn drop(&mut self) {
- error!("value: %s", self.x);
+ error2!("value: {}", self.x);
}
}
fn main() {
let x = X { x: ~"hello" };
let y = unwrap(x);
- error!("contents: %s", y);
+ error2!("contents: {}", y);
}
impl Drop for X {
fn drop(&mut self) {
- error!("value: %s", self.x);
+ error2!("value: {}", self.x);
}
}
let x = X { x: ~"hello" };
match x {
- X { x: y } => error!("contents: %s", y)
+ X { x: y } => error2!("contents: {}", y)
//~^ ERROR cannot move out of type `X`, which defines the `Drop` trait
}
}
// error-pattern: unresolved name `this_does_nothing_what_the`.
-fn main() { info!("doing"); this_does_nothing_what_the; info!("boing"); }
+fn main() { info2!("doing"); this_does_nothing_what_the; info2!("boing"); }
}
mod bar {
- fn x() { info!("x"); }
+ fn x() { info2!("x"); }
pub fn y() { }
}
// error-pattern:missing type
-fn main() { fmt!("%+"); }
+fn main() { oldfmt!("%+"); }
// error-pattern:fmt! takes at least 1 argument
-fn main() { fmt!(); }
+fn main() { oldfmt!(); }
// fmt!'s first argument must be a literal. Hopefully this
// restriction can be eased eventually to just require a
// compile-time constant.
- let x = fmt!("a" + "b");
+ let x = oldfmt!("a" + "b");
}
// fmt!'s first argument must be a literal. Hopefully this
// restriction can be eased eventually to just require a
// compile-time constant.
- let x = fmt!(20);
+ let x = oldfmt!(20);
}
extern mod extra;
-fn main() { let s = fmt!("%s%s%s", "test", "test"); }
+fn main() { let s = oldfmt!("%s%s%s", "test", "test"); }
extern mod extra;
-fn main() { let s = fmt!("%s", "test", "test"); }
+fn main() { let s = oldfmt!("%s", "test", "test"); }
// error-pattern:unknown type
-fn main() { fmt!("%w"); }
+fn main() { oldfmt!("%w"); }
fn main() {
// Can't use a sign on unsigned conversions
- fmt!("%+u", 10u);
+ oldfmt!("%+u", 10u);
}
fn main() {
// Can't use a space on unsigned conversions
- fmt!("% u", 10u);
+ oldfmt!("% u", 10u);
}
// error-pattern:unterminated conversion
-fn main() { fmt!("%"); }
+fn main() { oldfmt!("%"); }
// error-pattern:failed to find an implementation of trait std::sys::FailWithCause for int
-fn main() { fail!(5); }
+fn main() { fail2!(5); }
// error-pattern:unexpected token
fn main() {
- fail!(@);
+ fail2!(@);
}
// except according to those terms.
// error-pattern:failed to find an implementation of trait std::sys::FailWithCause for ~[int]
-fn main() { fail!(~[0i]); }
+fn main() { fail2!(~[0i]); }
struct A { y: Arc<int>, x: Arc<int> }
impl Drop for A {
- fn drop(&mut self) { println(fmt!("x=%?", self.x.get())); }
+ fn drop(&mut self) { println(format!("x={:?}", self.x.get())); }
}
fn main() {
let a = A { y: Arc::new(1), x: Arc::new(2) };
fn main() {
let a = if true { true };
- info!(a);
+ info2!("{:?}", a);
}
use module_of_many_things::*;
mod module_of_many_things {
- pub fn f1() { info!("f1"); }
- pub fn f2() { info!("f2"); }
- fn f3() { info!("f3"); }
- pub fn f4() { info!("f4"); }
+ pub fn f1() { info2!("f1"); }
+ pub fn f2() { info2!("f2"); }
+ fn f3() { info2!("f3"); }
+ pub fn f4() { info2!("f4"); }
}
mod circ1 {
pub use circ2::f2;
- pub fn f1() { info!("f1"); }
+ pub fn f1() { info2!("f1"); }
pub fn common() -> uint { return 0u; }
}
mod circ2 {
pub use circ1::f1;
- pub fn f2() { info!("f2"); }
+ pub fn f2() { info2!("f2"); }
pub fn common() -> uint { return 1u; }
}
use zed::bar;
use zed::baz;
mod zed {
- pub fn bar() { info!("bar"); }
+ pub fn bar() { info2!("bar"); }
}
fn main(args: ~[str]) { bar(); }
mod baz {}
mod zed {
- pub fn bar() { info!("bar3"); }
+ pub fn bar() { info2!("bar3"); }
}
fn main(args: ~[str]) { bar(); }
// error-pattern: unresolved
use main::bar;
-fn main(args: ~[str]) { info!("foo"); }
+fn main(args: ~[str]) { info2!("foo"); }
mod a { pub use b::foo; }
mod b { pub use a::foo; }
-fn main(args: ~[str]) { info!("loop"); }
+fn main(args: ~[str]) { info2!("loop"); }
// Regression test for issue #1448 and #1386
+fn foo(a: uint) -> uint { a }
+
fn main() {
- info!("%u", 10i); //~ ERROR mismatched types
+ info2!("{:u}", foo(10i)); //~ ERROR mismatched types
}
// except according to those terms.
fn main() {
- error!(x); //~ ERROR unresolved name `x`.
+ error2!("{:?}", x); //~ ERROR unresolved name `x`.
}
impl<A> vec_monad<A> for ~[A] {
fn bind<B>(&self, f: &fn(A) -> ~[B]) {
- let mut r = fail!();
+ let mut r = fail2!();
for elt in self.iter() { r = r + f(*elt); }
//~^ WARNING unreachable expression
//~^^ ERROR the type of this value must be known
fn fail_len(v: ~[int]) -> uint {
let mut i = 3;
- fail!();
+ fail2!();
for x in v.iter() { i += 1u; }
//~^ ERROR: unreachable statement
return i;
// except according to those terms.
fn main() {
- let x = fail!();
+ let x = fail2!();
x.clone(); //~ ERROR the type of this value must be known in this context
}
// error-pattern: unresolved name `foobar`.
-fn main(args: ~[str]) { info!(foobar); }
+fn main(args: ~[str]) { info2!("{:?}", foobar); }
// `chan` is not a trait, it's an enum
impl chan for int { //~ ERROR chan is not a trait
- fn send(&self, v: int) { fail!() }
+ fn send(&self, v: int) { fail2!() }
}
fn main() {
fn main() {
let kitty : cat = cat { x: () };
- error!(*kitty);
+ error2!("{:?}", *kitty);
}
fn main() {
let nyan = cat { foo: () };
- error!(*nyan);
+ error2!("{:?}", *nyan);
}
}
impl A for E {
- fn b<F:Freeze,G>(_x: F) -> F { fail!() } //~ ERROR type parameter 0 requires `Freeze`
+ fn b<F:Freeze,G>(_x: F) -> F { fail2!() } //~ ERROR type parameter 0 requires `Freeze`
}
fn main() {}
impl A for E {
// n.b. The error message is awful -- see #3404
- fn b<F:Clone,G>(&self, _x: G) -> G { fail!() } //~ ERROR method `b` has an incompatible type
+ fn b<F:Clone,G>(&self, _x: G) -> G { fail2!() } //~ ERROR method `b` has an incompatible type
}
fn main() {}
impl Drop for C {
fn drop(&mut self) {
- error!("dropping: %?", self.x);
+ error2!("dropping: {:?}", self.x);
}
}
//~^ ERROR unresolved name `k0`.
}
}
- fail!();
+ fail2!();
}
fn main() {}
{
let _z = match g(1, 2) {
- g(x, x) => { info!(x + x); }
+ g(x, x) => { info2!("{:?}", x + x); }
//~^ ERROR Identifier `x` is bound more than once in the same pattern
};
let _z = match i(l(1, 2), m(3, 4)) {
i(l(x, _), m(_, x)) //~ ERROR Identifier `x` is bound more than once in the same pattern
- => { error!(x + x); }
+ => { error2!("{:?}", x + x); }
};
let _z = match (1, 2) {
// except according to those terms.
fn a(x: ~str) -> ~str {
- fmt!("First function with %s", x)
+ format!("First function with {}", x)
}
fn a(x: ~str, y: ~str) -> ~str { //~ ERROR duplicate definition of value `a`
- fmt!("Second function with %s and %s", x, y)
+ format!("Second function with {} and {}", x, y)
}
fn main() {
- info!("Result: ");
+ info2!("Result: ");
}
static y: int = foo + 1; //~ ERROR: attempt to use a non-constant value in a constant
- error!(y);
+ error2!("{}", y);
}
Bar = foo //~ ERROR attempt to use a non-constant value in a constant
}
- error!(Bar);
+ error2!("{:?}", Bar);
}
~Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns
~HTMLImageElement(ref d) if d.image.is_some() => { true }
},
- _ => fail!("WAT") //~ ERROR unreachable pattern
+ _ => fail2!("WAT") //~ ERROR unreachable pattern
};
}
impl PTrait for P {
fn getChildOption(&self) -> Option<@P> {
static childVal: @P = self.child.get(); //~ ERROR attempt to use a non-constant value in a constant
- fail!();
+ fail2!();
}
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn main() { fmt!("%?", None); } //~ ERROR unconstrained type
+fn main() { format!("{:?}", None); } //~ ERROR unconstrained type
fn main () {
let bar = Bar { bar: 1 };
let foo = bar.make_foo(2);
- println(fmt!("%d", foo.foo));
+ println!("{}", foo.foo);
}
// except according to those terms.
fn foo<T>(t: T) {}
-fn main() { foo(fail!()) } //~ ERROR cannot determine a type for this expression: unconstrained type
+fn main() { foo(fail2!()) } //~ ERROR cannot determine a type for this expression: unconstrained type
// except according to those terms.
fn main() {
- fmt!("%?", None); //~ ERROR: cannot determine a type for this expression: unconstrained type
+ format!("{:?}", None); //~ ERROR: cannot determine a type for this bounded
}
}
}
-fn callback<T>(_f: &fn() -> T) -> T { fail!() }
+fn callback<T>(_f: &fn() -> T) -> T { fail2!() }
unsafe fn unsf() {}
fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block
sure that when purity is inherited that the source of the unsafe-ness
is tracked correctly */
unsafe {
- unsafe fn what() -> ~[~str] { fail!() }
+ unsafe fn what() -> ~[~str] { fail2!() }
do callback {
what();
fn main() {
let i: int;
- info!(false && { i = 5; true });
- info!(i); //~ ERROR use of possibly uninitialized variable: `i`
+ info2!("{}", false && { i = 5; true });
+ info2!("{}", i); //~ ERROR use of possibly uninitialized variable: `i`
}
// Tests that a function with a ! annotation always actually fails
// error-pattern: some control paths may return
-fn bad_bang(i: uint) -> ! { info!(3); }
+fn bad_bang(i: uint) -> ! { info2!("{}", 3); }
fn main() { bad_bang(5u); }
fn main() {
let x: int;
force(|| {
- info!(x); //~ ERROR capture of possibly uninitialized variable: `x`
+ info2!("{}", x); //~ ERROR capture of possibly uninitialized variable: `x`
});
}
x = 0;
}
- info!(x); //~ ERROR use of possibly uninitialized variable: `x`
+ info2!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
return 17;
}
-fn main() { info!(foo()); }
+fn main() { info2!("{}", foo()); }
x = 0;
}
- info!(x); //~ ERROR use of possibly uninitialized variable: `x`
+ info2!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
return 17;
}
-fn main() { info!(foo()); }
+fn main() { info2!("{}", foo()); }
// except according to those terms.
fn force(f: &fn() -> int) -> int { f() }
-fn main() { info!(force(|| {})); } //~ ERROR mismatched types
+fn main() { info2!("{:?}", force(|| {})); } //~ ERROR mismatched types
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn foo(x: int) { info!(x); }
+fn foo(x: int) { info2!("{}", x); }
fn main() {
let x: int; if 1 > 2 { x = 10; }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn foo(x: int) { info!(x); }
+fn foo(x: int) { info2!("{:?}", x); }
fn main() {
let x: int;
if 1 > 2 {
- info!("whoops");
+ info2!("whoops");
} else {
x = 10;
}
let i: int;
i //~ ERROR use of possibly uninitialized variable: `i`
};
- error!(f());
+ error2!("{:?}", f());
}
let y: ~int = ~42;
let mut x: ~int;
loop {
- info!(y);
+ info2!("{:?}", y);
loop {
loop {
loop {
let y: ~int = ~42;
let mut x: ~int;
loop {
- info!(y); //~ ERROR use of moved value: `y`
+ info2!("{:?}", y); //~ ERROR use of moved value: `y`
while true { while true { while true { x = y; x.clone(); } } }
//~^ ERROR use of moved value: `y`
}
fn main() {
let i: int;
- info!(false || { i = 5; true });
- info!(i); //~ ERROR use of possibly uninitialized variable: `i`
+ info2!("{}", false || { i = 5; true });
+ info2!("{}", i); //~ ERROR use of possibly uninitialized variable: `i`
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn foo(x: int) { info!(x); }
+fn foo(x: int) { info2!("{}", x); }
fn main() {
let x: int;
fn main() {
let x = ~5;
let y = x;
- info!(*x); //~ ERROR use of moved value: `x`
+ info2!("{:?}", *x); //~ ERROR use of moved value: `x`
y.clone();
}
// except according to those terms.
fn send<T:Send>(ch: _chan<T>, data: T) {
- info!(ch);
- info!(data);
- fail!();
+ info2!("{:?}", ch);
+ info2!("{:?}", data);
+ fail2!();
}
struct _chan<T>(int);
// message after the send deinitializes it
fn test00_start(ch: _chan<~int>, message: ~int, _count: ~int) {
send(ch, message);
- info!(message); //~ ERROR use of moved value: `message`
+ info2!("{:?}", message); //~ ERROR use of moved value: `message`
}
-fn main() { fail!(); }
+fn main() { fail2!(); }
v = 3;
break;
}
- info!("%d", v); //~ ERROR use of possibly uninitialized variable: `v`
+ info2!("{}", v); //~ ERROR use of possibly uninitialized variable: `v`
}
fn main() {
// a good test that we merge paths correctly in the presence of a
// variable that's used before it's declared
-fn my_fail() -> ! { fail!(); }
+fn my_fail() -> ! { fail2!(); }
fn main() {
match true { false => { my_fail(); } true => { } }
- info!(x); //~ ERROR unresolved name `x`.
+ info2!("{:?}", x); //~ ERROR unresolved name `x`.
let x: int;
}
// they occur as part of various kinds of expressions.
struct Foo<A> { f: A }
-fn guard(_s: ~str) -> bool {fail!()}
+fn guard(_s: ~str) -> bool {fail2!()}
fn touch<A>(_a: &A) {}
fn f10() {
// terms of the binding, not the discriminant.
struct Foo<A> { f: A }
-fn guard(_s: ~str) -> bool {fail!()}
+fn guard(_s: ~str) -> bool {fail2!()}
fn touch<A>(_a: &A) {}
fn f10() {
(f.c)(f, true);
println!("{:?}", msg);
},
- None => fail!("oops"),
+ None => fail2!("oops"),
}
}
}
assert_eq!((arc_v.get())[2], 3);
- info!(arc_v);
+ info2!("{:?}", arc_v);
}
assert_eq!((arc_v.get())[2], 3); //~ ERROR use of moved value: `arc_v`
- info!(arc_v); //~ ERROR use of moved value: `arc_v`
+ info2!("{:?}", arc_v); //~ ERROR use of moved value: `arc_v`
}
do task::spawn {
let y = x.take(); //~ ERROR does not fulfill `Send`
- error!(y);
+ error2!("{:?}", y);
}
}
fn main() {
let x = a(c);
match x {
- a(d) => { fail!("hello"); }
- b => { fail!("goodbye"); }
+ a(d) => { fail2!("hello"); }
+ b => { fail2!("goodbye"); }
}
}
fn main() {
let x = foo(10);
let _y = x.clone(); //~ ERROR does not implement any method in scope
- error!(x);
+ error2!("{:?}", x);
}
}
fn main() {
- info!(foo{ x: 1 } as int);
+ info2!("{:?}", foo{ x: 1 } as int);
}
// unrelated errors.
fn foo(a: int, b: int, c: int, d:int) {
- fail!();
+ fail2!();
}
fn main() {
// error-pattern:literal out of range
-fn main() { info!(300u8); }
+fn main() { info2!("{}", 300u8); }
let foo = Foo { bar: [1u8, 2, 3, 4, 5], baz: 10i32 };
unsafe {
let oof: Oof<[u8, .. 5], i32> = cast::transmute(foo);
- info!(oof);
+ info2!("{:?}", oof);
}
}
let foo = Foo { bar: 1, baz: 10 };
unsafe {
let oof: Oof = cast::transmute(foo);
- info!(oof);
+ info2!("{:?}", oof);
}
}
enum bar { t1((), Option<~[int]>), t2, }
// n.b. my change changes this error message, but I think it's right -- tjc
-fn foo(t: bar) -> int { match t { t1(_, Some(x)) => { return x * 3; } _ => { fail!(); } } } //~ ERROR binary operation * cannot be applied to
+fn foo(t: bar) -> int { match t { t1(_, Some(x)) => { return x * 3; } _ => { fail2!(); } } } //~ ERROR binary operation * cannot be applied to
fn main() { }
fn foo(t: bar) {
match t {
t1(_, Some::<int>(x)) => {
- info!(x);
+ info2!("{:?}", x);
}
- _ => { fail!(); }
+ _ => { fail2!(); }
}
}
// Can't do this copy
let x = ~~~A {y: r(i)};
let _z = x.clone(); //~ ERROR failed to find an implementation
- info!(x);
+ info2!("{:?}", x);
}
- error!(*i);
+ error2!("{:?}", *i);
}
fn main() {
let mut d = dog();
d.chase_cat();
- info!("cats_chased: %u", d.cats_chased);
+ info2!("cats_chased: {}", d.cats_chased);
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-fn of<T>() -> &fn(T) { fail!(); }
-fn subtype<T>(x: &fn(T)) { fail!(); }
+fn of<T>() -> &fn(T) { fail2!(); }
+fn subtype<T>(x: &fn(T)) { fail2!(); }
fn test_fn<'x,'y,'z,T>(_x: &'x T, _y: &'y T, _z: &'z T) {
// Here, x, y, and z are free. Other letters
// Do not infer an ordering from the return value.
let z: &'b uint = &*x;
//~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements
- fail!();
+ fail2!();
}
fn ordering4<'a, 'b>(a: &'a uint, b: &'b uint, x: &fn(&'a &'b uint)) {
fn main() {
let i = 3;
do wants_static_fn { //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements
- info!("i=%d", i);
+ info2!("i={}", i);
}
}
fn main() {
let x = return_it();
- info!("foo=%d", *x);
+ info2!("foo={}", *x);
}
fn main() {
let x = return_it();
- info!("foo=%d", *x);
+ info2!("foo={}", *x);
}
extern mod std;
fn last<T>(v: ~[&T]) -> std::option::Option<T> {
- fail!();
+ fail2!();
}
fn main() {
fn foo(c: quux) { assert!((false)); }
-fn main() { fail!(); }
+fn main() { fail2!(); }
// Issue #5062
fn main() {
- fmt!("%?", None); //~ ERROR cannot determine a type for this expression: unconstrained type
+ None; //~ ERROR cannot determine a type for this expression: unconstrained type
}
fn main() {
let i = ~r { b: true };
let _j = i.clone(); //~ ERROR failed to find an implementation
- info!(i);
+ info2!("{:?}", i);
}
let r2 = ~[~r { i: i2 }];
f(r1.clone(), r2.clone());
//~^ ERROR failed to find an implementation of
- info!((r2, *i1));
- info!((r1, *i2));
+ info2!("{:?}", (r2, *i1));
+ info2!("{:?}", (r1, *i2));
}
use std::libc;
fn main() {
- info!(1.0 as *libc::FILE); // Can't cast float to foreign.
+ info2!("{:?}", 1.0 as *libc::FILE); // Can't cast float to foreign.
}
fn f() {
let v = ~[1i];
- info!(v.some_field_name); //type error
+ info2!("{}", v.some_field_name); //type error
}
fn main() { }
let i = ~[r(0)];
let j = ~[r(1)];
let k = i + j;
- info!(j);
+ info2!("{}", j);
}