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:
Alex Crichton 2015-01-06 15:22:24 -08:00
commit 5c3ddcb15d
252 changed files with 2703 additions and 2072 deletions

View file

@ -43,9 +43,9 @@ impl FromStr for Mode {
} }
} }
impl fmt::Show for Mode { impl fmt::String for Mode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let msg = match *self { fmt::String::fmt(match *self {
CompileFail => "compile-fail", CompileFail => "compile-fail",
RunFail => "run-fail", RunFail => "run-fail",
RunPass => "run-pass", RunPass => "run-pass",
@ -54,8 +54,13 @@ impl fmt::Show for Mode {
DebugInfoGdb => "debuginfo-gdb", DebugInfoGdb => "debuginfo-gdb",
DebugInfoLldb => "debuginfo-lldb", DebugInfoLldb => "debuginfo-lldb",
Codegen => "codegen", Codegen => "codegen",
}; }, f)
msg.fmt(f) }
}
impl fmt::Show for Mode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(self, f)
} }
} }

View file

@ -108,7 +108,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
let matches = let matches =
&match getopts::getopts(args_.as_slice(), groups.as_slice()) { &match getopts::getopts(args_.as_slice(), groups.as_slice()) {
Ok(m) => m, Ok(m) => m,
Err(f) => panic!("{}", f) Err(f) => panic!("{:?}", f)
}; };
if matches.opt_present("h") || matches.opt_present("help") { if matches.opt_present("h") || matches.opt_present("help") {
@ -127,7 +127,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
match regex::Regex::new(s) { match regex::Regex::new(s) {
Ok(re) => Some(re), Ok(re) => Some(re),
Err(e) => { Err(e) => {
println!("failed to parse filter /{}/: {}", s, e); println!("failed to parse filter /{}/: {:?}", s, e);
panic!() panic!()
} }
} }
@ -186,11 +186,11 @@ pub fn parse_config(args: Vec<String> ) -> Config {
pub fn log_config(config: &Config) { pub fn log_config(config: &Config) {
let c = config; let c = config;
logv(c, format!("configuration:")); logv(c, format!("configuration:"));
logv(c, format!("compile_lib_path: {}", config.compile_lib_path)); logv(c, format!("compile_lib_path: {:?}", config.compile_lib_path));
logv(c, format!("run_lib_path: {}", config.run_lib_path)); logv(c, format!("run_lib_path: {:?}", config.run_lib_path));
logv(c, format!("rustc_path: {}", config.rustc_path.display())); logv(c, format!("rustc_path: {:?}", config.rustc_path.display()));
logv(c, format!("src_base: {}", config.src_base.display())); logv(c, format!("src_base: {:?}", config.src_base.display()));
logv(c, format!("build_base: {}", config.build_base.display())); logv(c, format!("build_base: {:?}", config.build_base.display()));
logv(c, format!("stage_id: {}", config.stage_id)); logv(c, format!("stage_id: {}", config.stage_id));
logv(c, format!("mode: {}", config.mode)); logv(c, format!("mode: {}", config.mode));
logv(c, format!("run_ignored: {}", config.run_ignored)); logv(c, format!("run_ignored: {}", config.run_ignored));
@ -206,10 +206,10 @@ pub fn log_config(config: &Config) {
logv(c, format!("jit: {}", config.jit)); logv(c, format!("jit: {}", config.jit));
logv(c, format!("target: {}", config.target)); logv(c, format!("target: {}", config.target));
logv(c, format!("host: {}", config.host)); logv(c, format!("host: {}", config.host));
logv(c, format!("android-cross-path: {}", logv(c, format!("android-cross-path: {:?}",
config.android_cross_path.display())); config.android_cross_path.display()));
logv(c, format!("adb_path: {}", config.adb_path)); logv(c, format!("adb_path: {:?}", config.adb_path));
logv(c, format!("adb_test_dir: {}", config.adb_test_dir)); logv(c, format!("adb_test_dir: {:?}", config.adb_test_dir));
logv(c, format!("adb_device_status: {}", logv(c, format!("adb_device_status: {}",
config.adb_device_status)); config.adb_device_status));
match config.test_shard { match config.test_shard {
@ -271,7 +271,7 @@ pub fn run_tests(config: &Config) {
Ok(true) => {} Ok(true) => {}
Ok(false) => panic!("Some tests failed"), Ok(false) => panic!("Some tests failed"),
Err(e) => { Err(e) => {
println!("I/O failure during tests: {}", e); println!("I/O failure during tests: {:?}", e);
} }
} }
} }
@ -299,13 +299,13 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
} }
pub fn make_tests(config: &Config) -> Vec<test::TestDescAndFn> { pub fn make_tests(config: &Config) -> Vec<test::TestDescAndFn> {
debug!("making tests from {}", debug!("making tests from {:?}",
config.src_base.display()); config.src_base.display());
let mut tests = Vec::new(); let mut tests = Vec::new();
let dirs = fs::readdir(&config.src_base).unwrap(); let dirs = fs::readdir(&config.src_base).unwrap();
for file in dirs.iter() { for file in dirs.iter() {
let file = file.clone(); let file = file.clone();
debug!("inspecting file {}", file.display()); debug!("inspecting file {:?}", file.display());
if is_test(config, &file) { if is_test(config, &file) {
let t = make_test(config, &file, || { let t = make_test(config, &file, || {
match config.mode { match config.mode {

View file

@ -84,7 +84,7 @@ fn parse_expected(last_nonfollow_error: Option<uint>,
(which, line) (which, line)
}; };
debug!("line={} which={} kind={} msg={}", line_num, which, kind, msg); debug!("line={} which={:?} kind={:?} msg={:?}", line_num, which, kind, msg);
Some((which, ExpectedError { line: line, Some((which, ExpectedError { line: line,
kind: kind, kind: kind,
msg: msg, })) msg: msg, }))

View file

@ -61,7 +61,7 @@ pub fn run_metrics(config: Config, testfile: String, mm: &mut MetricMap) {
print!("\n\n"); print!("\n\n");
} }
let testfile = Path::new(testfile); let testfile = Path::new(testfile);
debug!("running {}", testfile.display()); debug!("running {:?}", testfile.display());
let props = header::load_props(&testfile); let props = header::load_props(&testfile);
debug!("loaded props"); debug!("loaded props");
match config.mode { match config.mode {
@ -141,7 +141,7 @@ fn check_correct_failure_status(proc_res: &ProcRes) {
static RUST_ERR: int = 101; static RUST_ERR: int = 101;
if !proc_res.status.matches_exit_status(RUST_ERR) { if !proc_res.status.matches_exit_status(RUST_ERR) {
fatal_proc_rec( fatal_proc_rec(
format!("failure produced the wrong error: {}", format!("failure produced the wrong error: {:?}",
proc_res.status).as_slice(), proc_res.status).as_slice(),
proc_res); proc_res);
} }
@ -410,7 +410,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
], ],
vec!(("".to_string(), "".to_string())), vec!(("".to_string(), "".to_string())),
Some("".to_string())) Some("".to_string()))
.expect(format!("failed to exec `{}`", config.adb_path).as_slice()); .expect(format!("failed to exec `{:?}`", config.adb_path).as_slice());
procsrv::run("", procsrv::run("",
config.adb_path.as_slice(), config.adb_path.as_slice(),
@ -422,7 +422,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
], ],
vec!(("".to_string(), "".to_string())), vec!(("".to_string(), "".to_string())),
Some("".to_string())) Some("".to_string()))
.expect(format!("failed to exec `{}`", config.adb_path).as_slice()); .expect(format!("failed to exec `{:?}`", config.adb_path).as_slice());
let adb_arg = format!("export LD_LIBRARY_PATH={}; \ let adb_arg = format!("export LD_LIBRARY_PATH={}; \
gdbserver :5039 {}/{}", gdbserver :5039 {}/{}",
@ -443,7 +443,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
vec!(("".to_string(), vec!(("".to_string(),
"".to_string())), "".to_string())),
Some("".to_string())) Some("".to_string()))
.expect(format!("failed to exec `{}`", config.adb_path).as_slice()); .expect(format!("failed to exec `{:?}`", config.adb_path).as_slice());
loop { loop {
//waiting 1 second for gdbserver start //waiting 1 second for gdbserver start
timer::sleep(Duration::milliseconds(1000)); timer::sleep(Duration::milliseconds(1000));
@ -481,7 +481,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
debugger_opts.as_slice(), debugger_opts.as_slice(),
vec!(("".to_string(), "".to_string())), vec!(("".to_string(), "".to_string())),
None) None)
.expect(format!("failed to exec `{}`", gdb_path).as_slice()); .expect(format!("failed to exec `{:?}`", gdb_path).as_slice());
let cmdline = { let cmdline = {
let cmdline = make_cmdline("", let cmdline = make_cmdline("",
"arm-linux-androideabi-gdb", "arm-linux-androideabi-gdb",
@ -547,7 +547,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
// Add line breakpoints // Add line breakpoints
for line in breakpoint_lines.iter() { for line in breakpoint_lines.iter() {
script_str.push_str(&format!("break '{}':{}\n", script_str.push_str(&format!("break '{:?}':{}\n",
testfile.filename_display(), testfile.filename_display(),
*line)[]); *line)[]);
} }
@ -888,7 +888,7 @@ fn check_error_patterns(props: &TestProps,
output_to_check: &str, output_to_check: &str,
proc_res: &ProcRes) { proc_res: &ProcRes) {
if props.error_patterns.is_empty() { if props.error_patterns.is_empty() {
fatal(format!("no error pattern specified in {}", fatal(format!("no error pattern specified in {:?}",
testfile.display()).as_slice()); testfile.display()).as_slice());
} }
let mut next_err_idx = 0u; let mut next_err_idx = 0u;
@ -954,7 +954,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
} }
let prefixes = expected_errors.iter().map(|ee| { let prefixes = expected_errors.iter().map(|ee| {
format!("{}:{}:", testfile.display(), ee.line) format!("{:?}:{}:", testfile.display(), ee.line)
}).collect::<Vec<String> >(); }).collect::<Vec<String> >();
#[cfg(windows)] #[cfg(windows)]
@ -1190,7 +1190,7 @@ fn compose_and_run_compiler(
None); None);
if !auxres.status.success() { if !auxres.status.success() {
fatal_proc_rec( fatal_proc_rec(
format!("auxiliary build of {} failed to compile: ", format!("auxiliary build of {:?} failed to compile: ",
abs_ab.display()).as_slice(), abs_ab.display()).as_slice(),
&auxres); &auxres);
} }
@ -1600,7 +1600,7 @@ fn _arm_push_aux_shared_library(config: &Config, testfile: &Path) {
.expect(format!("failed to exec `{}`", config.adb_path).as_slice()); .expect(format!("failed to exec `{}`", config.adb_path).as_slice());
if config.verbose { if config.verbose {
println!("push ({}) {} {} {}", println!("push ({}) {:?} {} {}",
config.target, file.display(), config.target, file.display(),
copy_result.out, copy_result.err); copy_result.out, copy_result.err);
} }

View file

@ -581,7 +581,7 @@ impl<T: Eq> Eq for Arc<T> {}
impl<T: fmt::Show> fmt::Show for Arc<T> { impl<T: fmt::Show> fmt::Show for Arc<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
(**self).fmt(f) write!(f, "Arc({:?})", (**self))
} }
} }
@ -794,7 +794,7 @@ mod tests {
#[test] #[test]
fn show_arc() { fn show_arc() {
let a = Arc::new(5u32); let a = Arc::new(5u32);
assert!(format!("{}", a) == "5") assert!(format!("{:?}", a) == "Arc(5u32)")
} }
// Make sure deriving works with Arc<T> // Make sure deriving works with Arc<T>

View file

@ -145,7 +145,13 @@ impl BoxAny for Box<Any> {
impl<T: ?Sized + fmt::Show> fmt::Show for Box<T> { impl<T: ?Sized + fmt::Show> fmt::Show for Box<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
(**self).fmt(f) write!(f, "Box({:?})", &**self)
}
}
impl<T: ?Sized + fmt::String> fmt::String for Box<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(&**self, f)
} }
} }

View file

@ -607,7 +607,7 @@ impl<S: hash::Writer, T: Hash<S>> Hash<S> for Rc<T> {
#[experimental = "Show is experimental."] #[experimental = "Show is experimental."]
impl<T: fmt::Show> fmt::Show for Rc<T> { impl<T: fmt::Show> fmt::Show for Rc<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
(**self).fmt(f) write!(f, "Rc({:?})", **self)
} }
} }
@ -962,4 +962,10 @@ mod tests {
assert!(cow1_weak.upgrade().is_none()); assert!(cow1_weak.upgrade().is_none());
} }
#[test]
fn test_show() {
let foo = Rc::new(75u);
assert!(format!("{:?}", foo) == "Rc(75u)")
}
} }

View file

@ -1729,13 +1729,13 @@ impl BitvSet {
impl fmt::Show for BitvSet { impl fmt::Show for BitvSet {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
try!(write!(fmt, "{{")); try!(write!(fmt, "BitvSet {{"));
let mut first = true; let mut first = true;
for n in self.iter() { for n in self.iter() {
if !first { if !first {
try!(write!(fmt, ", ")); try!(write!(fmt, ", "));
} }
try!(write!(fmt, "{}", n)); try!(write!(fmt, "{:?}", n));
first = false; first = false;
} }
write!(fmt, "}}") write!(fmt, "}}")

View file

@ -866,11 +866,11 @@ impl<K: Ord, V: Ord> Ord for BTreeMap<K, V> {
#[stable] #[stable]
impl<K: Show, V: Show> Show for BTreeMap<K, V> { impl<K: Show, V: Show> Show for BTreeMap<K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "{{")); try!(write!(f, "BTreeMap {{"));
for (i, (k, v)) in self.iter().enumerate() { for (i, (k, v)) in self.iter().enumerate() {
if i != 0 { try!(write!(f, ", ")); } if i != 0 { try!(write!(f, ", ")); }
try!(write!(f, "{}: {}", *k, *v)); try!(write!(f, "{:?}: {:?}", *k, *v));
} }
write!(f, "}}") write!(f, "}}")

View file

@ -493,7 +493,7 @@ impl<K: Clone, V: Clone> Clone for Node<K, V> {
/// // Now the handle still points at index 75, but on the small node, which has no index 75. /// // Now the handle still points at index 75, but on the small node, which has no index 75.
/// flag.set(true); /// flag.set(true);
/// ///
/// println!("Uninitialized memory: {}", handle.into_kv()); /// println!("Uninitialized memory: {:?}", handle.into_kv());
/// } /// }
/// ``` /// ```
#[derive(Copy)] #[derive(Copy)]

View file

@ -556,11 +556,11 @@ impl<'a, 'b, T: Ord + Clone> BitOr<&'b BTreeSet<T>> for &'a BTreeSet<T> {
#[stable] #[stable]
impl<T: Show> Show for BTreeSet<T> { impl<T: Show> Show for BTreeSet<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "{{")); try!(write!(f, "BTreeSet {{"));
for (i, x) in self.iter().enumerate() { for (i, x) in self.iter().enumerate() {
if i != 0 { try!(write!(f, ", ")); } if i != 0 { try!(write!(f, ", ")); }
try!(write!(f, "{}", *x)); try!(write!(f, "{:?}", *x));
} }
write!(f, "}}") write!(f, "}}")

View file

@ -663,11 +663,11 @@ impl<A: Clone> Clone for DList<A> {
#[stable] #[stable]
impl<A: fmt::Show> fmt::Show for DList<A> { impl<A: fmt::Show> fmt::Show for DList<A> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "[")); try!(write!(f, "DList ["));
for (i, e) in self.iter().enumerate() { for (i, e) in self.iter().enumerate() {
if i != 0 { try!(write!(f, ", ")); } if i != 0 { try!(write!(f, ", ")); }
try!(write!(f, "{}", *e)); try!(write!(f, "{:?}", *e));
} }
write!(f, "]") write!(f, "]")

View file

@ -33,13 +33,13 @@ impl<E> Copy for EnumSet<E> {}
impl<E:CLike+fmt::Show> fmt::Show for EnumSet<E> { impl<E:CLike+fmt::Show> fmt::Show for EnumSet<E> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
try!(write!(fmt, "{{")); try!(write!(fmt, "EnumSet {{"));
let mut first = true; let mut first = true;
for e in self.iter() { for e in self.iter() {
if !first { if !first {
try!(write!(fmt, ", ")); try!(write!(fmt, ", "));
} }
try!(write!(fmt, "{}", e)); try!(write!(fmt, "{:?}", e));
first = false; first = false;
} }
write!(fmt, "}}") write!(fmt, "}}")
@ -287,11 +287,11 @@ mod test {
#[test] #[test]
fn test_show() { fn test_show() {
let mut e = EnumSet::new(); let mut e = EnumSet::new();
assert_eq!("{}", e.to_string()); assert!(format!("{:?}", e) == "EnumSet {}");
e.insert(A); e.insert(A);
assert_eq!("{A}", e.to_string()); assert!(format!("{:?}", e) == "EnumSet {A}");
e.insert(C); e.insert(C);
assert_eq!("{A, C}", e.to_string()); assert!(format!("{:?}", e) == "EnumSet {A, C}");
} }
#[test] #[test]

View file

@ -1613,11 +1613,11 @@ impl<A> Extend<A> for RingBuf<A> {
#[stable] #[stable]
impl<T: fmt::Show> fmt::Show for RingBuf<T> { impl<T: fmt::Show> fmt::Show for RingBuf<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "[")); try!(write!(f, "RingBuf ["));
for (i, e) in self.iter().enumerate() { for (i, e) in self.iter().enumerate() {
if i != 0 { try!(write!(f, ", ")); } if i != 0 { try!(write!(f, ", ")); }
try!(write!(f, "{}", *e)); try!(write!(f, "{:?}", *e));
} }
write!(f, "]") write!(f, "]")

View file

@ -2471,25 +2471,25 @@ mod tests {
macro_rules! test_show_vec { macro_rules! test_show_vec {
($x:expr, $x_str:expr) => ({ ($x:expr, $x_str:expr) => ({
let (x, x_str) = ($x, $x_str); let (x, x_str) = ($x, $x_str);
assert_eq!(format!("{}", x), x_str); assert_eq!(format!("{:?}", x), x_str);
assert_eq!(format!("{}", x.as_slice()), x_str); assert_eq!(format!("{:?}", x.as_slice()), x_str);
}) })
} }
let empty: Vec<int> = vec![]; let empty: Vec<int> = vec![];
test_show_vec!(empty, "[]"); test_show_vec!(empty, "[]");
test_show_vec!(vec![1i], "[1]"); test_show_vec!(vec![1i], "[1i]");
test_show_vec!(vec![1i, 2, 3], "[1, 2, 3]"); test_show_vec!(vec![1i, 2, 3], "[1i, 2i, 3i]");
test_show_vec!(vec![vec![], vec![1u], vec![1u, 1u]], test_show_vec!(vec![vec![], vec![1u], vec![1u, 1u]],
"[[], [1], [1, 1]]"); "[[], [1u], [1u, 1u]]");
let empty_mut: &mut [int] = &mut[]; let empty_mut: &mut [int] = &mut[];
test_show_vec!(empty_mut, "[]"); test_show_vec!(empty_mut, "[]");
let v: &mut[int] = &mut[1]; let v: &mut[int] = &mut[1];
test_show_vec!(v, "[1]"); test_show_vec!(v, "[1i]");
let v: &mut[int] = &mut[1, 2, 3]; let v: &mut[int] = &mut[1, 2, 3];
test_show_vec!(v, "[1, 2, 3]"); test_show_vec!(v, "[1i, 2i, 3i]");
let v: &mut [&mut[uint]] = &mut[&mut[], &mut[1u], &mut[1u, 1u]]; let v: &mut [&mut[uint]] = &mut[&mut[], &mut[1u], &mut[1u, 1u]];
test_show_vec!(v, "[[], [1], [1, 1]]"); test_show_vec!(v, "[[], [1u], [1u, 1u]]");
} }
#[test] #[test]

View file

@ -677,13 +677,25 @@ impl FromUtf8Error {
impl fmt::Show for FromUtf8Error { impl fmt::Show for FromUtf8Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.error.fmt(f) fmt::String::fmt(self, f)
}
}
impl fmt::String for FromUtf8Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(&self.error, f)
} }
} }
impl fmt::Show for FromUtf16Error { impl fmt::Show for FromUtf16Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
"invalid utf-16: lone surrogate found".fmt(f) fmt::String::fmt(self, f)
}
}
impl fmt::String for FromUtf16Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt("invalid utf-16: lone surrogate found", f)
} }
} }
@ -793,10 +805,17 @@ impl Default for String {
} }
} }
#[experimental = "waiting on Show stabilization"] #[experimental = "waiting on fmt stabilization"]
impl fmt::String for String {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(&**self, f)
}
}
#[experimental = "waiting on fmt stabilization"]
impl fmt::Show for String { impl fmt::Show for String {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
(**self).fmt(f) fmt::Show::fmt(&**self, f)
} }
} }
@ -902,6 +921,8 @@ pub trait ToString {
fn to_string(&self) -> String; fn to_string(&self) -> String;
} }
#[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;
@ -912,6 +933,17 @@ impl<T: fmt::Show> ToString for T {
} }
} }
#[cfg(not(stage0))]
impl<T: fmt::String> ToString for T {
fn to_string(&self) -> String {
use core::fmt::Writer;
let mut buf = String::new();
let _ = buf.write_fmt(format_args!("{}", self));
buf.shrink_to_fit();
buf
}
}
impl IntoCow<'static, String, str> for String { impl IntoCow<'static, String, str> for String {
fn into_cow(self) -> CowString<'static> { fn into_cow(self) -> CowString<'static> {
Cow::Owned(self) Cow::Owned(self)

View file

@ -1450,7 +1450,14 @@ 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 {
self.as_slice().fmt(f) fmt::Show::fmt(self.as_slice(), f)
}
}
#[experimental = "waiting on Show stability"]
impl<T:fmt::String> fmt::String for Vec<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(self.as_slice(), f)
} }
} }

View file

@ -489,11 +489,11 @@ impl<V: Ord> Ord for VecMap<V> {
#[stable] #[stable]
impl<V: fmt::Show> fmt::Show for VecMap<V> { impl<V: fmt::Show> fmt::Show for VecMap<V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "{{")); try!(write!(f, "VecMap {{"));
for (i, (k, v)) in self.iter().enumerate() { for (i, (k, v)) in self.iter().enumerate() {
if i != 0 { try!(write!(f, ", ")); } if i != 0 { try!(write!(f, ", ")); }
try!(write!(f, "{}: {}", k, *v)); try!(write!(f, "{}: {:?}", k, *v));
} }
write!(f, "}}") write!(f, "}}")
@ -929,9 +929,9 @@ mod test_map {
map.insert(1, 2i); map.insert(1, 2i);
map.insert(3, 4i); map.insert(3, 4i);
let map_str = map.to_string(); let map_str = format!("{:?}", map);
assert!(map_str == "{1: 2, 3: 4}" || map_str == "{3: 4, 1: 2}"); assert!(map_str == "VecMap {1: 2i, 3: 4i}" || map_str == "{3: 4i, 1: 2i}");
assert_eq!(format!("{}", empty), "{}"); assert_eq!(format!("{:?}", empty), "VecMap {}");
} }
#[test] #[test]

View file

@ -46,7 +46,7 @@
//! // 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

@ -133,6 +133,7 @@ impl<T> ToOwned<T> for T where T: Clone {
/// } /// }
/// } /// }
/// ``` /// ```
//#[deriving(Show)] NOTE(stage0): uncomment after snapshot
pub enum Cow<'a, T, B: ?Sized + 'a> where B: ToOwned<T> { pub enum Cow<'a, T, B: ?Sized + 'a> where B: ToOwned<T> {
/// Borrowed data. /// Borrowed data.
Borrowed(&'a B), Borrowed(&'a B),
@ -141,6 +142,16 @@ pub enum Cow<'a, T, B: ?Sized + 'a> where B: ToOwned<T> {
Owned(T) Owned(T)
} }
//NOTE(stage0): replace with deriving(Show) after snapshot
impl<'a, T, B: ?Sized> fmt::Show for Cow<'a, T, B> where
B: fmt::String + ToOwned<T>,
T: fmt::String
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(self, f)
}
}
#[stable] #[stable]
impl<'a, T, B: ?Sized> Clone for Cow<'a, T, B> where B: ToOwned<T> { impl<'a, T, B: ?Sized> Clone for Cow<'a, T, B> where B: ToOwned<T> {
fn clone(&self) -> Cow<'a, T, B> { fn clone(&self) -> Cow<'a, T, B> {
@ -237,11 +248,14 @@ impl<'a, T, B: ?Sized> PartialOrd for Cow<'a, T, B> where B: PartialOrd + ToOwne
} }
} }
impl<'a, T, B: ?Sized> fmt::Show for Cow<'a, T, B> where B: fmt::Show + ToOwned<T>, T: fmt::Show { impl<'a, T, B: ?Sized> fmt::String for Cow<'a, T, B> where
B: fmt::String + ToOwned<T>,
T: fmt::String,
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self { match *self {
Borrowed(ref b) => fmt::Show::fmt(b, f), Borrowed(ref b) => fmt::String::fmt(b, f),
Owned(ref o) => fmt::Show::fmt(o, f), Owned(ref o) => fmt::String::fmt(o, f),
} }
} }
} }

View file

@ -160,7 +160,6 @@
use clone::Clone; use clone::Clone;
use cmp::PartialEq; use cmp::PartialEq;
use default::Default; use default::Default;
use fmt;
use kinds::{Copy, Send}; use kinds::{Copy, Send};
use ops::{Deref, DerefMut, Drop}; use ops::{Deref, DerefMut, Drop};
use option::Option; use option::Option;
@ -364,16 +363,6 @@ impl<T: PartialEq> PartialEq for RefCell<T> {
} }
} }
#[unstable]
impl<T:fmt::Show> fmt::Show for RefCell<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.try_borrow() {
Some(val) => write!(f, "{}", val),
None => write!(f, "<borrowed RefCell>")
}
}
}
struct BorrowRef<'b> { struct BorrowRef<'b> {
_borrow: &'b Cell<BorrowFlag>, _borrow: &'b Cell<BorrowFlag>,
} }

View file

@ -13,7 +13,8 @@
#![allow(unused_variables)] #![allow(unused_variables)]
use any; use any;
use cell::{Cell, Ref, RefMut}; use cell::{Cell, RefCell, Ref, RefMut};
use char::CharExt;
use iter::{Iterator, IteratorExt, range}; use iter::{Iterator, IteratorExt, range};
use kinds::{Copy, Sized}; use kinds::{Copy, Sized};
use mem; use mem;
@ -215,21 +216,37 @@ 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) write(fmt.buf, *self)
} }
} }
/// When a format is not otherwise specified, types are formatted by ascribing #[cfg(not(stage0))]
/// to this trait. There is not an explicit way of selecting this trait to be impl<'a> String for Arguments<'a> {
/// used for formatting, it is only if no other format is specified. fn fmt(&self, fmt: &mut Formatter) -> Result {
write(fmt.buf, *self)
}
}
/// Format trait for the `:?` format. Useful for debugging, most all types
/// should implement this.
#[unstable = "I/O and core have yet to be reconciled"] #[unstable = "I/O and core have yet to be reconciled"]
pub trait Show { pub trait Show {
/// Formats the value using the given formatter. /// Formats the value using the given formatter.
fn fmt(&self, &mut Formatter) -> Result; fn fmt(&self, &mut Formatter) -> Result;
} }
/// When a value can be semantically expressed as a String, this trait may be
/// used. It corresponds to the default format, `{}`.
#[unstable = "I/O and core have yet to be reconciled"]
pub trait String {
/// Formats the value using the given formatter.
fn fmt(&self, &mut Formatter) -> Result;
}
/// Format trait for the `o` character /// Format trait for the `o` character
#[unstable = "I/O and core have yet to be reconciled"] #[unstable = "I/O and core have yet to be reconciled"]
@ -572,7 +589,7 @@ impl<'a> Formatter<'a> {
impl Show for Error { impl Show for Error {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
"an error occurred when formatting an argument".fmt(f) String::fmt("an error occurred when formatting an argument", f)
} }
} }
@ -595,33 +612,86 @@ pub fn argumentuint<'a>(s: &'a uint) -> Argument<'a> {
// Implementations of the core formatting traits // Implementations of the core formatting traits
impl<'a, T: ?Sized + Show> Show for &'a T { macro_rules! fmt_refs {
fn fmt(&self, f: &mut Formatter) -> Result { (**self).fmt(f) } ($($tr:ident),*) => {
} $(
impl<'a, T: ?Sized + Show> Show for &'a mut T { impl<'a, T: ?Sized + $tr> $tr for &'a T {
fn fmt(&self, f: &mut Formatter) -> Result { (**self).fmt(f) } fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, f) }
} }
impl<'a, T: ?Sized + $tr> $tr for &'a mut T {
impl Show for bool { fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, f) }
fn fmt(&self, f: &mut Formatter) -> Result { }
Show::fmt(if *self { "true" } else { "false" }, f) )*
} }
} }
fmt_refs! { Show, String, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperExp }
impl Show for bool {
fn fmt(&self, f: &mut Formatter) -> Result {
String::fmt(self, f)
}
}
impl String for bool {
fn fmt(&self, f: &mut Formatter) -> Result {
String::fmt(if *self { "true" } else { "false" }, f)
}
}
#[cfg(stage0)]
//NOTE(stage0): remove impl after snapshot
impl Show for str { impl Show for str {
fn fmt(&self, f: &mut Formatter) -> Result {
String::fmt(self, f)
}
}
#[cfg(not(stage0))]
//NOTE(stage0): remove cfg after snapshot
impl Show for str {
fn fmt(&self, f: &mut Formatter) -> Result {
try!(write!(f, "\""));
for c in self.chars().flat_map(|c| c.escape_default()) {
try!(write!(f, "{}", c));
}
write!(f, "\"")
}
}
impl String for str {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
f.pad(self) f.pad(self)
} }
} }
#[cfg(stage0)]
//NOTE(stage0): remove impl after snapshot
impl Show for char {
fn fmt(&self, f: &mut Formatter) -> Result {
String::fmt(self, f)
}
}
#[cfg(not(stage0))]
//NOTE(stage0): remove cfg after snapshot
impl Show for char { impl Show for char {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
use char::CharExt; use char::CharExt;
try!(write!(f, "'"));
for c in self.escape_default() {
try!(write!(f, "{}", c));
}
write!(f, "'")
}
}
impl String for char {
fn fmt(&self, f: &mut Formatter) -> Result {
let mut utf8 = [0u8; 4]; let mut utf8 = [0u8; 4];
let amt = self.encode_utf8(&mut utf8).unwrap_or(0); let amt = self.encode_utf8(&mut utf8).unwrap_or(0);
let s: &str = unsafe { mem::transmute(utf8.index(&(0..amt))) }; let s: &str = unsafe { mem::transmute(utf8.index(&(0..amt))) };
Show::fmt(s, f) String::fmt(s, f)
} }
} }
@ -653,7 +723,15 @@ impl<'a, T> Pointer for &'a mut T {
} }
macro_rules! floating { ($ty:ident) => { macro_rules! floating { ($ty:ident) => {
impl Show for $ty { impl Show for $ty {
fn fmt(&self, fmt: &mut Formatter) -> Result {
try!(String::fmt(self, fmt));
fmt.write_str(stringify!($ty))
}
}
impl String for $ty {
fn fmt(&self, fmt: &mut Formatter) -> Result { fn fmt(&self, fmt: &mut Formatter) -> Result {
use num::Float; use num::Float;
@ -746,7 +824,7 @@ macro_rules! tuple {
if n > 0 { if n > 0 {
try!(write!(f, ", ")); try!(write!(f, ", "));
} }
try!(write!(f, "{}", *$name)); try!(write!(f, "{:?}", *$name));
n += 1; n += 1;
)* )*
if n == 1 { if n == 1 {
@ -777,7 +855,7 @@ impl<T: Show> Show for [T] {
} else { } else {
try!(write!(f, ", ")); try!(write!(f, ", "));
} }
try!(write!(f, "{}", *x)) try!(write!(f, "{:?}", *x))
} }
if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 { if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 {
try!(write!(f, "]")); try!(write!(f, "]"));
@ -786,6 +864,21 @@ impl<T: Show> Show for [T] {
} }
} }
impl<T: String> String for [T] {
fn fmt(&self, f: &mut Formatter) -> Result {
let mut is_first = true;
for x in self.iter() {
if is_first {
is_first = false;
} else {
try!(write!(f, ", "));
}
try!(String::fmt(x, f))
}
Ok(())
}
}
impl Show for () { impl Show for () {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
f.pad("()") f.pad("()")
@ -794,23 +887,33 @@ impl Show for () {
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())
}
}
#[unstable]
impl<T: Show> Show for RefCell<T> {
fn fmt(&self, f: &mut Formatter) -> Result {
match self.try_borrow() {
Some(val) => write!(f, "RefCell {{ value: {:?} }}", val),
None => write!(f, "RefCell {{ <borrowed> }}")
}
} }
} }
impl<'b, T: Show> Show for Ref<'b, T> { impl<'b, T: Show> Show for Ref<'b, T> {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
(**self).fmt(f) Show::fmt(&**self, f)
} }
} }
impl<'b, T: Show> Show for RefMut<'b, T> { impl<'b, T: Show> Show for RefMut<'b, T> {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
(*(self.deref())).fmt(f) Show::fmt(&*(self.deref()), f)
} }
} }
impl Show for Utf8Error { impl String for Utf8Error {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
match *self { match *self {
Utf8Error::InvalidByte(n) => { Utf8Error::InvalidByte(n) => {

View file

@ -154,8 +154,22 @@ pub fn radix<T>(x: T, base: u8) -> RadixFmt<T, Radix> {
} }
macro_rules! radix_fmt { macro_rules! radix_fmt {
($T:ty as $U:ty, $fmt:ident) => { ($T:ty as $U:ty, $fmt:ident, $S:expr) => {
#[cfg(stage0)]
impl fmt::Show for RadixFmt<$T, Radix> { impl fmt::Show for RadixFmt<$T, Radix> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(self, f)
}
}
#[cfg(not(stage0))]
impl fmt::Show for RadixFmt<$T, Radix> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(fmt::String::fmt(self, f));
f.write_str($S)
}
}
impl fmt::String for RadixFmt<$T, Radix> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self { RadixFmt(ref x, radix) => radix.$fmt(*x as $U, f) } match *self { RadixFmt(ref x, radix) => radix.$fmt(*x as $U, f) }
} }
@ -171,24 +185,48 @@ macro_rules! int_base {
} }
} }
} }
macro_rules! show {
($T:ident with $S:expr) => {
#[cfg(stage0)]
impl fmt::Show for $T {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(self, f)
}
}
#[cfg(not(stage0))]
impl fmt::Show for $T {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(fmt::String::fmt(self, f));
f.write_str($S)
}
}
}
}
macro_rules! integer { macro_rules! integer {
($Int:ident, $Uint:ident) => { ($Int:ident, $Uint:ident) => {
int_base! { Show for $Int as $Int -> Decimal } integer! { $Int, $Uint, stringify!($Int), stringify!($Uint) }
};
($Int:ident, $Uint:ident, $SI:expr, $SU:expr) => {
int_base! { String for $Int as $Int -> Decimal }
int_base! { Binary for $Int as $Uint -> Binary } int_base! { Binary for $Int as $Uint -> Binary }
int_base! { Octal for $Int as $Uint -> Octal } int_base! { Octal for $Int as $Uint -> Octal }
int_base! { LowerHex for $Int as $Uint -> LowerHex } int_base! { LowerHex for $Int as $Uint -> LowerHex }
int_base! { UpperHex for $Int as $Uint -> UpperHex } int_base! { UpperHex for $Int as $Uint -> UpperHex }
radix_fmt! { $Int as $Int, fmt_int } radix_fmt! { $Int as $Int, fmt_int, $SI }
show! { $Int with $SI }
int_base! { Show for $Uint as $Uint -> Decimal } int_base! { String for $Uint as $Uint -> Decimal }
int_base! { Binary for $Uint as $Uint -> Binary } int_base! { Binary for $Uint as $Uint -> Binary }
int_base! { Octal for $Uint as $Uint -> Octal } int_base! { Octal for $Uint as $Uint -> Octal }
int_base! { LowerHex for $Uint as $Uint -> LowerHex } int_base! { LowerHex for $Uint as $Uint -> LowerHex }
int_base! { UpperHex for $Uint as $Uint -> UpperHex } int_base! { UpperHex for $Uint as $Uint -> UpperHex }
radix_fmt! { $Uint as $Uint, fmt_int } radix_fmt! { $Uint as $Uint, fmt_int, $SU }
show! { $Uint with $SU }
} }
} }
integer! { int, uint } integer! { int, uint, "i", "u" }
integer! { i8, u8 } integer! { i8, u8 }
integer! { i16, u16 } integer! { i16, u16 }
integer! { i32, u32 } integer! { i32, u32 }

View file

@ -83,7 +83,7 @@ macro_rules! assert_eq {
if !((*left_val == *right_val) && if !((*left_val == *right_val) &&
(*right_val == *left_val)) { (*right_val == *left_val)) {
panic!("assertion failed: `(left == right) && (right == left)` \ panic!("assertion failed: `(left == right) && (right == left)` \
(left: `{}`, right: `{}`)", *left_val, *right_val) (left: `{:?}`, right: `{:?}`)", *left_val, *right_val)
} }
} }
} }

View file

@ -47,10 +47,10 @@
//! 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);
//! } //! }
//! } //! }
//! ``` //! ```
@ -743,7 +743,7 @@ impl<T, E: Show> Result<T, E> {
match self { match self {
Ok(t) => t, Ok(t) => t,
Err(e) => Err(e) =>
panic!("called `Result::unwrap()` on an `Err` value: {}", e) panic!("called `Result::unwrap()` on an `Err` value: {:?}", e)
} }
} }
} }
@ -773,7 +773,7 @@ impl<T: Show, E> Result<T, E> {
pub fn unwrap_err(self) -> E { pub fn unwrap_err(self) -> E {
match self { match self {
Ok(t) => Ok(t) =>
panic!("called `Result::unwrap_err()` on an `Ok` value: {}", t), panic!("called `Result::unwrap_err()` on an `Ok` value: {:?}", t),
Err(e) => e Err(e) => e
} }
} }

View file

@ -143,7 +143,7 @@ Section: Creating a string
*/ */
/// Errors which can occur when attempting to interpret a byte slice as a `str`. /// Errors which can occur when attempting to interpret a byte slice as a `str`.
#[derive(Copy, Eq, PartialEq, Clone)] #[derive(Copy, Eq, PartialEq, Clone, Show)]
#[unstable = "error enumeration recently added and definitions may be refined"] #[unstable = "error enumeration recently added and definitions may be refined"]
pub enum Utf8Error { pub enum Utf8Error {
/// An invalid byte was detected at the byte offset given. /// An invalid byte was detected at the byte offset given.

View file

@ -56,12 +56,12 @@ fn any_downcast_ref() {
match a.downcast_ref::<uint>() { match a.downcast_ref::<uint>() {
Some(&5) => {} Some(&5) => {}
x => panic!("Unexpected value {}", x) x => panic!("Unexpected value {:?}", x)
} }
match a.downcast_ref::<Test>() { match a.downcast_ref::<Test>() {
None => {} None => {}
x => panic!("Unexpected value {}", x) x => panic!("Unexpected value {:?}", x)
} }
} }
@ -79,7 +79,7 @@ fn any_downcast_mut() {
assert_eq!(*x, 5u); assert_eq!(*x, 5u);
*x = 612; *x = 612;
} }
x => panic!("Unexpected value {}", x) x => panic!("Unexpected value {:?}", x)
} }
match b_r.downcast_mut::<uint>() { match b_r.downcast_mut::<uint>() {
@ -87,27 +87,27 @@ fn any_downcast_mut() {
assert_eq!(*x, 7u); assert_eq!(*x, 7u);
*x = 413; *x = 413;
} }
x => panic!("Unexpected value {}", x) x => panic!("Unexpected value {:?}", x)
} }
match a_r.downcast_mut::<Test>() { match a_r.downcast_mut::<Test>() {
None => (), None => (),
x => panic!("Unexpected value {}", x) x => panic!("Unexpected value {:?}", x)
} }
match b_r.downcast_mut::<Test>() { match b_r.downcast_mut::<Test>() {
None => (), None => (),
x => panic!("Unexpected value {}", x) x => panic!("Unexpected value {:?}", x)
} }
match a_r.downcast_mut::<uint>() { match a_r.downcast_mut::<uint>() {
Some(&612) => {} Some(&612) => {}
x => panic!("Unexpected value {}", x) x => panic!("Unexpected value {:?}", x)
} }
match b_r.downcast_mut::<uint>() { match b_r.downcast_mut::<uint>() {
Some(&413) => {} Some(&413) => {}
x => panic!("Unexpected value {}", x) x => panic!("Unexpected value {:?}", x)
} }
} }

View file

@ -29,10 +29,10 @@ fn smoketest_cell() {
#[test] #[test]
fn cell_has_sensible_show() { fn cell_has_sensible_show() {
let x = Cell::new("foo bar"); let x = Cell::new("foo bar");
assert!(format!("{}", x).contains(x.get())); assert!(format!("{:?}", x).contains(x.get()));
x.set("baz qux"); x.set("baz qux");
assert!(format!("{}", x).contains(x.get())); assert!(format!("{:?}", x).contains(x.get()));
} }
#[test] #[test]
@ -40,11 +40,11 @@ fn ref_and_refmut_have_sensible_show() {
let refcell = RefCell::new("foo"); let refcell = RefCell::new("foo");
let refcell_refmut = refcell.borrow_mut(); let refcell_refmut = refcell.borrow_mut();
assert!(format!("{}", refcell_refmut).contains("foo")); assert!(format!("{:?}", refcell_refmut).contains("foo"));
drop(refcell_refmut); drop(refcell_refmut);
let refcell_ref = refcell.borrow(); let refcell_ref = refcell.borrow();
assert!(format!("{}", refcell_ref).contains("foo")); assert!(format!("{:?}", refcell_ref).contains("foo"));
drop(refcell_ref); drop(refcell_ref);
} }

View file

@ -26,6 +26,11 @@ fn test_format_int() {
assert!(format!("{}", -1i16) == "-1"); assert!(format!("{}", -1i16) == "-1");
assert!(format!("{}", -1i32) == "-1"); assert!(format!("{}", -1i32) == "-1");
assert!(format!("{}", -1i64) == "-1"); assert!(format!("{}", -1i64) == "-1");
assert!(format!("{:?}", 1i) == "1i");
assert!(format!("{:?}", 1i8) == "1i8");
assert!(format!("{:?}", 1i16) == "1i16");
assert!(format!("{:?}", 1i32) == "1i32");
assert!(format!("{:?}", 1i64) == "1i64");
assert!(format!("{:b}", 1i) == "1"); assert!(format!("{:b}", 1i) == "1");
assert!(format!("{:b}", 1i8) == "1"); assert!(format!("{:b}", 1i8) == "1");
assert!(format!("{:b}", 1i16) == "1"); assert!(format!("{:b}", 1i16) == "1");
@ -52,6 +57,11 @@ fn test_format_int() {
assert!(format!("{}", 1u16) == "1"); assert!(format!("{}", 1u16) == "1");
assert!(format!("{}", 1u32) == "1"); assert!(format!("{}", 1u32) == "1");
assert!(format!("{}", 1u64) == "1"); assert!(format!("{}", 1u64) == "1");
assert!(format!("{:?}", 1u) == "1u");
assert!(format!("{:?}", 1u8) == "1u8");
assert!(format!("{:?}", 1u16) == "1u16");
assert!(format!("{:?}", 1u32) == "1u32");
assert!(format!("{:?}", 1u64) == "1u64");
assert!(format!("{:b}", 1u) == "1"); assert!(format!("{:b}", 1u) == "1");
assert!(format!("{:b}", 1u8) == "1"); assert!(format!("{:b}", 1u8) == "1");
assert!(format!("{:b}", 1u16) == "1"); assert!(format!("{:b}", 1u16) == "1");
@ -84,12 +94,14 @@ fn test_format_int() {
#[test] #[test]
fn test_format_int_zero() { fn test_format_int_zero() {
assert!(format!("{}", 0i) == "0"); assert!(format!("{}", 0i) == "0");
assert!(format!("{:?}", 0i) == "0i");
assert!(format!("{:b}", 0i) == "0"); assert!(format!("{:b}", 0i) == "0");
assert!(format!("{:o}", 0i) == "0"); assert!(format!("{:o}", 0i) == "0");
assert!(format!("{:x}", 0i) == "0"); assert!(format!("{:x}", 0i) == "0");
assert!(format!("{:X}", 0i) == "0"); assert!(format!("{:X}", 0i) == "0");
assert!(format!("{}", 0u) == "0"); assert!(format!("{}", 0u) == "0");
assert!(format!("{:?}", 0u) == "0u");
assert!(format!("{:b}", 0u) == "0"); assert!(format!("{:b}", 0u) == "0");
assert!(format!("{:o}", 0u) == "0"); assert!(format!("{:o}", 0u) == "0");
assert!(format!("{:x}", 0u) == "0"); assert!(format!("{:x}", 0u) == "0");
@ -183,6 +195,12 @@ mod uint {
b.iter(|| { format!("{:x}", rng.gen::<uint>()); }) b.iter(|| { format!("{:x}", rng.gen::<uint>()); })
} }
#[bench]
fn format_show(b: &mut Bencher) {
let mut rng = weak_rng();
b.iter(|| { format!("{:?}", rng.gen::<uint>()); })
}
#[bench] #[bench]
fn format_base_36(b: &mut Bencher) { fn format_base_36(b: &mut Bencher) {
let mut rng = weak_rng(); let mut rng = weak_rng();
@ -219,6 +237,12 @@ mod int {
b.iter(|| { format!("{:x}", rng.gen::<int>()); }) b.iter(|| { format!("{:x}", rng.gen::<int>()); })
} }
#[bench]
fn format_show(b: &mut Bencher) {
let mut rng = weak_rng();
b.iter(|| { format!("{:?}", rng.gen::<int>()); })
}
#[bench] #[bench]
fn format_base_36(b: &mut Bencher) { fn format_base_36(b: &mut Bencher) {
let mut rng = weak_rng(); let mut rng = weak_rng();

View file

@ -95,10 +95,10 @@ pub fn test_fmt_default() {
let ok: Result<int, &'static str> = Ok(100); let ok: Result<int, &'static str> = Ok(100);
let err: Result<int, &'static str> = Err("Err"); let err: Result<int, &'static str> = Err("Err");
let s = format!("{}", ok); let s = format!("{:?}", ok);
assert_eq!(s, "Ok(100)"); assert_eq!(s, "Ok(100i)");
let s = format!("{}", err); let s = format!("{:?}", err);
assert_eq!(s, "Err(Err)"); assert_eq!(s, "Err(\"Err\")");
} }
#[test] #[test]

View file

@ -59,10 +59,10 @@ fn test_tuple_cmp() {
#[test] #[test]
fn test_show() { fn test_show() {
let s = format!("{}", (1i,)); let s = format!("{:?}", (1i,));
assert_eq!(s, "(1,)"); assert_eq!(s, "(1i,)");
let s = format!("{}", (1i, true)); let s = format!("{:?}", (1i, true));
assert_eq!(s, "(1, true)"); assert_eq!(s, "(1i, true)");
let s = format!("{}", (1i, "hi", true)); let s = format!("{:?}", (1i, "hi", true));
assert_eq!(s, "(1, hi, true)"); assert_eq!(s, "(1i, \"hi\", true)");
} }

View file

@ -212,10 +212,11 @@ impl<'a> Parser<'a> {
self.cur.next(); self.cur.next();
} }
Some((_, other)) => { Some((_, other)) => {
self.err(format!("expected `{}`, found `{}`", c, other).index(&FullRange)); self.err(format!("expected `{:?}`, found `{:?}`", c,
other).index(&FullRange));
} }
None => { None => {
self.err(format!("expected `{}` but string was terminated", self.err(format!("expected `{:?}` but string was terminated",
c).index(&FullRange)); c).index(&FullRange));
} }
} }

View file

@ -105,7 +105,7 @@ use std::iter::repeat;
use std::result; use std::result;
/// Name of an option. Either a string or a single char. /// Name of an option. Either a string or a single char.
#[derive(Clone, PartialEq, Eq)] #[derive(Clone, PartialEq, Eq, Show)]
pub enum Name { pub enum Name {
/// A string representing the long name of an option. /// A string representing the long name of an option.
/// For example: "help" /// For example: "help"
@ -116,7 +116,7 @@ pub enum Name {
} }
/// Describes whether an option has an argument. /// Describes whether an option has an argument.
#[derive(Clone, Copy, PartialEq, Eq)] #[derive(Clone, Copy, PartialEq, Eq, Show)]
pub enum HasArg { pub enum HasArg {
/// The option requires an argument. /// The option requires an argument.
Yes, Yes,
@ -127,7 +127,7 @@ pub enum HasArg {
} }
/// Describes how often an option may occur. /// Describes how often an option may occur.
#[derive(Clone, Copy, PartialEq, Eq)] #[derive(Clone, Copy, PartialEq, Eq, Show)]
pub enum Occur { pub enum Occur {
/// The option occurs once. /// The option occurs once.
Req, Req,
@ -138,7 +138,7 @@ pub enum Occur {
} }
/// A description of a possible option. /// A description of a possible option.
#[derive(Clone, PartialEq, Eq)] #[derive(Clone, PartialEq, Eq, Show)]
pub struct Opt { pub struct Opt {
/// Name of the option /// Name of the option
pub name: Name, pub name: Name,
@ -152,7 +152,7 @@ pub struct Opt {
/// One group of options, e.g., both `-h` and `--help`, along with /// One group of options, e.g., both `-h` and `--help`, along with
/// their shared description and properties. /// their shared description and properties.
#[derive(Clone, PartialEq, Eq)] #[derive(Clone, PartialEq, Eq, Show)]
pub struct OptGroup { pub struct OptGroup {
/// Short name of the option, e.g. `h` for a `-h` option /// Short name of the option, e.g. `h` for a `-h` option
pub short_name: String, pub short_name: String,
@ -169,7 +169,7 @@ pub struct OptGroup {
} }
/// Describes whether an option is given at all or has a value. /// Describes whether an option is given at all or has a value.
#[derive(Clone, PartialEq, Eq)] #[derive(Clone, PartialEq, Eq, Show)]
enum Optval { enum Optval {
Val(String), Val(String),
Given, Given,
@ -177,7 +177,7 @@ enum Optval {
/// The result of checking command line arguments. Contains a vector /// The result of checking command line arguments. Contains a vector
/// of matches and a vector of free strings. /// of matches and a vector of free strings.
#[derive(Clone, PartialEq, Eq)] #[derive(Clone, PartialEq, Eq, Show)]
pub struct Matches { pub struct Matches {
/// Options that matched /// Options that matched
opts: Vec<Opt>, opts: Vec<Opt>,
@ -190,7 +190,7 @@ pub struct Matches {
/// The type returned when the command line does not conform to the /// The type returned when the command line does not conform to the
/// expected format. Use the `Show` implementation to output detailed /// expected format. Use the `Show` implementation to output detailed
/// information. /// information.
#[derive(Clone, PartialEq, Eq)] #[derive(Clone, PartialEq, Eq, Show)]
pub enum Fail { pub enum Fail {
/// The option requires an argument but none was passed. /// The option requires an argument but none was passed.
ArgumentMissing(String), ArgumentMissing(String),
@ -205,7 +205,7 @@ pub enum Fail {
} }
/// The type of failure that occurred. /// The type of failure that occurred.
#[derive(Copy, PartialEq, Eq)] #[derive(Copy, PartialEq, Eq, Show)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum FailType { pub enum FailType {
ArgumentMissing_, ArgumentMissing_,
@ -536,13 +536,13 @@ pub fn opt(short_name: &str,
impl Fail { impl Fail {
/// Convert a `Fail` enum into an error string. /// Convert a `Fail` enum into an error string.
#[deprecated="use `Show` (`{}` format specifier)"] #[deprecated="use `fmt::String` (`{}` format specifier)"]
pub fn to_err_msg(self) -> String { pub fn to_err_msg(self) -> String {
self.to_string() self.to_string()
} }
} }
impl fmt::Show for Fail { impl fmt::String for Fail {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self { match *self {
ArgumentMissing(ref nm) => { ArgumentMissing(ref nm) => {

View file

@ -84,7 +84,7 @@ pub fn parse_logging_spec(spec: &str) -> (Vec<LogDirective>, Option<Regex>) {
match Regex::new(filter) { match Regex::new(filter) {
Ok(re) => Some(re), Ok(re) => Some(re),
Err(e) => { Err(e) => {
println!("warning: invalid regex filter - {}", e); println!("warning: invalid regex filter - {:?}", e);
None None
} }
} }

View file

@ -16,12 +16,12 @@
//! #[macro_use] extern crate log; //! #[macro_use] extern crate log;
//! //!
//! fn main() { //! fn main() {
//! debug!("this is a debug {}", "message"); //! debug!("this is a debug {:?}", "message");
//! error!("this is printed by default"); //! error!("this is printed by default");
//! //!
//! if log_enabled!(log::INFO) { //! if log_enabled!(log::INFO) {
//! let x = 3i * 4i; // expensive computation //! let x = 3i * 4i; // expensive computation
//! info!("the answer was: {}", x); //! info!("the answer was: {:?}", x);
//! } //! }
//! } //! }
//! ``` //! ```
@ -238,11 +238,17 @@ struct DefaultLogger {
pub struct LogLevel(pub u32); pub struct LogLevel(pub u32);
impl fmt::Show for LogLevel { impl fmt::Show for LogLevel {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(self, fmt)
}
}
impl fmt::String for LogLevel {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let LogLevel(level) = *self; let LogLevel(level) = *self;
match LOG_LEVEL_NAMES.get(level as uint - 1) { match LOG_LEVEL_NAMES.get(level as uint - 1) {
Some(name) => name.fmt(fmt), Some(ref name) => fmt::String::fmt(name, fmt),
None => level.fmt(fmt) None => fmt::String::fmt(&level, fmt)
} }
} }
} }
@ -254,7 +260,7 @@ impl Logger for DefaultLogger {
record.level, record.level,
record.module_path, record.module_path,
record.args) { record.args) {
Err(e) => panic!("failed to log: {}", e), Err(e) => panic!("failed to log: {:?}", e),
Ok(()) => {} Ok(()) => {}
} }
} }
@ -264,7 +270,7 @@ impl Drop for DefaultLogger {
fn drop(&mut self) { fn drop(&mut self) {
// FIXME(#12628): is panicking the right thing to do? // FIXME(#12628): is panicking the right thing to do?
match self.handle.flush() { match self.handle.flush() {
Err(e) => panic!("failed to flush a logger: {}", e), Err(e) => panic!("failed to flush a logger: {:?}", e),
Ok(()) => {} Ok(()) => {}
} }
} }

View file

@ -147,7 +147,7 @@ pub mod reader {
match $e { match $e {
Ok(e) => e, Ok(e) => e,
Err(e) => { Err(e) => {
debug!("ignored error: {}", e); debug!("ignored error: {:?}", e);
return $r return $r
} }
} }
@ -256,7 +256,7 @@ pub mod reader {
match maybe_get_doc(d, tg) { match maybe_get_doc(d, tg) {
Some(d) => d, Some(d) => d,
None => { None => {
error!("failed to find block with tag {}", tg); error!("failed to find block with tag {:?}", tg);
panic!(); panic!();
} }
} }
@ -351,8 +351,8 @@ pub mod reader {
self.pos = r_doc.end; self.pos = r_doc.end;
let str = r_doc.as_str_slice(); let str = r_doc.as_str_slice();
if lbl != str { if lbl != str {
return Err(Expected(format!("Expected label {} but \ return Err(Expected(format!("Expected label {:?} but \
found {}", lbl, str))); found {:?}", lbl, str)));
} }
} }
} }
@ -360,14 +360,14 @@ pub mod reader {
} }
fn next_doc(&mut self, exp_tag: EbmlEncoderTag) -> DecodeResult<Doc<'doc>> { fn next_doc(&mut self, exp_tag: EbmlEncoderTag) -> DecodeResult<Doc<'doc>> {
debug!(". next_doc(exp_tag={})", exp_tag); debug!(". next_doc(exp_tag={:?})", exp_tag);
if self.pos >= self.parent.end { if self.pos >= self.parent.end {
return Err(Expected(format!("no more documents in \ return Err(Expected(format!("no more documents in \
current node!"))); current node!")));
} }
let TaggedDoc { tag: r_tag, doc: r_doc } = let TaggedDoc { tag: r_tag, doc: r_doc } =
try!(doc_at(self.parent.data, self.pos)); try!(doc_at(self.parent.data, self.pos));
debug!("self.parent={}-{} self.pos={} r_tag={} r_doc={}-{}", debug!("self.parent={:?}-{:?} self.pos={:?} r_tag={:?} r_doc={:?}-{:?}",
self.parent.start, self.parent.start,
self.parent.end, self.parent.end,
self.pos, self.pos,
@ -375,8 +375,8 @@ pub mod reader {
r_doc.start, r_doc.start,
r_doc.end); r_doc.end);
if r_tag != (exp_tag as uint) { if r_tag != (exp_tag as uint) {
return Err(Expected(format!("expected EBML doc with tag {} but \ return Err(Expected(format!("expected EBML doc with tag {:?} but \
found tag {}", exp_tag, r_tag))); found tag {:?}", exp_tag, r_tag)));
} }
if r_doc.end > self.parent.end { if r_doc.end > self.parent.end {
return Err(Expected(format!("invalid EBML, child extends to \ return Err(Expected(format!("invalid EBML, child extends to \
@ -403,7 +403,7 @@ pub mod reader {
fn _next_uint(&mut self, exp_tag: EbmlEncoderTag) -> DecodeResult<uint> { fn _next_uint(&mut self, exp_tag: EbmlEncoderTag) -> DecodeResult<uint> {
let r = doc_as_u32(try!(self.next_doc(exp_tag))); let r = doc_as_u32(try!(self.next_doc(exp_tag)));
debug!("_next_uint exp_tag={} result={}", exp_tag, r); debug!("_next_uint exp_tag={:?} result={:?}", exp_tag, r);
Ok(r as uint) Ok(r as uint)
} }
@ -486,7 +486,7 @@ pub mod reader {
fn read_enum<T, F>(&mut self, name: &str, f: F) -> DecodeResult<T> where fn read_enum<T, F>(&mut self, name: &str, f: F) -> DecodeResult<T> where
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>, F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
{ {
debug!("read_enum({})", name); debug!("read_enum({:?})", name);
try!(self._check_label(name)); try!(self._check_label(name));
let doc = try!(self.next_doc(EsEnum)); let doc = try!(self.next_doc(EsEnum));
@ -508,7 +508,7 @@ pub mod reader {
{ {
debug!("read_enum_variant()"); debug!("read_enum_variant()");
let idx = try!(self._next_uint(EsEnumVid)); let idx = try!(self._next_uint(EsEnumVid));
debug!(" idx={}", idx); debug!(" idx={:?}", idx);
let doc = try!(self.next_doc(EsEnumBody)); let doc = try!(self.next_doc(EsEnumBody));
@ -526,7 +526,7 @@ pub mod reader {
fn read_enum_variant_arg<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where fn read_enum_variant_arg<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>, F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
{ {
debug!("read_enum_variant_arg(idx={})", idx); debug!("read_enum_variant_arg(idx={:?})", idx);
f(self) f(self)
} }
@ -536,7 +536,7 @@ pub mod reader {
{ {
debug!("read_enum_struct_variant()"); debug!("read_enum_struct_variant()");
let idx = try!(self._next_uint(EsEnumVid)); let idx = try!(self._next_uint(EsEnumVid));
debug!(" idx={}", idx); debug!(" idx={:?}", idx);
let doc = try!(self.next_doc(EsEnumBody)); let doc = try!(self.next_doc(EsEnumBody));
@ -558,21 +558,21 @@ pub mod reader {
-> DecodeResult<T> where -> DecodeResult<T> where
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>, F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
{ {
debug!("read_enum_struct_variant_arg(name={}, idx={})", name, idx); debug!("read_enum_struct_variant_arg(name={:?}, idx={:?})", name, idx);
f(self) f(self)
} }
fn read_struct<T, F>(&mut self, name: &str, _: uint, f: F) -> DecodeResult<T> where fn read_struct<T, F>(&mut self, name: &str, _: uint, f: F) -> DecodeResult<T> where
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>, F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
{ {
debug!("read_struct(name={})", name); debug!("read_struct(name={:?})", name);
f(self) f(self)
} }
fn read_struct_field<T, F>(&mut self, name: &str, idx: uint, f: F) -> DecodeResult<T> where fn read_struct_field<T, F>(&mut self, name: &str, idx: uint, f: F) -> DecodeResult<T> where
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>, F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
{ {
debug!("read_struct_field(name={}, idx={})", name, idx); debug!("read_struct_field(name={:?}, idx={:?})", name, idx);
try!(self._check_label(name)); try!(self._check_label(name));
f(self) f(self)
} }
@ -594,14 +594,14 @@ pub mod reader {
fn read_tuple_arg<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where fn read_tuple_arg<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>, F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
{ {
debug!("read_tuple_arg(idx={})", idx); debug!("read_tuple_arg(idx={:?})", idx);
self.read_seq_elt(idx, f) self.read_seq_elt(idx, f)
} }
fn read_tuple_struct<T, F>(&mut self, name: &str, len: uint, f: F) -> DecodeResult<T> where fn read_tuple_struct<T, F>(&mut self, name: &str, len: uint, f: F) -> DecodeResult<T> where
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>, F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
{ {
debug!("read_tuple_struct(name={})", name); debug!("read_tuple_struct(name={:?})", name);
self.read_tuple(len, f) self.read_tuple(len, f)
} }
@ -611,7 +611,7 @@ pub mod reader {
-> DecodeResult<T> where -> DecodeResult<T> where
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>, F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
{ {
debug!("read_tuple_struct_arg(idx={})", idx); debug!("read_tuple_struct_arg(idx={:?})", idx);
self.read_tuple_arg(idx, f) self.read_tuple_arg(idx, f)
} }
@ -638,7 +638,7 @@ pub mod reader {
debug!("read_seq()"); debug!("read_seq()");
self.push_doc(EsVec, move |d| { self.push_doc(EsVec, move |d| {
let len = try!(d._next_uint(EsVecLen)); let len = try!(d._next_uint(EsVecLen));
debug!(" len={}", len); debug!(" len={:?}", len);
f(d, len) f(d, len)
}) })
} }
@ -646,7 +646,7 @@ pub mod reader {
fn read_seq_elt<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where fn read_seq_elt<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>, F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
{ {
debug!("read_seq_elt(idx={})", idx); debug!("read_seq_elt(idx={:?})", idx);
self.push_doc(EsVecElt, f) self.push_doc(EsVecElt, f)
} }
@ -656,7 +656,7 @@ pub mod reader {
debug!("read_map()"); debug!("read_map()");
self.push_doc(EsMap, move |d| { self.push_doc(EsMap, move |d| {
let len = try!(d._next_uint(EsMapLen)); let len = try!(d._next_uint(EsMapLen));
debug!(" len={}", len); debug!(" len={:?}", len);
f(d, len) f(d, len)
}) })
} }
@ -664,14 +664,14 @@ pub mod reader {
fn read_map_elt_key<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where fn read_map_elt_key<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>, F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
{ {
debug!("read_map_elt_key(idx={})", idx); debug!("read_map_elt_key(idx={:?})", idx);
self.push_doc(EsMapKey, f) self.push_doc(EsMapKey, f)
} }
fn read_map_elt_val<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where fn read_map_elt_val<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>, F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
{ {
debug!("read_map_elt_val(idx={})", idx); debug!("read_map_elt_val(idx={:?})", idx);
self.push_doc(EsMapVal, f) self.push_doc(EsMapVal, f)
} }
@ -1007,7 +1007,7 @@ pub mod writer {
} }
pub fn start_tag(&mut self, tag_id: uint) -> EncodeResult { pub fn start_tag(&mut self, tag_id: uint) -> EncodeResult {
debug!("Start tag {}", tag_id); debug!("Start tag {:?}", tag_id);
// Write the enum ID: // Write the enum ID:
try!(write_vuint(self.writer, tag_id)); try!(write_vuint(self.writer, tag_id));
@ -1026,7 +1026,7 @@ pub mod writer {
try!(write_sized_vuint(self.writer, size, 4u)); try!(write_sized_vuint(self.writer, size, 4u));
let r = try!(self.writer.seek(cur_pos as i64, io::SeekSet)); let r = try!(self.writer.seek(cur_pos as i64, io::SeekSet));
debug!("End tag (size = {})", size); debug!("End tag (size = {:?})", size);
Ok(r) Ok(r)
} }
@ -1093,12 +1093,12 @@ pub mod writer {
} }
pub fn wr_bytes(&mut self, b: &[u8]) -> EncodeResult { pub fn wr_bytes(&mut self, b: &[u8]) -> EncodeResult {
debug!("Write {} bytes", b.len()); debug!("Write {:?} bytes", b.len());
self.writer.write(b) self.writer.write(b)
} }
pub fn wr_str(&mut self, s: &str) -> EncodeResult { pub fn wr_str(&mut self, s: &str) -> EncodeResult {
debug!("Write str: {}", s); debug!("Write str: {:?}", s);
self.writer.write(s.as_bytes()) self.writer.write(s.as_bytes())
} }
} }
@ -1608,7 +1608,7 @@ mod tests {
#[test] #[test]
fn test_option_int() { fn test_option_int() {
fn test_v(v: Option<int>) { fn test_v(v: Option<int>) {
debug!("v == {}", v); debug!("v == {:?}", v);
let mut wr = SeekableMemWriter::new(); let mut wr = SeekableMemWriter::new();
{ {
let mut rbml_w = writer::Encoder::new(&mut wr); let mut rbml_w = writer::Encoder::new(&mut wr);
@ -1617,7 +1617,7 @@ mod tests {
let rbml_doc = Doc::new(wr.get_ref()); let rbml_doc = Doc::new(wr.get_ref());
let mut deser = reader::Decoder::new(rbml_doc); let mut deser = reader::Decoder::new(rbml_doc);
let v1 = Decodable::decode(&mut deser).unwrap(); let v1 = Decodable::decode(&mut deser).unwrap();
debug!("v1 == {}", v1); debug!("v1 == {:?}", v1);
assert_eq!(v, v1); assert_eq!(v, v1);
} }

View file

@ -13,7 +13,6 @@
//! Regular expressions implemented in Rust //! Regular expressions implemented in Rust
//! //!
//! For official documentation, see the rust-lang/regex crate //! For official documentation, see the rust-lang/regex crate
#![crate_name = "regex"] #![crate_name = "regex"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]

View file

@ -40,7 +40,7 @@ pub struct Error {
impl fmt::Show for Error { impl fmt::Show for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Regex syntax error near position {}: {}", write!(f, "Regex syntax error near position {}: {:?}",
self.pos, self.msg) self.pos, self.msg)
} }
} }
@ -122,7 +122,7 @@ impl BuildAst {
fn flags(&self) -> Flags { fn flags(&self) -> Flags {
match *self { match *self {
Paren(flags, _, _) => flags, Paren(flags, _, _) => flags,
_ => panic!("Cannot get flags from {}", self), _ => panic!("Cannot get flags from {:?}", self),
} }
} }
@ -130,7 +130,7 @@ impl BuildAst {
match *self { match *self {
Paren(_, 0, _) => None, Paren(_, 0, _) => None,
Paren(_, c, _) => Some(c), Paren(_, c, _) => Some(c),
_ => panic!("Cannot get capture group from {}", self), _ => panic!("Cannot get capture group from {:?}", self),
} }
} }
@ -144,7 +144,7 @@ impl BuildAst {
Some(name.clone()) Some(name.clone())
} }
} }
_ => panic!("Cannot get capture name from {}", self), _ => panic!("Cannot get capture name from {:?}", self),
} }
} }
@ -158,7 +158,7 @@ impl BuildAst {
fn unwrap(self) -> Result<Ast, Error> { fn unwrap(self) -> Result<Ast, Error> {
match self { match self {
Expr(x) => Ok(x), Expr(x) => Ok(x),
_ => panic!("Tried to unwrap non-AST item: {}", self), _ => panic!("Tried to unwrap non-AST item: {:?}", self),
} }
} }
} }
@ -285,7 +285,7 @@ impl<'a> Parser<'a> {
match self.next_char() { match self.next_char() {
true => Ok(()), true => Ok(()),
false => { false => {
self.err(format!("Expected {} but got EOF.", self.err(format!("Expected {:?} but got EOF.",
expected).index(&FullRange)) expected).index(&FullRange))
} }
} }
@ -294,10 +294,10 @@ impl<'a> Parser<'a> {
fn expect(&mut self, expected: char) -> Result<(), Error> { fn expect(&mut self, expected: char) -> Result<(), Error> {
match self.next_char() { match self.next_char() {
true if self.cur() == expected => Ok(()), true if self.cur() == expected => Ok(()),
true => self.err(format!("Expected '{}' but got '{}'.", true => self.err(format!("Expected '{:?}' but got '{:?}'.",
expected, self.cur()).index(&FullRange)), expected, self.cur()).index(&FullRange)),
false => { false => {
self.err(format!("Expected '{}' but got EOF.", self.err(format!("Expected '{:?}' but got EOF.",
expected).index(&FullRange)) expected).index(&FullRange))
} }
} }
@ -395,7 +395,7 @@ impl<'a> Parser<'a> {
continue continue
} }
Some(ast) => Some(ast) =>
panic!("Expected Class AST but got '{}'", ast), panic!("Expected Class AST but got '{:?}'", ast),
// Just drop down and try to add as a regular character. // Just drop down and try to add as a regular character.
None => {}, None => {},
}, },
@ -410,7 +410,7 @@ impl<'a> Parser<'a> {
return self.err( return self.err(
"\\A, \\z, \\b and \\B are not valid escape \ "\\A, \\z, \\b and \\B are not valid escape \
sequences inside a character class."), sequences inside a character class."),
ast => panic!("Unexpected AST item '{}'", ast), ast => panic!("Unexpected AST item '{:?}'", ast),
} }
} }
']' if ranges.len() > 0 || alts.len() > 0 => { ']' if ranges.len() > 0 || alts.len() > 0 => {
@ -443,7 +443,7 @@ impl<'a> Parser<'a> {
match try!(self.parse_escape()) { match try!(self.parse_escape()) {
Literal(c3, _) => c2 = c3, // allow literal escapes below Literal(c3, _) => c2 = c3, // allow literal escapes below
ast => ast =>
return self.err(format!("Expected a literal, but got {}.", return self.err(format!("Expected a literal, but got {:?}.",
ast).index(&FullRange)), ast).index(&FullRange)),
} }
} }
@ -513,7 +513,7 @@ impl<'a> Parser<'a> {
None => { None => {
return self.err(format!("No closing brace for counted \ return self.err(format!("No closing brace for counted \
repetition starting at position \ repetition starting at position \
{}.", {:?}.",
start).index(&FullRange)) start).index(&FullRange))
} }
}; };
@ -686,7 +686,7 @@ impl<'a> Parser<'a> {
match num::from_str_radix::<u32>(s.index(&FullRange), 8) { match num::from_str_radix::<u32>(s.index(&FullRange), 8) {
Some(n) => Ok(Literal(try!(self.char_from_u32(n)), FLAG_EMPTY)), Some(n) => Ok(Literal(try!(self.char_from_u32(n)), FLAG_EMPTY)),
None => { None => {
self.err(format!("Could not parse '{}' as octal number.", self.err(format!("Could not parse '{:?}' as octal number.",
s).index(&FullRange)) s).index(&FullRange))
} }
} }

View file

@ -90,10 +90,19 @@ impl Clone for ExNative {
} }
} }
#[cfg(stage0)]
//FIXME: remove after stage0 snapshot
impl fmt::Show for Regex { impl fmt::Show for Regex {
/// Shows the original regular expression. /// Shows the original regular expression.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.as_str()) fmt::String::fmt(self.as_str(), f)
}
}
impl fmt::String for Regex {
/// Shows the original regular expression.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(self.as_str(), f)
} }
} }

View file

@ -1629,7 +1629,6 @@ declare_lint! {
Warn, Warn,
"detects use of #[deprecated] items" "detects use of #[deprecated] items"
} }
// FIXME #6875: Change to Warn after std library stabilization is complete // FIXME #6875: Change to Warn after std library stabilization is complete
declare_lint! { declare_lint! {
EXPERIMENTAL, EXPERIMENTAL,
@ -1848,7 +1847,7 @@ declare_lint! {
"detects transmutes of fat pointers" "detects transmutes of fat pointers"
} }
declare_lint!{ declare_lint! {
pub MISSING_COPY_IMPLEMENTATIONS, pub MISSING_COPY_IMPLEMENTATIONS,
Warn, Warn,
"detects potentially-forgotten implementations of `Copy`" "detects potentially-forgotten implementations of `Copy`"

View file

@ -246,13 +246,13 @@ pub fn get_field_type<'tcx>(tcx: &ty::ctxt<'tcx>, class_id: ast::DefId,
let class_doc = expect(tcx.sess.diagnostic(), let class_doc = expect(tcx.sess.diagnostic(),
decoder::maybe_find_item(class_id.node, all_items), decoder::maybe_find_item(class_id.node, all_items),
|| { || {
(format!("get_field_type: class ID {} not found", (format!("get_field_type: class ID {:?} not found",
class_id)).to_string() class_id)).to_string()
}); });
let the_field = expect(tcx.sess.diagnostic(), let the_field = expect(tcx.sess.diagnostic(),
decoder::maybe_find_item(def.node, class_doc), decoder::maybe_find_item(def.node, class_doc),
|| { || {
(format!("get_field_type: in class {}, field ID {} not found", (format!("get_field_type: in class {:?}, field ID {:?} not found",
class_id, class_id,
def)).to_string() def)).to_string()
}); });

View file

@ -845,7 +845,7 @@ fn encode_info_for_method<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
parent_id: NodeId, parent_id: NodeId,
ast_item_opt: Option<&ast::ImplItem>) { ast_item_opt: Option<&ast::ImplItem>) {
debug!("encode_info_for_method: {} {}", m.def_id, debug!("encode_info_for_method: {:?} {:?}", m.def_id,
token::get_name(m.name)); token::get_name(m.name));
rbml_w.start_tag(tag_items_data_item); rbml_w.start_tag(tag_items_data_item);
@ -887,7 +887,7 @@ fn encode_info_for_associated_type(ecx: &EncodeContext,
impl_path: PathElems, impl_path: PathElems,
parent_id: NodeId, parent_id: NodeId,
typedef_opt: Option<P<ast::Typedef>>) { typedef_opt: Option<P<ast::Typedef>>) {
debug!("encode_info_for_associated_type({},{})", debug!("encode_info_for_associated_type({:?},{:?})",
associated_type.def_id, associated_type.def_id,
token::get_name(associated_type.name)); token::get_name(associated_type.name));

View file

@ -738,12 +738,12 @@ pub fn parse_def_id(buf: &[u8]) -> ast::DefId {
let crate_num = match str::from_utf8(crate_part).ok().and_then(|s| s.parse::<uint>()) { let crate_num = match str::from_utf8(crate_part).ok().and_then(|s| s.parse::<uint>()) {
Some(cn) => cn as ast::CrateNum, Some(cn) => cn as ast::CrateNum,
None => panic!("internal error: parse_def_id: crate number expected, found {}", None => panic!("internal error: parse_def_id: crate number expected, found {:?}",
crate_part) crate_part)
}; };
let def_num = match str::from_utf8(def_part).ok().and_then(|s| s.parse::<uint>()) { let def_num = match str::from_utf8(def_part).ok().and_then(|s| s.parse::<uint>()) {
Some(dn) => dn as ast::NodeId, Some(dn) => dn as ast::NodeId,
None => panic!("internal error: parse_def_id: id expected, found {}", None => panic!("internal error: parse_def_id: id expected, found {:?}",
def_part) def_part)
}; };
ast::DefId { krate: crate_num, node: def_num } ast::DefId { krate: crate_num, node: def_num }

View file

@ -82,7 +82,7 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
e::IIImplItemRef(_, &ast::MethodImplItem(ref m)) => m.id, e::IIImplItemRef(_, &ast::MethodImplItem(ref m)) => m.id,
e::IIImplItemRef(_, &ast::TypeImplItem(ref ti)) => ti.id, e::IIImplItemRef(_, &ast::TypeImplItem(ref ti)) => ti.id,
}; };
debug!("> Encoding inlined item: {} ({})", debug!("> Encoding inlined item: {} ({:?})",
ecx.tcx.map.path_to_string(id), ecx.tcx.map.path_to_string(id),
rbml_w.writer.tell()); rbml_w.writer.tell());
@ -96,7 +96,7 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
encode_side_tables_for_ii(ecx, rbml_w, &ii); encode_side_tables_for_ii(ecx, rbml_w, &ii);
rbml_w.end_tag(); rbml_w.end_tag();
debug!("< Encoded inlined fn: {} ({})", debug!("< Encoded inlined fn: {} ({:?})",
ecx.tcx.map.path_to_string(id), ecx.tcx.map.path_to_string(id),
rbml_w.writer.tell()); rbml_w.writer.tell());
} }
@ -127,7 +127,7 @@ pub fn decode_inlined_item<'tcx>(cdata: &cstore::crate_metadata,
None => Err(path), None => Err(path),
Some(ast_doc) => { Some(ast_doc) => {
let mut path_as_str = None; let mut path_as_str = None;
debug!("> Decoding inlined fn: {}::?", debug!("> Decoding inlined fn: {:?}::?",
{ {
// Do an Option dance to use the path after it is moved below. // Do an Option dance to use the path after it is moved below.
let s = ast_map::path_to_string(ast_map::Values(path.iter())); let s = ast_map::path_to_string(ast_map::Values(path.iter()));
@ -1880,7 +1880,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
NominalType | TypeWithId | RegionParameter => dcx.tr_def_id(did), NominalType | TypeWithId | RegionParameter => dcx.tr_def_id(did),
TypeParameter | UnboxedClosureSource => dcx.tr_intern_def_id(did) TypeParameter | UnboxedClosureSource => dcx.tr_intern_def_id(did)
}; };
debug!("convert_def_id(source={}, did={})={}", source, did, r); debug!("convert_def_id(source={:?}, did={:?})={:?}", source, did, r);
return r; return r;
} }
} }

View file

@ -480,12 +480,12 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
let inputs = inline_asm.inputs.iter(); let inputs = inline_asm.inputs.iter();
let outputs = inline_asm.outputs.iter(); let outputs = inline_asm.outputs.iter();
let post_inputs = self.exprs(inputs.map(|a| { let post_inputs = self.exprs(inputs.map(|a| {
debug!("cfg::construct InlineAsm id:{} input:{}", expr.id, a); debug!("cfg::construct InlineAsm id:{} input:{:?}", expr.id, a);
let &(_, ref expr) = a; let &(_, ref expr) = a;
&**expr &**expr
}), pred); }), pred);
let post_outputs = self.exprs(outputs.map(|a| { let post_outputs = self.exprs(outputs.map(|a| {
debug!("cfg::construct InlineAsm id:{} output:{}", expr.id, a); debug!("cfg::construct InlineAsm id:{} output:{:?}", expr.id, a);
let &(_, ref expr, _) = a; let &(_, ref expr, _) = a;
&**expr &**expr
}), post_inputs); }), post_inputs);
@ -622,7 +622,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
r => { r => {
self.tcx.sess.span_bug( self.tcx.sess.span_bug(
expr.span, expr.span,
format!("bad entry `{}` in def_map for label", format!("bad entry `{:?}` in def_map for label",
r).index(&FullRange)); r).index(&FullRange));
} }
} }

View file

@ -118,7 +118,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &ast::Expr) {
DefStruct(_) | DefVariant(_, _, _) => {} DefStruct(_) | DefVariant(_, _, _) => {}
def => { def => {
debug!("(checking const) found bad def: {}", def); debug!("(checking const) found bad def: {:?}", def);
span_err!(v.tcx.sess, e.span, E0014, span_err!(v.tcx.sess, e.span, E0014,
"paths in constants may only refer to constants \ "paths in constants may only refer to constants \
or functions"); or functions");

View file

@ -574,7 +574,7 @@ fn is_useful(cx: &MatchCheckCtxt,
witness: WitnessPreference) witness: WitnessPreference)
-> Usefulness { -> Usefulness {
let &Matrix(ref rows) = matrix; let &Matrix(ref rows) = matrix;
debug!("{:}", matrix); debug!("{:?}", matrix);
if rows.len() == 0u { if rows.len() == 0u {
return match witness { return match witness {
ConstructWitness => UsefulWithWitness(vec!()), ConstructWitness => UsefulWithWitness(vec!()),
@ -1042,7 +1042,7 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
cx.tcx.sess.span_bug( cx.tcx.sess.span_bug(
p.span, p.span,
format!("binding pattern {} is not an \ format!("binding pattern {} is not an \
identifier: {}", identifier: {:?}",
p.id, p.id,
p.node).index(&FullRange)); p.node).index(&FullRange));
} }

View file

@ -59,7 +59,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for RvalueContextDelegate<'a, 'tcx> {
span: Span, span: Span,
cmt: mc::cmt<'tcx>, cmt: mc::cmt<'tcx>,
_: euv::ConsumeMode) { _: euv::ConsumeMode) {
debug!("consume; cmt: {}; type: {}", *cmt, ty_to_string(self.tcx, cmt.ty)); debug!("consume; cmt: {:?}; type: {}", *cmt, ty_to_string(self.tcx, cmt.ty));
if !ty::type_is_sized(self.param_env, span, cmt.ty) { if !ty::type_is_sized(self.param_env, span, cmt.ty) {
span_err!(self.tcx.sess, span, E0161, span_err!(self.tcx.sess, span, E0161,
"cannot move a value of type {0}: the size of {0} cannot be statically determined", "cannot move a value of type {0}: the size of {0} cannot be statically determined",

View file

@ -196,7 +196,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
let words_per_id = (bits_per_id + uint::BITS - 1) / uint::BITS; let words_per_id = (bits_per_id + uint::BITS - 1) / uint::BITS;
let num_nodes = cfg.graph.all_nodes().len(); let num_nodes = cfg.graph.all_nodes().len();
debug!("DataFlowContext::new(analysis_name: {}, id_range={}, \ debug!("DataFlowContext::new(analysis_name: {}, id_range={:?}, \
bits_per_id={}, words_per_id={}) \ bits_per_id={}, words_per_id={}) \
num_nodes: {}", num_nodes: {}",
analysis_name, id_range, bits_per_id, words_per_id, analysis_name, id_range, bits_per_id, words_per_id,
@ -251,7 +251,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
fn apply_gen_kill(&self, cfgidx: CFGIndex, bits: &mut [uint]) { fn apply_gen_kill(&self, cfgidx: CFGIndex, bits: &mut [uint]) {
//! Applies the gen and kill sets for `cfgidx` to `bits` //! Applies the gen and kill sets for `cfgidx` to `bits`
debug!("{} apply_gen_kill(cfgidx={}, bits={}) [before]", debug!("{} apply_gen_kill(cfgidx={:?}, bits={}) [before]",
self.analysis_name, cfgidx, mut_bits_to_string(bits)); self.analysis_name, cfgidx, mut_bits_to_string(bits));
assert!(self.bits_per_id > 0); assert!(self.bits_per_id > 0);
@ -261,7 +261,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
let kills = self.kills.slice(start, end); let kills = self.kills.slice(start, end);
bitwise(bits, kills, &Subtract); bitwise(bits, kills, &Subtract);
debug!("{} apply_gen_kill(cfgidx={}, bits={}) [after]", debug!("{} apply_gen_kill(cfgidx={:?}, bits={}) [after]",
self.analysis_name, cfgidx, mut_bits_to_string(bits)); self.analysis_name, cfgidx, mut_bits_to_string(bits));
} }
@ -315,7 +315,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
temp_bits.index(&FullRange) temp_bits.index(&FullRange)
} }
}; };
debug!("{} each_bit_for_node({}, cfgidx={}) bits={}", debug!("{} each_bit_for_node({:?}, cfgidx={:?}) bits={}",
self.analysis_name, e, cfgidx, bits_to_string(slice)); self.analysis_name, e, cfgidx, bits_to_string(slice));
self.each_bit(slice, f) self.each_bit(slice, f)
} }
@ -410,7 +410,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
} }
} }
None => { None => {
debug!("{} add_kills_from_flow_exits flow_exit={} \ debug!("{} add_kills_from_flow_exits flow_exit={:?} \
no cfg_idx for exiting_scope={}", no cfg_idx for exiting_scope={}",
self.analysis_name, flow_exit, node_id); self.analysis_name, flow_exit, node_id);
} }
@ -419,10 +419,10 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
if changed { if changed {
let bits = self.kills.slice_mut(start, end); let bits = self.kills.slice_mut(start, end);
debug!("{} add_kills_from_flow_exits flow_exit={} bits={} [before]", debug!("{} add_kills_from_flow_exits flow_exit={:?} bits={} [before]",
self.analysis_name, flow_exit, mut_bits_to_string(bits)); self.analysis_name, flow_exit, mut_bits_to_string(bits));
bits.clone_from_slice(orig_kills.index(&FullRange)); bits.clone_from_slice(orig_kills.index(&FullRange));
debug!("{} add_kills_from_flow_exits flow_exit={} bits={} [after]", debug!("{} add_kills_from_flow_exits flow_exit={:?} bits={} [after]",
self.analysis_name, flow_exit, mut_bits_to_string(bits)); self.analysis_name, flow_exit, mut_bits_to_string(bits));
} }
true true
@ -481,7 +481,7 @@ impl<'a, 'b, 'tcx, O:DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> {
assert!(self.dfcx.bits_per_id > 0); assert!(self.dfcx.bits_per_id > 0);
cfg.graph.each_node(|node_index, node| { cfg.graph.each_node(|node_index, node| {
debug!("DataFlowContext::walk_cfg idx={} id={} begin in_out={}", debug!("DataFlowContext::walk_cfg idx={:?} id={} begin in_out={}",
node_index, node.data.id, bits_to_string(in_out)); node_index, node.data.id, bits_to_string(in_out));
let (start, end) = self.dfcx.compute_id_range(node_index); let (start, end) = self.dfcx.compute_id_range(node_index);
@ -521,7 +521,7 @@ impl<'a, 'b, 'tcx, O:DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> {
edge: &cfg::CFGEdge) { edge: &cfg::CFGEdge) {
let source = edge.source(); let source = edge.source();
let cfgidx = edge.target(); let cfgidx = edge.target();
debug!("{} propagate_bits_into_entry_set_for(pred_bits={}, {} to {})", debug!("{} propagate_bits_into_entry_set_for(pred_bits={}, {:?} to {:?})",
self.dfcx.analysis_name, bits_to_string(pred_bits), source, cfgidx); self.dfcx.analysis_name, bits_to_string(pred_bits), source, cfgidx);
assert!(self.dfcx.bits_per_id > 0); assert!(self.dfcx.bits_per_id > 0);
@ -532,7 +532,7 @@ impl<'a, 'b, 'tcx, O:DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> {
bitwise(on_entry, pred_bits, &self.dfcx.oper) bitwise(on_entry, pred_bits, &self.dfcx.oper)
}; };
if changed { if changed {
debug!("{} changed entry set for {} to {}", debug!("{} changed entry set for {:?} to {}",
self.dfcx.analysis_name, cfgidx, self.dfcx.analysis_name, cfgidx,
bits_to_string(self.dfcx.on_entry.slice(start, end))); bits_to_string(self.dfcx.on_entry.slice(start, end)));
self.changed = true; self.changed = true;

View file

@ -149,7 +149,7 @@ fn calculate_type(sess: &session::Session,
add_library(sess, cnum, cstore::RequireDynamic, &mut formats); add_library(sess, cnum, cstore::RequireDynamic, &mut formats);
let deps = csearch::get_dylib_dependency_formats(&sess.cstore, cnum); let deps = csearch::get_dylib_dependency_formats(&sess.cstore, cnum);
for &(depnum, style) in deps.iter() { for &(depnum, style) in deps.iter() {
debug!("adding {}: {}", style, debug!("adding {:?}: {}", style,
sess.cstore.get_crate_data(depnum).name.clone()); sess.cstore.get_crate_data(depnum).name.clone());
add_library(sess, depnum, style, &mut formats); add_library(sess, depnum, style, &mut formats);
} }

View file

@ -1019,7 +1019,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
if pat_util::pat_is_binding(def_map, pat) { if pat_util::pat_is_binding(def_map, pat) {
let tcx = typer.tcx(); let tcx = typer.tcx();
debug!("binding cmt_pat={} pat={} match_mode={}", debug!("binding cmt_pat={} pat={} match_mode={:?}",
cmt_pat.repr(tcx), cmt_pat.repr(tcx),
pat.repr(tcx), pat.repr(tcx),
match_mode); match_mode);
@ -1155,7 +1155,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
// pattern. // pattern.
if !tcx.sess.has_errors() { if !tcx.sess.has_errors() {
let msg = format!("Pattern has unexpected type: {} and type {}", let msg = format!("Pattern has unexpected type: {:?} and type {}",
def, def,
cmt_pat.ty.repr(tcx)); cmt_pat.ty.repr(tcx));
tcx.sess.span_bug(pat.span, msg.as_slice()) tcx.sess.span_bug(pat.span, msg.as_slice())
@ -1172,7 +1172,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
// reported. // reported.
if !tcx.sess.has_errors() { if !tcx.sess.has_errors() {
let msg = format!("Pattern has unexpected def: {} and type {}", let msg = format!("Pattern has unexpected def: {:?} and type {}",
def, def,
cmt_pat.ty.repr(tcx)); cmt_pat.ty.repr(tcx));
tcx.sess.span_bug(pat.span, msg.index(&FullRange)) tcx.sess.span_bug(pat.span, msg.index(&FullRange))

View file

@ -55,7 +55,7 @@ pub struct Edge<E> {
impl<E: Show> Show for Edge<E> { impl<E: Show> Show for Edge<E> {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> { fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
write!(f, "Edge {{ next_edge: [{}, {}], source: {}, target: {}, data: {} }}", write!(f, "Edge {{ next_edge: [{:?}, {:?}], source: {:?}, target: {:?}, data: {:?} }}",
self.next_edge[0], self.next_edge[1], self.source, self.next_edge[0], self.next_edge[1], self.source,
self.target, self.data) self.target, self.data)
} }

View file

@ -265,7 +265,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
ty::mt{ty: ty, mutbl: mt_b.mutbl}); ty::mt{ty: ty, mutbl: mt_b.mutbl});
try!(self.get_ref().infcx.try(|_| sub.tys(ty, b))); try!(self.get_ref().infcx.try(|_| sub.tys(ty, b)));
debug!("Success, coerced with AutoDerefRef(1, \ debug!("Success, coerced with AutoDerefRef(1, \
AutoPtr(AutoUnsize({})))", kind); AutoPtr(AutoUnsize({:?})))", kind);
Ok(Some(AdjustDerefRef(AutoDerefRef { Ok(Some(AdjustDerefRef(AutoDerefRef {
autoderefs: 1, autoderefs: 1,
autoref: Some(ty::AutoPtr(r_borrow, mt_b.mutbl, autoref: Some(ty::AutoPtr(r_borrow, mt_b.mutbl,
@ -288,7 +288,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
ty::mt{ty: ty, mutbl: mt_b.mutbl}); ty::mt{ty: ty, mutbl: mt_b.mutbl});
try!(self.get_ref().infcx.try(|_| sub.tys(ty, b))); try!(self.get_ref().infcx.try(|_| sub.tys(ty, b)));
debug!("Success, coerced with AutoDerefRef(1, \ debug!("Success, coerced with AutoDerefRef(1, \
AutoPtr(AutoUnsize({})))", kind); AutoPtr(AutoUnsize({:?})))", kind);
Ok(Some(AdjustDerefRef(AutoDerefRef { Ok(Some(AdjustDerefRef(AutoDerefRef {
autoderefs: 1, autoderefs: 1,
autoref: Some(ty::AutoUnsafe(mt_b.mutbl, autoref: Some(ty::AutoUnsafe(mt_b.mutbl,
@ -306,7 +306,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
let ty = ty::mk_uniq(self.tcx(), ty); let ty = ty::mk_uniq(self.tcx(), ty);
try!(self.get_ref().infcx.try(|_| sub.tys(ty, b))); try!(self.get_ref().infcx.try(|_| sub.tys(ty, b)));
debug!("Success, coerced with AutoDerefRef(1, \ debug!("Success, coerced with AutoDerefRef(1, \
AutoUnsizeUniq({}))", kind); AutoUnsizeUniq({:?}))", kind);
Ok(Some(AdjustDerefRef(AutoDerefRef { Ok(Some(AdjustDerefRef(AutoDerefRef {
autoderefs: 1, autoderefs: 1,
autoref: Some(ty::AutoUnsizeUniq(kind)) autoref: Some(ty::AutoUnsizeUniq(kind))
@ -328,7 +328,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
a: Ty<'tcx>, a: Ty<'tcx>,
ty_b: Ty<'tcx>) ty_b: Ty<'tcx>)
-> Option<(Ty<'tcx>, ty::UnsizeKind<'tcx>)> { -> Option<(Ty<'tcx>, ty::UnsizeKind<'tcx>)> {
debug!("unsize_ty(a={}, ty_b={})", a, ty_b.repr(self.tcx())); debug!("unsize_ty(a={:?}, ty_b={})", a, ty_b.repr(self.tcx()));
let tcx = self.tcx(); let tcx = self.tcx();
@ -406,7 +406,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
{ {
let tcx = self.tcx(); let tcx = self.tcx();
debug!("coerce_borrowed_object(a={}, b={}, b_mutbl={})", debug!("coerce_borrowed_object(a={}, b={}, b_mutbl={:?})",
a.repr(tcx), a.repr(tcx),
b.repr(tcx), b_mutbl); b.repr(tcx), b_mutbl);
@ -426,7 +426,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
{ {
let tcx = self.tcx(); let tcx = self.tcx();
debug!("coerce_unsafe_object(a={}, b={}, b_mutbl={})", debug!("coerce_unsafe_object(a={}, b={}, b_mutbl={:?})",
a.repr(tcx), a.repr(tcx),
b.repr(tcx), b_mutbl); b.repr(tcx), b_mutbl);
@ -449,7 +449,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
match a.sty { match a.sty {
ty::ty_rptr(_, ty::mt{ty, mutbl}) => match ty.sty { ty::ty_rptr(_, ty::mt{ty, mutbl}) => match ty.sty {
ty::ty_trait(box ty::TyTrait { ref principal, ref bounds }) => { ty::ty_trait(box ty::TyTrait { ref principal, ref bounds }) => {
debug!("mutbl={} b_mutbl={}", mutbl, b_mutbl); debug!("mutbl={:?} b_mutbl={:?}", mutbl, b_mutbl);
let tr = ty::mk_trait(tcx, principal.clone(), bounds.clone()); let tr = ty::mk_trait(tcx, principal.clone(), bounds.clone());
try!(self.subtype(mk_ty(tr), b)); try!(self.subtype(mk_ty(tr), b));
Ok(Some(AdjustDerefRef(AutoDerefRef { Ok(Some(AdjustDerefRef(AutoDerefRef {

View file

@ -361,7 +361,7 @@ pub trait Combine<'tcx> : Sized {
a: ty::TraitStore, a: ty::TraitStore,
b: ty::TraitStore) b: ty::TraitStore)
-> cres<'tcx, ty::TraitStore> { -> cres<'tcx, ty::TraitStore> {
debug!("{}.trait_stores(a={}, b={})", self.tag(), a, b); debug!("{}.trait_stores(a={:?}, b={:?})", self.tag(), a, b);
match (a, b) { match (a, b) {
(ty::RegionTraitStore(a_r, a_m), (ty::RegionTraitStore(a_r, a_m),
@ -471,7 +471,7 @@ pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C,
let tcx = this.infcx().tcx; let tcx = this.infcx().tcx;
let a_sty = &a.sty; let a_sty = &a.sty;
let b_sty = &b.sty; let b_sty = &b.sty;
debug!("super_tys: a_sty={} b_sty={}", a_sty, b_sty); debug!("super_tys: a_sty={:?} b_sty={:?}", a_sty, b_sty);
return match (a_sty, b_sty) { return match (a_sty, b_sty) {
// The "subtype" ought to be handling cases involving var: // The "subtype" ought to be handling cases involving var:
(&ty::ty_infer(TyVar(_)), _) | (&ty::ty_infer(TyVar(_)), _) |
@ -550,7 +550,7 @@ pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C,
(&ty::ty_trait(ref a_), (&ty::ty_trait(ref a_),
&ty::ty_trait(ref b_)) => { &ty::ty_trait(ref b_)) => {
debug!("Trying to match traits {} and {}", a, b); debug!("Trying to match traits {:?} and {:?}", a, b);
let principal = try!(this.binders(&a_.principal, &b_.principal)); let principal = try!(this.binders(&a_.principal, &b_.principal));
let bounds = try!(this.existential_bounds(&a_.bounds, &b_.bounds)); let bounds = try!(this.existential_bounds(&a_.bounds, &b_.bounds));
Ok(ty::mk_trait(tcx, principal, bounds)) Ok(ty::mk_trait(tcx, principal, bounds))
@ -724,7 +724,7 @@ impl<'f, 'tcx> CombineFields<'f, 'tcx> {
Some(e) => e, Some(e) => e,
}; };
debug!("instantiate(a_ty={} dir={} b_vid={})", debug!("instantiate(a_ty={} dir={:?} b_vid={})",
a_ty.repr(tcx), a_ty.repr(tcx),
dir, dir,
b_vid.repr(tcx)); b_vid.repr(tcx));
@ -745,7 +745,7 @@ impl<'f, 'tcx> CombineFields<'f, 'tcx> {
self.generalize(a_ty, b_vid, true) self.generalize(a_ty, b_vid, true)
} }
}); });
debug!("instantiate(a_ty={}, dir={}, \ debug!("instantiate(a_ty={}, dir={:?}, \
b_vid={}, generalized_ty={})", b_vid={}, generalized_ty={})",
a_ty.repr(tcx), dir, b_vid.repr(tcx), a_ty.repr(tcx), dir, b_vid.repr(tcx),
generalized_ty.repr(tcx)); generalized_ty.repr(tcx));

View file

@ -268,7 +268,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
} }
} }
let pe = ProcessedErrors(var_origins, trace_origins, same_regions); let pe = ProcessedErrors(var_origins, trace_origins, same_regions);
debug!("errors processed: {}", pe); debug!("errors processed: {:?}", pe);
processed_errors.push(pe); processed_errors.push(pe);
} }
return processed_errors; return processed_errors;
@ -297,7 +297,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
sub: Region, sub: Region,
sup: Region) sup: Region)
-> Option<FreeRegionsFromSameFn> { -> Option<FreeRegionsFromSameFn> {
debug!("free_regions_from_same_fn(sub={}, sup={})", sub, sup); debug!("free_regions_from_same_fn(sub={:?}, sup={:?})", sub, sup);
let (scope_id, fr1, fr2) = match (sub, sup) { let (scope_id, fr1, fr2) = match (sub, sup) {
(ReFree(fr1), ReFree(fr2)) => { (ReFree(fr1), ReFree(fr2)) => {
if fr1.scope != fr2.scope { if fr1.scope != fr2.scope {

View file

@ -154,7 +154,7 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C
// Regions that pre-dated the LUB computation stay as they are. // Regions that pre-dated the LUB computation stay as they are.
if !is_var_in_set(new_vars, r0) { if !is_var_in_set(new_vars, r0) {
assert!(!r0.is_bound()); assert!(!r0.is_bound());
debug!("generalize_region(r0={}): not new variable", r0); debug!("generalize_region(r0={:?}): not new variable", r0);
return r0; return r0;
} }
@ -164,8 +164,8 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C
// *related* to regions that pre-date the LUB computation // *related* to regions that pre-date the LUB computation
// stay as they are. // stay as they are.
if !tainted.iter().all(|r| is_var_in_set(new_vars, *r)) { if !tainted.iter().all(|r| is_var_in_set(new_vars, *r)) {
debug!("generalize_region(r0={}): \ debug!("generalize_region(r0={:?}): \
non-new-variables found in {}", non-new-variables found in {:?}",
r0, tainted); r0, tainted);
assert!(!r0.is_bound()); assert!(!r0.is_bound());
return r0; return r0;
@ -178,8 +178,8 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C
// with. // with.
for (a_br, a_r) in a_map.iter() { for (a_br, a_r) in a_map.iter() {
if tainted.iter().any(|x| x == a_r) { if tainted.iter().any(|x| x == a_r) {
debug!("generalize_region(r0={}): \ debug!("generalize_region(r0={:?}): \
replacing with {}, tainted={}", replacing with {:?}, tainted={:?}",
r0, *a_br, tainted); r0, *a_br, tainted);
return ty::ReLateBound(debruijn, *a_br); return ty::ReLateBound(debruijn, *a_br);
} }
@ -187,7 +187,7 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C
infcx.tcx.sess.span_bug( infcx.tcx.sess.span_bug(
span, span,
format!("region {} is not associated with \ format!("region {:?} is not associated with \
any bound region from A!", any bound region from A!",
r0).index(&FullRange)) r0).index(&FullRange))
} }
@ -322,7 +322,7 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C
} }
infcx.tcx.sess.span_bug( infcx.tcx.sess.span_bug(
span, span,
format!("could not find original bound region for {}", r).index(&FullRange)); format!("could not find original bound region for {:?}", r).index(&FullRange));
} }
fn fresh_bound_variable(infcx: &InferCtxt, debruijn: ty::DebruijnIndex) -> ty::Region { fn fresh_bound_variable(infcx: &InferCtxt, debruijn: ty::DebruijnIndex) -> ty::Region {
@ -339,7 +339,7 @@ fn var_ids<'tcx, T: Combine<'tcx>>(combiner: &T,
r => { r => {
combiner.infcx().tcx.sess.span_bug( combiner.infcx().tcx.sess.span_bug(
combiner.trace().origin.span(), combiner.trace().origin.span(),
format!("found non-region-vid: {}", r).index(&FullRange)); format!("found non-region-vid: {:?}", r).index(&FullRange));
} }
}).collect() }).collect()
} }

View file

@ -989,7 +989,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
err: Option<&ty::type_err<'tcx>>) where err: Option<&ty::type_err<'tcx>>) where
M: FnOnce(Option<String>, String) -> String, M: FnOnce(Option<String>, String) -> String,
{ {
debug!("hi! expected_ty = {}, actual_ty = {}", expected_ty, actual_ty); debug!("hi! expected_ty = {:?}, actual_ty = {}", expected_ty, actual_ty);
let resolved_expected = expected_ty.map(|e_ty| self.resolve_type_vars_if_possible(&e_ty)); let resolved_expected = expected_ty.map(|e_ty| self.resolve_type_vars_if_possible(&e_ty));
@ -1219,7 +1219,7 @@ impl<'tcx> Repr<'tcx> for SubregionOrigin<'tcx> {
} }
Reborrow(a) => format!("Reborrow({})", a.repr(tcx)), Reborrow(a) => format!("Reborrow({})", a.repr(tcx)),
ReborrowUpvar(a, b) => { ReborrowUpvar(a, b) => {
format!("ReborrowUpvar({},{})", a.repr(tcx), b) format!("ReborrowUpvar({},{:?})", a.repr(tcx), b)
} }
ReferenceOutlivesReferent(_, a) => { ReferenceOutlivesReferent(_, a) => {
format!("ReferenceOutlivesReferent({})", a.repr(tcx)) format!("ReferenceOutlivesReferent({})", a.repr(tcx))
@ -1277,7 +1277,7 @@ impl<'tcx> Repr<'tcx> for RegionVariableOrigin<'tcx> {
format!("EarlyBoundRegion({},{})", a.repr(tcx), b.repr(tcx)) format!("EarlyBoundRegion({},{})", a.repr(tcx), b.repr(tcx))
} }
LateBoundRegion(a, b, c) => { LateBoundRegion(a, b, c) => {
format!("LateBoundRegion({},{},{})", a.repr(tcx), b.repr(tcx), c) format!("LateBoundRegion({},{},{:?})", a.repr(tcx), b.repr(tcx), c)
} }
BoundRegionInCoherence(a) => { BoundRegionInCoherence(a) => {
format!("bound_regionInCoherence({})", a.repr(tcx)) format!("bound_regionInCoherence({})", a.repr(tcx))

View file

@ -67,7 +67,7 @@ pub fn maybe_print_constraints_for<'a, 'tcx>(region_vars: &RegionVarBindings<'a,
} }
let requested_output = os::getenv("RUST_REGION_GRAPH"); let requested_output = os::getenv("RUST_REGION_GRAPH");
debug!("requested_output: {} requested_node: {}", debug!("requested_output: {:?} requested_node: {:?}",
requested_output, requested_node); requested_output, requested_node);
let output_path = { let output_path = {
@ -166,7 +166,7 @@ impl<'a, 'tcx> dot::Labeller<'a, Node, Edge> for ConstraintGraph<'a, 'tcx> {
fn node_label(&self, n: &Node) -> dot::LabelText { fn node_label(&self, n: &Node) -> dot::LabelText {
match *n { match *n {
Node::RegionVid(n_vid) => Node::RegionVid(n_vid) =>
dot::LabelText::label(format!("{}", n_vid)), dot::LabelText::label(format!("{:?}", n_vid)),
Node::Region(n_rgn) => Node::Region(n_rgn) =>
dot::LabelText::label(format!("{}", n_rgn.repr(self.tcx))), dot::LabelText::label(format!("{}", n_rgn.repr(self.tcx))),
} }
@ -204,12 +204,12 @@ impl<'a, 'tcx> dot::GraphWalk<'a, Node, Edge> for ConstraintGraph<'a, 'tcx> {
} }
fn source(&self, edge: &Edge) -> Node { fn source(&self, edge: &Edge) -> Node {
let (n1, _) = constraint_to_nodes(edge); let (n1, _) = constraint_to_nodes(edge);
debug!("edge {} has source {}", edge, n1); debug!("edge {:?} has source {:?}", edge, n1);
n1 n1
} }
fn target(&self, edge: &Edge) -> Node { fn target(&self, edge: &Edge) -> Node {
let (_, n2) = constraint_to_nodes(edge); let (_, n2) = constraint_to_nodes(edge);
debug!("edge {} has target {}", edge, n2); debug!("edge {:?} has target {:?}", edge, n2);
n2 n2
} }
} }

View file

@ -273,7 +273,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
} }
pub fn rollback_to(&self, snapshot: RegionSnapshot) { pub fn rollback_to(&self, snapshot: RegionSnapshot) {
debug!("RegionVarBindings: rollback_to({})", snapshot); debug!("RegionVarBindings: rollback_to({:?})", snapshot);
let mut undo_log = self.undo_log.borrow_mut(); let mut undo_log = self.undo_log.borrow_mut();
assert!(undo_log.len() > snapshot.length); assert!(undo_log.len() > snapshot.length);
assert!((*undo_log)[snapshot.length] == OpenSnapshot); assert!((*undo_log)[snapshot.length] == OpenSnapshot);
@ -325,7 +325,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
if self.in_snapshot() { if self.in_snapshot() {
self.undo_log.borrow_mut().push(AddVar(vid)); self.undo_log.borrow_mut().push(AddVar(vid));
} }
debug!("created new region variable {} with origin {}", debug!("created new region variable {:?} with origin {}",
vid, origin.repr(self.tcx)); vid, origin.repr(self.tcx));
return vid; return vid;
} }
@ -427,7 +427,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
let mut givens = self.givens.borrow_mut(); let mut givens = self.givens.borrow_mut();
if givens.insert((sub, sup)) { if givens.insert((sub, sup)) {
debug!("add_given({} <= {})", debug!("add_given({} <= {:?})",
sub.repr(self.tcx), sub.repr(self.tcx),
sup); sup);
@ -565,7 +565,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
} }
Some(ref values) => { Some(ref values) => {
let r = lookup(values, rid); let r = lookup(values, rid);
debug!("resolve_var({}) = {}", rid, r.repr(self.tcx)); debug!("resolve_var({:?}) = {}", rid, r.repr(self.tcx));
r r
} }
} }
@ -602,7 +602,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
} }
relate(self, a, ReInfer(ReVar(c))); relate(self, a, ReInfer(ReVar(c)));
relate(self, b, ReInfer(ReVar(c))); relate(self, b, ReInfer(ReVar(c)));
debug!("combine_vars() c={}", c); debug!("combine_vars() c={:?}", c);
ReInfer(ReVar(c)) ReInfer(ReVar(c))
} }
@ -623,7 +623,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
/// made---`r0` itself will be the first entry. This is used when checking whether skolemized /// made---`r0` itself will be the first entry. This is used when checking whether skolemized
/// regions are being improperly related to other regions. /// regions are being improperly related to other regions.
pub fn tainted(&self, mark: &RegionSnapshot, r0: Region) -> Vec<Region> { pub fn tainted(&self, mark: &RegionSnapshot, r0: Region) -> Vec<Region> {
debug!("tainted(mark={}, r0={})", mark, r0.repr(self.tcx)); debug!("tainted(mark={:?}, r0={})", mark, r0.repr(self.tcx));
let _indenter = indenter(); let _indenter = indenter();
// `result_set` acts as a worklist: we explore all outgoing // `result_set` acts as a worklist: we explore all outgoing
@ -634,7 +634,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
while result_index < result_set.len() { while result_index < result_set.len() {
// nb: can't use uint::range() here because result_set grows // nb: can't use uint::range() here because result_set grows
let r = result_set[result_index]; let r = result_set[result_index];
debug!("result_index={}, r={}", result_index, r); debug!("result_index={}, r={:?}", result_index, r);
for undo_entry in for undo_entry in
self.undo_log.borrow().slice_from(mark.length).iter() self.undo_log.borrow().slice_from(mark.length).iter()
@ -751,7 +751,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
self.tcx.sess.span_bug( self.tcx.sess.span_bug(
(*self.var_origins.borrow())[v_id.index as uint].span(), (*self.var_origins.borrow())[v_id.index as uint].span(),
format!("lub_concrete_regions invoked with \ format!("lub_concrete_regions invoked with \
non-concrete regions: {}, {}", non-concrete regions: {:?}, {:?}",
a, a,
b).index(&FullRange)); b).index(&FullRange));
} }
@ -827,7 +827,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
a: Region, a: Region,
b: Region) b: Region)
-> cres<'tcx, Region> { -> cres<'tcx, Region> {
debug!("glb_concrete_regions({}, {})", a, b); debug!("glb_concrete_regions({:?}, {:?})", a, b);
match (a, b) { match (a, b) {
(ReLateBound(..), _) | (ReLateBound(..), _) |
(_, ReLateBound(..)) | (_, ReLateBound(..)) |
@ -854,7 +854,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
self.tcx.sess.span_bug( self.tcx.sess.span_bug(
(*self.var_origins.borrow())[v_id.index as uint].span(), (*self.var_origins.borrow())[v_id.index as uint].span(),
format!("glb_concrete_regions invoked with \ format!("glb_concrete_regions invoked with \
non-concrete regions: {}, {}", non-concrete regions: {:?}, {:?}",
a, a,
b).index(&FullRange)); b).index(&FullRange));
} }
@ -932,7 +932,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
// scopes or two free regions. So, if one of // scopes or two free regions. So, if one of
// these scopes is a subscope of the other, return // these scopes is a subscope of the other, return
// it. Otherwise fail. // it. Otherwise fail.
debug!("intersect_scopes(scope_a={}, scope_b={}, region_a={}, region_b={})", debug!("intersect_scopes(scope_a={:?}, scope_b={:?}, region_a={:?}, region_b={:?})",
scope_a, scope_b, region_a, region_b); scope_a, scope_b, region_a, region_b);
match self.tcx.region_maps.nearest_common_ancestor(scope_a, scope_b) { match self.tcx.region_maps.nearest_common_ancestor(scope_a, scope_b) {
Some(r_id) if scope_a == r_id => Ok(ReScope(scope_b)), Some(r_id) if scope_a == r_id => Ok(ReScope(scope_b)),
@ -971,7 +971,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
// Dorky hack to cause `dump_constraints` to only get called // Dorky hack to cause `dump_constraints` to only get called
// if debug mode is enabled: // if debug mode is enabled:
debug!("----() End constraint listing {}---", self.dump_constraints()); debug!("----() End constraint listing {:?}---", self.dump_constraints());
graphviz::maybe_print_constraints_for(self, subject); graphviz::maybe_print_constraints_for(self, subject);
self.expansion(var_data.as_mut_slice()); self.expansion(var_data.as_mut_slice());
@ -1039,7 +1039,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
b_data: &mut VarData) b_data: &mut VarData)
-> bool -> bool
{ {
debug!("expand_node({}, {} == {})", debug!("expand_node({}, {:?} == {})",
a_region.repr(self.tcx), a_region.repr(self.tcx),
b_vid, b_vid,
b_data.value.repr(self.tcx)); b_data.value.repr(self.tcx));
@ -1058,7 +1058,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
b_data.classification = Expanding; b_data.classification = Expanding;
match b_data.value { match b_data.value {
NoValue => { NoValue => {
debug!("Setting initial value of {} to {}", debug!("Setting initial value of {:?} to {}",
b_vid, a_region.repr(self.tcx)); b_vid, a_region.repr(self.tcx));
b_data.value = Value(a_region); b_data.value = Value(a_region);
@ -1071,7 +1071,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
return false; return false;
} }
debug!("Expanding value of {} from {} to {}", debug!("Expanding value of {:?} from {} to {}",
b_vid, b_vid,
cur_region.repr(self.tcx), cur_region.repr(self.tcx),
lub.repr(self.tcx)); lub.repr(self.tcx));
@ -1122,7 +1122,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
a_data: &mut VarData, a_data: &mut VarData,
b_region: Region) b_region: Region)
-> bool { -> bool {
debug!("contract_node({} == {}/{}, {})", debug!("contract_node({:?} == {}/{:?}, {})",
a_vid, a_data.value.repr(self.tcx), a_vid, a_data.value.repr(self.tcx),
a_data.classification, b_region.repr(self.tcx)); a_data.classification, b_region.repr(self.tcx));
@ -1156,7 +1156,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
b_region: Region) b_region: Region)
-> bool { -> bool {
if !this.is_subregion_of(a_region, b_region) { if !this.is_subregion_of(a_region, b_region) {
debug!("Setting {} to ErrorValue: {} not subregion of {}", debug!("Setting {:?} to ErrorValue: {} not subregion of {}",
a_vid, a_vid,
a_region.repr(this.tcx), a_region.repr(this.tcx),
b_region.repr(this.tcx)); b_region.repr(this.tcx));
@ -1176,7 +1176,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
if glb == a_region { if glb == a_region {
false false
} else { } else {
debug!("Contracting value of {} from {} to {}", debug!("Contracting value of {:?} from {} to {}",
a_vid, a_vid,
a_region.repr(this.tcx), a_region.repr(this.tcx),
glb.repr(this.tcx)); glb.repr(this.tcx));
@ -1185,7 +1185,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
} }
} }
Err(_) => { Err(_) => {
debug!("Setting {} to ErrorValue: no glb of {}, {}", debug!("Setting {:?} to ErrorValue: no glb of {}, {}",
a_vid, a_vid,
a_region.repr(this.tcx), a_region.repr(this.tcx),
b_region.repr(this.tcx)); b_region.repr(this.tcx));
@ -1412,7 +1412,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
self.tcx.sess.span_bug( self.tcx.sess.span_bug(
(*self.var_origins.borrow())[node_idx.index as uint].span(), (*self.var_origins.borrow())[node_idx.index as uint].span(),
format!("collect_error_for_expanding_node() could not find error \ format!("collect_error_for_expanding_node() could not find error \
for var {}, lower_bounds={}, upper_bounds={}", for var {:?}, lower_bounds={}, upper_bounds={}",
node_idx, node_idx,
lower_bounds.repr(self.tcx), lower_bounds.repr(self.tcx),
upper_bounds.repr(self.tcx)).index(&FullRange)); upper_bounds.repr(self.tcx)).index(&FullRange));
@ -1457,7 +1457,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
self.tcx.sess.span_bug( self.tcx.sess.span_bug(
(*self.var_origins.borrow())[node_idx.index as uint].span(), (*self.var_origins.borrow())[node_idx.index as uint].span(),
format!("collect_error_for_contracting_node() could not find error \ format!("collect_error_for_contracting_node() could not find error \
for var {}, upper_bounds={}", for var {:?}, upper_bounds={}",
node_idx, node_idx,
upper_bounds.repr(self.tcx)).index(&FullRange)); upper_bounds.repr(self.tcx)).index(&FullRange));
} }
@ -1498,8 +1498,8 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
state.dup_found = true; state.dup_found = true;
} }
debug!("collect_concrete_regions(orig_node_idx={}, node_idx={}, \ debug!("collect_concrete_regions(orig_node_idx={:?}, node_idx={:?}, \
classification={})", classification={:?})",
orig_node_idx, node_idx, classification); orig_node_idx, node_idx, classification);
// figure out the direction from which this node takes its // figure out the direction from which this node takes its
@ -1520,7 +1520,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
graph: &RegionGraph, graph: &RegionGraph,
source_vid: RegionVid, source_vid: RegionVid,
dir: Direction) { dir: Direction) {
debug!("process_edges(source_vid={}, dir={})", source_vid, dir); debug!("process_edges(source_vid={:?}, dir={:?})", source_vid, dir);
let source_node_index = NodeIndex(source_vid.index as uint); let source_node_index = NodeIndex(source_vid.index as uint);
graph.each_adjacent_edge(source_node_index, dir, |_, edge| { graph.each_adjacent_edge(source_node_index, dir, |_, edge| {

View file

@ -184,7 +184,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
let escaping_type = self.probe(vid).unwrap(); let escaping_type = self.probe(vid).unwrap();
escaping_types.push(escaping_type); escaping_types.push(escaping_type);
} }
debug!("SpecifyVar({}) new_elem_threshold={}", vid, new_elem_threshold); debug!("SpecifyVar({:?}) new_elem_threshold={}", vid, new_elem_threshold);
} }
_ => { } _ => { }

View file

@ -129,7 +129,7 @@ impl<'tcx, V:PartialEq+Clone+Repr<'tcx>, K:UnifyKey<'tcx, V>> UnificationTable<K
pub fn new_key(&mut self, value: V) -> K { pub fn new_key(&mut self, value: V) -> K {
let index = self.values.push(Root(value, 0)); let index = self.values.push(Root(value, 0));
let k = UnifyKey::from_index(index); let k = UnifyKey::from_index(index);
debug!("{}: created new key: {}", debug!("{}: created new key: {:?}",
UnifyKey::tag(None::<K>), UnifyKey::tag(None::<K>),
k); k);
k k

View file

@ -209,7 +209,7 @@ impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> {
} }
Some((space, index, &param_ty)) => { Some((space, index, &param_ty)) => {
debug!("with_each_combination: space={}, index={}, param_ty={}", debug!("with_each_combination: space={:?}, index={}, param_ty={}",
space, index, param_ty.repr(self.tcx)); space, index, param_ty.repr(self.tcx));
if !ty::type_is_sized(param_env, span, param_ty) { if !ty::type_is_sized(param_env, span, param_ty) {

View file

@ -289,7 +289,7 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> {
self.lnks.push(lnk); self.lnks.push(lnk);
self.num_live_nodes += 1; self.num_live_nodes += 1;
debug!("{} is of kind {}", ln.to_string(), debug!("{:?} is of kind {}", ln,
live_node_kind_to_string(lnk, self.tcx)); live_node_kind_to_string(lnk, self.tcx));
ln ln
@ -299,7 +299,7 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> {
let ln = self.add_live_node(lnk); let ln = self.add_live_node(lnk);
self.live_node_map.insert(node_id, ln); self.live_node_map.insert(node_id, ln);
debug!("{} is node {}", ln.to_string(), node_id); debug!("{:?} is node {}", ln, node_id);
} }
fn add_variable(&mut self, vk: VarKind) -> Variable { fn add_variable(&mut self, vk: VarKind) -> Variable {
@ -314,7 +314,7 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> {
ImplicitRet | CleanExit => {} ImplicitRet | CleanExit => {}
} }
debug!("{} is {}", v.to_string(), vk); debug!("{:?} is {:?}", v, vk);
v v
} }
@ -377,7 +377,7 @@ fn visit_fn(ir: &mut IrMaps,
// swap in a new set of IR maps for this function body: // swap in a new set of IR maps for this function body:
let mut fn_maps = IrMaps::new(ir.tcx); let mut fn_maps = IrMaps::new(ir.tcx);
debug!("creating fn_maps: {}", &fn_maps as *const IrMaps); debug!("creating fn_maps: {:?}", &fn_maps as *const IrMaps);
for arg in decl.inputs.iter() { for arg in decl.inputs.iter() {
pat_util::pat_bindings(&ir.tcx.def_map, pat_util::pat_bindings(&ir.tcx.def_map,
@ -430,7 +430,7 @@ fn visit_local(ir: &mut IrMaps, local: &ast::Local) {
fn visit_arm(ir: &mut IrMaps, arm: &ast::Arm) { fn visit_arm(ir: &mut IrMaps, arm: &ast::Arm) {
for pat in arm.pats.iter() { for pat in arm.pats.iter() {
pat_util::pat_bindings(&ir.tcx.def_map, &**pat, |bm, p_id, sp, path1| { pat_util::pat_bindings(&ir.tcx.def_map, &**pat, |bm, p_id, sp, path1| {
debug!("adding local variable {} from match with bm {}", debug!("adding local variable {} from match with bm {:?}",
p_id, bm); p_id, bm);
let name = path1.node; let name = path1.node;
ir.add_live_node_for_node(p_id, VarDefNode(sp)); ir.add_live_node_for_node(p_id, VarDefNode(sp));
@ -448,7 +448,7 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
// live nodes required for uses or definitions of variables: // live nodes required for uses or definitions of variables:
ast::ExprPath(_) => { ast::ExprPath(_) => {
let def = ir.tcx.def_map.borrow()[expr.id].clone(); let def = ir.tcx.def_map.borrow()[expr.id].clone();
debug!("expr {}: path that leads to {}", expr.id, def); debug!("expr {}: path that leads to {:?}", expr.id, def);
if let DefLocal(..) = def { if let DefLocal(..) = def {
ir.add_live_node_for_node(expr.id, ExprNode(expr.span)); ir.add_live_node_for_node(expr.id, ExprNode(expr.span));
} }
@ -491,7 +491,7 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
} }
ast::ExprForLoop(ref pat, _, _, _) => { ast::ExprForLoop(ref pat, _, _, _) => {
pat_util::pat_bindings(&ir.tcx.def_map, &**pat, |bm, p_id, sp, path1| { pat_util::pat_bindings(&ir.tcx.def_map, &**pat, |bm, p_id, sp, path1| {
debug!("adding local variable {} from for loop with bm {}", debug!("adding local variable {} from for loop with bm {:?}",
p_id, bm); p_id, bm);
let name = path1.node; let name = path1.node;
ir.add_live_node_for_node(p_id, VarDefNode(sp)); ir.add_live_node_for_node(p_id, VarDefNode(sp));
@ -702,7 +702,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
for var_idx in range(0u, self.ir.num_vars) { for var_idx in range(0u, self.ir.num_vars) {
let idx = node_base_idx + var_idx; let idx = node_base_idx + var_idx;
if test(idx).is_valid() { if test(idx).is_valid() {
try!(write!(wr, " {}", Variable(var_idx).to_string())); try!(write!(wr, " {:?}", Variable(var_idx)));
} }
} }
Ok(()) Ok(())
@ -740,11 +740,11 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
let mut wr = Vec::new(); let mut wr = Vec::new();
{ {
let wr = &mut wr as &mut io::Writer; let wr = &mut wr as &mut io::Writer;
write!(wr, "[ln({}) of kind {} reads", ln.get(), self.ir.lnk(ln)); write!(wr, "[ln({:?}) of kind {:?} reads", ln.get(), self.ir.lnk(ln));
self.write_vars(wr, ln, |idx| self.users[idx].reader); self.write_vars(wr, ln, |idx| self.users[idx].reader);
write!(wr, " writes"); write!(wr, " writes");
self.write_vars(wr, ln, |idx| self.users[idx].writer); self.write_vars(wr, ln, |idx| self.users[idx].writer);
write!(wr, " precedes {}]", self.successors[ln.get()].to_string()); write!(wr, " precedes {:?}]", self.successors[ln.get()]);
} }
String::from_utf8(wr).unwrap() String::from_utf8(wr).unwrap()
} }
@ -792,8 +792,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
} }
}); });
debug!("merge_from_succ(ln={}, succ={}, first_merge={}, changed={})", debug!("merge_from_succ(ln={:?}, succ={}, first_merge={}, changed={})",
ln.to_string(), self.ln_str(succ_ln), first_merge, changed); ln, self.ln_str(succ_ln), first_merge, changed);
return changed; return changed;
fn copy_if_invalid(src: LiveNode, dst: &mut LiveNode) -> bool { fn copy_if_invalid(src: LiveNode, dst: &mut LiveNode) -> bool {
@ -814,14 +814,14 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
self.users[idx].reader = invalid_node(); self.users[idx].reader = invalid_node();
self.users[idx].writer = invalid_node(); self.users[idx].writer = invalid_node();
debug!("{} defines {} (idx={}): {}", writer.to_string(), var.to_string(), debug!("{:?} defines {:?} (idx={}): {}", writer, var,
idx, self.ln_str(writer)); idx, self.ln_str(writer));
} }
// Either read, write, or both depending on the acc bitset // Either read, write, or both depending on the acc bitset
fn acc(&mut self, ln: LiveNode, var: Variable, acc: uint) { fn acc(&mut self, ln: LiveNode, var: Variable, acc: uint) {
debug!("{} accesses[{:x}] {}: {}", debug!("{:?} accesses[{:x}] {:?}: {}",
ln.to_string(), acc, var.to_string(), self.ln_str(ln)); ln, acc, var, self.ln_str(ln));
let idx = self.idx(ln, var); let idx = self.idx(ln, var);
let user = &mut self.users[idx]; let user = &mut self.users[idx];
@ -857,14 +857,14 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|this| this.propagate_through_fn_block(decl, body)); |this| this.propagate_through_fn_block(decl, body));
// hack to skip the loop unless debug! is enabled: // hack to skip the loop unless debug! is enabled:
debug!("^^ liveness computation results for body {} (entry={})", debug!("^^ liveness computation results for body {} (entry={:?})",
{ {
for ln_idx in range(0u, self.ir.num_live_nodes) { for ln_idx in range(0u, self.ir.num_live_nodes) {
debug!("{}", self.ln_str(LiveNode(ln_idx))); debug!("{:?}", self.ln_str(LiveNode(ln_idx)));
} }
body.id body.id
}, },
entry_ln.to_string()); entry_ln);
entry_ln entry_ln
} }

View file

@ -539,7 +539,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
expr_ty: Ty<'tcx>, expr_ty: Ty<'tcx>,
def: def::Def) def: def::Def)
-> McResult<cmt<'tcx>> { -> McResult<cmt<'tcx>> {
debug!("cat_def: id={} expr={} def={}", debug!("cat_def: id={} expr={} def={:?}",
id, expr_ty.repr(self.tcx()), def); id, expr_ty.repr(self.tcx()), def);
match def { match def {
@ -852,7 +852,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
}; };
let method_ty = self.typer.node_method_ty(method_call); let method_ty = self.typer.node_method_ty(method_call);
debug!("cat_deref: method_call={} method_ty={}", debug!("cat_deref: method_call={:?} method_ty={:?}",
method_call, method_ty.map(|ty| ty.repr(self.tcx()))); method_call, method_ty.map(|ty| ty.repr(self.tcx())));
let base_cmt = match method_ty { let base_cmt = match method_ty {
@ -1447,7 +1447,7 @@ impl<'tcx> cmt_<'tcx> {
impl<'tcx> Repr<'tcx> for cmt_<'tcx> { impl<'tcx> Repr<'tcx> for cmt_<'tcx> {
fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String { fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
format!("{{{} id:{} m:{} ty:{}}}", format!("{{{} id:{} m:{:?} ty:{}}}",
self.cat.repr(tcx), self.cat.repr(tcx),
self.id, self.id,
self.mutbl, self.mutbl,
@ -1462,7 +1462,7 @@ impl<'tcx> Repr<'tcx> for categorization<'tcx> {
cat_rvalue(..) | cat_rvalue(..) |
cat_local(..) | cat_local(..) |
cat_upvar(..) => { cat_upvar(..) => {
format!("{}", *self) format!("{:?}", *self)
} }
cat_deref(ref cmt, derefs, ptr) => { cat_deref(ref cmt, derefs, ptr) => {
format!("{}-{}{}->", cmt.cat.repr(tcx), ptr_sigil(ptr), derefs) format!("{}-{}{}->", cmt.cat.repr(tcx), ptr_sigil(ptr), derefs)

View file

@ -435,28 +435,28 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
fn def_privacy(&self, did: ast::DefId) -> PrivacyResult { fn def_privacy(&self, did: ast::DefId) -> PrivacyResult {
if !is_local(did) { if !is_local(did) {
if self.external_exports.contains(&did) { if self.external_exports.contains(&did) {
debug!("privacy - {} was externally exported", did); debug!("privacy - {:?} was externally exported", did);
return Allowable; return Allowable;
} }
debug!("privacy - is {} a public method", did); debug!("privacy - is {:?} a public method", did);
return match self.tcx.impl_or_trait_items.borrow().get(&did) { return match self.tcx.impl_or_trait_items.borrow().get(&did) {
Some(&ty::MethodTraitItem(ref meth)) => { Some(&ty::MethodTraitItem(ref meth)) => {
debug!("privacy - well at least it's a method: {}", debug!("privacy - well at least it's a method: {:?}",
*meth); *meth);
match meth.container { match meth.container {
ty::TraitContainer(id) => { ty::TraitContainer(id) => {
debug!("privacy - recursing on trait {}", id); debug!("privacy - recursing on trait {:?}", id);
self.def_privacy(id) self.def_privacy(id)
} }
ty::ImplContainer(id) => { ty::ImplContainer(id) => {
match ty::impl_trait_ref(self.tcx, id) { match ty::impl_trait_ref(self.tcx, id) {
Some(t) => { Some(t) => {
debug!("privacy - impl of trait {}", id); debug!("privacy - impl of trait {:?}", id);
self.def_privacy(t.def_id) self.def_privacy(t.def_id)
} }
None => { None => {
debug!("privacy - found a method {}", debug!("privacy - found a method {:?}",
meth.vis); meth.vis);
if meth.vis == ast::Public { if meth.vis == ast::Public {
Allowable Allowable
@ -471,17 +471,17 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
Some(&ty::TypeTraitItem(ref typedef)) => { Some(&ty::TypeTraitItem(ref typedef)) => {
match typedef.container { match typedef.container {
ty::TraitContainer(id) => { ty::TraitContainer(id) => {
debug!("privacy - recursing on trait {}", id); debug!("privacy - recursing on trait {:?}", id);
self.def_privacy(id) self.def_privacy(id)
} }
ty::ImplContainer(id) => { ty::ImplContainer(id) => {
match ty::impl_trait_ref(self.tcx, id) { match ty::impl_trait_ref(self.tcx, id) {
Some(t) => { Some(t) => {
debug!("privacy - impl of trait {}", id); debug!("privacy - impl of trait {:?}", id);
self.def_privacy(t.def_id) self.def_privacy(t.def_id)
} }
None => { None => {
debug!("privacy - found a typedef {}", debug!("privacy - found a typedef {:?}",
typedef.vis); typedef.vis);
if typedef.vis == ast::Public { if typedef.vis == ast::Public {
Allowable Allowable
@ -696,7 +696,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
let fields = ty::lookup_struct_fields(self.tcx, id); let fields = ty::lookup_struct_fields(self.tcx, id);
let field = match name { let field = match name {
NamedField(ident) => { NamedField(ident) => {
debug!("privacy - check named field {} in struct {}", ident.name, id); debug!("privacy - check named field {} in struct {:?}", ident.name, id);
fields.iter().find(|f| f.name == ident.name).unwrap() fields.iter().find(|f| f.name == ident.name).unwrap()
} }
UnnamedField(idx) => &fields[idx] UnnamedField(idx) => &fields[idx]

View file

@ -146,24 +146,24 @@ impl RegionMaps {
None => {} None => {}
} }
debug!("relate_free_regions(sub={}, sup={})", sub, sup); debug!("relate_free_regions(sub={:?}, sup={:?})", sub, sup);
self.free_region_map.borrow_mut().insert(sub, vec!(sup)); self.free_region_map.borrow_mut().insert(sub, vec!(sup));
} }
pub fn record_encl_scope(&self, sub: CodeExtent, sup: CodeExtent) { pub fn record_encl_scope(&self, sub: CodeExtent, sup: CodeExtent) {
debug!("record_encl_scope(sub={}, sup={})", sub, sup); debug!("record_encl_scope(sub={:?}, sup={:?})", sub, sup);
assert!(sub != sup); assert!(sub != sup);
self.scope_map.borrow_mut().insert(sub, sup); self.scope_map.borrow_mut().insert(sub, sup);
} }
pub fn record_var_scope(&self, var: ast::NodeId, lifetime: CodeExtent) { pub fn record_var_scope(&self, var: ast::NodeId, lifetime: CodeExtent) {
debug!("record_var_scope(sub={}, sup={})", var, lifetime); debug!("record_var_scope(sub={:?}, sup={:?})", var, lifetime);
assert!(var != lifetime.node_id()); assert!(var != lifetime.node_id());
self.var_map.borrow_mut().insert(var, lifetime); self.var_map.borrow_mut().insert(var, lifetime);
} }
pub fn record_rvalue_scope(&self, var: ast::NodeId, lifetime: CodeExtent) { pub fn record_rvalue_scope(&self, var: ast::NodeId, lifetime: CodeExtent) {
debug!("record_rvalue_scope(sub={}, sup={})", var, lifetime); debug!("record_rvalue_scope(sub={:?}, sup={:?})", var, lifetime);
assert!(var != lifetime.node_id()); assert!(var != lifetime.node_id());
self.rvalue_scopes.borrow_mut().insert(var, lifetime); self.rvalue_scopes.borrow_mut().insert(var, lifetime);
} }
@ -172,7 +172,7 @@ impl RegionMaps {
/// e.g. by an expression like `a().f` -- they will be freed within the innermost terminating /// e.g. by an expression like `a().f` -- they will be freed within the innermost terminating
/// scope. /// scope.
pub fn mark_as_terminating_scope(&self, scope_id: CodeExtent) { pub fn mark_as_terminating_scope(&self, scope_id: CodeExtent) {
debug!("record_terminating_scope(scope_id={})", scope_id); debug!("record_terminating_scope(scope_id={:?})", scope_id);
self.terminating_scopes.borrow_mut().insert(scope_id); self.terminating_scopes.borrow_mut().insert(scope_id);
} }
@ -186,7 +186,7 @@ impl RegionMaps {
//! Returns the narrowest scope that encloses `id`, if any. //! Returns the narrowest scope that encloses `id`, if any.
match self.scope_map.borrow().get(&id) { match self.scope_map.borrow().get(&id) {
Some(&r) => r, Some(&r) => r,
None => { panic!("no enclosing scope for id {}", id); } None => { panic!("no enclosing scope for id {:?}", id); }
} }
} }
@ -194,7 +194,7 @@ impl RegionMaps {
pub fn var_scope(&self, var_id: ast::NodeId) -> CodeExtent { pub fn var_scope(&self, var_id: ast::NodeId) -> CodeExtent {
match self.var_map.borrow().get(&var_id) { match self.var_map.borrow().get(&var_id) {
Some(&r) => r, Some(&r) => r,
None => { panic!("no enclosing scope for id {}", var_id); } None => { panic!("no enclosing scope for id {:?}", var_id); }
} }
} }
@ -204,7 +204,7 @@ impl RegionMaps {
// check for a designated rvalue scope // check for a designated rvalue scope
match self.rvalue_scopes.borrow().get(&expr_id) { match self.rvalue_scopes.borrow().get(&expr_id) {
Some(&s) => { Some(&s) => {
debug!("temporary_scope({}) = {} [custom]", expr_id, s); debug!("temporary_scope({:?}) = {:?} [custom]", expr_id, s);
return Some(s); return Some(s);
} }
None => { } None => { }
@ -225,12 +225,12 @@ impl RegionMaps {
id = p; id = p;
} }
None => { None => {
debug!("temporary_scope({}) = None", expr_id); debug!("temporary_scope({:?}) = None", expr_id);
return None; return None;
} }
} }
} }
debug!("temporary_scope({}) = {} [enclosing]", expr_id, id); debug!("temporary_scope({:?}) = {:?} [enclosing]", expr_id, id);
return Some(id); return Some(id);
} }
@ -238,7 +238,7 @@ impl RegionMaps {
//! Returns the lifetime of the variable `id`. //! Returns the lifetime of the variable `id`.
let scope = ty::ReScope(self.var_scope(id)); let scope = ty::ReScope(self.var_scope(id));
debug!("var_region({}) = {}", id, scope); debug!("var_region({:?}) = {:?}", id, scope);
scope scope
} }
@ -258,7 +258,7 @@ impl RegionMaps {
while superscope != s { while superscope != s {
match self.scope_map.borrow().get(&s) { match self.scope_map.borrow().get(&s) {
None => { None => {
debug!("is_subscope_of({}, {}, s={})=false", debug!("is_subscope_of({:?}, {:?}, s={:?})=false",
subscope, superscope, s); subscope, superscope, s);
return false; return false;
@ -267,7 +267,7 @@ impl RegionMaps {
} }
} }
debug!("is_subscope_of({}, {})=true", debug!("is_subscope_of({:?}, {:?})=true",
subscope, superscope); subscope, superscope);
return true; return true;
@ -287,7 +287,7 @@ impl RegionMaps {
sub_region: ty::Region, sub_region: ty::Region,
super_region: ty::Region) super_region: ty::Region)
-> bool { -> bool {
debug!("is_subregion_of(sub_region={}, super_region={})", debug!("is_subregion_of(sub_region={:?}, super_region={:?})",
sub_region, super_region); sub_region, super_region);
sub_region == super_region || { sub_region == super_region || {
@ -365,7 +365,7 @@ impl RegionMaps {
fn ancestors_of(this: &RegionMaps, scope: CodeExtent) fn ancestors_of(this: &RegionMaps, scope: CodeExtent)
-> Vec<CodeExtent> { -> Vec<CodeExtent> {
// debug!("ancestors_of(scope={})", scope); // debug!("ancestors_of(scope={:?})", scope);
let mut result = vec!(scope); let mut result = vec!(scope);
let mut scope = scope; let mut scope = scope;
loop { loop {
@ -376,7 +376,7 @@ impl RegionMaps {
scope = superscope; scope = superscope;
} }
} }
// debug!("ancestors_of_loop(scope={})", scope); // debug!("ancestors_of_loop(scope={:?})", scope);
} }
} }
} }
@ -414,7 +414,7 @@ fn record_var_lifetime(visitor: &mut RegionResolutionVisitor,
} }
fn resolve_block(visitor: &mut RegionResolutionVisitor, blk: &ast::Block) { fn resolve_block(visitor: &mut RegionResolutionVisitor, blk: &ast::Block) {
debug!("resolve_block(blk.id={})", blk.id); debug!("resolve_block(blk.id={:?})", blk.id);
// Record the parent of this block. // Record the parent of this block.
record_superlifetime(visitor, blk.id, blk.span); record_superlifetime(visitor, blk.id, blk.span);
@ -466,7 +466,7 @@ fn resolve_pat(visitor: &mut RegionResolutionVisitor, pat: &ast::Pat) {
fn resolve_stmt(visitor: &mut RegionResolutionVisitor, stmt: &ast::Stmt) { fn resolve_stmt(visitor: &mut RegionResolutionVisitor, stmt: &ast::Stmt) {
let stmt_id = stmt_id(stmt); let stmt_id = stmt_id(stmt);
debug!("resolve_stmt(stmt.id={})", stmt_id); debug!("resolve_stmt(stmt.id={:?})", stmt_id);
let stmt_scope = CodeExtent::from_node_id(stmt_id); let stmt_scope = CodeExtent::from_node_id(stmt_id);
visitor.region_maps.mark_as_terminating_scope(stmt_scope); visitor.region_maps.mark_as_terminating_scope(stmt_scope);
@ -479,7 +479,7 @@ fn resolve_stmt(visitor: &mut RegionResolutionVisitor, stmt: &ast::Stmt) {
} }
fn resolve_expr(visitor: &mut RegionResolutionVisitor, expr: &ast::Expr) { fn resolve_expr(visitor: &mut RegionResolutionVisitor, expr: &ast::Expr) {
debug!("resolve_expr(expr.id={})", expr.id); debug!("resolve_expr(expr.id={:?})", expr.id);
record_superlifetime(visitor, expr.id, expr.span); record_superlifetime(visitor, expr.id, expr.span);
@ -566,7 +566,7 @@ fn resolve_expr(visitor: &mut RegionResolutionVisitor, expr: &ast::Expr) {
} }
fn resolve_local(visitor: &mut RegionResolutionVisitor, local: &ast::Local) { fn resolve_local(visitor: &mut RegionResolutionVisitor, local: &ast::Local) {
debug!("resolve_local(local.id={},local.init={})", debug!("resolve_local(local.id={:?},local.init={:?})",
local.id,local.init.is_some()); local.id,local.init.is_some());
let blk_id = match visitor.cx.var_parent { let blk_id = match visitor.cx.var_parent {
@ -815,10 +815,10 @@ fn resolve_fn(visitor: &mut RegionResolutionVisitor,
body: &ast::Block, body: &ast::Block,
sp: Span, sp: Span,
id: ast::NodeId) { id: ast::NodeId) {
debug!("region::resolve_fn(id={}, \ debug!("region::resolve_fn(id={:?}, \
span={}, \ span={:?}, \
body.id={}, \ body.id={:?}, \
cx.parent={})", cx.parent={:?})",
id, id,
visitor.sess.codemap().span_to_string(sp), visitor.sess.codemap().span_to_string(sp),
body.id, body.id,

View file

@ -223,7 +223,7 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
fn visit_poly_trait_ref(&mut self, trait_ref: fn visit_poly_trait_ref(&mut self, trait_ref:
&ast::PolyTraitRef, &ast::PolyTraitRef,
_modifier: &ast::TraitBoundModifier) { _modifier: &ast::TraitBoundModifier) {
debug!("visit_poly_trait_ref trait_ref={}", trait_ref); debug!("visit_poly_trait_ref trait_ref={:?}", trait_ref);
self.with(LateScope(&trait_ref.bound_lifetimes, self.scope), |old_scope, this| { self.with(LateScope(&trait_ref.bound_lifetimes, self.scope), |old_scope, this| {
this.check_lifetime_defs(old_scope, &trait_ref.bound_lifetimes); this.check_lifetime_defs(old_scope, &trait_ref.bound_lifetimes);
@ -250,9 +250,9 @@ impl<'a> LifetimeContext<'a> {
scope: &wrap_scope, scope: &wrap_scope,
def_map: self.def_map, def_map: self.def_map,
}; };
debug!("entering scope {}", this.scope); debug!("entering scope {:?}", this.scope);
f(self.scope, &mut this); f(self.scope, &mut this);
debug!("exiting scope {}", this.scope); debug!("exiting scope {:?}", this.scope);
} }
/// Visits self by adding a scope and handling recursive walk over the contents with `walk`. /// Visits self by adding a scope and handling recursive walk over the contents with `walk`.
@ -281,7 +281,7 @@ impl<'a> LifetimeContext<'a> {
{ {
let referenced_idents = early_bound_lifetime_names(generics); let referenced_idents = early_bound_lifetime_names(generics);
debug!("visit_early_late: referenced_idents={}", debug!("visit_early_late: referenced_idents={:?}",
referenced_idents); referenced_idents);
let (early, late): (Vec<_>, _) = generics.lifetimes.iter().cloned().partition( let (early, late): (Vec<_>, _) = generics.lifetimes.iter().cloned().partition(
@ -488,7 +488,7 @@ impl<'a> LifetimeContext<'a> {
probably a bug in syntax::fold"); probably a bug in syntax::fold");
} }
debug!("lifetime_ref={} id={} resolved to {}", debug!("lifetime_ref={:?} id={:?} resolved to {:?}",
lifetime_to_string(lifetime_ref), lifetime_to_string(lifetime_ref),
lifetime_ref.id, lifetime_ref.id,
def); def);
@ -605,9 +605,9 @@ fn early_bound_lifetime_names(generics: &ast::Generics) -> Vec<ast::Name> {
impl<'a> fmt::Show for ScopeChain<'a> { impl<'a> fmt::Show for ScopeChain<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match *self { match *self {
EarlyScope(space, defs, _) => write!(fmt, "EarlyScope({}, {})", space, defs), EarlyScope(space, defs, _) => write!(fmt, "EarlyScope({:?}, {:?})", space, defs),
LateScope(defs, _) => write!(fmt, "LateScope({})", defs), LateScope(defs, _) => write!(fmt, "LateScope({:?})", defs),
BlockScope(id, _) => write!(fmt, "BlockScope({})", id), BlockScope(id, _) => write!(fmt, "BlockScope({:?})", id),
RootScope => write!(fmt, "RootScope"), RootScope => write!(fmt, "RootScope"),
} }
} }

View file

@ -161,7 +161,7 @@ pub fn lookup(tcx: &ty::ctxt, id: DefId) -> Option<Stability> {
// is this definition the implementation of a trait method? // is this definition the implementation of a trait method?
match ty::trait_item_of_item(tcx, id) { match ty::trait_item_of_item(tcx, id) {
Some(ty::MethodTraitItemId(trait_method_id)) if trait_method_id != id => { Some(ty::MethodTraitItemId(trait_method_id)) if trait_method_id != id => {
debug!("lookup: trait_method_id={}", trait_method_id); debug!("lookup: trait_method_id={:?}", trait_method_id);
return lookup(tcx, trait_method_id) return lookup(tcx, trait_method_id)
} }
_ => {} _ => {}
@ -182,7 +182,7 @@ pub fn lookup(tcx: &ty::ctxt, id: DefId) -> Option<Stability> {
// stability of the trait to determine the stability of any // stability of the trait to determine the stability of any
// unmarked impls for it. See FIXME above for more details. // unmarked impls for it. See FIXME above for more details.
debug!("lookup: trait_id={}", trait_id); debug!("lookup: trait_id={:?}", trait_id);
lookup(tcx, trait_id) lookup(tcx, trait_id)
} else { } else {
None None

View file

@ -242,7 +242,7 @@ impl<T:fmt::Show> fmt::Show for VecPerParamSpace<T> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
try!(write!(fmt, "VecPerParamSpace {{")); try!(write!(fmt, "VecPerParamSpace {{"));
for space in ParamSpace::all().iter() { for space in ParamSpace::all().iter() {
try!(write!(fmt, "{}: {}, ", *space, self.get_slice(*space))); try!(write!(fmt, "{:?}: {:?}, ", *space, self.get_slice(*space)));
} }
try!(write!(fmt, "}}")); try!(write!(fmt, "}}"));
Ok(()) Ok(())
@ -601,7 +601,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for SubstFolder<'a, 'tcx> {
span, span,
format!("Type parameter out of range \ format!("Type parameter out of range \
when substituting in region {} (root type={}) \ when substituting in region {} (root type={}) \
(space={}, index={})", (space={:?}, index={})",
region_name.as_str(), region_name.as_str(),
self.root_ty.repr(self.tcx()), self.root_ty.repr(self.tcx()),
space, i).index(&FullRange)); space, i).index(&FullRange));
@ -654,7 +654,7 @@ impl<'a,'tcx> SubstFolder<'a,'tcx> {
let span = self.span.unwrap_or(DUMMY_SP); let span = self.span.unwrap_or(DUMMY_SP);
self.tcx().sess.span_bug( self.tcx().sess.span_bug(
span, span,
format!("Type parameter `{}` ({}/{}/{}) out of range \ format!("Type parameter `{}` ({}/{:?}/{}) out of range \
when substituting (root type={}) substs={}", when substituting (root type={}) substs={}",
p.repr(self.tcx()), p.repr(self.tcx()),
source_ty.repr(self.tcx()), source_ty.repr(self.tcx()),
@ -711,7 +711,7 @@ impl<'a,'tcx> SubstFolder<'a,'tcx> {
/// first case we do not increase the Debruijn index and in the second case we do. The reason /// first case we do not increase the Debruijn index and in the second case we do. The reason
/// is that only in the second case have we passed through a fn binder. /// is that only in the second case have we passed through a fn binder.
fn shift_regions_through_binders(&self, ty: Ty<'tcx>) -> Ty<'tcx> { fn shift_regions_through_binders(&self, ty: Ty<'tcx>) -> Ty<'tcx> {
debug!("shift_regions(ty={}, region_binders_passed={}, type_has_escaping_regions={})", debug!("shift_regions(ty={:?}, region_binders_passed={:?}, type_has_escaping_regions={:?})",
ty.repr(self.tcx()), self.region_binders_passed, ty::type_has_escaping_regions(ty)); ty.repr(self.tcx()), self.region_binders_passed, ty::type_has_escaping_regions(ty));
if self.region_binders_passed == 0 || !ty::type_has_escaping_regions(ty) { if self.region_binders_passed == 0 || !ty::type_has_escaping_regions(ty) {
@ -719,7 +719,7 @@ impl<'a,'tcx> SubstFolder<'a,'tcx> {
} }
let result = ty_fold::shift_regions(self.tcx(), self.region_binders_passed, &ty); let result = ty_fold::shift_regions(self.tcx(), self.region_binders_passed, &ty);
debug!("shift_regions: shifted result = {}", result.repr(self.tcx())); debug!("shift_regions: shifted result = {:?}", result.repr(self.tcx()));
result result
} }

View file

@ -297,7 +297,7 @@ pub fn evaluate_builtin_bound<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
span: Span) span: Span)
-> SelectionResult<'tcx, ()> -> SelectionResult<'tcx, ()>
{ {
debug!("type_known_to_meet_builtin_bound(ty={}, bound={})", debug!("type_known_to_meet_builtin_bound(ty={}, bound={:?})",
ty.repr(infcx.tcx), ty.repr(infcx.tcx),
bound); bound);
@ -347,7 +347,7 @@ pub fn evaluate_builtin_bound<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
} }
}; };
debug!("type_known_to_meet_builtin_bound: ty={} bound={} result={}", debug!("type_known_to_meet_builtin_bound: ty={} bound={:?} result={:?}",
ty.repr(infcx.tcx), ty.repr(infcx.tcx),
bound, bound,
result); result);

View file

@ -295,7 +295,7 @@ impl<'tcx> Repr<'tcx> for ObjectSafetyViolation<'tcx> {
ObjectSafetyViolation::SizedSelf => ObjectSafetyViolation::SizedSelf =>
format!("SizedSelf"), format!("SizedSelf"),
ObjectSafetyViolation::Method(ref m, code) => ObjectSafetyViolation::Method(ref m, code) =>
format!("Method({},{})", m.repr(tcx), code), format!("Method({},{:?})", m.repr(tcx), code),
} }
} }
} }

View file

@ -368,7 +368,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
let result = self.evaluate_stack(&stack); let result = self.evaluate_stack(&stack);
debug!("result: {}", result); debug!("result: {:?}", result);
result result
} }
@ -944,14 +944,14 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
_ => { return Ok(()); } _ => { return Ok(()); }
}; };
debug!("assemble_unboxed_candidates: self_ty={} kind={} obligation={}", debug!("assemble_unboxed_candidates: self_ty={} kind={:?} obligation={}",
self_ty.repr(self.tcx()), self_ty.repr(self.tcx()),
kind, kind,
obligation.repr(self.tcx())); obligation.repr(self.tcx()));
let closure_kind = self.closure_typer.unboxed_closure_kind(closure_def_id); let closure_kind = self.closure_typer.unboxed_closure_kind(closure_def_id);
debug!("closure_kind = {}", closure_kind); debug!("closure_kind = {:?}", closure_kind);
if closure_kind == kind { if closure_kind == kind {
candidates.vec.push(UnboxedClosureCandidate(closure_def_id, substs.clone())); candidates.vec.push(UnboxedClosureCandidate(closure_def_id, substs.clone()));
@ -1102,7 +1102,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
Err(error) => EvaluatedToErr(error), Err(error) => EvaluatedToErr(error),
} }
}); });
debug!("winnow_candidate depth={} result={}", debug!("winnow_candidate depth={} result={:?}",
stack.obligation.recursion_depth, result); stack.obligation.recursion_depth, result);
result result
} }
@ -1716,7 +1716,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
let substs = let substs =
self.rematch_impl(impl_def_id, obligation, self.rematch_impl(impl_def_id, obligation,
snapshot, &skol_map, skol_obligation_trait_ref.trait_ref); snapshot, &skol_map, skol_obligation_trait_ref.trait_ref);
debug!("confirm_impl_candidate substs={}", substs); debug!("confirm_impl_candidate substs={:?}", substs);
Ok(self.vtable_impl(impl_def_id, substs, obligation.cause.clone(), Ok(self.vtable_impl(impl_def_id, substs, obligation.cause.clone(),
obligation.recursion_depth + 1, skol_map, snapshot)) obligation.recursion_depth + 1, skol_map, snapshot))
}) })
@ -2225,7 +2225,7 @@ impl<'tcx> Repr<'tcx> for SelectionCandidate<'tcx> {
fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String { fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
match *self { match *self {
ErrorCandidate => format!("ErrorCandidate"), ErrorCandidate => format!("ErrorCandidate"),
BuiltinCandidate(b) => format!("BuiltinCandidate({})", b), BuiltinCandidate(b) => format!("BuiltinCandidate({:?})", b),
ParamCandidate(ref a) => format!("ParamCandidate({})", a.repr(tcx)), ParamCandidate(ref a) => format!("ParamCandidate({})", a.repr(tcx)),
ImplCandidate(a) => format!("ImplCandidate({})", a.repr(tcx)), ImplCandidate(a) => format!("ImplCandidate({})", a.repr(tcx)),
ProjectionCandidate => format!("ProjectionCandidate"), ProjectionCandidate => format!("ProjectionCandidate"),
@ -2234,7 +2234,7 @@ impl<'tcx> Repr<'tcx> for SelectionCandidate<'tcx> {
format!("ObjectCandidate") format!("ObjectCandidate")
} }
UnboxedClosureCandidate(c, ref s) => { UnboxedClosureCandidate(c, ref s) => {
format!("UnboxedClosureCandidate({},{})", c, s.repr(tcx)) format!("UnboxedClosureCandidate({:?},{})", c, s.repr(tcx))
} }
} }
} }

View file

@ -238,7 +238,7 @@ pub fn fresh_substs_for_impl<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
impl<'tcx, N> fmt::Show for VtableImplData<'tcx, N> { impl<'tcx, N> fmt::Show for VtableImplData<'tcx, N> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "VtableImpl({})", self.impl_def_id) write!(f, "VtableImpl({:?})", self.impl_def_id)
} }
} }
@ -451,8 +451,8 @@ impl<'tcx> Repr<'tcx> for super::FulfillmentErrorCode<'tcx> {
impl<'tcx> fmt::Show for super::FulfillmentErrorCode<'tcx> { impl<'tcx> fmt::Show for super::FulfillmentErrorCode<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self { match *self {
super::CodeSelectionError(ref e) => write!(f, "{}", e), super::CodeSelectionError(ref e) => write!(f, "{:?}", e),
super::CodeProjectionError(ref e) => write!(f, "{}", e), super::CodeProjectionError(ref e) => write!(f, "{:?}", e),
super::CodeAmbiguity => write!(f, "Ambiguity") super::CodeAmbiguity => write!(f, "Ambiguity")
} }
} }

View file

@ -1709,8 +1709,8 @@ impl fmt::Show for InferTy {
TyVar(ref v) => v.fmt(f), TyVar(ref v) => v.fmt(f),
IntVar(ref v) => v.fmt(f), IntVar(ref v) => v.fmt(f),
FloatVar(ref v) => v.fmt(f), FloatVar(ref v) => v.fmt(f),
FreshTy(v) => write!(f, "FreshTy({})", v), FreshTy(v) => write!(f, "FreshTy({:?})", v),
FreshIntTy(v) => write!(f, "FreshIntTy({})", v), FreshIntTy(v) => write!(f, "FreshIntTy({:?})", v),
} }
} }
} }
@ -2470,7 +2470,7 @@ fn intern_ty<'tcx>(type_arena: &'tcx TypedArena<TyS<'tcx>>,
region_depth: flags.depth, region_depth: flags.depth,
}); });
debug!("Interned type: {} Pointer: {}", debug!("Interned type: {:?} Pointer: {:?}",
ty, ty as *const _); ty, ty as *const _);
interner.insert(InternedTy { ty: ty }, ty); interner.insert(InternedTy { ty: ty }, ty);
@ -3532,7 +3532,7 @@ fn type_impls_bound<'a,'tcx>(param_env: &ParameterEnvironment<'a,'tcx>,
match cache.borrow().get(&ty) { match cache.borrow().get(&ty) {
None => {} None => {}
Some(&result) => { Some(&result) => {
debug!("type_impls_bound({}, {}) = {} (cached)", debug!("type_impls_bound({}, {:?}) = {:?} (cached)",
ty.repr(param_env.tcx), ty.repr(param_env.tcx),
bound, bound,
result); result);
@ -3545,7 +3545,7 @@ fn type_impls_bound<'a,'tcx>(param_env: &ParameterEnvironment<'a,'tcx>,
let is_impld = traits::type_known_to_meet_builtin_bound(&infcx, param_env, ty, bound, span); let is_impld = traits::type_known_to_meet_builtin_bound(&infcx, param_env, ty, bound, span);
debug!("type_impls_bound({}, {}) = {}", debug!("type_impls_bound({}, {:?}) = {:?}",
ty.repr(param_env.tcx), ty.repr(param_env.tcx),
bound, bound,
is_impld); is_impld);
@ -3584,13 +3584,13 @@ pub fn is_ffi_safe<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> bool {
pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool { pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool {
fn type_requires<'tcx>(cx: &ctxt<'tcx>, seen: &mut Vec<DefId>, fn type_requires<'tcx>(cx: &ctxt<'tcx>, seen: &mut Vec<DefId>,
r_ty: Ty<'tcx>, ty: Ty<'tcx>) -> bool { r_ty: Ty<'tcx>, ty: Ty<'tcx>) -> bool {
debug!("type_requires({}, {})?", debug!("type_requires({:?}, {:?})?",
::util::ppaux::ty_to_string(cx, r_ty), ::util::ppaux::ty_to_string(cx, r_ty),
::util::ppaux::ty_to_string(cx, ty)); ::util::ppaux::ty_to_string(cx, ty));
let r = r_ty == ty || subtypes_require(cx, seen, r_ty, ty); let r = r_ty == ty || subtypes_require(cx, seen, r_ty, ty);
debug!("type_requires({}, {})? {}", debug!("type_requires({:?}, {:?})? {:?}",
::util::ppaux::ty_to_string(cx, r_ty), ::util::ppaux::ty_to_string(cx, r_ty),
::util::ppaux::ty_to_string(cx, ty), ::util::ppaux::ty_to_string(cx, ty),
r); r);
@ -3599,7 +3599,7 @@ pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool {
fn subtypes_require<'tcx>(cx: &ctxt<'tcx>, seen: &mut Vec<DefId>, fn subtypes_require<'tcx>(cx: &ctxt<'tcx>, seen: &mut Vec<DefId>,
r_ty: Ty<'tcx>, ty: Ty<'tcx>) -> bool { r_ty: Ty<'tcx>, ty: Ty<'tcx>) -> bool {
debug!("subtypes_require({}, {})?", debug!("subtypes_require({:?}, {:?})?",
::util::ppaux::ty_to_string(cx, r_ty), ::util::ppaux::ty_to_string(cx, r_ty),
::util::ppaux::ty_to_string(cx, ty)); ::util::ppaux::ty_to_string(cx, ty));
@ -3654,7 +3654,7 @@ pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool {
ty_unboxed_closure(..) => { ty_unboxed_closure(..) => {
// this check is run on type definitions, so we don't expect to see // this check is run on type definitions, so we don't expect to see
// inference by-products or unboxed closure types // inference by-products or unboxed closure types
cx.sess.bug(format!("requires check invoked on inapplicable type: {}", cx.sess.bug(format!("requires check invoked on inapplicable type: {:?}",
ty).as_slice()) ty).as_slice())
} }
@ -3680,7 +3680,7 @@ pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool {
} }
}; };
debug!("subtypes_require({}, {})? {}", debug!("subtypes_require({:?}, {:?})? {:?}",
::util::ppaux::ty_to_string(cx, r_ty), ::util::ppaux::ty_to_string(cx, r_ty),
::util::ppaux::ty_to_string(cx, ty), ::util::ppaux::ty_to_string(cx, ty),
r); r);
@ -3748,7 +3748,7 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
ty_unboxed_closure(..) => { ty_unboxed_closure(..) => {
// this check is run on type definitions, so we don't expect to see // this check is run on type definitions, so we don't expect to see
// unboxed closure types // unboxed closure types
cx.sess.bug(format!("requires check invoked on inapplicable type: {}", cx.sess.bug(format!("requires check invoked on inapplicable type: {:?}",
ty).as_slice()) ty).as_slice())
} }
_ => Representable, _ => Representable,
@ -3790,7 +3790,7 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
fn is_type_structurally_recursive<'tcx>(cx: &ctxt<'tcx>, sp: Span, fn is_type_structurally_recursive<'tcx>(cx: &ctxt<'tcx>, sp: Span,
seen: &mut Vec<Ty<'tcx>>, seen: &mut Vec<Ty<'tcx>>,
ty: Ty<'tcx>) -> Representability { ty: Ty<'tcx>) -> Representability {
debug!("is_type_structurally_recursive: {}", debug!("is_type_structurally_recursive: {:?}",
::util::ppaux::ty_to_string(cx, ty)); ::util::ppaux::ty_to_string(cx, ty));
match ty.sty { match ty.sty {
@ -3810,7 +3810,7 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
match iter.next() { match iter.next() {
Some(&seen_type) => { Some(&seen_type) => {
if same_struct_or_enum_def_id(seen_type, did) { if same_struct_or_enum_def_id(seen_type, did) {
debug!("SelfRecursive: {} contains {}", debug!("SelfRecursive: {:?} contains {:?}",
::util::ppaux::ty_to_string(cx, seen_type), ::util::ppaux::ty_to_string(cx, seen_type),
::util::ppaux::ty_to_string(cx, ty)); ::util::ppaux::ty_to_string(cx, ty));
return SelfRecursive; return SelfRecursive;
@ -3830,7 +3830,7 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
for &seen_type in iter { for &seen_type in iter {
if same_type(ty, seen_type) { if same_type(ty, seen_type) {
debug!("ContainsRecursive: {} contains {}", debug!("ContainsRecursive: {:?} contains {:?}",
::util::ppaux::ty_to_string(cx, seen_type), ::util::ppaux::ty_to_string(cx, seen_type),
::util::ppaux::ty_to_string(cx, ty)); ::util::ppaux::ty_to_string(cx, ty));
return ContainsRecursive; return ContainsRecursive;
@ -3852,7 +3852,7 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
} }
} }
debug!("is_type_representable: {}", debug!("is_type_representable: {:?}",
::util::ppaux::ty_to_string(cx, ty)); ::util::ppaux::ty_to_string(cx, ty));
// To avoid a stack overflow when checking an enum variant or struct that // To avoid a stack overflow when checking an enum variant or struct that
@ -3860,7 +3860,7 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
// of seen types and check recursion for each of them (issues #3008, #3779). // of seen types and check recursion for each of them (issues #3008, #3779).
let mut seen: Vec<Ty> = Vec::new(); let mut seen: Vec<Ty> = Vec::new();
let r = is_type_structurally_recursive(cx, sp, &mut seen, ty); let r = is_type_structurally_recursive(cx, sp, &mut seen, ty);
debug!("is_type_representable: {} is {}", debug!("is_type_representable: {:?} is {:?}",
::util::ppaux::ty_to_string(cx, ty), r); ::util::ppaux::ty_to_string(cx, ty), r);
r r
} }
@ -4123,7 +4123,7 @@ pub fn fn_is_variadic(fty: Ty) -> bool {
match fty.sty { match fty.sty {
ty_bare_fn(_, ref f) => f.sig.0.variadic, ty_bare_fn(_, ref f) => f.sig.0.variadic,
ref s => { ref s => {
panic!("fn_is_variadic() called on non-fn type: {}", s) panic!("fn_is_variadic() called on non-fn type: {:?}", s)
} }
} }
} }
@ -4132,7 +4132,7 @@ pub fn ty_fn_sig<'tcx>(fty: Ty<'tcx>) -> &'tcx PolyFnSig<'tcx> {
match fty.sty { match fty.sty {
ty_bare_fn(_, ref f) => &f.sig, ty_bare_fn(_, ref f) => &f.sig,
ref s => { ref s => {
panic!("ty_fn_sig() called on non-fn type: {}", s) panic!("ty_fn_sig() called on non-fn type: {:?}", s)
} }
} }
} }
@ -4158,7 +4158,7 @@ pub fn ty_closure_store(fty: Ty) -> TraitStore {
UniqTraitStore UniqTraitStore
} }
ref s => { ref s => {
panic!("ty_closure_store() called on non-closure type: {}", s) panic!("ty_closure_store() called on non-closure type: {:?}", s)
} }
} }
} }
@ -4167,7 +4167,7 @@ pub fn ty_fn_ret<'tcx>(fty: Ty<'tcx>) -> FnOutput<'tcx> {
match fty.sty { match fty.sty {
ty_bare_fn(_, ref f) => f.sig.0.output, ty_bare_fn(_, ref f) => f.sig.0.output,
ref s => { ref s => {
panic!("ty_fn_ret() called on non-fn type: {}", s) panic!("ty_fn_ret() called on non-fn type: {:?}", s)
} }
} }
} }
@ -4187,7 +4187,7 @@ pub fn ty_region(tcx: &ctxt,
ref s => { ref s => {
tcx.sess.span_bug( tcx.sess.span_bug(
span, span,
format!("ty_region() invoked on an inappropriate ty: {}", format!("ty_region() invoked on an inappropriate ty: {:?}",
s).index(&FullRange)); s).index(&FullRange));
} }
} }
@ -4247,7 +4247,7 @@ pub fn expr_span(cx: &ctxt, id: NodeId) -> Span {
e.span e.span
} }
Some(f) => { Some(f) => {
cx.sess.bug(format!("Node id {} is not an expr: {}", cx.sess.bug(format!("Node id {} is not an expr: {:?}",
id, id,
f).index(&FullRange)); f).index(&FullRange));
} }
@ -4267,14 +4267,14 @@ pub fn local_var_name_str(cx: &ctxt, id: NodeId) -> InternedString {
} }
_ => { _ => {
cx.sess.bug( cx.sess.bug(
format!("Variable id {} maps to {}, not local", format!("Variable id {} maps to {:?}, not local",
id, id,
pat).index(&FullRange)); pat).index(&FullRange));
} }
} }
} }
r => { r => {
cx.sess.bug(format!("Variable id {} maps to {}, not local", cx.sess.bug(format!("Variable id {} maps to {:?}, not local",
id, id,
r).index(&FullRange)); r).index(&FullRange));
} }
@ -4298,7 +4298,7 @@ pub fn adjust_ty<'tcx, F>(cx: &ctxt<'tcx>,
return match adjustment { return match adjustment {
Some(adjustment) => { Some(adjustment) => {
match *adjustment { match *adjustment {
AdjustReifyFnPointer(_) => { AdjustReifyFnPointer(_) => {
match unadjusted_ty.sty { match unadjusted_ty.sty {
ty::ty_bare_fn(Some(_), b) => { ty::ty_bare_fn(Some(_), b) => {
ty::mk_bare_fn(cx, None, b) ty::mk_bare_fn(cx, None, b)
@ -4306,7 +4306,7 @@ pub fn adjust_ty<'tcx, F>(cx: &ctxt<'tcx>,
ref b => { ref b => {
cx.sess.bug( cx.sess.bug(
format!("AdjustReifyFnPointer adjustment on non-fn-item: \ format!("AdjustReifyFnPointer adjustment on non-fn-item: \
{}", {:?}",
b).index(&FullRange)); b).index(&FullRange));
} }
} }
@ -4397,7 +4397,7 @@ pub fn unsize_ty<'tcx>(cx: &ctxt<'tcx>,
mk_vec(cx, ty, None) mk_vec(cx, ty, None)
} }
_ => cx.sess.span_bug(span, _ => cx.sess.span_bug(span,
format!("UnsizeLength with bad sty: {}", format!("UnsizeLength with bad sty: {:?}",
ty_to_string(cx, ty)).index(&FullRange)) ty_to_string(cx, ty)).index(&FullRange))
}, },
&UnsizeStruct(box ref k, tp_index) => match ty.sty { &UnsizeStruct(box ref k, tp_index) => match ty.sty {
@ -4409,7 +4409,7 @@ pub fn unsize_ty<'tcx>(cx: &ctxt<'tcx>,
mk_struct(cx, did, cx.mk_substs(unsized_substs)) mk_struct(cx, did, cx.mk_substs(unsized_substs))
} }
_ => cx.sess.span_bug(span, _ => cx.sess.span_bug(span,
format!("UnsizeStruct with bad sty: {}", format!("UnsizeStruct with bad sty: {:?}",
ty_to_string(cx, ty)).index(&FullRange)) ty_to_string(cx, ty)).index(&FullRange))
}, },
&UnsizeVtable(TyTrait { ref principal, ref bounds }, _) => { &UnsizeVtable(TyTrait { ref principal, ref bounds }, _) => {
@ -4516,7 +4516,7 @@ pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
def => { def => {
tcx.sess.span_bug( tcx.sess.span_bug(
expr.span, expr.span,
format!("uncategorized def for expr {}: {}", format!("uncategorized def for expr {}: {:?}",
expr.id, expr.id,
def).index(&FullRange)); def).index(&FullRange));
} }
@ -4639,7 +4639,7 @@ pub fn field_idx_strict(tcx: &ctxt, name: ast::Name, fields: &[field])
let mut i = 0u; let mut i = 0u;
for f in fields.iter() { if f.name == name { return i; } i += 1u; } for f in fields.iter() { if f.name == name { return i; } i += 1u; }
tcx.sess.bug(format!( tcx.sess.bug(format!(
"no field named `{}` found in the list of fields `{}`", "no field named `{}` found in the list of fields `{:?}`",
token::get_name(name), token::get_name(name),
fields.iter() fields.iter()
.map(|f| token::get_name(f.name).get().to_string()) .map(|f| token::get_name(f.name).get().to_string())
@ -4716,18 +4716,18 @@ pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String {
terr_mismatch => "types differ".to_string(), terr_mismatch => "types differ".to_string(),
terr_unsafety_mismatch(values) => { terr_unsafety_mismatch(values) => {
format!("expected {} fn, found {} fn", format!("expected {} fn, found {} fn",
values.expected.to_string(), values.expected,
values.found.to_string()) values.found)
} }
terr_abi_mismatch(values) => { terr_abi_mismatch(values) => {
format!("expected {} fn, found {} fn", format!("expected {} fn, found {} fn",
values.expected.to_string(), values.expected,
values.found.to_string()) values.found)
} }
terr_onceness_mismatch(values) => { terr_onceness_mismatch(values) => {
format!("expected {} fn, found {} fn", format!("expected {} fn, found {} fn",
values.expected.to_string(), values.expected,
values.found.to_string()) values.found)
} }
terr_sigil_mismatch(values) => { terr_sigil_mismatch(values) => {
format!("expected {}, found {}", format!("expected {}, found {}",
@ -4819,14 +4819,14 @@ pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String {
"expected an integral type, found `char`".to_string() "expected an integral type, found `char`".to_string()
} }
terr_int_mismatch(ref values) => { terr_int_mismatch(ref values) => {
format!("expected `{}`, found `{}`", format!("expected `{:?}`, found `{:?}`",
values.expected.to_string(), values.expected,
values.found.to_string()) values.found)
} }
terr_float_mismatch(ref values) => { terr_float_mismatch(ref values) => {
format!("expected `{}`, found `{}`", format!("expected `{:?}`, found `{:?}`",
values.expected.to_string(), values.expected,
values.found.to_string()) values.found)
} }
terr_variadic_mismatch(ref values) => { terr_variadic_mismatch(ref values) => {
format!("expected {} fn, found {} function", format!("expected {} fn, found {} function",
@ -4915,14 +4915,14 @@ pub fn provided_trait_methods<'tcx>(cx: &ctxt<'tcx>, id: ast::DefId)
}).collect() }).collect()
} }
_ => { _ => {
cx.sess.bug(format!("provided_trait_methods: `{}` is \ cx.sess.bug(format!("provided_trait_methods: `{:?}` is \
not a trait", not a trait",
id).index(&FullRange)) id).index(&FullRange))
} }
} }
} }
_ => { _ => {
cx.sess.bug(format!("provided_trait_methods: `{}` is not a \ cx.sess.bug(format!("provided_trait_methods: `{:?}` is not a \
trait", trait",
id).index(&FullRange)) id).index(&FullRange))
} }
@ -4951,7 +4951,7 @@ fn lookup_locally_or_in_crate_store<V, F>(descr: &str,
} }
if def_id.krate == ast::LOCAL_CRATE { if def_id.krate == ast::LOCAL_CRATE {
panic!("No def'n found for {} in tcx.{}", def_id, descr); panic!("No def'n found for {:?} in tcx.{}", def_id, descr);
} }
let v = load_external(); let v = load_external();
map.insert(def_id, v.clone()); map.insert(def_id, v.clone());
@ -5058,7 +5058,7 @@ pub fn impl_trait_ref<'tcx>(cx: &ctxt<'tcx>, id: ast::DefId)
-> Option<Rc<TraitRef<'tcx>>> { -> Option<Rc<TraitRef<'tcx>>> {
memoized(&cx.impl_trait_cache, id, |id: ast::DefId| { memoized(&cx.impl_trait_cache, id, |id: ast::DefId| {
if id.krate == ast::LOCAL_CRATE { if id.krate == ast::LOCAL_CRATE {
debug!("(impl_trait_ref) searching for trait impl {}", id); debug!("(impl_trait_ref) searching for trait impl {:?}", id);
match cx.map.find(id.node) { match cx.map.find(id.node) {
Some(ast_map::NodeItem(item)) => { Some(ast_map::NodeItem(item)) => {
match item.node { match item.node {
@ -5378,7 +5378,7 @@ pub fn predicates_for_trait_ref<'tcx>(tcx: &ctxt<'tcx>,
{ {
let trait_def = lookup_trait_def(tcx, trait_ref.def_id()); let trait_def = lookup_trait_def(tcx, trait_ref.def_id());
debug!("bounds_for_trait_ref(trait_def={}, trait_ref={})", debug!("bounds_for_trait_ref(trait_def={:?}, trait_ref={:?})",
trait_def.repr(tcx), trait_ref.repr(tcx)); trait_def.repr(tcx), trait_ref.repr(tcx));
// The interaction between HRTB and supertraits is not entirely // The interaction between HRTB and supertraits is not entirely
@ -5930,7 +5930,7 @@ pub fn required_region_bounds<'tcx>(tcx: &ctxt<'tcx>,
predicates: Vec<ty::Predicate<'tcx>>) predicates: Vec<ty::Predicate<'tcx>>)
-> Vec<ty::Region> -> Vec<ty::Region>
{ {
debug!("required_region_bounds(erased_self_ty={}, predicates={})", debug!("required_region_bounds(erased_self_ty={:?}, predicates={:?})",
erased_self_ty.repr(tcx), erased_self_ty.repr(tcx),
predicates.repr(tcx)); predicates.repr(tcx));
@ -6008,7 +6008,7 @@ pub fn populate_implementations_for_type_if_necessary(tcx: &ctxt,
return return
} }
debug!("populate_implementations_for_type_if_necessary: searching for {}", type_id); debug!("populate_implementations_for_type_if_necessary: searching for {:?}", type_id);
let mut inherent_impls = Vec::new(); let mut inherent_impls = Vec::new();
csearch::each_implementation_for_type(&tcx.sess.cstore, type_id, csearch::each_implementation_for_type(&tcx.sess.cstore, type_id,
@ -6369,7 +6369,7 @@ pub fn construct_parameter_environment<'a,'tcx>(
record_region_bounds(tcx, &bounds); record_region_bounds(tcx, &bounds);
debug!("construct_parameter_environment: free_id={} free_subst={} bounds={}", debug!("construct_parameter_environment: free_id={:?} free_subst={:?} bounds={:?}",
free_id, free_id,
free_substs.repr(tcx), free_substs.repr(tcx),
bounds.repr(tcx)); bounds.repr(tcx));
@ -6395,15 +6395,15 @@ pub fn construct_parameter_environment<'a,'tcx>(
types: &mut VecPerParamSpace<Ty<'tcx>>, types: &mut VecPerParamSpace<Ty<'tcx>>,
defs: &[TypeParameterDef<'tcx>]) { defs: &[TypeParameterDef<'tcx>]) {
for def in defs.iter() { for def in defs.iter() {
debug!("construct_parameter_environment(): push_types_from_defs: def={}", debug!("construct_parameter_environment(): push_types_from_defs: def={:?}",
def.repr(tcx)); def.repr(tcx));
let ty = ty::mk_param_from_def(tcx, def); let ty = ty::mk_param_from_def(tcx, def);
types.push(def.space, ty); types.push(def.space, ty);
} }
} }
fn record_region_bounds<'tcx>(tcx: &ty::ctxt<'tcx>, bounds: &GenericBounds<'tcx>) { fn record_region_bounds<'tcx>(tcx: &ty::ctxt<'tcx>, bounds: &GenericBounds<'tcx>) {
debug!("record_region_bounds(bounds={})", bounds.repr(tcx)); debug!("record_region_bounds(bounds={:?})", bounds.repr(tcx));
for predicate in bounds.predicates.iter() { for predicate in bounds.predicates.iter() {
match *predicate { match *predicate {
@ -6757,7 +6757,7 @@ pub fn replace_late_bound_regions<'tcx, T, F>(
} }
}); });
debug!("resulting map: {} value: {}", map, value.repr(tcx)); debug!("resulting map: {:?} value: {:?}", map, value.repr(tcx));
(value, map) (value, map)
} }
@ -6805,7 +6805,7 @@ impl<'tcx> Repr<'tcx> for AutoRef<'tcx> {
fn repr(&self, tcx: &ctxt<'tcx>) -> String { fn repr(&self, tcx: &ctxt<'tcx>) -> String {
match *self { match *self {
AutoPtr(a, b, ref c) => { AutoPtr(a, b, ref c) => {
format!("AutoPtr({},{},{})", a.repr(tcx), b, c.repr(tcx)) format!("AutoPtr({},{:?},{})", a.repr(tcx), b, c.repr(tcx))
} }
AutoUnsize(ref a) => { AutoUnsize(ref a) => {
format!("AutoUnsize({})", a.repr(tcx)) format!("AutoUnsize({})", a.repr(tcx))
@ -6814,7 +6814,7 @@ impl<'tcx> Repr<'tcx> for AutoRef<'tcx> {
format!("AutoUnsizeUniq({})", a.repr(tcx)) format!("AutoUnsizeUniq({})", a.repr(tcx))
} }
AutoUnsafe(ref a, ref b) => { AutoUnsafe(ref a, ref b) => {
format!("AutoUnsafe({},{})", a, b.repr(tcx)) format!("AutoUnsafe({:?},{})", a, b.repr(tcx))
} }
} }
} }
@ -6844,7 +6844,7 @@ impl<'tcx> Repr<'tcx> for vtable_origin<'tcx> {
fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String { fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
match *self { match *self {
vtable_static(def_id, ref tys, ref vtable_res) => { vtable_static(def_id, ref tys, ref vtable_res) => {
format!("vtable_static({}:{}, {}, {})", format!("vtable_static({:?}:{}, {}, {})",
def_id, def_id,
ty::item_path_str(tcx, def_id), ty::item_path_str(tcx, def_id),
tys.repr(tcx), tys.repr(tcx),
@ -6852,11 +6852,11 @@ impl<'tcx> Repr<'tcx> for vtable_origin<'tcx> {
} }
vtable_param(x, y) => { vtable_param(x, y) => {
format!("vtable_param({}, {})", x, y) format!("vtable_param({:?}, {})", x, y)
} }
vtable_unboxed_closure(def_id) => { vtable_unboxed_closure(def_id) => {
format!("vtable_unboxed_closure({})", def_id) format!("vtable_unboxed_closure({:?})", def_id)
} }
vtable_error => { vtable_error => {
@ -7287,7 +7287,7 @@ impl ReferencesError for Region
impl<'tcx> Repr<'tcx> for ClosureTy<'tcx> { impl<'tcx> Repr<'tcx> for ClosureTy<'tcx> {
fn repr(&self, tcx: &ctxt<'tcx>) -> String { fn repr(&self, tcx: &ctxt<'tcx>) -> String {
format!("ClosureTy({},{},{},{},{},{})", format!("ClosureTy({},{},{:?},{},{},{})",
self.unsafety, self.unsafety,
self.onceness, self.onceness,
self.store, self.store,

View file

@ -95,7 +95,7 @@ impl<'tcx> Iterator for TypeWalker<'tcx> {
type Item = Ty<'tcx>; type Item = Ty<'tcx>;
fn next(&mut self) -> Option<Ty<'tcx>> { fn next(&mut self) -> Option<Ty<'tcx>> {
debug!("next(): stack={}", self.stack); debug!("next(): stack={:?}", self.stack);
match self.stack.pop() { match self.stack.pop() {
None => { None => {
return None; return None;
@ -103,7 +103,7 @@ impl<'tcx> Iterator for TypeWalker<'tcx> {
Some(ty) => { Some(ty) => {
self.last_subtree = self.stack.len(); self.last_subtree = self.stack.len();
self.push_subtypes(ty); self.push_subtypes(ty);
debug!("next: stack={}", self.stack); debug!("next: stack={:?}", self.stack);
Some(ty) Some(ty)
} }
} }

View file

@ -64,7 +64,7 @@ pub fn indent<R, F>(op: F) -> R where
// to make debug output more readable. // to make debug output more readable.
debug!(">>"); debug!(">>");
let r = op(); let r = op();
debug!("<< (Result = {})", r); debug!("<< (Result = {:?})", r);
r r
} }

View file

@ -111,7 +111,7 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region)
} }
Some(_) | None => { Some(_) | None => {
// this really should not happen // this really should not happen
(format!("unknown scope: {}. Please report a bug.", scope), None) (format!("unknown scope: {:?}. Please report a bug.", scope), None)
} }
} }
} }
@ -140,7 +140,7 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region)
} }
Some(_) | None => { Some(_) | None => {
// this really should not happen // this really should not happen
(format!("{} unknown free region bounded by scope {}", prefix, fr.scope), None) (format!("{} unknown free region bounded by scope {:?}", prefix, fr.scope), None)
} }
} }
} }
@ -156,7 +156,7 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region)
// I believe these cases should not occur (except when debugging, // I believe these cases should not occur (except when debugging,
// perhaps) // perhaps)
ty::ReInfer(_) | ty::ReLateBound(..) => { ty::ReInfer(_) | ty::ReLateBound(..) => {
(format!("lifetime {}", region), None) (format!("lifetime {:?}", region), None)
} }
}; };
@ -653,13 +653,13 @@ impl<'tcx, T:UserString<'tcx>> UserString<'tcx> for Vec<T> {
impl<'tcx> Repr<'tcx> for def::Def { impl<'tcx> Repr<'tcx> for def::Def {
fn repr(&self, _tcx: &ctxt) -> String { fn repr(&self, _tcx: &ctxt) -> String {
format!("{}", *self) format!("{:?}", *self)
} }
} }
impl<'tcx> Repr<'tcx> for ty::TypeParameterDef<'tcx> { impl<'tcx> Repr<'tcx> for ty::TypeParameterDef<'tcx> {
fn repr(&self, tcx: &ctxt<'tcx>) -> String { fn repr(&self, tcx: &ctxt<'tcx>) -> String {
format!("TypeParameterDef({}, {}, {}/{})", format!("TypeParameterDef({:?}, {}, {:?}/{})",
self.def_id, self.def_id,
self.bounds.repr(tcx), self.bounds.repr(tcx),
self.space, self.space,
@ -854,7 +854,7 @@ impl<'tcx> Repr<'tcx> for ty::Region {
fn repr(&self, tcx: &ctxt) -> String { fn repr(&self, tcx: &ctxt) -> String {
match *self { match *self {
ty::ReEarlyBound(id, space, index, name) => { ty::ReEarlyBound(id, space, index, name) => {
format!("ReEarlyBound({}, {}, {}, {})", format!("ReEarlyBound({}, {:?}, {}, {})",
id, id,
space, space,
index, index,
@ -862,7 +862,7 @@ impl<'tcx> Repr<'tcx> for ty::Region {
} }
ty::ReLateBound(binder_id, ref bound_region) => { ty::ReLateBound(binder_id, ref bound_region) => {
format!("ReLateBound({}, {})", format!("ReLateBound({:?}, {})",
binder_id, binder_id,
bound_region.repr(tcx)) bound_region.repr(tcx))
} }
@ -870,7 +870,7 @@ impl<'tcx> Repr<'tcx> for ty::Region {
ty::ReFree(ref fr) => fr.repr(tcx), ty::ReFree(ref fr) => fr.repr(tcx),
ty::ReScope(id) => { ty::ReScope(id) => {
format!("ReScope({})", id) format!("ReScope({:?})", id)
} }
ty::ReStatic => { ty::ReStatic => {
@ -878,7 +878,7 @@ impl<'tcx> Repr<'tcx> for ty::Region {
} }
ty::ReInfer(ReVar(ref vid)) => { ty::ReInfer(ReVar(ref vid)) => {
format!("{}", vid) format!("{:?}", vid)
} }
ty::ReInfer(ReSkolemized(id, ref bound_region)) => { ty::ReInfer(ReSkolemized(id, ref bound_region)) => {
@ -920,14 +920,14 @@ impl<'tcx> Repr<'tcx> for ast::DefId {
Some(ast_map::NodeVariant(..)) | Some(ast_map::NodeVariant(..)) |
Some(ast_map::NodeStructCtor(..)) => { Some(ast_map::NodeStructCtor(..)) => {
return format!( return format!(
"{}:{}", "{:?}:{}",
*self, *self,
ty::item_path_str(tcx, *self)) ty::item_path_str(tcx, *self))
} }
_ => {} _ => {}
} }
} }
return format!("{}", *self) return format!("{:?}", *self)
} }
} }
@ -1007,13 +1007,13 @@ impl<'tcx> Repr<'tcx> for ast::Ident {
impl<'tcx> Repr<'tcx> for ast::ExplicitSelf_ { impl<'tcx> Repr<'tcx> for ast::ExplicitSelf_ {
fn repr(&self, _tcx: &ctxt) -> String { fn repr(&self, _tcx: &ctxt) -> String {
format!("{}", *self) format!("{:?}", *self)
} }
} }
impl<'tcx> Repr<'tcx> for ast::Visibility { impl<'tcx> Repr<'tcx> for ast::Visibility {
fn repr(&self, _tcx: &ctxt) -> String { fn repr(&self, _tcx: &ctxt) -> String {
format!("{}", *self) format!("{:?}", *self)
} }
} }
@ -1026,6 +1026,7 @@ impl<'tcx> Repr<'tcx> for ty::BareFnTy<'tcx> {
} }
} }
impl<'tcx> Repr<'tcx> for ty::FnSig<'tcx> { impl<'tcx> Repr<'tcx> for ty::FnSig<'tcx> {
fn repr(&self, tcx: &ctxt<'tcx>) -> String { fn repr(&self, tcx: &ctxt<'tcx>) -> String {
format!("fn{} -> {}", self.inputs.repr(tcx), self.output.repr(tcx)) format!("fn{} -> {}", self.inputs.repr(tcx), self.output.repr(tcx))
@ -1096,7 +1097,7 @@ impl<'tcx> Repr<'tcx> for ty::TraitStore {
impl<'tcx> Repr<'tcx> for ty::BuiltinBound { impl<'tcx> Repr<'tcx> for ty::BuiltinBound {
fn repr(&self, _tcx: &ctxt) -> String { fn repr(&self, _tcx: &ctxt) -> String {
format!("{}", *self) format!("{:?}", *self)
} }
} }
@ -1251,13 +1252,13 @@ impl<'tcx> Repr<'tcx> for ty::UpvarId {
impl<'tcx> Repr<'tcx> for ast::Mutability { impl<'tcx> Repr<'tcx> for ast::Mutability {
fn repr(&self, _tcx: &ctxt) -> String { fn repr(&self, _tcx: &ctxt) -> String {
format!("{}", *self) format!("{:?}", *self)
} }
} }
impl<'tcx> Repr<'tcx> for ty::BorrowKind { impl<'tcx> Repr<'tcx> for ty::BorrowKind {
fn repr(&self, _tcx: &ctxt) -> String { fn repr(&self, _tcx: &ctxt) -> String {
format!("{}", *self) format!("{:?}", *self)
} }
} }
@ -1271,49 +1272,49 @@ impl<'tcx> Repr<'tcx> for ty::UpvarBorrow {
impl<'tcx> Repr<'tcx> for ty::IntVid { impl<'tcx> Repr<'tcx> for ty::IntVid {
fn repr(&self, _tcx: &ctxt) -> String { fn repr(&self, _tcx: &ctxt) -> String {
format!("{}", self) format!("{:?}", self)
} }
} }
impl<'tcx> Repr<'tcx> for ty::FloatVid { impl<'tcx> Repr<'tcx> for ty::FloatVid {
fn repr(&self, _tcx: &ctxt) -> String { fn repr(&self, _tcx: &ctxt) -> String {
format!("{}", self) format!("{:?}", self)
} }
} }
impl<'tcx> Repr<'tcx> for ty::RegionVid { impl<'tcx> Repr<'tcx> for ty::RegionVid {
fn repr(&self, _tcx: &ctxt) -> String { fn repr(&self, _tcx: &ctxt) -> String {
format!("{}", self) format!("{:?}", self)
} }
} }
impl<'tcx> Repr<'tcx> for ty::TyVid { impl<'tcx> Repr<'tcx> for ty::TyVid {
fn repr(&self, _tcx: &ctxt) -> String { fn repr(&self, _tcx: &ctxt) -> String {
format!("{}", self) format!("{:?}", self)
} }
} }
impl<'tcx> Repr<'tcx> for ty::IntVarValue { impl<'tcx> Repr<'tcx> for ty::IntVarValue {
fn repr(&self, _tcx: &ctxt) -> String { fn repr(&self, _tcx: &ctxt) -> String {
format!("{}", *self) format!("{:?}", *self)
} }
} }
impl<'tcx> Repr<'tcx> for ast::IntTy { impl<'tcx> Repr<'tcx> for ast::IntTy {
fn repr(&self, _tcx: &ctxt) -> String { fn repr(&self, _tcx: &ctxt) -> String {
format!("{}", *self) format!("{:?}", *self)
} }
} }
impl<'tcx> Repr<'tcx> for ast::UintTy { impl<'tcx> Repr<'tcx> for ast::UintTy {
fn repr(&self, _tcx: &ctxt) -> String { fn repr(&self, _tcx: &ctxt) -> String {
format!("{}", *self) format!("{:?}", *self)
} }
} }
impl<'tcx> Repr<'tcx> for ast::FloatTy { impl<'tcx> Repr<'tcx> for ast::FloatTy {
fn repr(&self, _tcx: &ctxt) -> String { fn repr(&self, _tcx: &ctxt) -> String {
format!("{}", *self) format!("{:?}", *self)
} }
} }
@ -1332,7 +1333,7 @@ impl<'tcx> UserString<'tcx> for ParamTy {
impl<'tcx> Repr<'tcx> for ParamTy { impl<'tcx> Repr<'tcx> for ParamTy {
fn repr(&self, tcx: &ctxt) -> String { fn repr(&self, tcx: &ctxt) -> String {
let ident = self.user_string(tcx); let ident = self.user_string(tcx);
format!("{}/{}.{}", ident, self.space, self.idx) format!("{}/{:?}.{}", ident, self.space, self.idx)
} }
} }

View file

@ -64,7 +64,7 @@ fn run_ar(handler: &ErrorHandler, maybe_ar_prog: &Option<String>,
match cwd { match cwd {
Some(p) => { Some(p) => {
cmd.cwd(p); cmd.cwd(p);
debug!("inside {}", p.display()); debug!("inside {:?}", p.display());
} }
None => {} None => {}
} }
@ -105,7 +105,7 @@ pub fn find_library(name: &str, osprefix: &str, ossuffix: &str,
let unixlibname = format!("lib{}.a", name); let unixlibname = format!("lib{}.a", name);
for path in search_paths.iter() { for path in search_paths.iter() {
debug!("looking for {} inside {}", name, path.display()); debug!("looking for {} inside {:?}", name, path.display());
let test = path.join(oslibname.index(&FullRange)); let test = path.join(oslibname.index(&FullRange));
if test.exists() { return test } if test.exists() { return test }
if oslibname != unixlibname { if oslibname != unixlibname {

View file

@ -61,10 +61,10 @@ fn get_rpaths<F, G>(mut config: RPathConfig<F, G>, libs: &[Path]) -> Vec<String>
F: FnOnce() -> Path, F: FnOnce() -> Path,
G: FnMut(&Path) -> Result<Path, IoError>, G: FnMut(&Path) -> Result<Path, IoError>,
{ {
debug!("output: {}", config.out_filename.display()); debug!("output: {:?}", config.out_filename.display());
debug!("libs:"); debug!("libs:");
for libpath in libs.iter() { for libpath in libs.iter() {
debug!(" {}", libpath.display()); debug!(" {:?}", libpath.display());
} }
// Use relative paths to the libraries. Binaries can be moved // Use relative paths to the libraries. Binaries can be moved

View file

@ -119,6 +119,14 @@ impl Svh {
} }
impl fmt::Show for Svh { impl fmt::Show for Svh {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
//NOTE(stage0): uncomment after snapshot
//write!(f, "Svh {{ {} }}", self.as_str())
fmt::String::fmt(self, f)
}
}
impl fmt::String for Svh {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad(self.as_str()) f.pad(self.as_str())
} }

View file

@ -301,8 +301,8 @@ impl Target {
use serialize::json; use serialize::json;
fn load_file(path: &Path) -> Result<Target, String> { fn load_file(path: &Path) -> Result<Target, String> {
let mut f = try!(File::open(path).map_err(|e| e.to_string())); let mut f = try!(File::open(path).map_err(|e| format!("{:?}", e)));
let obj = try!(json::from_reader(&mut f).map_err(|e| e.to_string())); let obj = try!(json::from_reader(&mut f).map_err(|e| format!("{:?}", e)));
Ok(Target::from_json(obj)) Ok(Target::from_json(obj))
} }
@ -315,7 +315,7 @@ impl Target {
$( $(
else if target == stringify!($name) { else if target == stringify!($name) {
let t = $name::target(); let t = $name::target();
debug!("Got builtin target: {}", t); debug!("Got builtin target: {:?}", t);
return Ok(t); return Ok(t);
} }
)* )*
@ -379,6 +379,6 @@ impl Target {
} }
} }
Err(format!("Could not find specification for target {}", target)) Err(format!("Could not find specification for target {:?}", target))
} }
} }

View file

@ -96,7 +96,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> {
consume_span: Span, consume_span: Span,
cmt: mc::cmt<'tcx>, cmt: mc::cmt<'tcx>,
mode: euv::ConsumeMode) { mode: euv::ConsumeMode) {
debug!("consume(consume_id={}, cmt={}, mode={})", debug!("consume(consume_id={}, cmt={}, mode={:?})",
consume_id, cmt.repr(self.tcx()), mode); consume_id, cmt.repr(self.tcx()), mode);
self.consume_common(consume_id, consume_span, cmt, mode); self.consume_common(consume_id, consume_span, cmt, mode);
@ -111,7 +111,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> {
consume_pat: &ast::Pat, consume_pat: &ast::Pat,
cmt: mc::cmt<'tcx>, cmt: mc::cmt<'tcx>,
mode: euv::ConsumeMode) { mode: euv::ConsumeMode) {
debug!("consume_pat(consume_pat={}, cmt={}, mode={})", debug!("consume_pat(consume_pat={}, cmt={}, mode={:?})",
consume_pat.repr(self.tcx()), consume_pat.repr(self.tcx()),
cmt.repr(self.tcx()), cmt.repr(self.tcx()),
mode); mode);
@ -127,8 +127,8 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> {
bk: ty::BorrowKind, bk: ty::BorrowKind,
loan_cause: euv::LoanCause) loan_cause: euv::LoanCause)
{ {
debug!("borrow(borrow_id={}, cmt={}, loan_region={}, \ debug!("borrow(borrow_id={}, cmt={}, loan_region={:?}, \
bk={}, loan_cause={})", bk={:?}, loan_cause={:?})",
borrow_id, cmt.repr(self.tcx()), loan_region, borrow_id, cmt.repr(self.tcx()), loan_region,
bk, loan_cause); bk, loan_cause);
@ -355,10 +355,10 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
//! (Note that some loans can be *issued* without necessarily //! (Note that some loans can be *issued* without necessarily
//! taking effect yet.) //! taking effect yet.)
debug!("check_for_conflicting_loans(scope={})", scope); debug!("check_for_conflicting_loans(scope={:?})", scope);
let new_loan_indices = self.loans_generated_by(scope); let new_loan_indices = self.loans_generated_by(scope);
debug!("new_loan_indices = {}", new_loan_indices); debug!("new_loan_indices = {:?}", new_loan_indices);
self.each_issued_loan(scope, |issued_loan| { self.each_issued_loan(scope, |issued_loan| {
for &new_loan_index in new_loan_indices.iter() { for &new_loan_index in new_loan_indices.iter() {
@ -696,7 +696,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
span: Span, span: Span,
use_kind: MovedValueUseKind, use_kind: MovedValueUseKind,
lp: &Rc<LoanPath<'tcx>>) { lp: &Rc<LoanPath<'tcx>>) {
debug!("check_if_path_is_moved(id={}, use_kind={}, lp={})", debug!("check_if_path_is_moved(id={}, use_kind={:?}, lp={})",
id, use_kind, lp.repr(self.bccx.tcx)); id, use_kind, lp.repr(self.bccx.tcx));
let base_lp = owned_ptr_base_path_rc(lp); let base_lp = owned_ptr_base_path_rc(lp);
self.move_data.each_move_of(id, &base_lp, |the_move, moved_lp| { self.move_data.each_move_of(id, &base_lp, |the_move, moved_lp| {

View file

@ -198,11 +198,11 @@ pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) {
// First, filter out duplicates // First, filter out duplicates
moved.sort(); moved.sort();
moved.dedup(); moved.dedup();
debug!("fragments 1 moved: {}", path_lps(moved.index(&FullRange))); debug!("fragments 1 moved: {:?}", path_lps(moved.index(&FullRange)));
assigned.sort(); assigned.sort();
assigned.dedup(); assigned.dedup();
debug!("fragments 1 assigned: {}", path_lps(assigned.index(&FullRange))); debug!("fragments 1 assigned: {:?}", path_lps(assigned.index(&FullRange)));
// Second, build parents from the moved and assigned. // Second, build parents from the moved and assigned.
for m in moved.iter() { for m in moved.iter() {
@ -222,14 +222,14 @@ pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) {
parents.sort(); parents.sort();
parents.dedup(); parents.dedup();
debug!("fragments 2 parents: {}", path_lps(parents.index(&FullRange))); debug!("fragments 2 parents: {:?}", path_lps(parents.index(&FullRange)));
// Third, filter the moved and assigned fragments down to just the non-parents // Third, filter the moved and assigned fragments down to just the non-parents
moved.retain(|f| non_member(*f, parents.index(&FullRange))); moved.retain(|f| non_member(*f, parents.index(&FullRange)));
debug!("fragments 3 moved: {}", path_lps(moved.index(&FullRange))); debug!("fragments 3 moved: {:?}", path_lps(moved.index(&FullRange)));
assigned.retain(|f| non_member(*f, parents.index(&FullRange))); assigned.retain(|f| non_member(*f, parents.index(&FullRange)));
debug!("fragments 3 assigned: {}", path_lps(assigned.index(&FullRange))); debug!("fragments 3 assigned: {:?}", path_lps(assigned.index(&FullRange)));
// Fourth, build the leftover from the moved, assigned, and parents. // Fourth, build the leftover from the moved, assigned, and parents.
for m in moved.iter() { for m in moved.iter() {
@ -247,7 +247,7 @@ pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) {
unmoved.sort(); unmoved.sort();
unmoved.dedup(); unmoved.dedup();
debug!("fragments 4 unmoved: {}", frag_lps(unmoved.index(&FullRange))); debug!("fragments 4 unmoved: {:?}", frag_lps(unmoved.index(&FullRange)));
// Fifth, filter the leftover fragments down to its core. // Fifth, filter the leftover fragments down to its core.
unmoved.retain(|f| match *f { unmoved.retain(|f| match *f {
@ -256,7 +256,7 @@ pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) {
non_member(mpi, moved.index(&FullRange)) && non_member(mpi, moved.index(&FullRange)) &&
non_member(mpi, assigned.index(&FullRange)) non_member(mpi, assigned.index(&FullRange))
}); });
debug!("fragments 5 unmoved: {}", frag_lps(unmoved.index(&FullRange))); debug!("fragments 5 unmoved: {:?}", frag_lps(unmoved.index(&FullRange)));
// Swap contents back in. // Swap contents back in.
fragments.unmoved_fragments = unmoved; fragments.unmoved_fragments = unmoved;
@ -430,7 +430,7 @@ fn add_fragment_siblings_for_extension<'tcx>(this: &MoveData<'tcx>,
} }
ref sty_and_variant_info => { ref sty_and_variant_info => {
let msg = format!("type {} ({}) is not fragmentable", let msg = format!("type {} ({:?}) is not fragmentable",
parent_ty.repr(tcx), sty_and_variant_info); parent_ty.repr(tcx), sty_and_variant_info);
let opt_span = origin_id.and_then(|id|tcx.map.opt_span(id)); let opt_span = origin_id.and_then(|id|tcx.map.opt_span(id));
tcx.sess.opt_span_bug(opt_span, msg.index(&FullRange)) tcx.sess.opt_span_bug(opt_span, msg.index(&FullRange))

View file

@ -65,7 +65,7 @@ pub fn gather_match_variant<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
cmt: mc::cmt<'tcx>, cmt: mc::cmt<'tcx>,
mode: euv::MatchMode) { mode: euv::MatchMode) {
let tcx = bccx.tcx; let tcx = bccx.tcx;
debug!("gather_match_variant(move_pat={}, cmt={}, mode={})", debug!("gather_match_variant(move_pat={}, cmt={}, mode={:?})",
move_pat.id, cmt.repr(tcx), mode); move_pat.id, cmt.repr(tcx), mode);
let opt_lp = opt_loan_path(&cmt); let opt_lp = opt_loan_path(&cmt);

View file

@ -76,7 +76,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
_consume_span: Span, _consume_span: Span,
cmt: mc::cmt<'tcx>, cmt: mc::cmt<'tcx>,
mode: euv::ConsumeMode) { mode: euv::ConsumeMode) {
debug!("consume(consume_id={}, cmt={}, mode={})", debug!("consume(consume_id={}, cmt={}, mode={:?})",
consume_id, cmt.repr(self.tcx()), mode); consume_id, cmt.repr(self.tcx()), mode);
match mode { match mode {
@ -93,7 +93,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
matched_pat: &ast::Pat, matched_pat: &ast::Pat,
cmt: mc::cmt<'tcx>, cmt: mc::cmt<'tcx>,
mode: euv::MatchMode) { mode: euv::MatchMode) {
debug!("matched_pat(matched_pat={}, cmt={}, mode={})", debug!("matched_pat(matched_pat={}, cmt={}, mode={:?})",
matched_pat.repr(self.tcx()), matched_pat.repr(self.tcx()),
cmt.repr(self.tcx()), cmt.repr(self.tcx()),
mode); mode);
@ -109,7 +109,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
consume_pat: &ast::Pat, consume_pat: &ast::Pat,
cmt: mc::cmt<'tcx>, cmt: mc::cmt<'tcx>,
mode: euv::ConsumeMode) { mode: euv::ConsumeMode) {
debug!("consume_pat(consume_pat={}, cmt={}, mode={})", debug!("consume_pat(consume_pat={}, cmt={}, mode={:?})",
consume_pat.repr(self.tcx()), consume_pat.repr(self.tcx()),
cmt.repr(self.tcx()), cmt.repr(self.tcx()),
mode); mode);
@ -132,8 +132,8 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
bk: ty::BorrowKind, bk: ty::BorrowKind,
loan_cause: euv::LoanCause) loan_cause: euv::LoanCause)
{ {
debug!("borrow(borrow_id={}, cmt={}, loan_region={}, \ debug!("borrow(borrow_id={}, cmt={}, loan_region={:?}, \
bk={}, loan_cause={})", bk={:?}, loan_cause={:?})",
borrow_id, cmt.repr(self.tcx()), loan_region, borrow_id, cmt.repr(self.tcx()), loan_region,
bk, loan_cause); bk, loan_cause);
@ -235,7 +235,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
loan_region: ty::Region, loan_region: ty::Region,
cause: euv::LoanCause) { cause: euv::LoanCause) {
debug!("guarantee_valid(borrow_id={}, cmt={}, \ debug!("guarantee_valid(borrow_id={}, cmt={}, \
req_mutbl={}, loan_region={})", req_mutbl={:?}, loan_region={:?})",
borrow_id, borrow_id,
cmt.repr(self.tcx()), cmt.repr(self.tcx()),
req_kind, req_kind,
@ -273,7 +273,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
self.bccx, borrow_span, cause, self.bccx, borrow_span, cause,
cmt.clone(), loan_region); cmt.clone(), loan_region);
debug!("guarantee_valid(): restrictions={}", restr); debug!("guarantee_valid(): restrictions={:?}", restr);
// Create the loan record (if needed). // Create the loan record (if needed).
let loan = match restr { let loan = match restr {
@ -306,18 +306,18 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
ty::ReInfer(..) => { ty::ReInfer(..) => {
self.tcx().sess.span_bug( self.tcx().sess.span_bug(
cmt.span, cmt.span,
format!("invalid borrow lifetime: {}", format!("invalid borrow lifetime: {:?}",
loan_region).index(&FullRange)); loan_region).index(&FullRange));
} }
}; };
debug!("loan_scope = {}", loan_scope); debug!("loan_scope = {:?}", loan_scope);
let borrow_scope = region::CodeExtent::from_node_id(borrow_id); let borrow_scope = region::CodeExtent::from_node_id(borrow_id);
let gen_scope = self.compute_gen_scope(borrow_scope, loan_scope); let gen_scope = self.compute_gen_scope(borrow_scope, loan_scope);
debug!("gen_scope = {}", gen_scope); debug!("gen_scope = {:?}", gen_scope);
let kill_scope = self.compute_kill_scope(loan_scope, &*loan_path); let kill_scope = self.compute_kill_scope(loan_scope, &*loan_path);
debug!("kill_scope = {}", kill_scope); debug!("kill_scope = {:?}", kill_scope);
if req_kind == ty::MutBorrow { if req_kind == ty::MutBorrow {
self.mark_loan_path_as_mutated(&*loan_path); self.mark_loan_path_as_mutated(&*loan_path);

View file

@ -586,7 +586,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
} }
r => { r => {
self.tcx.sess.bug(format!("MoveExpr({}) maps to \ self.tcx.sess.bug(format!("MoveExpr({}) maps to \
{}, not Expr", {:?}, not Expr",
the_move.id, the_move.id,
r).index(&FullRange)) r).index(&FullRange))
} }
@ -624,7 +624,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
} }
r => { r => {
self.tcx.sess.bug(format!("Captured({}) maps to \ self.tcx.sess.bug(format!("Captured({}) maps to \
{}, not Expr", {:?}, not Expr",
the_move.id, the_move.id,
r).index(&FullRange)) r).index(&FullRange))
} }
@ -1005,7 +1005,7 @@ impl DataFlowOperator for LoanDataFlowOperator {
impl<'tcx> Repr<'tcx> for Loan<'tcx> { impl<'tcx> Repr<'tcx> for Loan<'tcx> {
fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String { fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
format!("Loan_{}({}, {}, {}-{}, {})", format!("Loan_{}({}, {:?}, {:?}-{:?}, {})",
self.index, self.index,
self.loan_path.repr(tcx), self.loan_path.repr(tcx),
self.kind, self.kind,

View file

@ -311,7 +311,7 @@ impl<'tcx> MoveData<'tcx> {
} }
}; };
debug!("move_path(lp={}, index={})", debug!("move_path(lp={}, index={:?})",
lp.repr(tcx), lp.repr(tcx),
index); index);
@ -362,7 +362,7 @@ impl<'tcx> MoveData<'tcx> {
lp: Rc<LoanPath<'tcx>>, lp: Rc<LoanPath<'tcx>>,
id: ast::NodeId, id: ast::NodeId,
kind: MoveKind) { kind: MoveKind) {
debug!("add_move(lp={}, id={}, kind={})", debug!("add_move(lp={}, id={}, kind={:?})",
lp.repr(tcx), lp.repr(tcx),
id, id,
kind); kind);
@ -413,12 +413,12 @@ impl<'tcx> MoveData<'tcx> {
}; };
if self.is_var_path(path_index) { if self.is_var_path(path_index) {
debug!("add_assignment[var](lp={}, assignment={}, path_index={})", debug!("add_assignment[var](lp={}, assignment={}, path_index={:?})",
lp.repr(tcx), self.var_assignments.borrow().len(), path_index); lp.repr(tcx), self.var_assignments.borrow().len(), path_index);
self.var_assignments.borrow_mut().push(assignment); self.var_assignments.borrow_mut().push(assignment);
} else { } else {
debug!("add_assignment[path](lp={}, path_index={})", debug!("add_assignment[path](lp={}, path_index={:?})",
lp.repr(tcx), path_index); lp.repr(tcx), path_index);
self.path_assignments.borrow_mut().push(assignment); self.path_assignments.borrow_mut().push(assignment);

View file

@ -53,7 +53,7 @@ pub struct DataflowLabeller<'a, 'tcx: 'a> {
impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> { impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> {
fn dataflow_for(&self, e: EntryOrExit, n: &Node<'a>) -> String { fn dataflow_for(&self, e: EntryOrExit, n: &Node<'a>) -> String {
let id = n.1.data.id; let id = n.1.data.id;
debug!("dataflow_for({}, id={}) {}", e, id, self.variants); debug!("dataflow_for({:?}, id={}) {:?}", e, id, self.variants);
let mut sets = "".to_string(); let mut sets = "".to_string();
let mut seen_one = false; let mut seen_one = false;
for &variant in self.variants.iter() { for &variant in self.variants.iter() {

View file

@ -726,7 +726,7 @@ pub fn collect_crate_types(session: &Session,
let res = !link::invalid_output_for_target(session, *crate_type); let res = !link::invalid_output_for_target(session, *crate_type);
if !res { if !res {
session.warn(format!("dropping unsupported crate type `{}` \ session.warn(format!("dropping unsupported crate type `{:?}` \
for target `{}`", for target `{}`",
*crate_type, session.opts.target_triple).index(&FullRange)); *crate_type, session.opts.target_triple).index(&FullRange));
} }

View file

@ -548,7 +548,7 @@ pub fn pretty_print_input(sess: Session,
(PpmSource(s), None) => (PpmSource(s), None) =>
s.call_with_pp_support( s.call_with_pp_support(
sess, ast_map, &arenas, id, out, |annotation, out| { sess, ast_map, &arenas, id, out, |annotation, out| {
debug!("pretty printing source code {}", s); debug!("pretty printing source code {:?}", s);
let sess = annotation.sess(); let sess = annotation.sess();
pprust::print_crate(sess.codemap(), pprust::print_crate(sess.codemap(),
sess.diagnostic(), sess.diagnostic(),
@ -563,7 +563,7 @@ pub fn pretty_print_input(sess: Session,
(PpmSource(s), Some(uii)) => (PpmSource(s), Some(uii)) =>
s.call_with_pp_support( s.call_with_pp_support(
sess, ast_map, &arenas, id, (out,uii), |annotation, (out,uii)| { sess, ast_map, &arenas, id, (out,uii), |annotation, (out,uii)| {
debug!("pretty printing source code {}", s); debug!("pretty printing source code {:?}", s);
let sess = annotation.sess(); let sess = annotation.sess();
let ast_map = annotation.ast_map() let ast_map = annotation.ast_map()
.expect("--pretty missing ast_map"); .expect("--pretty missing ast_map");
@ -586,7 +586,7 @@ pub fn pretty_print_input(sess: Session,
}), }),
(PpmFlowGraph, opt_uii) => { (PpmFlowGraph, opt_uii) => {
debug!("pretty printing flow graph for {}", opt_uii); debug!("pretty printing flow graph for {:?}", opt_uii);
let uii = opt_uii.unwrap_or_else(|| { let uii = opt_uii.unwrap_or_else(|| {
sess.fatal(format!("`pretty flowgraph=..` needs NodeId (int) or sess.fatal(format!("`pretty flowgraph=..` needs NodeId (int) or
unique path suffix (b::c::d)").index(&FullRange)) unique path suffix (b::c::d)").index(&FullRange))
@ -609,7 +609,7 @@ pub fn pretty_print_input(sess: Session,
} }
None => { None => {
let message = format!("--pretty=flowgraph needs \ let message = format!("--pretty=flowgraph needs \
block, fn, or method; got {}", block, fn, or method; got {:?}",
node); node);
// point to what was found, if there's an // point to what was found, if there's an

View file

@ -845,7 +845,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
name: Name, name: Name,
new_parent: &Rc<Module>) { new_parent: &Rc<Module>) {
debug!("(building reduced graph for \ debug!("(building reduced graph for \
external crate) building external def, priv {}", external crate) building external def, priv {:?}",
vis); vis);
let is_public = vis == ast::Public; let is_public = vis == ast::Public;
let modifiers = if is_public { PUBLIC } else { DefModifiers::empty() } | IMPORTABLE; let modifiers = if is_public { PUBLIC } else { DefModifiers::empty() } | IMPORTABLE;
@ -989,7 +989,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
DefLocal(..) | DefPrimTy(..) | DefTyParam(..) | DefLocal(..) | DefPrimTy(..) | DefTyParam(..) |
DefUse(..) | DefUpvar(..) | DefRegion(..) | DefUse(..) | DefUpvar(..) | DefRegion(..) |
DefTyParamBinder(..) | DefLabel(..) | DefSelfTy(..) => { DefTyParamBinder(..) | DefLabel(..) | DefSelfTy(..) => {
panic!("didn't expect `{}`", def); panic!("didn't expect `{:?}`", def);
} }
} }
} }

View file

@ -58,7 +58,7 @@ impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> {
// public or private item, we will check the correct thing, dependent on how the import // public or private item, we will check the correct thing, dependent on how the import
// is used. // is used.
fn finalize_import(&mut self, id: ast::NodeId, span: Span) { fn finalize_import(&mut self, id: ast::NodeId, span: Span) {
debug!("finalizing import uses for {}", debug!("finalizing import uses for {:?}",
self.session.codemap().span_to_snippet(span)); self.session.codemap().span_to_snippet(span));
if !self.used_imports.contains(&(id, TypeNS)) && if !self.used_imports.contains(&(id, TypeNS)) &&

View file

@ -548,7 +548,7 @@ impl Module {
impl fmt::Show for Module { impl fmt::Show for Module {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}, kind: {}, {}", write!(f, "{:?}, kind: {:?}, {}",
self.def_id, self.def_id,
self.kind, self.kind,
if self.is_public { "public" } else { "private" } ) if self.is_public { "public" } else { "private" } )
@ -689,7 +689,7 @@ impl NameBindings {
/// Records a type definition. /// Records a type definition.
fn define_type(&self, def: Def, sp: Span, modifiers: DefModifiers) { fn define_type(&self, def: Def, sp: Span, modifiers: DefModifiers) {
debug!("defining type for def {} with modifiers {}", def, modifiers); debug!("defining type for def {:?} with modifiers {:?}", def, modifiers);
// Merges the type with the existing type def or creates a new one. // Merges the type with the existing type def or creates a new one.
let type_def = self.type_def.borrow().clone(); let type_def = self.type_def.borrow().clone();
match type_def { match type_def {
@ -714,7 +714,7 @@ impl NameBindings {
/// Records a value definition. /// Records a value definition.
fn define_value(&self, def: Def, sp: Span, modifiers: DefModifiers) { fn define_value(&self, def: Def, sp: Span, modifiers: DefModifiers) {
debug!("defining value for def {} with modifiers {}", def, modifiers); debug!("defining value for def {:?} with modifiers {:?}", def, modifiers);
*self.value_def.borrow_mut() = Some(ValueNsDef { *self.value_def.borrow_mut() = Some(ValueNsDef {
def: def, def: def,
value_span: Some(sp), value_span: Some(sp),
@ -1274,7 +1274,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
lp: LastPrivate) lp: LastPrivate)
-> ResolveResult<()> { -> ResolveResult<()> {
debug!("(resolving single import) resolving `{}` = `{}::{}` from \ debug!("(resolving single import) resolving `{}` = `{}::{}` from \
`{}` id {}, last private {}", `{}` id {}, last private {:?}",
token::get_name(target), token::get_name(target),
self.module_to_string(&*containing_module), self.module_to_string(&*containing_module),
token::get_name(source), token::get_name(source),
@ -1377,7 +1377,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
shadowable: _ shadowable: _
}) => { }) => {
debug!("(resolving single import) found \ debug!("(resolving single import) found \
import in ns {}", namespace); import in ns {:?}", namespace);
let id = import_resolution.id(namespace); let id = import_resolution.id(namespace);
// track used imports and extern crates as well // track used imports and extern crates as well
this.used_imports.insert((id, namespace)); this.used_imports.insert((id, namespace));
@ -1486,7 +1486,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
match *result { match *result {
BoundResult(ref target_module, ref name_bindings) => { BoundResult(ref target_module, ref name_bindings) => {
debug!("(resolving single import) found {} target: {}", debug!("(resolving single import) found {:?} target: {:?}",
namespace_name, namespace_name,
name_bindings.def_for_namespace(namespace)); name_bindings.def_for_namespace(namespace));
self.check_for_conflicting_import( self.check_for_conflicting_import(
@ -1510,7 +1510,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
} }
UnboundResult => { /* Continue. */ } UnboundResult => { /* Continue. */ }
UnknownResult => { UnknownResult => {
panic!("{} result should be known at this point", namespace_name); panic!("{:?} result should be known at this point", namespace_name);
} }
} }
}; };
@ -2167,7 +2167,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
namespace: Namespace) namespace: Namespace)
-> ResolveResult<(Target, bool)> { -> ResolveResult<(Target, bool)> {
debug!("(resolving item in lexical scope) resolving `{}` in \ debug!("(resolving item in lexical scope) resolving `{}` in \
namespace {} in `{}`", namespace {:?} in `{}`",
token::get_name(name), token::get_name(name),
namespace, namespace,
self.module_to_string(&*module_)); self.module_to_string(&*module_));
@ -2197,7 +2197,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
None => { None => {
// Not found; continue. // Not found; continue.
debug!("(resolving item in lexical scope) found \ debug!("(resolving item in lexical scope) found \
import resolution, but not in namespace {}", import resolution, but not in namespace {:?}",
namespace); namespace);
} }
Some(target) => { Some(target) => {
@ -2477,7 +2477,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
match import_resolution.target_for_namespace(namespace) { match import_resolution.target_for_namespace(namespace) {
None => { None => {
debug!("(resolving name in module) name found, \ debug!("(resolving name in module) name found, \
but not in namespace {}", but not in namespace {:?}",
namespace); namespace);
} }
Some(target) => { Some(target) => {
@ -2622,7 +2622,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
match def_like { match def_like {
DlDef(d @ DefUpvar(..)) => { DlDef(d @ DefUpvar(..)) => {
self.session.span_bug(span, self.session.span_bug(span,
format!("unexpected {} in bindings", d).index(&FullRange)) format!("unexpected {:?} in bindings", d).index(&FullRange))
} }
DlDef(d @ DefLocal(_)) => { DlDef(d @ DefLocal(_)) => {
let node_id = d.def_id().node; let node_id = d.def_id().node;
@ -3189,7 +3189,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
Some(def) => { Some(def) => {
match def { match def {
(DefTrait(_), _) => { (DefTrait(_), _) => {
debug!("(resolving trait) found trait def: {}", def); debug!("(resolving trait) found trait def: {:?}", def);
self.record_def(trait_reference.ref_id, def); self.record_def(trait_reference.ref_id, def);
} }
(def, _) => { (def, _) => {
@ -3580,8 +3580,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
None => { None => {
match self.resolve_path(ty.id, path, TypeNS, true) { match self.resolve_path(ty.id, path, TypeNS, true) {
Some(def) => { Some(def) => {
debug!("(resolving type) resolved `{}` to \ debug!("(resolving type) resolved `{:?}` to \
type {}", type {:?}",
token::get_ident(path.segments.last().unwrap() .identifier), token::get_ident(path.segments.last().unwrap() .identifier),
def); def);
result_def = Some(def); result_def = Some(def);
@ -3799,7 +3799,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
} }
result => { result => {
debug!("(resolving pattern) didn't find struct \ debug!("(resolving pattern) didn't find struct \
def: {}", result); def: {:?}", result);
let msg = format!("`{}` does not name a structure", let msg = format!("`{}` does not name a structure",
self.path_names_to_string(path)); self.path_names_to_string(path));
self.resolve_error(path.span, msg.index(&FullRange)); self.resolve_error(path.span, msg.index(&FullRange));
@ -3823,7 +3823,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
ValueNS) { ValueNS) {
Success((target, _)) => { Success((target, _)) => {
debug!("(resolve bare identifier pattern) succeeded in \ debug!("(resolve bare identifier pattern) succeeded in \
finding {} at {}", finding {} at {:?}",
token::get_name(name), token::get_name(name),
target.bindings.value_def.borrow()); target.bindings.value_def.borrow());
match *target.bindings.value_def.borrow() { match *target.bindings.value_def.borrow() {
@ -4181,7 +4181,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
match search_result { match search_result {
Some(DlDef(def)) => { Some(DlDef(def)) => {
debug!("(resolving path in local ribs) resolved `{}` to \ debug!("(resolving path in local ribs) resolved `{}` to \
local: {}", local: {:?}",
token::get_ident(ident), token::get_ident(ident),
def); def);
return Some(def); return Some(def);
@ -4532,7 +4532,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
Some(definition) => self.record_def(expr.id, definition), Some(definition) => self.record_def(expr.id, definition),
result => { result => {
debug!("(resolving expression) didn't find struct \ debug!("(resolving expression) didn't find struct \
def: {}", result); def: {:?}", result);
let msg = format!("`{}` does not name a structure", let msg = format!("`{}` does not name a structure",
self.path_names_to_string(path)); self.path_names_to_string(path));
self.resolve_error(path.span, msg.index(&FullRange)); self.resolve_error(path.span, msg.index(&FullRange));
@ -4719,7 +4719,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
} }
fn record_def(&mut self, node_id: NodeId, (def, lp): (Def, LastPrivate)) { fn record_def(&mut self, node_id: NodeId, (def, lp): (Def, LastPrivate)) {
debug!("(recording def) recording {} for {}, last private {}", debug!("(recording def) recording {:?} for {}, last private {:?}",
def, node_id, lp); def, node_id, lp);
assert!(match lp {LastImport{..} => false, _ => true}, assert!(match lp {LastImport{..} => false, _ => true},
"Import should only be used for `use` directives"); "Import should only be used for `use` directives");
@ -4731,8 +4731,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
// the same conclusion! - nmatsakis // the same conclusion! - nmatsakis
Occupied(entry) => if def != *entry.get() { Occupied(entry) => if def != *entry.get() {
self.session self.session
.bug(format!("node_id {} resolved first to {} and \ .bug(format!("node_id {} resolved first to {:?} and \
then {}", then {:?}",
node_id, node_id,
*entry.get(), *entry.get(),
def).index(&FullRange)); def).index(&FullRange));

View file

@ -117,7 +117,7 @@ impl<'a, 'b, 'tcx> ExportRecorder<'a, 'b, 'tcx> {
ns: Namespace) { ns: Namespace) {
match namebindings.def_for_namespace(ns) { match namebindings.def_for_namespace(ns) {
Some(d) => { Some(d) => {
debug!("(computing exports) YES: export '{}' => {}", debug!("(computing exports) YES: export '{}' => {:?}",
name, d.def_id()); name, d.def_id());
exports.push(Export { exports.push(Export {
name: name, name: name,
@ -125,7 +125,7 @@ impl<'a, 'b, 'tcx> ExportRecorder<'a, 'b, 'tcx> {
}); });
} }
d_opt => { d_opt => {
debug!("(computing exports) NO: {}", d_opt); debug!("(computing exports) NO: {:?}", d_opt);
} }
} }
} }

View file

@ -171,7 +171,7 @@ pub fn build_link_meta(sess: &Session, krate: &ast::Crate,
crate_name: name, crate_name: name,
crate_hash: Svh::calculate(&sess.opts.cg.metadata, krate), crate_hash: Svh::calculate(&sess.opts.cg.metadata, krate),
}; };
info!("{}", r); info!("{:?}", r);
return r; return r;
} }
@ -373,7 +373,7 @@ pub fn link_binary(sess: &Session,
let mut out_filenames = Vec::new(); let mut out_filenames = Vec::new();
for &crate_type in sess.crate_types.borrow().iter() { for &crate_type in sess.crate_types.borrow().iter() {
if invalid_output_for_target(sess, crate_type) { if invalid_output_for_target(sess, crate_type) {
sess.bug(format!("invalid output type `{}` for target os `{}`", sess.bug(format!("invalid output type `{:?}` for target os `{}`",
crate_type, sess.opts.target_triple).index(&FullRange)); crate_type, sess.opts.target_triple).index(&FullRange));
} }
let out_file = link_binary_output(sess, trans, crate_type, outputs, let out_file = link_binary_output(sess, trans, crate_type, outputs,

View file

@ -174,7 +174,7 @@ fn create_target_machine(sess: &Session) -> TargetMachineRef {
"default" => llvm::RelocDefault, "default" => llvm::RelocDefault,
"dynamic-no-pic" => llvm::RelocDynamicNoPic, "dynamic-no-pic" => llvm::RelocDynamicNoPic,
_ => { _ => {
sess.err(format!("{} is not a valid relocation mode", sess.err(format!("{:?} is not a valid relocation mode",
sess.opts sess.opts
.cg .cg
.relocation_model).index(&FullRange)); .relocation_model).index(&FullRange));
@ -209,7 +209,7 @@ fn create_target_machine(sess: &Session) -> TargetMachineRef {
"medium" => llvm::CodeModelMedium, "medium" => llvm::CodeModelMedium,
"large" => llvm::CodeModelLarge, "large" => llvm::CodeModelLarge,
_ => { _ => {
sess.err(format!("{} is not a valid code model", sess.err(format!("{:?} is not a valid code model",
sess.opts sess.opts
.cg .cg
.code_model).index(&FullRange)); .code_model).index(&FullRange));

View file

@ -240,7 +240,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
def::DefUse(_) | def::DefUse(_) |
def::DefMethod(..) | def::DefMethod(..) |
def::DefPrimTy(_) => { def::DefPrimTy(_) => {
self.sess.span_bug(span, format!("lookup_def_kind for unexpected item: {}", self.sess.span_bug(span, format!("lookup_def_kind for unexpected item: {:?}",
def).index(&FullRange)); def).index(&FullRange));
}, },
} }
@ -308,7 +308,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
}, },
_ => { _ => {
self.sess.span_bug(method.span, self.sess.span_bug(method.span,
format!("Container {} for method {} is not a node item {}", format!("Container {} for method {} is not a node item {:?}",
impl_id.node, impl_id.node,
method.id, method.id,
self.analysis.ty_cx.map.get(impl_id.node) self.analysis.ty_cx.map.get(impl_id.node)
@ -1444,7 +1444,8 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> {
// FIXME(nrc) what are these doing here? // FIXME(nrc) what are these doing here?
def::DefStatic(_, _) => {} def::DefStatic(_, _) => {}
def::DefConst(..) => {} def::DefConst(..) => {}
_ => error!("unexpected definition kind when processing collected paths: {}", *def) _ => error!("unexpected definition kind when processing collected paths: {:?}",
*def)
} }
} }
for &(id, span, ref path, ref_kind) in paths_to_process.iter() { for &(id, span, ref path, ref_kind) in paths_to_process.iter() {

View file

@ -518,7 +518,7 @@ fn enter_opt<'a, 'p, 'blk, 'tcx>(
variant_size: uint, variant_size: uint,
val: ValueRef) val: ValueRef)
-> Vec<Match<'a, 'p, 'blk, 'tcx>> { -> Vec<Match<'a, 'p, 'blk, 'tcx>> {
debug!("enter_opt(bcx={}, m={}, opt={}, col={}, val={})", debug!("enter_opt(bcx={}, m={}, opt={:?}, col={}, val={})",
bcx.to_str(), bcx.to_str(),
m.repr(bcx.tcx()), m.repr(bcx.tcx()),
*opt, *opt,
@ -1046,7 +1046,7 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
// Decide what kind of branch we need // Decide what kind of branch we need
let opts = get_branches(bcx, m, col); let opts = get_branches(bcx, m, col);
debug!("options={}", opts); debug!("options={:?}", opts);
let mut kind = NoBranch; let mut kind = NoBranch;
let mut test_val = val; let mut test_val = val;
debug!("test_val={}", bcx.val_to_string(test_val)); debug!("test_val={}", bcx.val_to_string(test_val));

View file

@ -145,7 +145,7 @@ pub fn represent_type<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
} }
let repr = Rc::new(represent_type_uncached(cx, t)); let repr = Rc::new(represent_type_uncached(cx, t));
debug!("Represented as: {}", repr); debug!("Represented as: {:?}", repr);
cx.adt_reprs().borrow_mut().insert(t, repr.clone()); cx.adt_reprs().borrow_mut().insert(t, repr.clone());
repr repr
} }
@ -482,7 +482,7 @@ fn mk_cenum<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
} }
fn range_to_inttype(cx: &CrateContext, hint: Hint, bounds: &IntBounds) -> IntType { fn range_to_inttype(cx: &CrateContext, hint: Hint, bounds: &IntBounds) -> IntType {
debug!("range_to_inttype: {} {}", hint, bounds); debug!("range_to_inttype: {:?} {:?}", hint, bounds);
// Lists of sizes to try. u64 is always allowed as a fallback. // Lists of sizes to try. u64 is always allowed as a fallback.
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
static choose_shortest: &'static[IntType] = &[ static choose_shortest: &'static[IntType] = &[
@ -533,7 +533,7 @@ pub fn ll_inttype(cx: &CrateContext, ity: IntType) -> Type {
} }
fn bounds_usable(cx: &CrateContext, ity: IntType, bounds: &IntBounds) -> bool { fn bounds_usable(cx: &CrateContext, ity: IntType, bounds: &IntBounds) -> bool {
debug!("bounds_usable: {} {}", ity, bounds); debug!("bounds_usable: {:?} {:?}", ity, bounds);
match ity { match ity {
attr::SignedInt(_) => { attr::SignedInt(_) => {
let lllo = C_integral(ll_inttype(cx, ity), bounds.slo as u64, true); let lllo = C_integral(ll_inttype(cx, ity), bounds.slo as u64, true);
@ -731,7 +731,7 @@ pub fn trans_get_discr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, r: &Repr<'tcx>,
-> ValueRef { -> ValueRef {
let signed; let signed;
let val; let val;
debug!("trans_get_discr r: {}", r); debug!("trans_get_discr r: {:?}", r);
match *r { match *r {
CEnum(ity, min, max) => { CEnum(ity, min, max) => {
val = load_discr(bcx, ity, scrutinee, min, max); val = load_discr(bcx, ity, scrutinee, min, max);

View file

@ -976,7 +976,7 @@ pub fn invoke<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
} }
if need_invoke(bcx) { if need_invoke(bcx) {
debug!("invoking {} at {}", bcx.val_to_string(llfn), bcx.llbb); debug!("invoking {} at {:?}", bcx.val_to_string(llfn), bcx.llbb);
for &llarg in llargs.iter() { for &llarg in llargs.iter() {
debug!("arg: {}", bcx.val_to_string(llarg)); debug!("arg: {}", bcx.val_to_string(llarg));
} }
@ -996,7 +996,7 @@ pub fn invoke<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
Some(attributes)); Some(attributes));
return (llresult, normal_bcx); return (llresult, normal_bcx);
} else { } else {
debug!("calling {} at {}", bcx.val_to_string(llfn), bcx.llbb); debug!("calling {} at {:?}", bcx.val_to_string(llfn), bcx.llbb);
for &llarg in llargs.iter() { for &llarg in llargs.iter() {
debug!("arg: {}", bcx.val_to_string(llarg)); debug!("arg: {}", bcx.val_to_string(llarg));
} }
@ -2742,7 +2742,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
} }
let item = ccx.tcx().map.get(id); let item = ccx.tcx().map.get(id);
debug!("get_item_val: id={} item={}", id, item); debug!("get_item_val: id={} item={:?}", id, item);
let val = match item { let val = match item {
ast_map::NodeItem(i) => { ast_map::NodeItem(i) => {
let ty = ty::node_id_to_type(ccx.tcx(), i.id); let ty = ty::node_id_to_type(ccx.tcx(), i.id);
@ -2917,7 +2917,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
} }
ref variant => { ref variant => {
ccx.sess().bug(format!("get_item_val(): unexpected variant: {}", ccx.sess().bug(format!("get_item_val(): unexpected variant: {:?}",
variant).index(&FullRange)) variant).index(&FullRange))
} }
}; };

Some files were not shown because too many files have changed in this diff Show more