core: split into fmt::Show and fmt::String
fmt::Show is for debugging, and can and should be implemented for all public types. This trait is used with `{:?}` syntax. There still exists #[derive(Show)]. fmt::String is for types that faithfully be represented as a String. Because of this, there is no way to derive fmt::String, all implementations must be purposeful. It is used by the default format syntax, `{}`. This will break most instances of `{}`, since that now requires the type to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the correct fix. Types that were being printed specifically for users should receive a fmt::String implementation to fix this. Part of #20013 [breaking-change]
This commit is contained in:
parent
8efd9901b6
commit
44440e5c18
@ -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 {
|
||||
let msg = match *self {
|
||||
fmt::String::fmt(match *self {
|
||||
CompileFail => "compile-fail",
|
||||
RunFail => "run-fail",
|
||||
RunPass => "run-pass",
|
||||
@ -54,8 +54,13 @@ impl fmt::Show for Mode {
|
||||
DebugInfoGdb => "debuginfo-gdb",
|
||||
DebugInfoLldb => "debuginfo-lldb",
|
||||
Codegen => "codegen",
|
||||
};
|
||||
msg.fmt(f)
|
||||
}, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Show for Mode {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt::String::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
|
||||
let matches =
|
||||
&match getopts::getopts(args_.as_slice(), groups.as_slice()) {
|
||||
Ok(m) => m,
|
||||
Err(f) => panic!("{}", f)
|
||||
Err(f) => panic!("{:?}", f)
|
||||
};
|
||||
|
||||
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) {
|
||||
Ok(re) => Some(re),
|
||||
Err(e) => {
|
||||
println!("failed to parse filter /{}/: {}", s, e);
|
||||
println!("failed to parse filter /{}/: {:?}", s, e);
|
||||
panic!()
|
||||
}
|
||||
}
|
||||
@ -186,11 +186,11 @@ pub fn parse_config(args: Vec<String> ) -> Config {
|
||||
pub fn log_config(config: &Config) {
|
||||
let c = config;
|
||||
logv(c, format!("configuration:"));
|
||||
logv(c, format!("compile_lib_path: {}", config.compile_lib_path));
|
||||
logv(c, format!("run_lib_path: {}", config.run_lib_path));
|
||||
logv(c, format!("rustc_path: {}", config.rustc_path.display()));
|
||||
logv(c, format!("src_base: {}", config.src_base.display()));
|
||||
logv(c, format!("build_base: {}", config.build_base.display()));
|
||||
logv(c, format!("compile_lib_path: {:?}", config.compile_lib_path));
|
||||
logv(c, format!("run_lib_path: {:?}", config.run_lib_path));
|
||||
logv(c, format!("rustc_path: {:?}", config.rustc_path.display()));
|
||||
logv(c, format!("src_base: {:?}", config.src_base.display()));
|
||||
logv(c, format!("build_base: {:?}", config.build_base.display()));
|
||||
logv(c, format!("stage_id: {}", config.stage_id));
|
||||
logv(c, format!("mode: {}", config.mode));
|
||||
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!("target: {}", config.target));
|
||||
logv(c, format!("host: {}", config.host));
|
||||
logv(c, format!("android-cross-path: {}",
|
||||
logv(c, format!("android-cross-path: {:?}",
|
||||
config.android_cross_path.display()));
|
||||
logv(c, format!("adb_path: {}", config.adb_path));
|
||||
logv(c, format!("adb_test_dir: {}", config.adb_test_dir));
|
||||
logv(c, format!("adb_path: {:?}", config.adb_path));
|
||||
logv(c, format!("adb_test_dir: {:?}", config.adb_test_dir));
|
||||
logv(c, format!("adb_device_status: {}",
|
||||
config.adb_device_status));
|
||||
match config.test_shard {
|
||||
@ -271,7 +271,7 @@ pub fn run_tests(config: &Config) {
|
||||
Ok(true) => {}
|
||||
Ok(false) => panic!("Some tests failed"),
|
||||
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> {
|
||||
debug!("making tests from {}",
|
||||
debug!("making tests from {:?}",
|
||||
config.src_base.display());
|
||||
let mut tests = Vec::new();
|
||||
let dirs = fs::readdir(&config.src_base).unwrap();
|
||||
for file in dirs.iter() {
|
||||
let file = file.clone();
|
||||
debug!("inspecting file {}", file.display());
|
||||
debug!("inspecting file {:?}", file.display());
|
||||
if is_test(config, &file) {
|
||||
let t = make_test(config, &file, || {
|
||||
match config.mode {
|
||||
|
@ -84,7 +84,7 @@ fn parse_expected(last_nonfollow_error: Option<uint>,
|
||||
(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,
|
||||
kind: kind,
|
||||
msg: msg, }))
|
||||
|
@ -61,7 +61,7 @@ pub fn run_metrics(config: Config, testfile: String, mm: &mut MetricMap) {
|
||||
print!("\n\n");
|
||||
}
|
||||
let testfile = Path::new(testfile);
|
||||
debug!("running {}", testfile.display());
|
||||
debug!("running {:?}", testfile.display());
|
||||
let props = header::load_props(&testfile);
|
||||
debug!("loaded props");
|
||||
match config.mode {
|
||||
@ -141,7 +141,7 @@ fn check_correct_failure_status(proc_res: &ProcRes) {
|
||||
static RUST_ERR: int = 101;
|
||||
if !proc_res.status.matches_exit_status(RUST_ERR) {
|
||||
fatal_proc_rec(
|
||||
format!("failure produced the wrong error: {}",
|
||||
format!("failure produced the wrong error: {:?}",
|
||||
proc_res.status).as_slice(),
|
||||
proc_res);
|
||||
}
|
||||
@ -410,7 +410,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
|
||||
],
|
||||
vec!(("".to_string(), "".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("",
|
||||
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())),
|
||||
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={}; \
|
||||
gdbserver :5039 {}/{}",
|
||||
@ -443,7 +443,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
|
||||
vec!(("".to_string(),
|
||||
"".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 {
|
||||
//waiting 1 second for gdbserver start
|
||||
timer::sleep(Duration::milliseconds(1000));
|
||||
@ -481,7 +481,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
|
||||
debugger_opts.as_slice(),
|
||||
vec!(("".to_string(), "".to_string())),
|
||||
None)
|
||||
.expect(format!("failed to exec `{}`", gdb_path).as_slice());
|
||||
.expect(format!("failed to exec `{:?}`", gdb_path).as_slice());
|
||||
let cmdline = {
|
||||
let cmdline = make_cmdline("",
|
||||
"arm-linux-androideabi-gdb",
|
||||
@ -548,7 +548,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
|
||||
|
||||
// Add line breakpoints
|
||||
for line in breakpoint_lines.iter() {
|
||||
script_str.push_str(format!("break '{}':{}\n",
|
||||
script_str.push_str(format!("break '{:?}':{}\n",
|
||||
testfile.filename_display(),
|
||||
*line)[]);
|
||||
}
|
||||
@ -889,7 +889,7 @@ fn check_error_patterns(props: &TestProps,
|
||||
output_to_check: &str,
|
||||
proc_res: &ProcRes) {
|
||||
if props.error_patterns.is_empty() {
|
||||
fatal(format!("no error pattern specified in {}",
|
||||
fatal(format!("no error pattern specified in {:?}",
|
||||
testfile.display()).as_slice());
|
||||
}
|
||||
let mut next_err_idx = 0u;
|
||||
@ -955,7 +955,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
|
||||
}
|
||||
|
||||
let prefixes = expected_errors.iter().map(|ee| {
|
||||
format!("{}:{}:", testfile.display(), ee.line)
|
||||
format!("{:?}:{}:", testfile.display(), ee.line)
|
||||
}).collect::<Vec<String> >();
|
||||
|
||||
#[cfg(windows)]
|
||||
@ -1191,7 +1191,7 @@ fn compose_and_run_compiler(
|
||||
None);
|
||||
if !auxres.status.success() {
|
||||
fatal_proc_rec(
|
||||
format!("auxiliary build of {} failed to compile: ",
|
||||
format!("auxiliary build of {:?} failed to compile: ",
|
||||
abs_ab.display()).as_slice(),
|
||||
&auxres);
|
||||
}
|
||||
@ -1601,7 +1601,7 @@ fn _arm_push_aux_shared_library(config: &Config, testfile: &Path) {
|
||||
.expect(format!("failed to exec `{}`", config.adb_path).as_slice());
|
||||
|
||||
if config.verbose {
|
||||
println!("push ({}) {} {} {}",
|
||||
println!("push ({}) {:?} {} {}",
|
||||
config.target, file.display(),
|
||||
copy_result.out, copy_result.err);
|
||||
}
|
||||
|
@ -581,7 +581,7 @@ impl<T: Eq> Eq for Arc<T> {}
|
||||
|
||||
impl<T: fmt::Show> fmt::Show for Arc<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
(**self).fmt(f)
|
||||
write!(f, "Arc({:?})", (**self))
|
||||
}
|
||||
}
|
||||
|
||||
@ -794,7 +794,7 @@ mod tests {
|
||||
#[test]
|
||||
fn show_arc() {
|
||||
let a = Arc::new(5u32);
|
||||
assert!(format!("{}", a) == "5")
|
||||
assert!(format!("{:?}", a) == "Arc(5u32)")
|
||||
}
|
||||
|
||||
// Make sure deriving works with Arc<T>
|
||||
|
@ -145,7 +145,13 @@ impl BoxAny for Box<Any> {
|
||||
|
||||
impl<T: ?Sized + fmt::Show> fmt::Show for Box<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
(**self).fmt(f)
|
||||
write!(f, "Box({:?})", &**self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<Sized? T: fmt::String> fmt::String for Box<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt::String::fmt(&**self, f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -607,7 +607,7 @@ impl<S: hash::Writer, T: Hash<S>> Hash<S> for Rc<T> {
|
||||
#[experimental = "Show is experimental."]
|
||||
impl<T: fmt::Show> fmt::Show for Rc<T> {
|
||||
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());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_show() {
|
||||
let foo = Rc::new(75u);
|
||||
assert!(format!("{:?}", foo) == "Rc(75u)")
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1729,13 +1729,13 @@ impl BitvSet {
|
||||
|
||||
impl fmt::Show for BitvSet {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
try!(write!(fmt, "{{"));
|
||||
try!(write!(fmt, "BitvSet {{"));
|
||||
let mut first = true;
|
||||
for n in self.iter() {
|
||||
if !first {
|
||||
try!(write!(fmt, ", "));
|
||||
}
|
||||
try!(write!(fmt, "{}", n));
|
||||
try!(write!(fmt, "{:?}", n));
|
||||
first = false;
|
||||
}
|
||||
write!(fmt, "}}")
|
||||
|
@ -866,11 +866,11 @@ impl<K: Ord, V: Ord> Ord for BTreeMap<K, V> {
|
||||
#[stable]
|
||||
impl<K: Show, V: Show> Show for BTreeMap<K, V> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
try!(write!(f, "{{"));
|
||||
try!(write!(f, "BTreeMap {{"));
|
||||
|
||||
for (i, (k, v)) in self.iter().enumerate() {
|
||||
if i != 0 { try!(write!(f, ", ")); }
|
||||
try!(write!(f, "{}: {}", *k, *v));
|
||||
try!(write!(f, "{:?}: {:?}", *k, *v));
|
||||
}
|
||||
|
||||
write!(f, "}}")
|
||||
|
@ -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.
|
||||
/// flag.set(true);
|
||||
///
|
||||
/// println!("Uninitialized memory: {}", handle.into_kv());
|
||||
/// println!("Uninitialized memory: {:?}", handle.into_kv());
|
||||
/// }
|
||||
/// ```
|
||||
#[derive(Copy)]
|
||||
|
@ -556,11 +556,11 @@ impl<'a, 'b, T: Ord + Clone> BitOr<&'b BTreeSet<T>> for &'a BTreeSet<T> {
|
||||
#[stable]
|
||||
impl<T: Show> Show for BTreeSet<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
try!(write!(f, "{{"));
|
||||
try!(write!(f, "BTreeSet {{"));
|
||||
|
||||
for (i, x) in self.iter().enumerate() {
|
||||
if i != 0 { try!(write!(f, ", ")); }
|
||||
try!(write!(f, "{}", *x));
|
||||
try!(write!(f, "{:?}", *x));
|
||||
}
|
||||
|
||||
write!(f, "}}")
|
||||
|
@ -663,11 +663,11 @@ impl<A: Clone> Clone for DList<A> {
|
||||
#[stable]
|
||||
impl<A: fmt::Show> fmt::Show for DList<A> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
try!(write!(f, "["));
|
||||
try!(write!(f, "DList ["));
|
||||
|
||||
for (i, e) in self.iter().enumerate() {
|
||||
if i != 0 { try!(write!(f, ", ")); }
|
||||
try!(write!(f, "{}", *e));
|
||||
try!(write!(f, "{:?}", *e));
|
||||
}
|
||||
|
||||
write!(f, "]")
|
||||
|
@ -33,13 +33,13 @@ impl<E> Copy for EnumSet<E> {}
|
||||
|
||||
impl<E:CLike+fmt::Show> fmt::Show for EnumSet<E> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
try!(write!(fmt, "{{"));
|
||||
try!(write!(fmt, "EnumSet {{"));
|
||||
let mut first = true;
|
||||
for e in self.iter() {
|
||||
if !first {
|
||||
try!(write!(fmt, ", "));
|
||||
}
|
||||
try!(write!(fmt, "{}", e));
|
||||
try!(write!(fmt, "{:?}", e));
|
||||
first = false;
|
||||
}
|
||||
write!(fmt, "}}")
|
||||
@ -287,11 +287,11 @@ mod test {
|
||||
#[test]
|
||||
fn test_show() {
|
||||
let mut e = EnumSet::new();
|
||||
assert_eq!("{}", e.to_string());
|
||||
assert!(format!("{:?}", e) == "EnumSet {}");
|
||||
e.insert(A);
|
||||
assert_eq!("{A}", e.to_string());
|
||||
assert!(format!("{:?}", e) == "EnumSet {A}");
|
||||
e.insert(C);
|
||||
assert_eq!("{A, C}", e.to_string());
|
||||
assert!(format!("{:?}", e) == "EnumSet {A, C}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1613,11 +1613,11 @@ impl<A> Extend<A> for RingBuf<A> {
|
||||
#[stable]
|
||||
impl<T: fmt::Show> fmt::Show for RingBuf<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
try!(write!(f, "["));
|
||||
try!(write!(f, "RingBuf ["));
|
||||
|
||||
for (i, e) in self.iter().enumerate() {
|
||||
if i != 0 { try!(write!(f, ", ")); }
|
||||
try!(write!(f, "{}", *e));
|
||||
try!(write!(f, "{:?}", *e));
|
||||
}
|
||||
|
||||
write!(f, "]")
|
||||
|
@ -2466,25 +2466,25 @@ mod tests {
|
||||
macro_rules! test_show_vec {
|
||||
($x:expr, $x_str:expr) => ({
|
||||
let (x, x_str) = ($x, $x_str);
|
||||
assert_eq!(format!("{}", x), x_str);
|
||||
assert_eq!(format!("{}", x.as_slice()), x_str);
|
||||
assert_eq!(format!("{:?}", x), x_str);
|
||||
assert_eq!(format!("{:?}", x.as_slice()), x_str);
|
||||
})
|
||||
}
|
||||
let empty: Vec<int> = vec![];
|
||||
test_show_vec!(empty, "[]");
|
||||
test_show_vec!(vec![1i], "[1]");
|
||||
test_show_vec!(vec![1i, 2, 3], "[1, 2, 3]");
|
||||
test_show_vec!(vec![1i], "[1i]");
|
||||
test_show_vec!(vec![1i, 2, 3], "[1i, 2i, 3i]");
|
||||
test_show_vec!(vec![vec![], vec![1u], vec![1u, 1u]],
|
||||
"[[], [1], [1, 1]]");
|
||||
"[[], [1u], [1u, 1u]]");
|
||||
|
||||
let empty_mut: &mut [int] = &mut[];
|
||||
test_show_vec!(empty_mut, "[]");
|
||||
let v: &mut[int] = &mut[1];
|
||||
test_show_vec!(v, "[1]");
|
||||
test_show_vec!(v, "[1i]");
|
||||
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]];
|
||||
test_show_vec!(v, "[[], [1], [1, 1]]");
|
||||
test_show_vec!(v, "[[], [1u], [1u, 1u]]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -677,13 +677,25 @@ impl FromUtf8Error {
|
||||
|
||||
impl fmt::Show for FromUtf8Error {
|
||||
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 {
|
||||
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 {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
(**self).fmt(f)
|
||||
fmt::Show::fmt(&**self, f)
|
||||
}
|
||||
}
|
||||
|
||||
@ -895,6 +914,8 @@ pub trait ToString {
|
||||
fn to_string(&self) -> String;
|
||||
}
|
||||
|
||||
#[cfg(stage0)]
|
||||
//NOTE(stage0): remove after stage0 snapshot
|
||||
impl<T: fmt::Show> ToString for T {
|
||||
fn to_string(&self) -> String {
|
||||
use core::fmt::Writer;
|
||||
@ -905,6 +926,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 {
|
||||
fn into_cow(self) -> CowString<'static> {
|
||||
Cow::Owned(self)
|
||||
|
@ -1432,7 +1432,14 @@ impl<T> Default for Vec<T> {
|
||||
#[experimental = "waiting on Show stability"]
|
||||
impl<T:fmt::Show> fmt::Show for Vec<T> {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -488,11 +488,11 @@ impl<V: Ord> Ord for VecMap<V> {
|
||||
#[stable]
|
||||
impl<V: fmt::Show> fmt::Show for VecMap<V> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
try!(write!(f, "{{"));
|
||||
try!(write!(f, "VecMap {{"));
|
||||
|
||||
for (i, (k, v)) in self.iter().enumerate() {
|
||||
if i != 0 { try!(write!(f, ", ")); }
|
||||
try!(write!(f, "{}: {}", k, *v));
|
||||
try!(write!(f, "{}: {:?}", k, *v));
|
||||
}
|
||||
|
||||
write!(f, "}}")
|
||||
@ -928,9 +928,9 @@ mod test_map {
|
||||
map.insert(1, 2i);
|
||||
map.insert(3, 4i);
|
||||
|
||||
let map_str = map.to_string();
|
||||
assert!(map_str == "{1: 2, 3: 4}" || map_str == "{3: 4, 1: 2}");
|
||||
assert_eq!(format!("{}", empty), "{}");
|
||||
let map_str = format!("{:?}", map);
|
||||
assert!(map_str == "VecMap {1: 2i, 3: 4i}" || map_str == "{3: 4i, 1: 2i}");
|
||||
assert_eq!(format!("{:?}", empty), "VecMap {}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -46,7 +46,7 @@
|
||||
//! // different type: just print it out unadorned.
|
||||
//! match value_any.downcast_ref::<String>() {
|
||||
//! Some(as_string) => {
|
||||
//! println!("String ({}): {}", as_string.len(), as_string);
|
||||
//! println!("String ({}): {:?}", as_string.len(), as_string);
|
||||
//! }
|
||||
//! None => {
|
||||
//! println!("{}", value);
|
||||
|
@ -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> {
|
||||
/// Borrowed data.
|
||||
Borrowed(&'a B),
|
||||
@ -141,6 +142,16 @@ pub enum Cow<'a, T, B: ?Sized + 'a> where B: ToOwned<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]
|
||||
impl<'a, T, B: ?Sized> Clone for Cow<'a, T, B> where B: ToOwned<T> {
|
||||
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 {
|
||||
match *self {
|
||||
Borrowed(ref b) => fmt::Show::fmt(b, f),
|
||||
Owned(ref o) => fmt::Show::fmt(o, f),
|
||||
Borrowed(ref b) => fmt::String::fmt(b, f),
|
||||
Owned(ref o) => fmt::String::fmt(o, f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -160,7 +160,6 @@
|
||||
use clone::Clone;
|
||||
use cmp::PartialEq;
|
||||
use default::Default;
|
||||
use fmt;
|
||||
use kinds::{Copy, Send};
|
||||
use ops::{Deref, DerefMut, Drop};
|
||||
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> {
|
||||
_borrow: &'b Cell<BorrowFlag>,
|
||||
}
|
||||
|
@ -13,7 +13,8 @@
|
||||
#![allow(unused_variables)]
|
||||
|
||||
use any;
|
||||
use cell::{Cell, Ref, RefMut};
|
||||
use cell::{Cell, RefCell, Ref, RefMut};
|
||||
use char::CharExt;
|
||||
use iter::{Iterator, IteratorExt, range};
|
||||
use kinds::{Copy, Sized};
|
||||
use mem;
|
||||
@ -215,21 +216,37 @@ pub struct Arguments<'a> {
|
||||
args: &'a [Argument<'a>],
|
||||
}
|
||||
|
||||
#[cfg(stage0)]
|
||||
//FIXME: remove after stage0 snapshot
|
||||
impl<'a> Show for Arguments<'a> {
|
||||
fn fmt(&self, fmt: &mut Formatter) -> Result {
|
||||
write(fmt.buf, *self)
|
||||
}
|
||||
}
|
||||
|
||||
/// When a format is not otherwise specified, types are formatted by ascribing
|
||||
/// to this trait. There is not an explicit way of selecting this trait to be
|
||||
/// used for formatting, it is only if no other format is specified.
|
||||
#[cfg(not(stage0))]
|
||||
impl<'a> String for Arguments<'a> {
|
||||
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"]
|
||||
pub trait Show {
|
||||
/// Formats the value using the given formatter.
|
||||
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
|
||||
#[unstable = "I/O and core have yet to be reconciled"]
|
||||
@ -572,7 +589,7 @@ impl<'a> Formatter<'a> {
|
||||
|
||||
impl Show for Error {
|
||||
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
|
||||
|
||||
impl<'a, T: ?Sized + Show> Show for &'a T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result { (**self).fmt(f) }
|
||||
}
|
||||
impl<'a, T: ?Sized + Show> Show for &'a mut T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result { (**self).fmt(f) }
|
||||
}
|
||||
|
||||
impl Show for bool {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
Show::fmt(if *self { "true" } else { "false" }, f)
|
||||
macro_rules! fmt_refs {
|
||||
($($tr:ident),*) => {
|
||||
$(
|
||||
impl<'a, T: ?Sized + $tr> $tr for &'a T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, f) }
|
||||
}
|
||||
impl<'a, T: ?Sized + $tr> $tr for &'a mut T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, 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 {
|
||||
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 {
|
||||
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 {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
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 amt = self.encode_utf8(&mut utf8).unwrap_or(0);
|
||||
let s: &str = unsafe { mem::transmute(utf8[..amt]) };
|
||||
Show::fmt(s, f)
|
||||
f.write_str(s)
|
||||
}
|
||||
}
|
||||
|
||||
@ -653,7 +723,15 @@ impl<'a, T> Pointer for &'a mut T {
|
||||
}
|
||||
|
||||
macro_rules! floating { ($ty:ident) => {
|
||||
|
||||
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 {
|
||||
use num::Float;
|
||||
|
||||
@ -746,7 +824,7 @@ macro_rules! tuple {
|
||||
if n > 0 {
|
||||
try!(write!(f, ", "));
|
||||
}
|
||||
try!(write!(f, "{}", *$name));
|
||||
try!(write!(f, "{:?}", *$name));
|
||||
n += 1;
|
||||
)*
|
||||
if n == 1 {
|
||||
@ -777,7 +855,7 @@ impl<T: Show> Show for [T] {
|
||||
} else {
|
||||
try!(write!(f, ", "));
|
||||
}
|
||||
try!(write!(f, "{}", *x))
|
||||
try!(write!(f, "{:?}", *x))
|
||||
}
|
||||
if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 {
|
||||
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 () {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
f.pad("()")
|
||||
@ -794,23 +887,33 @@ impl Show for () {
|
||||
|
||||
impl<T: Copy + Show> Show for Cell<T> {
|
||||
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> {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
(**self).fmt(f)
|
||||
Show::fmt(&**self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'b, T: Show> Show for RefMut<'b, T> {
|
||||
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 {
|
||||
match *self {
|
||||
Utf8Error::InvalidByte(n) => {
|
||||
|
@ -153,8 +153,22 @@ pub fn radix<T>(x: T, base: u8) -> RadixFmt<T, Radix> {
|
||||
}
|
||||
|
||||
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> {
|
||||
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 {
|
||||
match *self { RadixFmt(ref x, radix) => radix.$fmt(*x as $U, f) }
|
||||
}
|
||||
@ -170,24 +184,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 {
|
||||
($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! { Octal for $Int as $Uint -> Octal }
|
||||
int_base! { LowerHex for $Int as $Uint -> LowerHex }
|
||||
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! { Octal for $Uint as $Uint -> Octal }
|
||||
int_base! { LowerHex for $Uint as $Uint -> LowerHex }
|
||||
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! { i16, u16 }
|
||||
integer! { i32, u32 }
|
||||
|
@ -83,7 +83,7 @@ macro_rules! assert_eq {
|
||||
if !((*left_val == *right_val) &&
|
||||
(*right_val == *left_val)) {
|
||||
panic!("assertion failed: `(left == right) && (right == left)` \
|
||||
(left: `{}`, right: `{}`)", *left_val, *right_val)
|
||||
(left: `{:?}`, right: `{:?}`)", *left_val, *right_val)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,10 +47,10 @@
|
||||
//! let version = parse_version(&[1, 2, 3, 4]);
|
||||
//! match version {
|
||||
//! Ok(v) => {
|
||||
//! println!("working with version: {}", v);
|
||||
//! println!("working with version: {:?}", v);
|
||||
//! }
|
||||
//! 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 {
|
||||
Ok(t) => t,
|
||||
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 {
|
||||
match self {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ Section: Creating a string
|
||||
*/
|
||||
|
||||
/// 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"]
|
||||
pub enum Utf8Error {
|
||||
/// An invalid byte was detected at the byte offset given.
|
||||
|
@ -56,12 +56,12 @@ fn any_downcast_ref() {
|
||||
|
||||
match a.downcast_ref::<uint>() {
|
||||
Some(&5) => {}
|
||||
x => panic!("Unexpected value {}", x)
|
||||
x => panic!("Unexpected value {:?}", x)
|
||||
}
|
||||
|
||||
match a.downcast_ref::<Test>() {
|
||||
None => {}
|
||||
x => panic!("Unexpected value {}", x)
|
||||
x => panic!("Unexpected value {:?}", x)
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ fn any_downcast_mut() {
|
||||
assert_eq!(*x, 5u);
|
||||
*x = 612;
|
||||
}
|
||||
x => panic!("Unexpected value {}", x)
|
||||
x => panic!("Unexpected value {:?}", x)
|
||||
}
|
||||
|
||||
match b_r.downcast_mut::<uint>() {
|
||||
@ -87,27 +87,27 @@ fn any_downcast_mut() {
|
||||
assert_eq!(*x, 7u);
|
||||
*x = 413;
|
||||
}
|
||||
x => panic!("Unexpected value {}", x)
|
||||
x => panic!("Unexpected value {:?}", x)
|
||||
}
|
||||
|
||||
match a_r.downcast_mut::<Test>() {
|
||||
None => (),
|
||||
x => panic!("Unexpected value {}", x)
|
||||
x => panic!("Unexpected value {:?}", x)
|
||||
}
|
||||
|
||||
match b_r.downcast_mut::<Test>() {
|
||||
None => (),
|
||||
x => panic!("Unexpected value {}", x)
|
||||
x => panic!("Unexpected value {:?}", x)
|
||||
}
|
||||
|
||||
match a_r.downcast_mut::<uint>() {
|
||||
Some(&612) => {}
|
||||
x => panic!("Unexpected value {}", x)
|
||||
x => panic!("Unexpected value {:?}", x)
|
||||
}
|
||||
|
||||
match b_r.downcast_mut::<uint>() {
|
||||
Some(&413) => {}
|
||||
x => panic!("Unexpected value {}", x)
|
||||
x => panic!("Unexpected value {:?}", x)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,10 +29,10 @@ fn smoketest_cell() {
|
||||
#[test]
|
||||
fn cell_has_sensible_show() {
|
||||
let x = Cell::new("foo bar");
|
||||
assert!(format!("{}", x).contains(x.get()));
|
||||
assert!(format!("{:?}", x).contains(x.get()));
|
||||
|
||||
x.set("baz qux");
|
||||
assert!(format!("{}", x).contains(x.get()));
|
||||
assert!(format!("{:?}", x).contains(x.get()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -40,11 +40,11 @@ fn ref_and_refmut_have_sensible_show() {
|
||||
let refcell = RefCell::new("foo");
|
||||
|
||||
let refcell_refmut = refcell.borrow_mut();
|
||||
assert!(format!("{}", refcell_refmut).contains("foo"));
|
||||
assert!(format!("{:?}", refcell_refmut).contains("foo"));
|
||||
drop(refcell_refmut);
|
||||
|
||||
let refcell_ref = refcell.borrow();
|
||||
assert!(format!("{}", refcell_ref).contains("foo"));
|
||||
assert!(format!("{:?}", refcell_ref).contains("foo"));
|
||||
drop(refcell_ref);
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,11 @@ fn test_format_int() {
|
||||
assert!(format!("{}", -1i16) == "-1");
|
||||
assert!(format!("{}", -1i32) == "-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}", 1i8) == "1");
|
||||
assert!(format!("{:b}", 1i16) == "1");
|
||||
@ -52,6 +57,11 @@ fn test_format_int() {
|
||||
assert!(format!("{}", 1u16) == "1");
|
||||
assert!(format!("{}", 1u32) == "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}", 1u8) == "1");
|
||||
assert!(format!("{:b}", 1u16) == "1");
|
||||
@ -84,12 +94,14 @@ fn test_format_int() {
|
||||
#[test]
|
||||
fn test_format_int_zero() {
|
||||
assert!(format!("{}", 0i) == "0");
|
||||
assert!(format!("{:?}", 0i) == "0i");
|
||||
assert!(format!("{:b}", 0i) == "0");
|
||||
assert!(format!("{:o}", 0i) == "0");
|
||||
assert!(format!("{:x}", 0i) == "0");
|
||||
assert!(format!("{:X}", 0i) == "0");
|
||||
|
||||
assert!(format!("{}", 0u) == "0");
|
||||
assert!(format!("{:?}", 0u) == "0u");
|
||||
assert!(format!("{:b}", 0u) == "0");
|
||||
assert!(format!("{:o}", 0u) == "0");
|
||||
assert!(format!("{:x}", 0u) == "0");
|
||||
@ -183,6 +195,12 @@ mod 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]
|
||||
fn format_base_36(b: &mut Bencher) {
|
||||
let mut rng = weak_rng();
|
||||
@ -219,6 +237,12 @@ mod 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]
|
||||
fn format_base_36(b: &mut Bencher) {
|
||||
let mut rng = weak_rng();
|
||||
|
@ -95,10 +95,10 @@ pub fn test_fmt_default() {
|
||||
let ok: Result<int, &'static str> = Ok(100);
|
||||
let err: Result<int, &'static str> = Err("Err");
|
||||
|
||||
let s = format!("{}", ok);
|
||||
assert_eq!(s, "Ok(100)");
|
||||
let s = format!("{}", err);
|
||||
assert_eq!(s, "Err(Err)");
|
||||
let s = format!("{:?}", ok);
|
||||
assert_eq!(s, "Ok(100i)");
|
||||
let s = format!("{:?}", err);
|
||||
assert_eq!(s, "Err(\"Err\")");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -59,10 +59,10 @@ fn test_tuple_cmp() {
|
||||
|
||||
#[test]
|
||||
fn test_show() {
|
||||
let s = format!("{}", (1i,));
|
||||
assert_eq!(s, "(1,)");
|
||||
let s = format!("{}", (1i, true));
|
||||
assert_eq!(s, "(1, true)");
|
||||
let s = format!("{}", (1i, "hi", true));
|
||||
assert_eq!(s, "(1, hi, true)");
|
||||
let s = format!("{:?}", (1i,));
|
||||
assert_eq!(s, "(1i,)");
|
||||
let s = format!("{:?}", (1i, true));
|
||||
assert_eq!(s, "(1i, true)");
|
||||
let s = format!("{:?}", (1i, "hi", true));
|
||||
assert_eq!(s, "(1i, \"hi\", true)");
|
||||
}
|
||||
|
@ -212,12 +212,12 @@ impl<'a> Parser<'a> {
|
||||
self.cur.next();
|
||||
}
|
||||
Some((_, other)) => {
|
||||
self.err(format!("expected `{}`, found `{}`", c, other)[]);
|
||||
self.err(format!("expected `{:?}`, found `{:?}`", c, other)[]);
|
||||
}
|
||||
None => {
|
||||
self.err(format!("expected `{}` but string was terminated",
|
||||
self.err(format!("expected `{:?}` but string was terminated",
|
||||
c)[]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ use std::iter::repeat;
|
||||
use std::result;
|
||||
|
||||
/// Name of an option. Either a string or a single char.
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
#[derive(Clone, PartialEq, Eq, Show)]
|
||||
pub enum Name {
|
||||
/// A string representing the long name of an option.
|
||||
/// For example: "help"
|
||||
@ -116,7 +116,7 @@ pub enum Name {
|
||||
}
|
||||
|
||||
/// Describes whether an option has an argument.
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Show)]
|
||||
pub enum HasArg {
|
||||
/// The option requires an argument.
|
||||
Yes,
|
||||
@ -127,7 +127,7 @@ pub enum HasArg {
|
||||
}
|
||||
|
||||
/// Describes how often an option may occur.
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Show)]
|
||||
pub enum Occur {
|
||||
/// The option occurs once.
|
||||
Req,
|
||||
@ -138,7 +138,7 @@ pub enum Occur {
|
||||
}
|
||||
|
||||
/// A description of a possible option.
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
#[derive(Clone, PartialEq, Eq, Show)]
|
||||
pub struct Opt {
|
||||
/// Name of the option
|
||||
pub name: Name,
|
||||
@ -152,7 +152,7 @@ pub struct Opt {
|
||||
|
||||
/// One group of options, e.g., both `-h` and `--help`, along with
|
||||
/// their shared description and properties.
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
#[derive(Clone, PartialEq, Eq, Show)]
|
||||
pub struct OptGroup {
|
||||
/// Short name of the option, e.g. `h` for a `-h` option
|
||||
pub short_name: String,
|
||||
@ -169,7 +169,7 @@ pub struct OptGroup {
|
||||
}
|
||||
|
||||
/// Describes whether an option is given at all or has a value.
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
#[derive(Clone, PartialEq, Eq, Show)]
|
||||
enum Optval {
|
||||
Val(String),
|
||||
Given,
|
||||
@ -177,7 +177,7 @@ enum Optval {
|
||||
|
||||
/// The result of checking command line arguments. Contains a vector
|
||||
/// of matches and a vector of free strings.
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
#[derive(Clone, PartialEq, Eq, Show)]
|
||||
pub struct Matches {
|
||||
/// Options that matched
|
||||
opts: Vec<Opt>,
|
||||
@ -190,7 +190,7 @@ pub struct Matches {
|
||||
/// The type returned when the command line does not conform to the
|
||||
/// expected format. Use the `Show` implementation to output detailed
|
||||
/// information.
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
#[derive(Clone, PartialEq, Eq, Show)]
|
||||
pub enum Fail {
|
||||
/// The option requires an argument but none was passed.
|
||||
ArgumentMissing(String),
|
||||
@ -205,7 +205,7 @@ pub enum Fail {
|
||||
}
|
||||
|
||||
/// The type of failure that occurred.
|
||||
#[derive(Copy, PartialEq, Eq)]
|
||||
#[derive(Copy, PartialEq, Eq, Show)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum FailType {
|
||||
ArgumentMissing_,
|
||||
@ -536,13 +536,13 @@ pub fn opt(short_name: &str,
|
||||
|
||||
impl Fail {
|
||||
/// 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 {
|
||||
self.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Show for Fail {
|
||||
impl fmt::String for Fail {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
ArgumentMissing(ref nm) => {
|
||||
|
@ -84,7 +84,7 @@ pub fn parse_logging_spec(spec: &str) -> (Vec<LogDirective>, Option<Regex>) {
|
||||
match Regex::new(filter) {
|
||||
Ok(re) => Some(re),
|
||||
Err(e) => {
|
||||
println!("warning: invalid regex filter - {}", e);
|
||||
println!("warning: invalid regex filter - {:?}", e);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
@ -16,12 +16,12 @@
|
||||
//! #[macro_use] extern crate log;
|
||||
//!
|
||||
//! fn main() {
|
||||
//! debug!("this is a debug {}", "message");
|
||||
//! debug!("this is a debug {:?}", "message");
|
||||
//! error!("this is printed by default");
|
||||
//!
|
||||
//! if log_enabled!(log::INFO) {
|
||||
//! 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);
|
||||
|
||||
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 {
|
||||
let LogLevel(level) = *self;
|
||||
match LOG_LEVEL_NAMES.get(level as uint - 1) {
|
||||
Some(name) => name.fmt(fmt),
|
||||
None => level.fmt(fmt)
|
||||
Some(ref name) => fmt::String::fmt(name, fmt),
|
||||
None => fmt::String::fmt(&level, fmt)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -254,7 +260,7 @@ impl Logger for DefaultLogger {
|
||||
record.level,
|
||||
record.module_path,
|
||||
record.args) {
|
||||
Err(e) => panic!("failed to log: {}", e),
|
||||
Err(e) => panic!("failed to log: {:?}", e),
|
||||
Ok(()) => {}
|
||||
}
|
||||
}
|
||||
@ -264,7 +270,7 @@ impl Drop for DefaultLogger {
|
||||
fn drop(&mut self) {
|
||||
// FIXME(#12628): is panicking the right thing to do?
|
||||
match self.handle.flush() {
|
||||
Err(e) => panic!("failed to flush a logger: {}", e),
|
||||
Err(e) => panic!("failed to flush a logger: {:?}", e),
|
||||
Ok(()) => {}
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ pub mod reader {
|
||||
match $e {
|
||||
Ok(e) => e,
|
||||
Err(e) => {
|
||||
debug!("ignored error: {}", e);
|
||||
debug!("ignored error: {:?}", e);
|
||||
return $r
|
||||
}
|
||||
}
|
||||
@ -256,7 +256,7 @@ pub mod reader {
|
||||
match maybe_get_doc(d, tg) {
|
||||
Some(d) => d,
|
||||
None => {
|
||||
error!("failed to find block with tag {}", tg);
|
||||
error!("failed to find block with tag {:?}", tg);
|
||||
panic!();
|
||||
}
|
||||
}
|
||||
@ -351,8 +351,8 @@ pub mod reader {
|
||||
self.pos = r_doc.end;
|
||||
let str = r_doc.as_str_slice();
|
||||
if lbl != str {
|
||||
return Err(Expected(format!("Expected label {} but \
|
||||
found {}", lbl, str)));
|
||||
return Err(Expected(format!("Expected label {:?} but \
|
||||
found {:?}", lbl, str)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -360,14 +360,14 @@ pub mod reader {
|
||||
}
|
||||
|
||||
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 {
|
||||
return Err(Expected(format!("no more documents in \
|
||||
current node!")));
|
||||
}
|
||||
let TaggedDoc { tag: r_tag, doc: r_doc } =
|
||||
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.end,
|
||||
self.pos,
|
||||
@ -375,8 +375,8 @@ pub mod reader {
|
||||
r_doc.start,
|
||||
r_doc.end);
|
||||
if r_tag != (exp_tag as uint) {
|
||||
return Err(Expected(format!("expected EBML doc with tag {} but \
|
||||
found tag {}", exp_tag, r_tag)));
|
||||
return Err(Expected(format!("expected EBML doc with tag {:?} but \
|
||||
found tag {:?}", exp_tag, r_tag)));
|
||||
}
|
||||
if r_doc.end > self.parent.end {
|
||||
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> {
|
||||
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)
|
||||
}
|
||||
|
||||
@ -486,7 +486,7 @@ pub mod reader {
|
||||
fn read_enum<T, F>(&mut self, name: &str, f: F) -> DecodeResult<T> where
|
||||
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
|
||||
{
|
||||
debug!("read_enum({})", name);
|
||||
debug!("read_enum({:?})", name);
|
||||
try!(self._check_label(name));
|
||||
|
||||
let doc = try!(self.next_doc(EsEnum));
|
||||
@ -508,7 +508,7 @@ pub mod reader {
|
||||
{
|
||||
debug!("read_enum_variant()");
|
||||
let idx = try!(self._next_uint(EsEnumVid));
|
||||
debug!(" idx={}", idx);
|
||||
debug!(" idx={:?}", idx);
|
||||
|
||||
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
|
||||
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
|
||||
{
|
||||
debug!("read_enum_variant_arg(idx={})", idx);
|
||||
debug!("read_enum_variant_arg(idx={:?})", idx);
|
||||
f(self)
|
||||
}
|
||||
|
||||
@ -536,7 +536,7 @@ pub mod reader {
|
||||
{
|
||||
debug!("read_enum_struct_variant()");
|
||||
let idx = try!(self._next_uint(EsEnumVid));
|
||||
debug!(" idx={}", idx);
|
||||
debug!(" idx={:?}", idx);
|
||||
|
||||
let doc = try!(self.next_doc(EsEnumBody));
|
||||
|
||||
@ -558,21 +558,21 @@ pub mod reader {
|
||||
-> DecodeResult<T> where
|
||||
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)
|
||||
}
|
||||
|
||||
fn read_struct<T, F>(&mut self, name: &str, _: uint, f: F) -> DecodeResult<T> where
|
||||
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
|
||||
{
|
||||
debug!("read_struct(name={})", name);
|
||||
debug!("read_struct(name={:?})", name);
|
||||
f(self)
|
||||
}
|
||||
|
||||
fn read_struct_field<T, F>(&mut self, name: &str, idx: uint, f: F) -> DecodeResult<T> where
|
||||
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));
|
||||
f(self)
|
||||
}
|
||||
@ -594,14 +594,14 @@ pub mod reader {
|
||||
fn read_tuple_arg<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
|
||||
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)
|
||||
}
|
||||
|
||||
fn read_tuple_struct<T, F>(&mut self, name: &str, len: uint, f: F) -> DecodeResult<T> where
|
||||
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
|
||||
{
|
||||
debug!("read_tuple_struct(name={})", name);
|
||||
debug!("read_tuple_struct(name={:?})", name);
|
||||
self.read_tuple(len, f)
|
||||
}
|
||||
|
||||
@ -611,7 +611,7 @@ pub mod reader {
|
||||
-> DecodeResult<T> where
|
||||
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)
|
||||
}
|
||||
|
||||
@ -638,7 +638,7 @@ pub mod reader {
|
||||
debug!("read_seq()");
|
||||
self.push_doc(EsVec, move |d| {
|
||||
let len = try!(d._next_uint(EsVecLen));
|
||||
debug!(" len={}", len);
|
||||
debug!(" len={:?}", 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
|
||||
F: FnOnce(&mut Decoder<'doc>) -> DecodeResult<T>,
|
||||
{
|
||||
debug!("read_seq_elt(idx={})", idx);
|
||||
debug!("read_seq_elt(idx={:?})", idx);
|
||||
self.push_doc(EsVecElt, f)
|
||||
}
|
||||
|
||||
@ -656,7 +656,7 @@ pub mod reader {
|
||||
debug!("read_map()");
|
||||
self.push_doc(EsMap, move |d| {
|
||||
let len = try!(d._next_uint(EsMapLen));
|
||||
debug!(" len={}", len);
|
||||
debug!(" len={:?}", 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
|
||||
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)
|
||||
}
|
||||
|
||||
fn read_map_elt_val<T, F>(&mut self, idx: uint, f: F) -> DecodeResult<T> where
|
||||
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)
|
||||
}
|
||||
|
||||
@ -1007,7 +1007,7 @@ pub mod writer {
|
||||
}
|
||||
|
||||
pub fn start_tag(&mut self, tag_id: uint) -> EncodeResult {
|
||||
debug!("Start tag {}", tag_id);
|
||||
debug!("Start tag {:?}", tag_id);
|
||||
|
||||
// Write the enum ID:
|
||||
try!(write_vuint(self.writer, tag_id));
|
||||
@ -1026,7 +1026,7 @@ pub mod writer {
|
||||
try!(write_sized_vuint(self.writer, size, 4u));
|
||||
let r = try!(self.writer.seek(cur_pos as i64, io::SeekSet));
|
||||
|
||||
debug!("End tag (size = {})", size);
|
||||
debug!("End tag (size = {:?})", size);
|
||||
Ok(r)
|
||||
}
|
||||
|
||||
@ -1093,12 +1093,12 @@ pub mod writer {
|
||||
}
|
||||
|
||||
pub fn wr_bytes(&mut self, b: &[u8]) -> EncodeResult {
|
||||
debug!("Write {} bytes", b.len());
|
||||
debug!("Write {:?} bytes", b.len());
|
||||
self.writer.write(b)
|
||||
}
|
||||
|
||||
pub fn wr_str(&mut self, s: &str) -> EncodeResult {
|
||||
debug!("Write str: {}", s);
|
||||
debug!("Write str: {:?}", s);
|
||||
self.writer.write(s.as_bytes())
|
||||
}
|
||||
}
|
||||
@ -1608,7 +1608,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_option_int() {
|
||||
fn test_v(v: Option<int>) {
|
||||
debug!("v == {}", v);
|
||||
debug!("v == {:?}", v);
|
||||
let mut wr = SeekableMemWriter::new();
|
||||
{
|
||||
let mut rbml_w = writer::Encoder::new(&mut wr);
|
||||
@ -1617,7 +1617,7 @@ mod tests {
|
||||
let rbml_doc = Doc::new(wr.get_ref());
|
||||
let mut deser = reader::Decoder::new(rbml_doc);
|
||||
let v1 = Decodable::decode(&mut deser).unwrap();
|
||||
debug!("v1 == {}", v1);
|
||||
debug!("v1 == {:?}", v1);
|
||||
assert_eq!(v, v1);
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
//! Regular expressions implemented in Rust
|
||||
//!
|
||||
//! For official documentation, see the rust-lang/regex crate
|
||||
|
||||
#![crate_name = "regex"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
|
@ -39,7 +39,7 @@ pub struct Error {
|
||||
|
||||
impl fmt::Show for Error {
|
||||
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)
|
||||
}
|
||||
}
|
||||
@ -121,7 +121,7 @@ impl BuildAst {
|
||||
fn flags(&self) -> Flags {
|
||||
match *self {
|
||||
Paren(flags, _, _) => flags,
|
||||
_ => panic!("Cannot get flags from {}", self),
|
||||
_ => panic!("Cannot get flags from {:?}", self),
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ impl BuildAst {
|
||||
match *self {
|
||||
Paren(_, 0, _) => None,
|
||||
Paren(_, c, _) => Some(c),
|
||||
_ => panic!("Cannot get capture group from {}", self),
|
||||
_ => panic!("Cannot get capture group from {:?}", self),
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ impl BuildAst {
|
||||
Some(name.clone())
|
||||
}
|
||||
}
|
||||
_ => panic!("Cannot get capture name from {}", self),
|
||||
_ => panic!("Cannot get capture name from {:?}", self),
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ impl BuildAst {
|
||||
fn unwrap(self) -> Result<Ast, Error> {
|
||||
match self {
|
||||
Expr(x) => Ok(x),
|
||||
_ => panic!("Tried to unwrap non-AST item: {}", self),
|
||||
_ => panic!("Tried to unwrap non-AST item: {:?}", self),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -284,7 +284,7 @@ impl<'a> Parser<'a> {
|
||||
match self.next_char() {
|
||||
true => Ok(()),
|
||||
false => {
|
||||
self.err(format!("Expected {} but got EOF.",
|
||||
self.err(format!("Expected {:?} but got EOF.",
|
||||
expected)[])
|
||||
}
|
||||
}
|
||||
@ -293,10 +293,10 @@ impl<'a> Parser<'a> {
|
||||
fn expect(&mut self, expected: char) -> Result<(), Error> {
|
||||
match self.next_char() {
|
||||
true if self.cur() == expected => Ok(()),
|
||||
true => self.err(format!("Expected '{}' but got '{}'.",
|
||||
true => self.err(format!("Expected '{:?}' but got '{:?}'.",
|
||||
expected, self.cur())[]),
|
||||
false => {
|
||||
self.err(format!("Expected '{}' but got EOF.",
|
||||
self.err(format!("Expected '{:?}' but got EOF.",
|
||||
expected)[])
|
||||
}
|
||||
}
|
||||
@ -394,7 +394,7 @@ impl<'a> Parser<'a> {
|
||||
continue
|
||||
}
|
||||
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.
|
||||
None => {},
|
||||
},
|
||||
@ -409,7 +409,7 @@ impl<'a> Parser<'a> {
|
||||
return self.err(
|
||||
"\\A, \\z, \\b and \\B are not valid escape \
|
||||
sequences inside a character class."),
|
||||
ast => panic!("Unexpected AST item '{}'", ast),
|
||||
ast => panic!("Unexpected AST item '{:?}'", ast),
|
||||
}
|
||||
}
|
||||
']' if ranges.len() > 0 || alts.len() > 0 => {
|
||||
@ -442,7 +442,7 @@ impl<'a> Parser<'a> {
|
||||
match try!(self.parse_escape()) {
|
||||
Literal(c3, _) => c2 = c3, // allow literal escapes below
|
||||
ast =>
|
||||
return self.err(format!("Expected a literal, but got {}.",
|
||||
return self.err(format!("Expected a literal, but got {:?}.",
|
||||
ast)[]),
|
||||
}
|
||||
}
|
||||
@ -512,7 +512,7 @@ impl<'a> Parser<'a> {
|
||||
None => {
|
||||
return self.err(format!("No closing brace for counted \
|
||||
repetition starting at position \
|
||||
{}.",
|
||||
{:?}.",
|
||||
start)[])
|
||||
}
|
||||
};
|
||||
@ -685,7 +685,7 @@ impl<'a> Parser<'a> {
|
||||
match num::from_str_radix::<u32>(s[], 8) {
|
||||
Some(n) => Ok(Literal(try!(self.char_from_u32(n)), FLAG_EMPTY)),
|
||||
None => {
|
||||
self.err(format!("Could not parse '{}' as octal number.",
|
||||
self.err(format!("Could not parse {:?} as octal number.",
|
||||
s)[])
|
||||
}
|
||||
}
|
||||
|
@ -90,10 +90,19 @@ impl Clone for ExNative {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(stage0)]
|
||||
//FIXME: remove after stage0 snapshot
|
||||
impl fmt::Show for Regex {
|
||||
/// Shows the original regular expression.
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1629,7 +1629,6 @@ declare_lint! {
|
||||
Warn,
|
||||
"detects use of #[deprecated] items"
|
||||
}
|
||||
|
||||
// FIXME #6875: Change to Warn after std library stabilization is complete
|
||||
declare_lint! {
|
||||
EXPERIMENTAL,
|
||||
@ -1848,7 +1847,7 @@ declare_lint! {
|
||||
"detects transmutes of fat pointers"
|
||||
}
|
||||
|
||||
declare_lint!{
|
||||
declare_lint! {
|
||||
pub MISSING_COPY_IMPLEMENTATIONS,
|
||||
Warn,
|
||||
"detects potentially-forgotten implementations of `Copy`"
|
||||
|
@ -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(),
|
||||
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()
|
||||
});
|
||||
let the_field = expect(tcx.sess.diagnostic(),
|
||||
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,
|
||||
def)).to_string()
|
||||
});
|
||||
|
@ -845,7 +845,7 @@ fn encode_info_for_method<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
|
||||
parent_id: NodeId,
|
||||
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));
|
||||
rbml_w.start_tag(tag_items_data_item);
|
||||
|
||||
@ -887,7 +887,7 @@ fn encode_info_for_associated_type(ecx: &EncodeContext,
|
||||
impl_path: PathElems,
|
||||
parent_id: NodeId,
|
||||
typedef_opt: Option<P<ast::Typedef>>) {
|
||||
debug!("encode_info_for_associated_type({},{})",
|
||||
debug!("encode_info_for_associated_type({:?},{:?})",
|
||||
associated_type.def_id,
|
||||
token::get_name(associated_type.name));
|
||||
|
||||
|
@ -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>()) {
|
||||
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)
|
||||
};
|
||||
let def_num = match str::from_utf8(def_part).ok().and_then(|s| s.parse::<uint>()) {
|
||||
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)
|
||||
};
|
||||
ast::DefId { krate: crate_num, node: def_num }
|
||||
|
@ -82,7 +82,7 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
|
||||
e::IIImplItemRef(_, &ast::MethodImplItem(ref m)) => m.id,
|
||||
e::IIImplItemRef(_, &ast::TypeImplItem(ref ti)) => ti.id,
|
||||
};
|
||||
debug!("> Encoding inlined item: {} ({})",
|
||||
debug!("> Encoding inlined item: {} ({:?})",
|
||||
ecx.tcx.map.path_to_string(id),
|
||||
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);
|
||||
rbml_w.end_tag();
|
||||
|
||||
debug!("< Encoded inlined fn: {} ({})",
|
||||
debug!("< Encoded inlined fn: {} ({:?})",
|
||||
ecx.tcx.map.path_to_string(id),
|
||||
rbml_w.writer.tell());
|
||||
}
|
||||
@ -127,7 +127,7 @@ pub fn decode_inlined_item<'tcx>(cdata: &cstore::crate_metadata,
|
||||
None => Err(path),
|
||||
Some(ast_doc) => {
|
||||
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.
|
||||
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),
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -480,12 +480,12 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
|
||||
let inputs = inline_asm.inputs.iter();
|
||||
let outputs = inline_asm.outputs.iter();
|
||||
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;
|
||||
&**expr
|
||||
}), pred);
|
||||
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;
|
||||
&**expr
|
||||
}), post_inputs);
|
||||
@ -622,7 +622,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
|
||||
r => {
|
||||
self.tcx.sess.span_bug(
|
||||
expr.span,
|
||||
format!("bad entry `{}` in def_map for label",
|
||||
format!("bad entry `{:?}` in def_map for label",
|
||||
r)[]);
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &ast::Expr) {
|
||||
DefStruct(_) | DefVariant(_, _, _) => {}
|
||||
|
||||
def => {
|
||||
debug!("(checking const) found bad def: {}", def);
|
||||
debug!("(checking const) found bad def: {:?}", def);
|
||||
span_err!(v.tcx.sess, e.span, E0014,
|
||||
"paths in constants may only refer to constants \
|
||||
or functions");
|
||||
|
@ -574,7 +574,7 @@ fn is_useful(cx: &MatchCheckCtxt,
|
||||
witness: WitnessPreference)
|
||||
-> Usefulness {
|
||||
let &Matrix(ref rows) = matrix;
|
||||
debug!("{:}", matrix);
|
||||
debug!("{:?}", matrix);
|
||||
if rows.len() == 0u {
|
||||
return match witness {
|
||||
ConstructWitness => UsefulWithWitness(vec!()),
|
||||
@ -1042,7 +1042,7 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
|
||||
cx.tcx.sess.span_bug(
|
||||
p.span,
|
||||
format!("binding pattern {} is not an \
|
||||
identifier: {}",
|
||||
identifier: {:?}",
|
||||
p.id,
|
||||
p.node)[]);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for RvalueContextDelegate<'a, 'tcx> {
|
||||
span: Span,
|
||||
cmt: mc::cmt<'tcx>,
|
||||
_: 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) {
|
||||
span_err!(self.tcx.sess, span, E0161,
|
||||
"cannot move a value of type {0}: the size of {0} cannot be statically determined",
|
||||
|
@ -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 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={}) \
|
||||
num_nodes: {}",
|
||||
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]) {
|
||||
//! 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));
|
||||
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);
|
||||
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));
|
||||
}
|
||||
|
||||
@ -315,7 +315,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
||||
temp_bits[]
|
||||
}
|
||||
};
|
||||
debug!("{} each_bit_for_node({}, cfgidx={}) bits={}",
|
||||
debug!("{} each_bit_for_node({:?}, cfgidx={:?}) bits={}",
|
||||
self.analysis_name, e, cfgidx, bits_to_string(slice));
|
||||
self.each_bit(slice, f)
|
||||
}
|
||||
@ -410,7 +410,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
||||
}
|
||||
}
|
||||
None => {
|
||||
debug!("{} add_kills_from_flow_exits flow_exit={} \
|
||||
debug!("{} add_kills_from_flow_exits flow_exit={:?} \
|
||||
no cfg_idx for exiting_scope={}",
|
||||
self.analysis_name, flow_exit, node_id);
|
||||
}
|
||||
@ -419,10 +419,10 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
||||
|
||||
if changed {
|
||||
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));
|
||||
bits.clone_from_slice(orig_kills[]);
|
||||
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));
|
||||
}
|
||||
true
|
||||
@ -481,7 +481,7 @@ impl<'a, 'b, 'tcx, O:DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> {
|
||||
assert!(self.dfcx.bits_per_id > 0);
|
||||
|
||||
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));
|
||||
|
||||
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) {
|
||||
let source = edge.source();
|
||||
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);
|
||||
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)
|
||||
};
|
||||
if changed {
|
||||
debug!("{} changed entry set for {} to {}",
|
||||
debug!("{} changed entry set for {:?} to {}",
|
||||
self.dfcx.analysis_name, cfgidx,
|
||||
bits_to_string(self.dfcx.on_entry.slice(start, end)));
|
||||
self.changed = true;
|
||||
|
@ -149,7 +149,7 @@ fn calculate_type(sess: &session::Session,
|
||||
add_library(sess, cnum, cstore::RequireDynamic, &mut formats);
|
||||
let deps = csearch::get_dylib_dependency_formats(&sess.cstore, cnum);
|
||||
for &(depnum, style) in deps.iter() {
|
||||
debug!("adding {}: {}", style,
|
||||
debug!("adding {:?}: {}", style,
|
||||
sess.cstore.get_crate_data(depnum).name.clone());
|
||||
add_library(sess, depnum, style, &mut formats);
|
||||
}
|
||||
|
@ -1035,7 +1035,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
|
||||
if pat_util::pat_is_binding(def_map, pat) {
|
||||
let tcx = typer.tcx();
|
||||
|
||||
debug!("binding cmt_pat={} pat={} match_mode={}",
|
||||
debug!("binding cmt_pat={} pat={} match_mode={:?}",
|
||||
cmt_pat.repr(tcx),
|
||||
pat.repr(tcx),
|
||||
match_mode);
|
||||
@ -1171,7 +1171,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
|
||||
// pattern.
|
||||
|
||||
if !tcx.sess.has_errors() {
|
||||
let msg = format!("Pattern has unexpected type: {} and type {}",
|
||||
let msg = format!("Pattern has unexpected type: {:?} and type {}",
|
||||
def,
|
||||
cmt_pat.ty.repr(tcx));
|
||||
tcx.sess.span_bug(pat.span, msg[])
|
||||
@ -1188,7 +1188,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
|
||||
// reported.
|
||||
|
||||
if !tcx.sess.has_errors() {
|
||||
let msg = format!("Pattern has unexpected def: {} and type {}",
|
||||
let msg = format!("Pattern has unexpected def: {:?} and type {}",
|
||||
def,
|
||||
cmt_pat.ty.repr(tcx));
|
||||
tcx.sess.span_bug(pat.span, msg[])
|
||||
|
@ -55,7 +55,7 @@ pub struct Edge<E> {
|
||||
|
||||
impl<E: Show> Show for Edge<E> {
|
||||
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.target, self.data)
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
||||
ty::mt{ty: ty, mutbl: mt_b.mutbl});
|
||||
try!(self.get_ref().infcx.try(|_| sub.tys(ty, b)));
|
||||
debug!("Success, coerced with AutoDerefRef(1, \
|
||||
AutoPtr(AutoUnsize({})))", kind);
|
||||
AutoPtr(AutoUnsize({:?})))", kind);
|
||||
Ok(Some(AdjustDerefRef(AutoDerefRef {
|
||||
autoderefs: 1,
|
||||
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});
|
||||
try!(self.get_ref().infcx.try(|_| sub.tys(ty, b)));
|
||||
debug!("Success, coerced with AutoDerefRef(1, \
|
||||
AutoPtr(AutoUnsize({})))", kind);
|
||||
AutoPtr(AutoUnsize({:?})))", kind);
|
||||
Ok(Some(AdjustDerefRef(AutoDerefRef {
|
||||
autoderefs: 1,
|
||||
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);
|
||||
try!(self.get_ref().infcx.try(|_| sub.tys(ty, b)));
|
||||
debug!("Success, coerced with AutoDerefRef(1, \
|
||||
AutoUnsizeUniq({}))", kind);
|
||||
AutoUnsizeUniq({:?}))", kind);
|
||||
Ok(Some(AdjustDerefRef(AutoDerefRef {
|
||||
autoderefs: 1,
|
||||
autoref: Some(ty::AutoUnsizeUniq(kind))
|
||||
@ -328,7 +328,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
||||
a: Ty<'tcx>,
|
||||
ty_b: Ty<'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();
|
||||
|
||||
@ -406,7 +406,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
||||
{
|
||||
let tcx = self.tcx();
|
||||
|
||||
debug!("coerce_borrowed_object(a={}, b={}, b_mutbl={})",
|
||||
debug!("coerce_borrowed_object(a={}, b={}, b_mutbl={:?})",
|
||||
a.repr(tcx),
|
||||
b.repr(tcx), b_mutbl);
|
||||
|
||||
@ -426,7 +426,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
||||
{
|
||||
let tcx = self.tcx();
|
||||
|
||||
debug!("coerce_unsafe_object(a={}, b={}, b_mutbl={})",
|
||||
debug!("coerce_unsafe_object(a={}, b={}, b_mutbl={:?})",
|
||||
a.repr(tcx),
|
||||
b.repr(tcx), b_mutbl);
|
||||
|
||||
@ -449,7 +449,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
||||
match a.sty {
|
||||
ty::ty_rptr(_, ty::mt{ty, mutbl}) => match ty.sty {
|
||||
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());
|
||||
try!(self.subtype(mk_ty(tr), b));
|
||||
Ok(Some(AdjustDerefRef(AutoDerefRef {
|
||||
|
@ -361,7 +361,7 @@ pub trait Combine<'tcx> : Sized {
|
||||
a: ty::TraitStore,
|
||||
b: 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) {
|
||||
(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 a_sty = &a.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) {
|
||||
// The "subtype" ought to be handling cases involving var:
|
||||
(&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 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 bounds = try!(this.existential_bounds(&a_.bounds, &b_.bounds));
|
||||
Ok(ty::mk_trait(tcx, principal, bounds))
|
||||
@ -724,7 +724,7 @@ impl<'f, 'tcx> CombineFields<'f, 'tcx> {
|
||||
Some(e) => e,
|
||||
};
|
||||
|
||||
debug!("instantiate(a_ty={} dir={} b_vid={})",
|
||||
debug!("instantiate(a_ty={} dir={:?} b_vid={})",
|
||||
a_ty.repr(tcx),
|
||||
dir,
|
||||
b_vid.repr(tcx));
|
||||
@ -745,7 +745,7 @@ impl<'f, 'tcx> CombineFields<'f, 'tcx> {
|
||||
self.generalize(a_ty, b_vid, true)
|
||||
}
|
||||
});
|
||||
debug!("instantiate(a_ty={}, dir={}, \
|
||||
debug!("instantiate(a_ty={}, dir={:?}, \
|
||||
b_vid={}, generalized_ty={})",
|
||||
a_ty.repr(tcx), dir, b_vid.repr(tcx),
|
||||
generalized_ty.repr(tcx));
|
||||
|
@ -268,7 +268,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
let pe = ProcessedErrors(var_origins, trace_origins, same_regions);
|
||||
debug!("errors processed: {}", pe);
|
||||
debug!("errors processed: {:?}", pe);
|
||||
processed_errors.push(pe);
|
||||
}
|
||||
return processed_errors;
|
||||
@ -297,7 +297,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
|
||||
sub: Region,
|
||||
sup: Region)
|
||||
-> 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) {
|
||||
(ReFree(fr1), ReFree(fr2)) => {
|
||||
if fr1.scope != fr2.scope {
|
||||
|
@ -154,7 +154,7 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C
|
||||
// Regions that pre-dated the LUB computation stay as they are.
|
||||
if !is_var_in_set(new_vars, r0) {
|
||||
assert!(!r0.is_bound());
|
||||
debug!("generalize_region(r0={}): not new variable", r0);
|
||||
debug!("generalize_region(r0={:?}): not new variable", r0);
|
||||
return r0;
|
||||
}
|
||||
|
||||
@ -164,8 +164,8 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C
|
||||
// *related* to regions that pre-date the LUB computation
|
||||
// stay as they are.
|
||||
if !tainted.iter().all(|r| is_var_in_set(new_vars, *r)) {
|
||||
debug!("generalize_region(r0={}): \
|
||||
non-new-variables found in {}",
|
||||
debug!("generalize_region(r0={:?}): \
|
||||
non-new-variables found in {:?}",
|
||||
r0, tainted);
|
||||
assert!(!r0.is_bound());
|
||||
return r0;
|
||||
@ -178,8 +178,8 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C
|
||||
// with.
|
||||
for (a_br, a_r) in a_map.iter() {
|
||||
if tainted.iter().any(|x| x == a_r) {
|
||||
debug!("generalize_region(r0={}): \
|
||||
replacing with {}, tainted={}",
|
||||
debug!("generalize_region(r0={:?}): \
|
||||
replacing with {:?}, tainted={:?}",
|
||||
r0, *a_br, tainted);
|
||||
return ty::ReLateBound(debruijn, *a_br);
|
||||
}
|
||||
@ -187,7 +187,7 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C
|
||||
|
||||
infcx.tcx.sess.span_bug(
|
||||
span,
|
||||
format!("region {} is not associated with \
|
||||
format!("region {:?} is not associated with \
|
||||
any bound region from A!",
|
||||
r0)[])
|
||||
}
|
||||
@ -322,7 +322,7 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C
|
||||
}
|
||||
infcx.tcx.sess.span_bug(
|
||||
span,
|
||||
format!("could not find original bound region for {}", r)[]);
|
||||
format!("could not find original bound region for {:?}", r)[]);
|
||||
}
|
||||
|
||||
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 => {
|
||||
combiner.infcx().tcx.sess.span_bug(
|
||||
combiner.trace().origin.span(),
|
||||
format!("found non-region-vid: {}", r)[]);
|
||||
format!("found non-region-vid: {:?}", r)[]);
|
||||
}
|
||||
}).collect()
|
||||
}
|
||||
|
@ -989,7 +989,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
err: Option<&ty::type_err<'tcx>>) where
|
||||
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));
|
||||
|
||||
@ -1219,7 +1219,7 @@ impl<'tcx> Repr<'tcx> for SubregionOrigin<'tcx> {
|
||||
}
|
||||
Reborrow(a) => format!("Reborrow({})", a.repr(tcx)),
|
||||
ReborrowUpvar(a, b) => {
|
||||
format!("ReborrowUpvar({},{})", a.repr(tcx), b)
|
||||
format!("ReborrowUpvar({},{:?})", a.repr(tcx), b)
|
||||
}
|
||||
ReferenceOutlivesReferent(_, a) => {
|
||||
format!("ReferenceOutlivesReferent({})", a.repr(tcx))
|
||||
@ -1277,7 +1277,7 @@ impl<'tcx> Repr<'tcx> for RegionVariableOrigin<'tcx> {
|
||||
format!("EarlyBoundRegion({},{})", a.repr(tcx), b.repr(tcx))
|
||||
}
|
||||
LateBoundRegion(a, b, c) => {
|
||||
format!("LateBoundRegion({},{},{})", a.repr(tcx), b.repr(tcx), c)
|
||||
format!("LateBoundRegion({},{},{:?})", a.repr(tcx), b.repr(tcx), c)
|
||||
}
|
||||
BoundRegionInCoherence(a) => {
|
||||
format!("bound_regionInCoherence({})", a.repr(tcx))
|
||||
|
@ -67,7 +67,7 @@ pub fn maybe_print_constraints_for<'a, 'tcx>(region_vars: &RegionVarBindings<'a,
|
||||
}
|
||||
|
||||
let requested_output = os::getenv("RUST_REGION_GRAPH");
|
||||
debug!("requested_output: {} requested_node: {}",
|
||||
debug!("requested_output: {:?} requested_node: {:?}",
|
||||
requested_output, requested_node);
|
||||
|
||||
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 {
|
||||
match *n {
|
||||
Node::RegionVid(n_vid) =>
|
||||
dot::LabelText::label(format!("{}", n_vid)),
|
||||
dot::LabelText::label(format!("{:?}", n_vid)),
|
||||
Node::Region(n_rgn) =>
|
||||
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 {
|
||||
let (n1, _) = constraint_to_nodes(edge);
|
||||
debug!("edge {} has source {}", edge, n1);
|
||||
debug!("edge {:?} has source {:?}", edge, n1);
|
||||
n1
|
||||
}
|
||||
fn target(&self, edge: &Edge) -> Node {
|
||||
let (_, n2) = constraint_to_nodes(edge);
|
||||
debug!("edge {} has target {}", edge, n2);
|
||||
debug!("edge {:?} has target {:?}", edge, n2);
|
||||
n2
|
||||
}
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
}
|
||||
|
||||
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();
|
||||
assert!(undo_log.len() > snapshot.length);
|
||||
assert!((*undo_log)[snapshot.length] == OpenSnapshot);
|
||||
@ -325,7 +325,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
if self.in_snapshot() {
|
||||
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));
|
||||
return vid;
|
||||
}
|
||||
@ -427,7 +427,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
|
||||
let mut givens = self.givens.borrow_mut();
|
||||
if givens.insert((sub, sup)) {
|
||||
debug!("add_given({} <= {})",
|
||||
debug!("add_given({} <= {:?})",
|
||||
sub.repr(self.tcx),
|
||||
sup);
|
||||
|
||||
@ -565,7 +565,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
}
|
||||
Some(ref values) => {
|
||||
let r = lookup(values, rid);
|
||||
debug!("resolve_var({}) = {}", rid, r.repr(self.tcx));
|
||||
debug!("resolve_var({:?}) = {}", rid, r.repr(self.tcx));
|
||||
r
|
||||
}
|
||||
}
|
||||
@ -602,7 +602,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
}
|
||||
relate(self, a, ReInfer(ReVar(c)));
|
||||
relate(self, b, ReInfer(ReVar(c)));
|
||||
debug!("combine_vars() c={}", c);
|
||||
debug!("combine_vars() c={:?}", 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
|
||||
/// regions are being improperly related to other regions.
|
||||
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();
|
||||
|
||||
// `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() {
|
||||
// nb: can't use uint::range() here because result_set grows
|
||||
let r = result_set[result_index];
|
||||
debug!("result_index={}, r={}", result_index, r);
|
||||
debug!("result_index={}, r={:?}", result_index, r);
|
||||
|
||||
for undo_entry in
|
||||
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.var_origins.borrow())[v_id.index as uint].span(),
|
||||
format!("lub_concrete_regions invoked with \
|
||||
non-concrete regions: {}, {}",
|
||||
non-concrete regions: {:?}, {:?}",
|
||||
a,
|
||||
b)[]);
|
||||
}
|
||||
@ -827,7 +827,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
a: Region,
|
||||
b: Region)
|
||||
-> cres<'tcx, Region> {
|
||||
debug!("glb_concrete_regions({}, {})", a, b);
|
||||
debug!("glb_concrete_regions({:?}, {:?})", a, b);
|
||||
match (a, b) {
|
||||
(ReLateBound(..), _) |
|
||||
(_, ReLateBound(..)) |
|
||||
@ -854,7 +854,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
self.tcx.sess.span_bug(
|
||||
(*self.var_origins.borrow())[v_id.index as uint].span(),
|
||||
format!("glb_concrete_regions invoked with \
|
||||
non-concrete regions: {}, {}",
|
||||
non-concrete regions: {:?}, {:?}",
|
||||
a,
|
||||
b)[]);
|
||||
}
|
||||
@ -932,7 +932,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
// scopes or two free regions. So, if one of
|
||||
// these scopes is a subscope of the other, return
|
||||
// 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);
|
||||
match self.tcx.region_maps.nearest_common_ancestor(scope_a, 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
|
||||
// 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);
|
||||
|
||||
self.expansion(var_data.as_mut_slice());
|
||||
@ -1039,7 +1039,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
b_data: &mut VarData)
|
||||
-> bool
|
||||
{
|
||||
debug!("expand_node({}, {} == {})",
|
||||
debug!("expand_node({}, {:?} == {})",
|
||||
a_region.repr(self.tcx),
|
||||
b_vid,
|
||||
b_data.value.repr(self.tcx));
|
||||
@ -1058,7 +1058,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
b_data.classification = Expanding;
|
||||
match b_data.value {
|
||||
NoValue => {
|
||||
debug!("Setting initial value of {} to {}",
|
||||
debug!("Setting initial value of {:?} to {}",
|
||||
b_vid, a_region.repr(self.tcx));
|
||||
|
||||
b_data.value = Value(a_region);
|
||||
@ -1071,7 +1071,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
return false;
|
||||
}
|
||||
|
||||
debug!("Expanding value of {} from {} to {}",
|
||||
debug!("Expanding value of {:?} from {} to {}",
|
||||
b_vid,
|
||||
cur_region.repr(self.tcx),
|
||||
lub.repr(self.tcx));
|
||||
@ -1122,7 +1122,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
a_data: &mut VarData,
|
||||
b_region: Region)
|
||||
-> bool {
|
||||
debug!("contract_node({} == {}/{}, {})",
|
||||
debug!("contract_node({:?} == {}/{:?}, {})",
|
||||
a_vid, a_data.value.repr(self.tcx),
|
||||
a_data.classification, b_region.repr(self.tcx));
|
||||
|
||||
@ -1156,7 +1156,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
b_region: Region)
|
||||
-> bool {
|
||||
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_region.repr(this.tcx),
|
||||
b_region.repr(this.tcx));
|
||||
@ -1176,7 +1176,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
if glb == a_region {
|
||||
false
|
||||
} else {
|
||||
debug!("Contracting value of {} from {} to {}",
|
||||
debug!("Contracting value of {:?} from {} to {}",
|
||||
a_vid,
|
||||
a_region.repr(this.tcx),
|
||||
glb.repr(this.tcx));
|
||||
@ -1185,7 +1185,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
Err(_) => {
|
||||
debug!("Setting {} to ErrorValue: no glb of {}, {}",
|
||||
debug!("Setting {:?} to ErrorValue: no glb of {}, {}",
|
||||
a_vid,
|
||||
a_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.var_origins.borrow())[node_idx.index as uint].span(),
|
||||
format!("collect_error_for_expanding_node() could not find error \
|
||||
for var {}, lower_bounds={}, upper_bounds={}",
|
||||
for var {:?}, lower_bounds={}, upper_bounds={}",
|
||||
node_idx,
|
||||
lower_bounds.repr(self.tcx),
|
||||
upper_bounds.repr(self.tcx))[]);
|
||||
@ -1457,7 +1457,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
self.tcx.sess.span_bug(
|
||||
(*self.var_origins.borrow())[node_idx.index as uint].span(),
|
||||
format!("collect_error_for_contracting_node() could not find error \
|
||||
for var {}, upper_bounds={}",
|
||||
for var {:?}, upper_bounds={}",
|
||||
node_idx,
|
||||
upper_bounds.repr(self.tcx))[]);
|
||||
}
|
||||
@ -1498,8 +1498,8 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
state.dup_found = true;
|
||||
}
|
||||
|
||||
debug!("collect_concrete_regions(orig_node_idx={}, node_idx={}, \
|
||||
classification={})",
|
||||
debug!("collect_concrete_regions(orig_node_idx={:?}, node_idx={:?}, \
|
||||
classification={:?})",
|
||||
orig_node_idx, node_idx, classification);
|
||||
|
||||
// figure out the direction from which this node takes its
|
||||
@ -1520,7 +1520,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
graph: &RegionGraph,
|
||||
source_vid: RegionVid,
|
||||
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);
|
||||
graph.each_adjacent_edge(source_node_index, dir, |_, edge| {
|
||||
|
@ -184,7 +184,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
|
||||
let escaping_type = self.probe(vid).unwrap();
|
||||
escaping_types.push(escaping_type);
|
||||
}
|
||||
debug!("SpecifyVar({}) new_elem_threshold={}", vid, new_elem_threshold);
|
||||
debug!("SpecifyVar({:?}) new_elem_threshold={}", vid, new_elem_threshold);
|
||||
}
|
||||
|
||||
_ => { }
|
||||
|
@ -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 {
|
||||
let index = self.values.push(Root(value, 0));
|
||||
let k = UnifyKey::from_index(index);
|
||||
debug!("{}: created new key: {}",
|
||||
debug!("{}: created new key: {:?}",
|
||||
UnifyKey::tag(None::<K>),
|
||||
k);
|
||||
k
|
||||
|
@ -209,7 +209,7 @@ impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
Some((space, index, ¶m_ty)) => {
|
||||
debug!("with_each_combination: space={}, index={}, param_ty={}",
|
||||
debug!("with_each_combination: space={:?}, index={}, param_ty={}",
|
||||
space, index, param_ty.repr(self.tcx));
|
||||
|
||||
if !ty::type_is_sized(param_env, span, param_ty) {
|
||||
|
@ -289,7 +289,7 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> {
|
||||
self.lnks.push(lnk);
|
||||
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));
|
||||
|
||||
ln
|
||||
@ -299,7 +299,7 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> {
|
||||
let ln = self.add_live_node(lnk);
|
||||
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 {
|
||||
@ -314,7 +314,7 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> {
|
||||
ImplicitRet | CleanExit => {}
|
||||
}
|
||||
|
||||
debug!("{} is {}", v.to_string(), vk);
|
||||
debug!("{:?} is {:?}", v, vk);
|
||||
|
||||
v
|
||||
}
|
||||
@ -377,7 +377,7 @@ fn visit_fn(ir: &mut IrMaps,
|
||||
// swap in a new set of IR maps for this function body:
|
||||
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() {
|
||||
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) {
|
||||
for pat in arm.pats.iter() {
|
||||
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);
|
||||
let name = path1.node;
|
||||
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:
|
||||
ast::ExprPath(_) => {
|
||||
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 {
|
||||
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, _, _, _) => {
|
||||
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);
|
||||
let name = path1.node;
|
||||
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) {
|
||||
let idx = node_base_idx + var_idx;
|
||||
if test(idx).is_valid() {
|
||||
try!(write!(wr, " {}", Variable(var_idx).to_string()));
|
||||
try!(write!(wr, " {:?}", Variable(var_idx)));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@ -740,11 +740,11 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
||||
let mut wr = Vec::new();
|
||||
{
|
||||
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);
|
||||
write!(wr, " writes");
|
||||
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()
|
||||
}
|
||||
@ -792,8 +792,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
||||
}
|
||||
});
|
||||
|
||||
debug!("merge_from_succ(ln={}, succ={}, first_merge={}, changed={})",
|
||||
ln.to_string(), self.ln_str(succ_ln), first_merge, changed);
|
||||
debug!("merge_from_succ(ln={:?}, succ={}, first_merge={}, changed={})",
|
||||
ln, self.ln_str(succ_ln), first_merge, changed);
|
||||
return changed;
|
||||
|
||||
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].writer = invalid_node();
|
||||
|
||||
debug!("{} defines {} (idx={}): {}", writer.to_string(), var.to_string(),
|
||||
debug!("{:?} defines {:?} (idx={}): {}", writer, var,
|
||||
idx, self.ln_str(writer));
|
||||
}
|
||||
|
||||
// Either read, write, or both depending on the acc bitset
|
||||
fn acc(&mut self, ln: LiveNode, var: Variable, acc: uint) {
|
||||
debug!("{} accesses[{:x}] {}: {}",
|
||||
ln.to_string(), acc, var.to_string(), self.ln_str(ln));
|
||||
debug!("{:?} accesses[{:x}] {:?}: {}",
|
||||
ln, acc, var, self.ln_str(ln));
|
||||
|
||||
let idx = self.idx(ln, var);
|
||||
let user = &mut self.users[idx];
|
||||
@ -857,14 +857,14 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
||||
|this| this.propagate_through_fn_block(decl, body));
|
||||
|
||||
// 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) {
|
||||
debug!("{}", self.ln_str(LiveNode(ln_idx)));
|
||||
debug!("{:?}", self.ln_str(LiveNode(ln_idx)));
|
||||
}
|
||||
body.id
|
||||
},
|
||||
entry_ln.to_string());
|
||||
entry_ln);
|
||||
|
||||
entry_ln
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
|
||||
expr_ty: Ty<'tcx>,
|
||||
def: def::Def)
|
||||
-> McResult<cmt<'tcx>> {
|
||||
debug!("cat_def: id={} expr={} def={}",
|
||||
debug!("cat_def: id={} expr={} def={:?}",
|
||||
id, expr_ty.repr(self.tcx()), def);
|
||||
|
||||
match def {
|
||||
@ -860,7 +860,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
|
||||
};
|
||||
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())));
|
||||
|
||||
let base_cmt = match method_ty {
|
||||
@ -1455,7 +1455,7 @@ impl<'tcx> cmt_<'tcx> {
|
||||
|
||||
impl<'tcx> Repr<'tcx> for cmt_<'tcx> {
|
||||
fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
|
||||
format!("{{{} id:{} m:{} ty:{}}}",
|
||||
format!("{{{} id:{} m:{:?} ty:{}}}",
|
||||
self.cat.repr(tcx),
|
||||
self.id,
|
||||
self.mutbl,
|
||||
@ -1470,7 +1470,7 @@ impl<'tcx> Repr<'tcx> for categorization<'tcx> {
|
||||
cat_rvalue(..) |
|
||||
cat_local(..) |
|
||||
cat_upvar(..) => {
|
||||
format!("{}", *self)
|
||||
format!("{:?}", *self)
|
||||
}
|
||||
cat_deref(ref cmt, derefs, ptr) => {
|
||||
format!("{}-{}{}->", cmt.cat.repr(tcx), ptr_sigil(ptr), derefs)
|
||||
|
@ -435,28 +435,28 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
|
||||
fn def_privacy(&self, did: ast::DefId) -> PrivacyResult {
|
||||
if !is_local(did) {
|
||||
if self.external_exports.contains(&did) {
|
||||
debug!("privacy - {} was externally exported", did);
|
||||
debug!("privacy - {:?} was externally exported", did);
|
||||
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) {
|
||||
Some(&ty::MethodTraitItem(ref meth)) => {
|
||||
debug!("privacy - well at least it's a method: {}",
|
||||
debug!("privacy - well at least it's a method: {:?}",
|
||||
*meth);
|
||||
match meth.container {
|
||||
ty::TraitContainer(id) => {
|
||||
debug!("privacy - recursing on trait {}", id);
|
||||
debug!("privacy - recursing on trait {:?}", id);
|
||||
self.def_privacy(id)
|
||||
}
|
||||
ty::ImplContainer(id) => {
|
||||
match ty::impl_trait_ref(self.tcx, id) {
|
||||
Some(t) => {
|
||||
debug!("privacy - impl of trait {}", id);
|
||||
debug!("privacy - impl of trait {:?}", id);
|
||||
self.def_privacy(t.def_id)
|
||||
}
|
||||
None => {
|
||||
debug!("privacy - found a method {}",
|
||||
debug!("privacy - found a method {:?}",
|
||||
meth.vis);
|
||||
if meth.vis == ast::Public {
|
||||
Allowable
|
||||
@ -471,17 +471,17 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
|
||||
Some(&ty::TypeTraitItem(ref typedef)) => {
|
||||
match typedef.container {
|
||||
ty::TraitContainer(id) => {
|
||||
debug!("privacy - recursing on trait {}", id);
|
||||
debug!("privacy - recursing on trait {:?}", id);
|
||||
self.def_privacy(id)
|
||||
}
|
||||
ty::ImplContainer(id) => {
|
||||
match ty::impl_trait_ref(self.tcx, id) {
|
||||
Some(t) => {
|
||||
debug!("privacy - impl of trait {}", id);
|
||||
debug!("privacy - impl of trait {:?}", id);
|
||||
self.def_privacy(t.def_id)
|
||||
}
|
||||
None => {
|
||||
debug!("privacy - found a typedef {}",
|
||||
debug!("privacy - found a typedef {:?}",
|
||||
typedef.vis);
|
||||
if typedef.vis == ast::Public {
|
||||
Allowable
|
||||
@ -696,7 +696,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
|
||||
let fields = ty::lookup_struct_fields(self.tcx, id);
|
||||
let field = match name {
|
||||
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()
|
||||
}
|
||||
UnnamedField(idx) => &fields[idx]
|
||||
|
@ -146,24 +146,24 @@ impl RegionMaps {
|
||||
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));
|
||||
}
|
||||
|
||||
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);
|
||||
self.scope_map.borrow_mut().insert(sub, sup);
|
||||
}
|
||||
|
||||
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());
|
||||
self.var_map.borrow_mut().insert(var, lifetime);
|
||||
}
|
||||
|
||||
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());
|
||||
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
|
||||
/// scope.
|
||||
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);
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ impl RegionMaps {
|
||||
//! Returns the narrowest scope that encloses `id`, if any.
|
||||
match self.scope_map.borrow().get(&id) {
|
||||
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 {
|
||||
match self.var_map.borrow().get(&var_id) {
|
||||
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
|
||||
match self.rvalue_scopes.borrow().get(&expr_id) {
|
||||
Some(&s) => {
|
||||
debug!("temporary_scope({}) = {} [custom]", expr_id, s);
|
||||
debug!("temporary_scope({:?}) = {:?} [custom]", expr_id, s);
|
||||
return Some(s);
|
||||
}
|
||||
None => { }
|
||||
@ -225,12 +225,12 @@ impl RegionMaps {
|
||||
id = p;
|
||||
}
|
||||
None => {
|
||||
debug!("temporary_scope({}) = None", expr_id);
|
||||
debug!("temporary_scope({:?}) = None", expr_id);
|
||||
return None;
|
||||
}
|
||||
}
|
||||
}
|
||||
debug!("temporary_scope({}) = {} [enclosing]", expr_id, id);
|
||||
debug!("temporary_scope({:?}) = {:?} [enclosing]", expr_id, id);
|
||||
return Some(id);
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ impl RegionMaps {
|
||||
//! Returns the lifetime of the variable `id`.
|
||||
|
||||
let scope = ty::ReScope(self.var_scope(id));
|
||||
debug!("var_region({}) = {}", id, scope);
|
||||
debug!("var_region({:?}) = {:?}", id, scope);
|
||||
scope
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ impl RegionMaps {
|
||||
while superscope != s {
|
||||
match self.scope_map.borrow().get(&s) {
|
||||
None => {
|
||||
debug!("is_subscope_of({}, {}, s={})=false",
|
||||
debug!("is_subscope_of({:?}, {:?}, s={:?})=false",
|
||||
subscope, superscope, s);
|
||||
|
||||
return false;
|
||||
@ -267,7 +267,7 @@ impl RegionMaps {
|
||||
}
|
||||
}
|
||||
|
||||
debug!("is_subscope_of({}, {})=true",
|
||||
debug!("is_subscope_of({:?}, {:?})=true",
|
||||
subscope, superscope);
|
||||
|
||||
return true;
|
||||
@ -287,7 +287,7 @@ impl RegionMaps {
|
||||
sub_region: ty::Region,
|
||||
super_region: ty::Region)
|
||||
-> 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 || {
|
||||
@ -365,7 +365,7 @@ impl RegionMaps {
|
||||
|
||||
fn ancestors_of(this: &RegionMaps, scope: CodeExtent)
|
||||
-> Vec<CodeExtent> {
|
||||
// debug!("ancestors_of(scope={})", scope);
|
||||
// debug!("ancestors_of(scope={:?})", scope);
|
||||
let mut result = vec!(scope);
|
||||
let mut scope = scope;
|
||||
loop {
|
||||
@ -376,7 +376,7 @@ impl RegionMaps {
|
||||
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) {
|
||||
debug!("resolve_block(blk.id={})", blk.id);
|
||||
debug!("resolve_block(blk.id={:?})", blk.id);
|
||||
|
||||
// Record the parent of this block.
|
||||
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) {
|
||||
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);
|
||||
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) {
|
||||
debug!("resolve_expr(expr.id={})", expr.id);
|
||||
debug!("resolve_expr(expr.id={:?})", expr.id);
|
||||
|
||||
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) {
|
||||
debug!("resolve_local(local.id={},local.init={})",
|
||||
debug!("resolve_local(local.id={:?},local.init={:?})",
|
||||
local.id,local.init.is_some());
|
||||
|
||||
let blk_id = match visitor.cx.var_parent {
|
||||
@ -815,10 +815,10 @@ fn resolve_fn(visitor: &mut RegionResolutionVisitor,
|
||||
body: &ast::Block,
|
||||
sp: Span,
|
||||
id: ast::NodeId) {
|
||||
debug!("region::resolve_fn(id={}, \
|
||||
span={}, \
|
||||
body.id={}, \
|
||||
cx.parent={})",
|
||||
debug!("region::resolve_fn(id={:?}, \
|
||||
span={:?}, \
|
||||
body.id={:?}, \
|
||||
cx.parent={:?})",
|
||||
id,
|
||||
visitor.sess.codemap().span_to_string(sp),
|
||||
body.id,
|
||||
|
@ -223,7 +223,7 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
|
||||
fn visit_poly_trait_ref(&mut self, trait_ref:
|
||||
&ast::PolyTraitRef,
|
||||
_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| {
|
||||
this.check_lifetime_defs(old_scope, &trait_ref.bound_lifetimes);
|
||||
@ -250,9 +250,9 @@ impl<'a> LifetimeContext<'a> {
|
||||
scope: &wrap_scope,
|
||||
def_map: self.def_map,
|
||||
};
|
||||
debug!("entering scope {}", this.scope);
|
||||
debug!("entering scope {:?}", this.scope);
|
||||
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`.
|
||||
@ -281,7 +281,7 @@ impl<'a> LifetimeContext<'a> {
|
||||
{
|
||||
let referenced_idents = early_bound_lifetime_names(generics);
|
||||
|
||||
debug!("visit_early_late: referenced_idents={}",
|
||||
debug!("visit_early_late: referenced_idents={:?}",
|
||||
referenced_idents);
|
||||
|
||||
let (early, late): (Vec<_>, _) = generics.lifetimes.iter().cloned().partition(
|
||||
@ -488,7 +488,7 @@ impl<'a> LifetimeContext<'a> {
|
||||
probably a bug in syntax::fold");
|
||||
}
|
||||
|
||||
debug!("lifetime_ref={} id={} resolved to {}",
|
||||
debug!("lifetime_ref={:?} id={:?} resolved to {:?}",
|
||||
lifetime_to_string(lifetime_ref),
|
||||
lifetime_ref.id,
|
||||
def);
|
||||
@ -605,9 +605,9 @@ fn early_bound_lifetime_names(generics: &ast::Generics) -> Vec<ast::Name> {
|
||||
impl<'a> fmt::Show for ScopeChain<'a> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
EarlyScope(space, defs, _) => write!(fmt, "EarlyScope({}, {})", space, defs),
|
||||
LateScope(defs, _) => write!(fmt, "LateScope({})", defs),
|
||||
BlockScope(id, _) => write!(fmt, "BlockScope({})", id),
|
||||
EarlyScope(space, defs, _) => write!(fmt, "EarlyScope({:?}, {:?})", space, defs),
|
||||
LateScope(defs, _) => write!(fmt, "LateScope({:?})", defs),
|
||||
BlockScope(id, _) => write!(fmt, "BlockScope({:?})", id),
|
||||
RootScope => write!(fmt, "RootScope"),
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ pub fn lookup(tcx: &ty::ctxt, id: DefId) -> Option<Stability> {
|
||||
// is this definition the implementation of a trait method?
|
||||
match ty::trait_item_of_item(tcx, 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)
|
||||
}
|
||||
_ => {}
|
||||
@ -182,7 +182,7 @@ pub fn lookup(tcx: &ty::ctxt, id: DefId) -> Option<Stability> {
|
||||
// stability of the trait to determine the stability of any
|
||||
// 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)
|
||||
} else {
|
||||
None
|
||||
|
@ -242,7 +242,7 @@ impl<T:fmt::Show> fmt::Show for VecPerParamSpace<T> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
try!(write!(fmt, "VecPerParamSpace {{"));
|
||||
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, "}}"));
|
||||
Ok(())
|
||||
@ -601,7 +601,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for SubstFolder<'a, 'tcx> {
|
||||
span,
|
||||
format!("Type parameter out of range \
|
||||
when substituting in region {} (root type={}) \
|
||||
(space={}, index={})",
|
||||
(space={:?}, index={})",
|
||||
region_name.as_str(),
|
||||
self.root_ty.repr(self.tcx()),
|
||||
space, i)[]);
|
||||
@ -654,7 +654,7 @@ impl<'a,'tcx> SubstFolder<'a,'tcx> {
|
||||
let span = self.span.unwrap_or(DUMMY_SP);
|
||||
self.tcx().sess.span_bug(
|
||||
span,
|
||||
format!("Type parameter `{}` ({}/{}/{}) out of range \
|
||||
format!("Type parameter `{}` ({}/{:?}/{}) out of range \
|
||||
when substituting (root type={}) substs={}",
|
||||
p.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
|
||||
/// 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> {
|
||||
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));
|
||||
|
||||
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);
|
||||
debug!("shift_regions: shifted result = {}", result.repr(self.tcx()));
|
||||
debug!("shift_regions: shifted result = {:?}", result.repr(self.tcx()));
|
||||
|
||||
result
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ pub fn evaluate_builtin_bound<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
|
||||
span: Span)
|
||||
-> SelectionResult<'tcx, ()>
|
||||
{
|
||||
debug!("type_known_to_meet_builtin_bound(ty={}, bound={})",
|
||||
debug!("type_known_to_meet_builtin_bound(ty={}, bound={:?})",
|
||||
ty.repr(infcx.tcx),
|
||||
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),
|
||||
bound,
|
||||
result);
|
||||
|
@ -295,7 +295,7 @@ impl<'tcx> Repr<'tcx> for ObjectSafetyViolation<'tcx> {
|
||||
ObjectSafetyViolation::SizedSelf =>
|
||||
format!("SizedSelf"),
|
||||
ObjectSafetyViolation::Method(ref m, code) =>
|
||||
format!("Method({},{})", m.repr(tcx), code),
|
||||
format!("Method({},{:?})", m.repr(tcx), code),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
|
||||
let result = self.evaluate_stack(&stack);
|
||||
|
||||
debug!("result: {}", result);
|
||||
debug!("result: {:?}", result);
|
||||
result
|
||||
}
|
||||
|
||||
@ -944,14 +944,14 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
_ => { return Ok(()); }
|
||||
};
|
||||
|
||||
debug!("assemble_unboxed_candidates: self_ty={} kind={} obligation={}",
|
||||
debug!("assemble_unboxed_candidates: self_ty={} kind={:?} obligation={}",
|
||||
self_ty.repr(self.tcx()),
|
||||
kind,
|
||||
obligation.repr(self.tcx()));
|
||||
|
||||
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 {
|
||||
candidates.vec.push(UnboxedClosureCandidate(closure_def_id, substs.clone()));
|
||||
@ -1102,7 +1102,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
Err(error) => EvaluatedToErr(error),
|
||||
}
|
||||
});
|
||||
debug!("winnow_candidate depth={} result={}",
|
||||
debug!("winnow_candidate depth={} result={:?}",
|
||||
stack.obligation.recursion_depth, result);
|
||||
result
|
||||
}
|
||||
@ -1716,7 +1716,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
let substs =
|
||||
self.rematch_impl(impl_def_id, obligation,
|
||||
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(),
|
||||
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 {
|
||||
match *self {
|
||||
ErrorCandidate => format!("ErrorCandidate"),
|
||||
BuiltinCandidate(b) => format!("BuiltinCandidate({})", b),
|
||||
BuiltinCandidate(b) => format!("BuiltinCandidate({:?})", b),
|
||||
ParamCandidate(ref a) => format!("ParamCandidate({})", a.repr(tcx)),
|
||||
ImplCandidate(a) => format!("ImplCandidate({})", a.repr(tcx)),
|
||||
ProjectionCandidate => format!("ProjectionCandidate"),
|
||||
@ -2234,7 +2234,7 @@ impl<'tcx> Repr<'tcx> for SelectionCandidate<'tcx> {
|
||||
format!("ObjectCandidate")
|
||||
}
|
||||
UnboxedClosureCandidate(c, ref s) => {
|
||||
format!("UnboxedClosureCandidate({},{})", c, s.repr(tcx))
|
||||
format!("UnboxedClosureCandidate({:?},{})", c, s.repr(tcx))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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> {
|
||||
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> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
super::CodeSelectionError(ref e) => write!(f, "{}", e),
|
||||
super::CodeProjectionError(ref e) => write!(f, "{}", e),
|
||||
super::CodeSelectionError(ref e) => write!(f, "{:?}", e),
|
||||
super::CodeProjectionError(ref e) => write!(f, "{:?}", e),
|
||||
super::CodeAmbiguity => write!(f, "Ambiguity")
|
||||
}
|
||||
}
|
||||
|
@ -1710,8 +1710,8 @@ impl fmt::Show for InferTy {
|
||||
TyVar(ref v) => v.fmt(f),
|
||||
IntVar(ref v) => v.fmt(f),
|
||||
FloatVar(ref v) => v.fmt(f),
|
||||
FreshTy(v) => write!(f, "FreshTy({})", v),
|
||||
FreshIntTy(v) => write!(f, "FreshIntTy({})", v),
|
||||
FreshTy(v) => write!(f, "FreshTy({:?})", v),
|
||||
FreshIntTy(v) => write!(f, "FreshIntTy({:?})", v),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2471,7 +2471,7 @@ fn intern_ty<'tcx>(type_arena: &'tcx TypedArena<TyS<'tcx>>,
|
||||
region_depth: flags.depth,
|
||||
});
|
||||
|
||||
debug!("Interned type: {} Pointer: {}",
|
||||
debug!("Interned type: {:?} Pointer: {:?}",
|
||||
ty, ty as *const _);
|
||||
|
||||
interner.insert(InternedTy { ty: ty }, ty);
|
||||
@ -3533,7 +3533,7 @@ fn type_impls_bound<'a,'tcx>(param_env: &ParameterEnvironment<'a,'tcx>,
|
||||
match cache.borrow().get(&ty) {
|
||||
None => {}
|
||||
Some(&result) => {
|
||||
debug!("type_impls_bound({}, {}) = {} (cached)",
|
||||
debug!("type_impls_bound({}, {:?}) = {:?} (cached)",
|
||||
ty.repr(param_env.tcx),
|
||||
bound,
|
||||
result);
|
||||
@ -3546,7 +3546,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);
|
||||
|
||||
debug!("type_impls_bound({}, {}) = {}",
|
||||
debug!("type_impls_bound({}, {:?}) = {:?}",
|
||||
ty.repr(param_env.tcx),
|
||||
bound,
|
||||
is_impld);
|
||||
@ -3585,13 +3585,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 {
|
||||
fn type_requires<'tcx>(cx: &ctxt<'tcx>, seen: &mut Vec<DefId>,
|
||||
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, 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, ty),
|
||||
r);
|
||||
@ -3600,7 +3600,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>,
|
||||
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, ty));
|
||||
|
||||
@ -3655,7 +3655,7 @@ pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool {
|
||||
ty_unboxed_closure(..) => {
|
||||
// this check is run on type definitions, so we don't expect to see
|
||||
// inference by-products or unboxed closure types
|
||||
cx.sess.bug(format!("requires check invoked on inapplicable type: {}", ty)[])
|
||||
cx.sess.bug(format!("requires check invoked on inapplicable type: {:?}", ty)[])
|
||||
}
|
||||
|
||||
ty_tup(ref ts) => {
|
||||
@ -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, ty),
|
||||
r);
|
||||
@ -3748,7 +3748,7 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
|
||||
ty_unboxed_closure(..) => {
|
||||
// this check is run on type definitions, so we don't expect to see
|
||||
// unboxed closure types
|
||||
cx.sess.bug(format!("requires check invoked on inapplicable type: {}", ty)[])
|
||||
cx.sess.bug(format!("requires check invoked on inapplicable type: {:?}", ty)[])
|
||||
}
|
||||
_ => Representable,
|
||||
}
|
||||
@ -3789,7 +3789,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,
|
||||
seen: &mut Vec<Ty<'tcx>>,
|
||||
ty: Ty<'tcx>) -> Representability {
|
||||
debug!("is_type_structurally_recursive: {}",
|
||||
debug!("is_type_structurally_recursive: {:?}",
|
||||
::util::ppaux::ty_to_string(cx, ty));
|
||||
|
||||
match ty.sty {
|
||||
@ -3809,7 +3809,7 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
|
||||
match iter.next() {
|
||||
Some(&seen_type) => {
|
||||
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, ty));
|
||||
return SelfRecursive;
|
||||
@ -3829,7 +3829,7 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
|
||||
|
||||
for &seen_type in iter {
|
||||
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, ty));
|
||||
return ContainsRecursive;
|
||||
@ -3851,7 +3851,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));
|
||||
|
||||
// To avoid a stack overflow when checking an enum variant or struct that
|
||||
@ -3859,7 +3859,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).
|
||||
let mut seen: Vec<Ty> = Vec::new();
|
||||
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);
|
||||
r
|
||||
}
|
||||
@ -4122,7 +4122,7 @@ pub fn fn_is_variadic(fty: Ty) -> bool {
|
||||
match fty.sty {
|
||||
ty_bare_fn(_, ref f) => f.sig.0.variadic,
|
||||
ref s => {
|
||||
panic!("fn_is_variadic() called on non-fn type: {}", s)
|
||||
panic!("fn_is_variadic() called on non-fn type: {:?}", s)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4131,7 +4131,7 @@ pub fn ty_fn_sig<'tcx>(fty: Ty<'tcx>) -> &'tcx PolyFnSig<'tcx> {
|
||||
match fty.sty {
|
||||
ty_bare_fn(_, ref f) => &f.sig,
|
||||
ref s => {
|
||||
panic!("ty_fn_sig() called on non-fn type: {}", s)
|
||||
panic!("ty_fn_sig() called on non-fn type: {:?}", s)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4157,7 +4157,7 @@ pub fn ty_closure_store(fty: Ty) -> TraitStore {
|
||||
UniqTraitStore
|
||||
}
|
||||
ref s => {
|
||||
panic!("ty_closure_store() called on non-closure type: {}", s)
|
||||
panic!("ty_closure_store() called on non-closure type: {:?}", s)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4166,7 +4166,7 @@ pub fn ty_fn_ret<'tcx>(fty: Ty<'tcx>) -> FnOutput<'tcx> {
|
||||
match fty.sty {
|
||||
ty_bare_fn(_, ref f) => f.sig.0.output,
|
||||
ref s => {
|
||||
panic!("ty_fn_ret() called on non-fn type: {}", s)
|
||||
panic!("ty_fn_ret() called on non-fn type: {:?}", s)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4186,7 +4186,7 @@ pub fn ty_region(tcx: &ctxt,
|
||||
ref s => {
|
||||
tcx.sess.span_bug(
|
||||
span,
|
||||
format!("ty_region() invoked on an inappropriate ty: {}",
|
||||
format!("ty_region() invoked on an inappropriate ty: {:?}",
|
||||
s)[]);
|
||||
}
|
||||
}
|
||||
@ -4246,7 +4246,7 @@ pub fn expr_span(cx: &ctxt, id: NodeId) -> Span {
|
||||
e.span
|
||||
}
|
||||
Some(f) => {
|
||||
cx.sess.bug(format!("Node id {} is not an expr: {}",
|
||||
cx.sess.bug(format!("Node id {} is not an expr: {:?}",
|
||||
id,
|
||||
f)[]);
|
||||
}
|
||||
@ -4266,14 +4266,14 @@ pub fn local_var_name_str(cx: &ctxt, id: NodeId) -> InternedString {
|
||||
}
|
||||
_ => {
|
||||
cx.sess.bug(
|
||||
format!("Variable id {} maps to {}, not local",
|
||||
format!("Variable id {} maps to {:?}, not local",
|
||||
id,
|
||||
pat)[]);
|
||||
}
|
||||
}
|
||||
}
|
||||
r => {
|
||||
cx.sess.bug(format!("Variable id {} maps to {}, not local",
|
||||
cx.sess.bug(format!("Variable id {} maps to {:?}, not local",
|
||||
id,
|
||||
r)[]);
|
||||
}
|
||||
@ -4297,7 +4297,7 @@ pub fn adjust_ty<'tcx, F>(cx: &ctxt<'tcx>,
|
||||
return match adjustment {
|
||||
Some(adjustment) => {
|
||||
match *adjustment {
|
||||
AdjustReifyFnPointer(_) => {
|
||||
AdjustReifyFnPointer(_) => {
|
||||
match unadjusted_ty.sty {
|
||||
ty::ty_bare_fn(Some(_), b) => {
|
||||
ty::mk_bare_fn(cx, None, b)
|
||||
@ -4305,7 +4305,7 @@ pub fn adjust_ty<'tcx, F>(cx: &ctxt<'tcx>,
|
||||
ref b => {
|
||||
cx.sess.bug(
|
||||
format!("AdjustReifyFnPointer adjustment on non-fn-item: \
|
||||
{}",
|
||||
{:?}",
|
||||
b)[]);
|
||||
}
|
||||
}
|
||||
@ -4396,7 +4396,7 @@ pub fn unsize_ty<'tcx>(cx: &ctxt<'tcx>,
|
||||
mk_vec(cx, ty, None)
|
||||
}
|
||||
_ => cx.sess.span_bug(span,
|
||||
format!("UnsizeLength with bad sty: {}",
|
||||
format!("UnsizeLength with bad sty: {:?}",
|
||||
ty_to_string(cx, ty))[])
|
||||
},
|
||||
&UnsizeStruct(box ref k, tp_index) => match ty.sty {
|
||||
@ -4408,7 +4408,7 @@ pub fn unsize_ty<'tcx>(cx: &ctxt<'tcx>,
|
||||
mk_struct(cx, did, cx.mk_substs(unsized_substs))
|
||||
}
|
||||
_ => cx.sess.span_bug(span,
|
||||
format!("UnsizeStruct with bad sty: {}",
|
||||
format!("UnsizeStruct with bad sty: {:?}",
|
||||
ty_to_string(cx, ty))[])
|
||||
},
|
||||
&UnsizeVtable(TyTrait { ref principal, ref bounds }, _) => {
|
||||
@ -4515,7 +4515,7 @@ pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
|
||||
def => {
|
||||
tcx.sess.span_bug(
|
||||
expr.span,
|
||||
format!("uncategorized def for expr {}: {}",
|
||||
format!("uncategorized def for expr {}: {:?}",
|
||||
expr.id,
|
||||
def)[]);
|
||||
}
|
||||
@ -4638,7 +4638,7 @@ pub fn field_idx_strict(tcx: &ctxt, name: ast::Name, fields: &[field])
|
||||
let mut i = 0u;
|
||||
for f in fields.iter() { if f.name == name { return i; } i += 1u; }
|
||||
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),
|
||||
fields.iter()
|
||||
.map(|f| token::get_name(f.name).get().to_string())
|
||||
@ -4715,18 +4715,18 @@ pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String {
|
||||
terr_mismatch => "types differ".to_string(),
|
||||
terr_unsafety_mismatch(values) => {
|
||||
format!("expected {} fn, found {} fn",
|
||||
values.expected.to_string(),
|
||||
values.found.to_string())
|
||||
values.expected,
|
||||
values.found)
|
||||
}
|
||||
terr_abi_mismatch(values) => {
|
||||
format!("expected {} fn, found {} fn",
|
||||
values.expected.to_string(),
|
||||
values.found.to_string())
|
||||
values.expected,
|
||||
values.found)
|
||||
}
|
||||
terr_onceness_mismatch(values) => {
|
||||
format!("expected {} fn, found {} fn",
|
||||
values.expected.to_string(),
|
||||
values.found.to_string())
|
||||
values.expected,
|
||||
values.found)
|
||||
}
|
||||
terr_sigil_mismatch(values) => {
|
||||
format!("expected {}, found {}",
|
||||
@ -4818,14 +4818,14 @@ pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String {
|
||||
"expected an integral type, found `char`".to_string()
|
||||
}
|
||||
terr_int_mismatch(ref values) => {
|
||||
format!("expected `{}`, found `{}`",
|
||||
values.expected.to_string(),
|
||||
values.found.to_string())
|
||||
format!("expected `{:?}`, found `{:?}`",
|
||||
values.expected,
|
||||
values.found)
|
||||
}
|
||||
terr_float_mismatch(ref values) => {
|
||||
format!("expected `{}`, found `{}`",
|
||||
values.expected.to_string(),
|
||||
values.found.to_string())
|
||||
format!("expected `{:?}`, found `{:?}`",
|
||||
values.expected,
|
||||
values.found)
|
||||
}
|
||||
terr_variadic_mismatch(ref values) => {
|
||||
format!("expected {} fn, found {} function",
|
||||
@ -4914,14 +4914,14 @@ pub fn provided_trait_methods<'tcx>(cx: &ctxt<'tcx>, id: ast::DefId)
|
||||
}).collect()
|
||||
}
|
||||
_ => {
|
||||
cx.sess.bug(format!("provided_trait_methods: `{}` is \
|
||||
cx.sess.bug(format!("provided_trait_methods: `{:?}` is \
|
||||
not a trait",
|
||||
id)[])
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
cx.sess.bug(format!("provided_trait_methods: `{}` is not a \
|
||||
cx.sess.bug(format!("provided_trait_methods: `{:?}` is not a \
|
||||
trait",
|
||||
id)[])
|
||||
}
|
||||
@ -4950,7 +4950,7 @@ fn lookup_locally_or_in_crate_store<V, F>(descr: &str,
|
||||
}
|
||||
|
||||
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();
|
||||
map.insert(def_id, v.clone());
|
||||
@ -5057,7 +5057,7 @@ pub fn impl_trait_ref<'tcx>(cx: &ctxt<'tcx>, id: ast::DefId)
|
||||
-> Option<Rc<TraitRef<'tcx>>> {
|
||||
memoized(&cx.impl_trait_cache, id, |id: ast::DefId| {
|
||||
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) {
|
||||
Some(ast_map::NodeItem(item)) => {
|
||||
match item.node {
|
||||
@ -5377,7 +5377,7 @@ pub fn predicates_for_trait_ref<'tcx>(tcx: &ctxt<'tcx>,
|
||||
{
|
||||
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));
|
||||
|
||||
// The interaction between HRTB and supertraits is not entirely
|
||||
@ -5929,7 +5929,7 @@ pub fn required_region_bounds<'tcx>(tcx: &ctxt<'tcx>,
|
||||
predicates: Vec<ty::Predicate<'tcx>>)
|
||||
-> Vec<ty::Region>
|
||||
{
|
||||
debug!("required_region_bounds(erased_self_ty={}, predicates={})",
|
||||
debug!("required_region_bounds(erased_self_ty={:?}, predicates={:?})",
|
||||
erased_self_ty.repr(tcx),
|
||||
predicates.repr(tcx));
|
||||
|
||||
@ -6007,7 +6007,7 @@ pub fn populate_implementations_for_type_if_necessary(tcx: &ctxt,
|
||||
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();
|
||||
csearch::each_implementation_for_type(&tcx.sess.cstore, type_id,
|
||||
@ -6368,7 +6368,7 @@ pub fn construct_parameter_environment<'a,'tcx>(
|
||||
|
||||
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_substs.repr(tcx),
|
||||
bounds.repr(tcx));
|
||||
@ -6394,15 +6394,15 @@ pub fn construct_parameter_environment<'a,'tcx>(
|
||||
types: &mut VecPerParamSpace<Ty<'tcx>>,
|
||||
defs: &[TypeParameterDef<'tcx>]) {
|
||||
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));
|
||||
let ty = ty::mk_param_from_def(tcx, def);
|
||||
types.push(def.space, ty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
match *predicate {
|
||||
@ -6756,7 +6756,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)
|
||||
}
|
||||
|
||||
@ -6804,7 +6804,7 @@ impl<'tcx> Repr<'tcx> for AutoRef<'tcx> {
|
||||
fn repr(&self, tcx: &ctxt<'tcx>) -> String {
|
||||
match *self {
|
||||
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) => {
|
||||
format!("AutoUnsize({})", a.repr(tcx))
|
||||
@ -6813,7 +6813,7 @@ impl<'tcx> Repr<'tcx> for AutoRef<'tcx> {
|
||||
format!("AutoUnsizeUniq({})", a.repr(tcx))
|
||||
}
|
||||
AutoUnsafe(ref a, ref b) => {
|
||||
format!("AutoUnsafe({},{})", a, b.repr(tcx))
|
||||
format!("AutoUnsafe({:?},{})", a, b.repr(tcx))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6843,7 +6843,7 @@ impl<'tcx> Repr<'tcx> for vtable_origin<'tcx> {
|
||||
fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
|
||||
match *self {
|
||||
vtable_static(def_id, ref tys, ref vtable_res) => {
|
||||
format!("vtable_static({}:{}, {}, {})",
|
||||
format!("vtable_static({:?}:{}, {}, {})",
|
||||
def_id,
|
||||
ty::item_path_str(tcx, def_id),
|
||||
tys.repr(tcx),
|
||||
@ -6851,11 +6851,11 @@ impl<'tcx> Repr<'tcx> for vtable_origin<'tcx> {
|
||||
}
|
||||
|
||||
vtable_param(x, y) => {
|
||||
format!("vtable_param({}, {})", x, y)
|
||||
format!("vtable_param({:?}, {})", x, y)
|
||||
}
|
||||
|
||||
vtable_unboxed_closure(def_id) => {
|
||||
format!("vtable_unboxed_closure({})", def_id)
|
||||
format!("vtable_unboxed_closure({:?})", def_id)
|
||||
}
|
||||
|
||||
vtable_error => {
|
||||
@ -7286,7 +7286,7 @@ impl ReferencesError for Region
|
||||
|
||||
impl<'tcx> Repr<'tcx> for ClosureTy<'tcx> {
|
||||
fn repr(&self, tcx: &ctxt<'tcx>) -> String {
|
||||
format!("ClosureTy({},{},{},{},{},{})",
|
||||
format!("ClosureTy({},{},{:?},{},{},{})",
|
||||
self.unsafety,
|
||||
self.onceness,
|
||||
self.store,
|
||||
|
@ -95,7 +95,7 @@ impl<'tcx> Iterator for TypeWalker<'tcx> {
|
||||
type Item = Ty<'tcx>;
|
||||
|
||||
fn next(&mut self) -> Option<Ty<'tcx>> {
|
||||
debug!("next(): stack={}", self.stack);
|
||||
debug!("next(): stack={:?}", self.stack);
|
||||
match self.stack.pop() {
|
||||
None => {
|
||||
return None;
|
||||
@ -103,7 +103,7 @@ impl<'tcx> Iterator for TypeWalker<'tcx> {
|
||||
Some(ty) => {
|
||||
self.last_subtree = self.stack.len();
|
||||
self.push_subtypes(ty);
|
||||
debug!("next: stack={}", self.stack);
|
||||
debug!("next: stack={:?}", self.stack);
|
||||
Some(ty)
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ pub fn indent<R, F>(op: F) -> R where
|
||||
// to make debug output more readable.
|
||||
debug!(">>");
|
||||
let r = op();
|
||||
debug!("<< (Result = {})", r);
|
||||
debug!("<< (Result = {:?})", r);
|
||||
r
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region)
|
||||
}
|
||||
Some(_) | None => {
|
||||
// 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 => {
|
||||
// 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,
|
||||
// perhaps)
|
||||
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 {
|
||||
fn repr(&self, _tcx: &ctxt) -> String {
|
||||
format!("{}", *self)
|
||||
format!("{:?}", *self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Repr<'tcx> for ty::TypeParameterDef<'tcx> {
|
||||
fn repr(&self, tcx: &ctxt<'tcx>) -> String {
|
||||
format!("TypeParameterDef({}, {}, {}/{})",
|
||||
format!("TypeParameterDef({:?}, {}, {:?}/{})",
|
||||
self.def_id,
|
||||
self.bounds.repr(tcx),
|
||||
self.space,
|
||||
@ -854,7 +854,7 @@ impl<'tcx> Repr<'tcx> for ty::Region {
|
||||
fn repr(&self, tcx: &ctxt) -> String {
|
||||
match *self {
|
||||
ty::ReEarlyBound(id, space, index, name) => {
|
||||
format!("ReEarlyBound({}, {}, {}, {})",
|
||||
format!("ReEarlyBound({}, {:?}, {}, {})",
|
||||
id,
|
||||
space,
|
||||
index,
|
||||
@ -862,7 +862,7 @@ impl<'tcx> Repr<'tcx> for ty::Region {
|
||||
}
|
||||
|
||||
ty::ReLateBound(binder_id, ref bound_region) => {
|
||||
format!("ReLateBound({}, {})",
|
||||
format!("ReLateBound({:?}, {})",
|
||||
binder_id,
|
||||
bound_region.repr(tcx))
|
||||
}
|
||||
@ -870,7 +870,7 @@ impl<'tcx> Repr<'tcx> for ty::Region {
|
||||
ty::ReFree(ref fr) => fr.repr(tcx),
|
||||
|
||||
ty::ReScope(id) => {
|
||||
format!("ReScope({})", id)
|
||||
format!("ReScope({:?})", id)
|
||||
}
|
||||
|
||||
ty::ReStatic => {
|
||||
@ -878,7 +878,7 @@ impl<'tcx> Repr<'tcx> for ty::Region {
|
||||
}
|
||||
|
||||
ty::ReInfer(ReVar(ref vid)) => {
|
||||
format!("{}", vid)
|
||||
format!("{:?}", vid)
|
||||
}
|
||||
|
||||
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::NodeStructCtor(..)) => {
|
||||
return format!(
|
||||
"{}:{}",
|
||||
"{:?}:{}",
|
||||
*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_ {
|
||||
fn repr(&self, _tcx: &ctxt) -> String {
|
||||
format!("{}", *self)
|
||||
format!("{:?}", *self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Repr<'tcx> for ast::Visibility {
|
||||
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> {
|
||||
fn repr(&self, tcx: &ctxt<'tcx>) -> String {
|
||||
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 {
|
||||
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 {
|
||||
fn repr(&self, _tcx: &ctxt) -> String {
|
||||
format!("{}", *self)
|
||||
format!("{:?}", *self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Repr<'tcx> for ty::BorrowKind {
|
||||
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 {
|
||||
fn repr(&self, _tcx: &ctxt) -> String {
|
||||
format!("{}", self)
|
||||
format!("{:?}", self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Repr<'tcx> for ty::FloatVid {
|
||||
fn repr(&self, _tcx: &ctxt) -> String {
|
||||
format!("{}", self)
|
||||
format!("{:?}", self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Repr<'tcx> for ty::RegionVid {
|
||||
fn repr(&self, _tcx: &ctxt) -> String {
|
||||
format!("{}", self)
|
||||
format!("{:?}", self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Repr<'tcx> for ty::TyVid {
|
||||
fn repr(&self, _tcx: &ctxt) -> String {
|
||||
format!("{}", self)
|
||||
format!("{:?}", self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Repr<'tcx> for ty::IntVarValue {
|
||||
fn repr(&self, _tcx: &ctxt) -> String {
|
||||
format!("{}", *self)
|
||||
format!("{:?}", *self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Repr<'tcx> for ast::IntTy {
|
||||
fn repr(&self, _tcx: &ctxt) -> String {
|
||||
format!("{}", *self)
|
||||
format!("{:?}", *self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Repr<'tcx> for ast::UintTy {
|
||||
fn repr(&self, _tcx: &ctxt) -> String {
|
||||
format!("{}", *self)
|
||||
format!("{:?}", *self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Repr<'tcx> for ast::FloatTy {
|
||||
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 {
|
||||
fn repr(&self, tcx: &ctxt) -> String {
|
||||
let ident = self.user_string(tcx);
|
||||
format!("{}/{}.{}", ident, self.space, self.idx)
|
||||
format!("{}/{:?}.{}", ident, self.space, self.idx)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ fn run_ar(handler: &ErrorHandler, maybe_ar_prog: &Option<String>,
|
||||
match cwd {
|
||||
Some(p) => {
|
||||
cmd.cwd(p);
|
||||
debug!("inside {}", p.display());
|
||||
debug!("inside {:?}", p.display());
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
@ -105,7 +105,7 @@ pub fn find_library(name: &str, osprefix: &str, ossuffix: &str,
|
||||
let unixlibname = format!("lib{}.a", name);
|
||||
|
||||
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[]);
|
||||
if test.exists() { return test }
|
||||
if oslibname != unixlibname {
|
||||
|
@ -61,10 +61,10 @@ fn get_rpaths<F, G>(mut config: RPathConfig<F, G>, libs: &[Path]) -> Vec<String>
|
||||
F: FnOnce() -> Path,
|
||||
G: FnMut(&Path) -> Result<Path, IoError>,
|
||||
{
|
||||
debug!("output: {}", config.out_filename.display());
|
||||
debug!("output: {:?}", config.out_filename.display());
|
||||
debug!("libs:");
|
||||
for libpath in libs.iter() {
|
||||
debug!(" {}", libpath.display());
|
||||
debug!(" {:?}", libpath.display());
|
||||
}
|
||||
|
||||
// Use relative paths to the libraries. Binaries can be moved
|
||||
|
@ -119,6 +119,14 @@ impl 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 {
|
||||
f.pad(self.as_str())
|
||||
}
|
||||
|
@ -299,8 +299,8 @@ impl Target {
|
||||
use serialize::json;
|
||||
|
||||
fn load_file(path: &Path) -> Result<Target, String> {
|
||||
let mut f = try!(File::open(path).map_err(|e| e.to_string()));
|
||||
let obj = try!(json::from_reader(&mut f).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| format!("{:?}", e)));
|
||||
Ok(Target::from_json(obj))
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ impl Target {
|
||||
$(
|
||||
else if target == stringify!($name) {
|
||||
let t = $name::target();
|
||||
debug!("Got builtin target: {}", t);
|
||||
debug!("Got builtin target: {:?}", t);
|
||||
return Ok(t);
|
||||
}
|
||||
)*
|
||||
@ -377,6 +377,6 @@ impl Target {
|
||||
}
|
||||
}
|
||||
|
||||
Err(format!("Could not find specification for target {}", target))
|
||||
Err(format!("Could not find specification for target {:?}", target))
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> {
|
||||
consume_span: Span,
|
||||
cmt: mc::cmt<'tcx>,
|
||||
mode: euv::ConsumeMode) {
|
||||
debug!("consume(consume_id={}, cmt={}, mode={})",
|
||||
debug!("consume(consume_id={}, cmt={}, mode={:?})",
|
||||
consume_id, cmt.repr(self.tcx()), 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,
|
||||
cmt: mc::cmt<'tcx>,
|
||||
mode: euv::ConsumeMode) {
|
||||
debug!("consume_pat(consume_pat={}, cmt={}, mode={})",
|
||||
debug!("consume_pat(consume_pat={}, cmt={}, mode={:?})",
|
||||
consume_pat.repr(self.tcx()),
|
||||
cmt.repr(self.tcx()),
|
||||
mode);
|
||||
@ -127,8 +127,8 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> {
|
||||
bk: ty::BorrowKind,
|
||||
loan_cause: euv::LoanCause)
|
||||
{
|
||||
debug!("borrow(borrow_id={}, cmt={}, loan_region={}, \
|
||||
bk={}, loan_cause={})",
|
||||
debug!("borrow(borrow_id={}, cmt={}, loan_region={:?}, \
|
||||
bk={:?}, loan_cause={:?})",
|
||||
borrow_id, cmt.repr(self.tcx()), loan_region,
|
||||
bk, loan_cause);
|
||||
|
||||
@ -355,10 +355,10 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
|
||||
//! (Note that some loans can be *issued* without necessarily
|
||||
//! 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);
|
||||
debug!("new_loan_indices = {}", new_loan_indices);
|
||||
debug!("new_loan_indices = {:?}", new_loan_indices);
|
||||
|
||||
self.each_issued_loan(scope, |issued_loan| {
|
||||
for &new_loan_index in new_loan_indices.iter() {
|
||||
@ -696,7 +696,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
|
||||
span: Span,
|
||||
use_kind: MovedValueUseKind,
|
||||
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));
|
||||
let base_lp = owned_ptr_base_path_rc(lp);
|
||||
self.move_data.each_move_of(id, &base_lp, |the_move, moved_lp| {
|
||||
|
@ -198,11 +198,11 @@ pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) {
|
||||
// First, filter out duplicates
|
||||
moved.sort();
|
||||
moved.dedup();
|
||||
debug!("fragments 1 moved: {}", path_lps(moved[]));
|
||||
debug!("fragments 1 moved: {:?}", path_lps(moved[]));
|
||||
|
||||
assigned.sort();
|
||||
assigned.dedup();
|
||||
debug!("fragments 1 assigned: {}", path_lps(assigned[]));
|
||||
debug!("fragments 1 assigned: {:?}", path_lps(assigned[]));
|
||||
|
||||
// Second, build parents from the moved and assigned.
|
||||
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.dedup();
|
||||
debug!("fragments 2 parents: {}", path_lps(parents[]));
|
||||
debug!("fragments 2 parents: {:?}", path_lps(parents[]));
|
||||
|
||||
// Third, filter the moved and assigned fragments down to just the non-parents
|
||||
moved.retain(|f| non_member(*f, parents[]));
|
||||
debug!("fragments 3 moved: {}", path_lps(moved[]));
|
||||
debug!("fragments 3 moved: {:?}", path_lps(moved[]));
|
||||
|
||||
assigned.retain(|f| non_member(*f, parents[]));
|
||||
debug!("fragments 3 assigned: {}", path_lps(assigned[]));
|
||||
debug!("fragments 3 assigned: {:?}", path_lps(assigned[]));
|
||||
|
||||
// Fourth, build the leftover from the moved, assigned, and parents.
|
||||
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.dedup();
|
||||
debug!("fragments 4 unmoved: {}", frag_lps(unmoved[]));
|
||||
debug!("fragments 4 unmoved: {:?}", frag_lps(unmoved[]));
|
||||
|
||||
// Fifth, filter the leftover fragments down to its core.
|
||||
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[]) &&
|
||||
non_member(mpi, assigned[])
|
||||
});
|
||||
debug!("fragments 5 unmoved: {}", frag_lps(unmoved[]));
|
||||
debug!("fragments 5 unmoved: {:?}", frag_lps(unmoved[]));
|
||||
|
||||
// Swap contents back in.
|
||||
fragments.unmoved_fragments = unmoved;
|
||||
@ -430,7 +430,7 @@ fn add_fragment_siblings_for_extension<'tcx>(this: &MoveData<'tcx>,
|
||||
}
|
||||
|
||||
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);
|
||||
let opt_span = origin_id.and_then(|id|tcx.map.opt_span(id));
|
||||
tcx.sess.opt_span_bug(opt_span, msg[])
|
||||
|
@ -65,7 +65,7 @@ pub fn gather_match_variant<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
|
||||
cmt: mc::cmt<'tcx>,
|
||||
mode: euv::MatchMode) {
|
||||
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);
|
||||
|
||||
let opt_lp = opt_loan_path(&cmt);
|
||||
|
@ -76,7 +76,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
|
||||
_consume_span: Span,
|
||||
cmt: mc::cmt<'tcx>,
|
||||
mode: euv::ConsumeMode) {
|
||||
debug!("consume(consume_id={}, cmt={}, mode={})",
|
||||
debug!("consume(consume_id={}, cmt={}, mode={:?})",
|
||||
consume_id, cmt.repr(self.tcx()), mode);
|
||||
|
||||
match mode {
|
||||
@ -93,7 +93,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
|
||||
matched_pat: &ast::Pat,
|
||||
cmt: mc::cmt<'tcx>,
|
||||
mode: euv::MatchMode) {
|
||||
debug!("matched_pat(matched_pat={}, cmt={}, mode={})",
|
||||
debug!("matched_pat(matched_pat={}, cmt={}, mode={:?})",
|
||||
matched_pat.repr(self.tcx()),
|
||||
cmt.repr(self.tcx()),
|
||||
mode);
|
||||
@ -109,7 +109,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
|
||||
consume_pat: &ast::Pat,
|
||||
cmt: mc::cmt<'tcx>,
|
||||
mode: euv::ConsumeMode) {
|
||||
debug!("consume_pat(consume_pat={}, cmt={}, mode={})",
|
||||
debug!("consume_pat(consume_pat={}, cmt={}, mode={:?})",
|
||||
consume_pat.repr(self.tcx()),
|
||||
cmt.repr(self.tcx()),
|
||||
mode);
|
||||
@ -132,8 +132,8 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
|
||||
bk: ty::BorrowKind,
|
||||
loan_cause: euv::LoanCause)
|
||||
{
|
||||
debug!("borrow(borrow_id={}, cmt={}, loan_region={}, \
|
||||
bk={}, loan_cause={})",
|
||||
debug!("borrow(borrow_id={}, cmt={}, loan_region={:?}, \
|
||||
bk={:?}, loan_cause={:?})",
|
||||
borrow_id, cmt.repr(self.tcx()), loan_region,
|
||||
bk, loan_cause);
|
||||
|
||||
@ -235,7 +235,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
|
||||
loan_region: ty::Region,
|
||||
cause: euv::LoanCause) {
|
||||
debug!("guarantee_valid(borrow_id={}, cmt={}, \
|
||||
req_mutbl={}, loan_region={})",
|
||||
req_mutbl={:?}, loan_region={:?})",
|
||||
borrow_id,
|
||||
cmt.repr(self.tcx()),
|
||||
req_kind,
|
||||
@ -273,7 +273,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
|
||||
self.bccx, borrow_span, cause,
|
||||
cmt.clone(), loan_region);
|
||||
|
||||
debug!("guarantee_valid(): restrictions={}", restr);
|
||||
debug!("guarantee_valid(): restrictions={:?}", restr);
|
||||
|
||||
// Create the loan record (if needed).
|
||||
let loan = match restr {
|
||||
@ -306,18 +306,18 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
|
||||
ty::ReInfer(..) => {
|
||||
self.tcx().sess.span_bug(
|
||||
cmt.span,
|
||||
format!("invalid borrow lifetime: {}",
|
||||
format!("invalid borrow lifetime: {:?}",
|
||||
loan_region)[]);
|
||||
}
|
||||
};
|
||||
debug!("loan_scope = {}", loan_scope);
|
||||
debug!("loan_scope = {:?}", loan_scope);
|
||||
|
||||
let borrow_scope = region::CodeExtent::from_node_id(borrow_id);
|
||||
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);
|
||||
debug!("kill_scope = {}", kill_scope);
|
||||
debug!("kill_scope = {:?}", kill_scope);
|
||||
|
||||
if req_kind == ty::MutBorrow {
|
||||
self.mark_loan_path_as_mutated(&*loan_path);
|
||||
|
@ -586,7 +586,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
|
||||
}
|
||||
r => {
|
||||
self.tcx.sess.bug(format!("MoveExpr({}) maps to \
|
||||
{}, not Expr",
|
||||
{:?}, not Expr",
|
||||
the_move.id,
|
||||
r)[])
|
||||
}
|
||||
@ -624,7 +624,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
|
||||
}
|
||||
r => {
|
||||
self.tcx.sess.bug(format!("Captured({}) maps to \
|
||||
{}, not Expr",
|
||||
{:?}, not Expr",
|
||||
the_move.id,
|
||||
r)[])
|
||||
}
|
||||
@ -1005,7 +1005,7 @@ impl DataFlowOperator for LoanDataFlowOperator {
|
||||
|
||||
impl<'tcx> Repr<'tcx> for Loan<'tcx> {
|
||||
fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
|
||||
format!("Loan_{}({}, {}, {}-{}, {})",
|
||||
format!("Loan_{}({}, {:?}, {:?}-{:?}, {})",
|
||||
self.index,
|
||||
self.loan_path.repr(tcx),
|
||||
self.kind,
|
||||
|
@ -311,7 +311,7 @@ impl<'tcx> MoveData<'tcx> {
|
||||
}
|
||||
};
|
||||
|
||||
debug!("move_path(lp={}, index={})",
|
||||
debug!("move_path(lp={}, index={:?})",
|
||||
lp.repr(tcx),
|
||||
index);
|
||||
|
||||
@ -362,7 +362,7 @@ impl<'tcx> MoveData<'tcx> {
|
||||
lp: Rc<LoanPath<'tcx>>,
|
||||
id: ast::NodeId,
|
||||
kind: MoveKind) {
|
||||
debug!("add_move(lp={}, id={}, kind={})",
|
||||
debug!("add_move(lp={}, id={}, kind={:?})",
|
||||
lp.repr(tcx),
|
||||
id,
|
||||
kind);
|
||||
@ -413,12 +413,12 @@ impl<'tcx> MoveData<'tcx> {
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
self.var_assignments.borrow_mut().push(assignment);
|
||||
} else {
|
||||
debug!("add_assignment[path](lp={}, path_index={})",
|
||||
debug!("add_assignment[path](lp={}, path_index={:?})",
|
||||
lp.repr(tcx), path_index);
|
||||
|
||||
self.path_assignments.borrow_mut().push(assignment);
|
||||
|
@ -53,7 +53,7 @@ pub struct DataflowLabeller<'a, 'tcx: 'a> {
|
||||
impl<'a, 'tcx> DataflowLabeller<'a, 'tcx> {
|
||||
fn dataflow_for(&self, e: EntryOrExit, n: &Node<'a>) -> String {
|
||||
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 seen_one = false;
|
||||
for &variant in self.variants.iter() {
|
||||
|
@ -726,7 +726,7 @@ pub fn collect_crate_types(session: &Session,
|
||||
let res = !link::invalid_output_for_target(session, *crate_type);
|
||||
|
||||
if !res {
|
||||
session.warn(format!("dropping unsupported crate type `{}` \
|
||||
session.warn(format!("dropping unsupported crate type `{:?}` \
|
||||
for target `{}`",
|
||||
*crate_type, session.opts.target_triple)[]);
|
||||
}
|
||||
|
@ -548,7 +548,7 @@ pub fn pretty_print_input(sess: Session,
|
||||
(PpmSource(s), None) =>
|
||||
s.call_with_pp_support(
|
||||
sess, ast_map, &arenas, id, out, |annotation, out| {
|
||||
debug!("pretty printing source code {}", s);
|
||||
debug!("pretty printing source code {:?}", s);
|
||||
let sess = annotation.sess();
|
||||
pprust::print_crate(sess.codemap(),
|
||||
sess.diagnostic(),
|
||||
@ -563,7 +563,7 @@ pub fn pretty_print_input(sess: Session,
|
||||
(PpmSource(s), Some(uii)) =>
|
||||
s.call_with_pp_support(
|
||||
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 ast_map = annotation.ast_map()
|
||||
.expect("--pretty missing ast_map");
|
||||
@ -586,7 +586,7 @@ pub fn pretty_print_input(sess: Session,
|
||||
}),
|
||||
|
||||
(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(|| {
|
||||
sess.fatal(format!("`pretty flowgraph=..` needs NodeId (int) or
|
||||
unique path suffix (b::c::d)")[])
|
||||
@ -609,7 +609,7 @@ pub fn pretty_print_input(sess: Session,
|
||||
}
|
||||
None => {
|
||||
let message = format!("--pretty=flowgraph needs \
|
||||
block, fn, or method; got {}",
|
||||
block, fn, or method; got {:?}",
|
||||
node);
|
||||
|
||||
// point to what was found, if there's an
|
||||
|
@ -845,7 +845,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
|
||||
name: Name,
|
||||
new_parent: &Rc<Module>) {
|
||||
debug!("(building reduced graph for \
|
||||
external crate) building external def, priv {}",
|
||||
external crate) building external def, priv {:?}",
|
||||
vis);
|
||||
let is_public = vis == ast::Public;
|
||||
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(..) |
|
||||
DefUse(..) | DefUpvar(..) | DefRegion(..) |
|
||||
DefTyParamBinder(..) | DefLabel(..) | DefSelfTy(..) => {
|
||||
panic!("didn't expect `{}`", def);
|
||||
panic!("didn't expect `{:?}`", def);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
// is used.
|
||||
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));
|
||||
|
||||
if !self.used_imports.contains(&(id, TypeNS)) &&
|
||||
|
@ -548,7 +548,7 @@ impl Module {
|
||||
|
||||
impl fmt::Show for Module {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}, kind: {}, {}",
|
||||
write!(f, "{:?}, kind: {:?}, {}",
|
||||
self.def_id,
|
||||
self.kind,
|
||||
if self.is_public { "public" } else { "private" } )
|
||||
@ -689,7 +689,7 @@ impl NameBindings {
|
||||
|
||||
/// Records a type definition.
|
||||
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.
|
||||
let type_def = self.type_def.borrow().clone();
|
||||
match type_def {
|
||||
@ -714,7 +714,7 @@ impl NameBindings {
|
||||
|
||||
/// Records a value definition.
|
||||
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 {
|
||||
def: def,
|
||||
value_span: Some(sp),
|
||||
@ -1272,7 +1272,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
lp: LastPrivate)
|
||||
-> ResolveResult<()> {
|
||||
debug!("(resolving single import) resolving `{}` = `{}::{}` from \
|
||||
`{}` id {}, last private {}",
|
||||
`{}` id {}, last private {:?}",
|
||||
token::get_name(target),
|
||||
self.module_to_string(&*containing_module),
|
||||
token::get_name(source),
|
||||
@ -1375,7 +1375,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
shadowable: _
|
||||
}) => {
|
||||
debug!("(resolving single import) found \
|
||||
import in ns {}", namespace);
|
||||
import in ns {:?}", namespace);
|
||||
let id = import_resolution.id(namespace);
|
||||
// track used imports and extern crates as well
|
||||
this.used_imports.insert((id, namespace));
|
||||
@ -1484,7 +1484,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
|
||||
match *result {
|
||||
BoundResult(ref target_module, ref name_bindings) => {
|
||||
debug!("(resolving single import) found {} target: {}",
|
||||
debug!("(resolving single import) found {:?} target: {:?}",
|
||||
namespace_name,
|
||||
name_bindings.def_for_namespace(namespace));
|
||||
self.check_for_conflicting_import(
|
||||
@ -1508,7 +1508,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
}
|
||||
UnboundResult => { /* Continue. */ }
|
||||
UnknownResult => {
|
||||
panic!("{} result should be known at this point", namespace_name);
|
||||
panic!("{:?} result should be known at this point", namespace_name);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -2165,7 +2165,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
namespace: Namespace)
|
||||
-> ResolveResult<(Target, bool)> {
|
||||
debug!("(resolving item in lexical scope) resolving `{}` in \
|
||||
namespace {} in `{}`",
|
||||
namespace {:?} in `{}`",
|
||||
token::get_name(name),
|
||||
namespace,
|
||||
self.module_to_string(&*module_));
|
||||
@ -2195,7 +2195,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
None => {
|
||||
// Not found; continue.
|
||||
debug!("(resolving item in lexical scope) found \
|
||||
import resolution, but not in namespace {}",
|
||||
import resolution, but not in namespace {:?}",
|
||||
namespace);
|
||||
}
|
||||
Some(target) => {
|
||||
@ -2475,7 +2475,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
match import_resolution.target_for_namespace(namespace) {
|
||||
None => {
|
||||
debug!("(resolving name in module) name found, \
|
||||
but not in namespace {}",
|
||||
but not in namespace {:?}",
|
||||
namespace);
|
||||
}
|
||||
Some(target) => {
|
||||
@ -2620,7 +2620,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
match def_like {
|
||||
DlDef(d @ DefUpvar(..)) => {
|
||||
self.session.span_bug(span,
|
||||
format!("unexpected {} in bindings", d)[])
|
||||
format!("unexpected {:?} in bindings", d)[])
|
||||
}
|
||||
DlDef(d @ DefLocal(_)) => {
|
||||
let node_id = d.def_id().node;
|
||||
@ -3187,7 +3187,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
Some(def) => {
|
||||
match def {
|
||||
(DefTrait(_), _) => {
|
||||
debug!("(resolving trait) found trait def: {}", def);
|
||||
debug!("(resolving trait) found trait def: {:?}", def);
|
||||
self.record_def(trait_reference.ref_id, def);
|
||||
}
|
||||
(def, _) => {
|
||||
@ -3578,8 +3578,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
None => {
|
||||
match self.resolve_path(ty.id, path, TypeNS, true) {
|
||||
Some(def) => {
|
||||
debug!("(resolving type) resolved `{}` to \
|
||||
type {}",
|
||||
debug!("(resolving type) resolved `{:?}` to \
|
||||
type {:?}",
|
||||
token::get_ident(path.segments.last().unwrap() .identifier),
|
||||
def);
|
||||
result_def = Some(def);
|
||||
@ -3797,7 +3797,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
}
|
||||
result => {
|
||||
debug!("(resolving pattern) didn't find struct \
|
||||
def: {}", result);
|
||||
def: {:?}", result);
|
||||
let msg = format!("`{}` does not name a structure",
|
||||
self.path_names_to_string(path));
|
||||
self.resolve_error(path.span, msg[]);
|
||||
@ -3821,7 +3821,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
ValueNS) {
|
||||
Success((target, _)) => {
|
||||
debug!("(resolve bare identifier pattern) succeeded in \
|
||||
finding {} at {}",
|
||||
finding {} at {:?}",
|
||||
token::get_name(name),
|
||||
target.bindings.value_def.borrow());
|
||||
match *target.bindings.value_def.borrow() {
|
||||
@ -4179,7 +4179,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
match search_result {
|
||||
Some(DlDef(def)) => {
|
||||
debug!("(resolving path in local ribs) resolved `{}` to \
|
||||
local: {}",
|
||||
local: {:?}",
|
||||
token::get_ident(ident),
|
||||
def);
|
||||
return Some(def);
|
||||
@ -4530,7 +4530,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
Some(definition) => self.record_def(expr.id, definition),
|
||||
result => {
|
||||
debug!("(resolving expression) didn't find struct \
|
||||
def: {}", result);
|
||||
def: {:?}", result);
|
||||
let msg = format!("`{}` does not name a structure",
|
||||
self.path_names_to_string(path));
|
||||
self.resolve_error(path.span, msg[]);
|
||||
@ -4717,7 +4717,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
}
|
||||
|
||||
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);
|
||||
assert!(match lp {LastImport{..} => false, _ => true},
|
||||
"Import should only be used for `use` directives");
|
||||
@ -4729,8 +4729,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
// the same conclusion! - nmatsakis
|
||||
Occupied(entry) => if def != *entry.get() {
|
||||
self.session
|
||||
.bug(format!("node_id {} resolved first to {} and \
|
||||
then {}",
|
||||
.bug(format!("node_id {} resolved first to {:?} and \
|
||||
then {:?}",
|
||||
node_id,
|
||||
*entry.get(),
|
||||
def)[]);
|
||||
|
@ -117,7 +117,7 @@ impl<'a, 'b, 'tcx> ExportRecorder<'a, 'b, 'tcx> {
|
||||
ns: Namespace) {
|
||||
match namebindings.def_for_namespace(ns) {
|
||||
Some(d) => {
|
||||
debug!("(computing exports) YES: export '{}' => {}",
|
||||
debug!("(computing exports) YES: export '{}' => {:?}",
|
||||
name, d.def_id());
|
||||
exports.push(Export {
|
||||
name: name,
|
||||
@ -125,7 +125,7 @@ impl<'a, 'b, 'tcx> ExportRecorder<'a, 'b, 'tcx> {
|
||||
});
|
||||
}
|
||||
d_opt => {
|
||||
debug!("(computing exports) NO: {}", d_opt);
|
||||
debug!("(computing exports) NO: {:?}", d_opt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ pub fn build_link_meta(sess: &Session, krate: &ast::Crate,
|
||||
crate_name: name,
|
||||
crate_hash: Svh::calculate(&sess.opts.cg.metadata, krate),
|
||||
};
|
||||
info!("{}", r);
|
||||
info!("{:?}", r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -373,7 +373,7 @@ pub fn link_binary(sess: &Session,
|
||||
let mut out_filenames = Vec::new();
|
||||
for &crate_type in sess.crate_types.borrow().iter() {
|
||||
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)[]);
|
||||
}
|
||||
let out_file = link_binary_output(sess, trans, crate_type, outputs,
|
||||
|
@ -174,7 +174,7 @@ fn create_target_machine(sess: &Session) -> TargetMachineRef {
|
||||
"default" => llvm::RelocDefault,
|
||||
"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
|
||||
.cg
|
||||
.relocation_model)[]);
|
||||
@ -209,7 +209,7 @@ fn create_target_machine(sess: &Session) -> TargetMachineRef {
|
||||
"medium" => llvm::CodeModelMedium,
|
||||
"large" => llvm::CodeModelLarge,
|
||||
_ => {
|
||||
sess.err(format!("{} is not a valid code model",
|
||||
sess.err(format!("{:?} is not a valid code model",
|
||||
sess.opts
|
||||
.cg
|
||||
.code_model)[]);
|
||||
|
@ -240,7 +240,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
|
||||
def::DefUse(_) |
|
||||
def::DefMethod(..) |
|
||||
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)[]);
|
||||
},
|
||||
}
|
||||
@ -308,7 +308,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
|
||||
},
|
||||
_ => {
|
||||
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,
|
||||
method.id,
|
||||
self.analysis.ty_cx.map.get(impl_id.node)
|
||||
@ -1443,7 +1443,8 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> {
|
||||
// FIXME(nrc) what are these doing here?
|
||||
def::DefStatic(_, _) => {}
|
||||
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() {
|
||||
|
@ -518,7 +518,7 @@ fn enter_opt<'a, 'p, 'blk, 'tcx>(
|
||||
variant_size: uint,
|
||||
val: ValueRef)
|
||||
-> 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(),
|
||||
m.repr(bcx.tcx()),
|
||||
*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
|
||||
let opts = get_branches(bcx, m, col);
|
||||
debug!("options={}", opts);
|
||||
debug!("options={:?}", opts);
|
||||
let mut kind = NoBranch;
|
||||
let mut test_val = val;
|
||||
debug!("test_val={}", bcx.val_to_string(test_val));
|
||||
|
@ -145,7 +145,7 @@ pub fn represent_type<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
||||
}
|
||||
|
||||
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());
|
||||
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 {
|
||||
debug!("range_to_inttype: {} {}", hint, bounds);
|
||||
debug!("range_to_inttype: {:?} {:?}", hint, bounds);
|
||||
// Lists of sizes to try. u64 is always allowed as a fallback.
|
||||
#[allow(non_upper_case_globals)]
|
||||
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 {
|
||||
debug!("bounds_usable: {} {}", ity, bounds);
|
||||
debug!("bounds_usable: {:?} {:?}", ity, bounds);
|
||||
match ity {
|
||||
attr::SignedInt(_) => {
|
||||
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 {
|
||||
let signed;
|
||||
let val;
|
||||
debug!("trans_get_discr r: {}", r);
|
||||
debug!("trans_get_discr r: {:?}", r);
|
||||
match *r {
|
||||
CEnum(ity, min, max) => {
|
||||
val = load_discr(bcx, ity, scrutinee, min, max);
|
||||
|
@ -976,7 +976,7 @@ pub fn invoke<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||
}
|
||||
|
||||
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() {
|
||||
debug!("arg: {}", bcx.val_to_string(llarg));
|
||||
}
|
||||
@ -996,7 +996,7 @@ pub fn invoke<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||
Some(attributes));
|
||||
return (llresult, normal_bcx);
|
||||
} 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() {
|
||||
debug!("arg: {}", bcx.val_to_string(llarg));
|
||||
}
|
||||
@ -2738,7 +2738,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
|
||||
}
|
||||
|
||||
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 {
|
||||
ast_map::NodeItem(i) => {
|
||||
let ty = ty::node_id_to_type(ccx.tcx(), i.id);
|
||||
@ -2913,7 +2913,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
|
||||
}
|
||||
|
||||
ref variant => {
|
||||
ccx.sess().bug(format!("get_item_val(): unexpected variant: {}",
|
||||
ccx.sess().bug(format!("get_item_val(): unexpected variant: {:?}",
|
||||
variant)[])
|
||||
}
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user