Skip to content

Suggest more helpful formatting string #50441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2018
Merged

Conversation

kornelski
Copy link
Contributor

Based on user feedback the minimal suggestion of :? is unclear.

Also {:#?} is much more readable than the standard debug, so this PR suggests it to help surface this nice feature.

@rust-highfive
Copy link
Contributor

r? @Kimundi

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 4, 2018
@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:03:00]    Compiling std v0.0.0 (file:///checkout/src/libstd)
[00:03:04]    Compiling compiler_builtins v0.0.0 (file:///checkout/src/rustc/compiler_builtins_shim)
[00:03:04]    Compiling cmake v0.1.30
[00:03:04]    Compiling alloc_jemalloc v0.0.0 (file:///checkout/src/liballoc_jemalloc)
[00:03:08] error[E0231]: only named substitution parameters are allowed
[00:03:08]    --> libcore/fmt/mod.rs:611:1
[00:03:08]     |
[00:03:08] 611 | / #[rustc_on_unimplemented(
[00:03:08] 612 | |     message="`{Self}` doesn't implement `{Display}`",
[00:03:08] 613 | |     label="`{Self}` cannot be formatted with the default formatter; \
[00:03:08] 614 | |            try using `{:#?}` instead if you are using a format string",
[00:03:08] 615 | | )]
[00:03:08]     | |__^
[00:03:08] error: aborting due to previous error
[00:03:08] 
[00:03:08] For more information about this error, try `rustc --explain E0231`.
[00:03:08] error: Could not compile `core`.
[00:03:08] error: Could not compile `core`.
[00:03:08] 
[00:03:08] Caused by:
[00:03:08]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name core libcore/lib.rs --color always --error-format json --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=fb1e36473ec4786e -C extra-filename=-fb1e36473ec4786e --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/release/deps` (exit code: 101)
[00:03:08] warning: build failed, waiting for other jobs to finish...
[00:03:10] error: build failed
[00:03:10] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "--release" "--locked" "--color" "always" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "--message-format" "json"
[00:03:10] expected success, got: exit code: 101
[00:03:10] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1091:9
[00:03:10] travis_fold:end:stage0-std

[00:03:10] travis_time:end:stage0-std:start=1525434932963736033,finish=1525434945811664640,duration=12847928607


[00:03:10] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:10] Build completed unsuccessfully in 0:00:14
[00:03:10] make: *** [tidy] Error 1
[00:03:10] Makefile:79: recipe for target 'tidy' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:13053696
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@@ -610,7 +610,7 @@ pub trait Debug {
#[rustc_on_unimplemented(
message="`{Self}` doesn't implement `{Display}`",
label="`{Self}` cannot be formatted with the default formatter; \
try using `:?` instead if you are using a format string",
try using `{:#?}` instead if you are using a format string",
Copy link
Member

@varkor varkor May 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you include both:

try using {:?} or {:#?} instead if you are using a format string

Or maybe something like:

try using {:?} (or {:#?} for extra padding) instead if you are using a format string

I think both are useful in their own right, so I don't think in making one clearer, we should hide the other.

@varkor
Copy link
Member

varkor commented May 4, 2018

There was additional feedback to point to the use of {} in the original string. Did you look into how difficult it would be to do that (it's contextual, but maybe it's possible to work out anyway)?

@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:45:36] ....................................................................................................
[00:45:41] ....................................................................................................
[00:45:47] ....................................................................................................
[00:45:53] .........................................i..........................................................
[00:45:59] .................i..................F...............................................................
[00:46:11] ....................................................................................................
[00:46:11] ....................................................................................................
 doesn't implement `std::fmt::Debug`
[00:46:17] 15    |
[00:46:17] 16    = help: the trait `std::fmt::Debug` is not implemented for `no_debug::Bar`
[00:46:17] 17    = note: required by `std::fmt::Debug::fmt`
[00:46:17] 20   --> $DIR/no-debug.rs:21:23
[00:46:17] 21    |
[00:46:17] 21    |
[00:46:17] 22 LL |     println!("{} {}", Foo, Bar);
[00:46:17] -    |                       ^^^ `Foo` cannot be formatted with the default formatter; try using `:?` instead if you are using a format string
[00:46:17] +    |                       ^^^ `Foo` cannot be formatted with the default formatter; try using `{:?}` (or {:#?}) for pretty-print) instead if you are using a format string
[00:46:17] 24    |
[00:46:17] 25    = help: the trait `std::fmt::Display` is not implemented for `Foo`
[00:46:17] 26    = note: required by `std::fmt::Display::fmt`
[00:46:17] 29   --> $DIR/no-debug.rs:21:28
[00:46:17] 30    |
[00:46:17] 30    |
[00:46:17] 31 LL |     println!("{} {}", Foo, Bar);
[00:46:17] -    |                            ^^^ `no_debug::Bar` cannot be formatted with the default formatter; try using `:?` instead if you are using a format string
[00:46:17] +    |                            ^^^ `no_debug::Bar` cannot be formatted with the default formatter; try using `{:?}` (or {:#?}) for pretty-print) instead if you are using a format string
[00:46:17] 33    |
[00:46:17] 34    = help: the trait `std::fmt::Display` is not implemented for `no_debug::Bar`
[00:46:17] 35    = note: required by `std::fmt::Display::fmt`
[00:46:17] 
[00:46:17] The actual stderr differed from the expected stderr.
[00:46:17] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/on-unimplemented/no-debug.stderr
[00:46:17] To update references, run this command from build directory:
[00:46:17] To update references, run this command from build directory:
[00:46:17] /checkout/src/test/ui/update-references.sh '/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui' 'on-unimplemented/no-debug.rs'
[00:46:17] error: 1 errors occurred comparing output.
[00:46:17] status: exit code: 101
[00:46:17] status: exit code: 101
[00:46:17] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/on-unimplemented/no-debug.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/on-unimplemented/no-debug.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/on-unimplemented/no-debug.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"
[00:46:17] ------------------------------------------
[00:46:17] 
[00:46:17] ------------------------------------------
[00:46:17] stderr:
[00:46:17] stderr:
[00:46:17] ------------------------------------------
[00:46:17] {"message":"`Foo` doesn't implement `std::fmt::Debug`","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/on-unimplemented/no-debug.rs","byte_start":588,"byte_end":591,"line_start":20,"line_end":20,"column_start":27,"column_end":30,"is_primary":true,"text":[{"text":"    println!(\"{:?} {:?}\", Foo, Bar);","highlight_start":27,"highlight_end":30}],"label":"`Foo` cannot be formatted using `:?`; add `#[derive(Debug)]` or manually implement `std::fmt::Debug`","suggested_replacement":null,"expansion":{"span":{"file_name":"<print macros>","byte_start":54,"byte_end":85,"line_start":2,"line_end":2,"column_start":27,"column_end":58,"is_primary":false,"text":[{"text":"$ crate :: io :: _print ( format_args ! ( $ ( $ arg ) * ) ) ) ;","highlight_start":27,"highlight_end":58}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"<println macros>","byte_start":138,"byte_end":191,"line_start":3,"line_end":3,"column_start":8,"column_end":61,"is_primary":false,"text":[{"text":") => ( print ! ( concat ! ( $ fmt , \"\\n\" ) , $ ( $ arg ) * ) ) ;","highlight_start":8,"highlight_end":61}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"/checkout/src/test/ui/on-unimplemented/no-debug.rs","byte_start":566,"byte_end":598,"line_start":20,"line_end":20,"column_start":5,"column_end":37,"is_primary":false,"text-debug.rs:20:27\n   |\nLL |     println!(\"{:?} {:?}\", Foo, Bar);\n   |                           ^^^ `Foo` cannot be formatted using `:?`; add `#[derive(Debug)]` or manually implement `std::fmt::Debug`\n   |\n   = help: the trait `std::fmt::Debug` is not implemented for `Foo`\n   = note: required by `std::fmt::Debug::fmt`\n\n"}
[00:46:17] {"message":"`no_debug::Bar` doesn't implement `std::fmt::Debug`","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/on-unimplemented/no-debug.rs","byte_start":593,"byte_end":596,"line_start":20,"line_end":20,"column_start":32,"column_end":35,"is_primary":true,"text":[{"text":"    println!(\"{:?} {:?}\", Foo, Bar);","highlight_start":32,"highlight_end":35}],"label":"`no_debug::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`","suggested_replacement":null,"expansion":{"span":{"file_name":"<print macros>","byte_start":54,"byte_end":85,"line_start":2,"line_end":2,"column_start":27,"column_end":58,"is_primary":false,"text":[{"text":"$ crate :: io :: _print ( format_args ! ( $ ( $ arg ) * ) ) ) ;","highlight_start":27,"highlight_end":58}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"<println macros>","byte_start":138,"byte_end":191,"line_start":3,"line_end":3,"column_start":8,"column_end":61,"is_primary":false,"text":[{"text":") => ( print ! ( concat ! ( $ fmt , \"\\n\" ) , $ ( $ arg ) * ) ) ;","highlight_start":8,"highlight_end":61}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"/checkout/src/test/ui/on-unimplemented/no-debug.rs","byte_start":566,"byte_end":598,"line_start":20,"line_end":20,"column_start":5,"column_end":37,"is_primary":false,"text":[{"text":"    println!(\"{:?} {:?}\", Foo, Bar);","highlight_start":5,"highlight_end":37}],"label":null,"suggested_replacement":null,"expansion":null},"macro_decl_name":"println!","def_site_span":{"file_name":"<println macros>","byte_start":0,"byte_end":195,"line_start":1,"line_end":3,"column_start":1,"column_end":65,"is_primary":false,"text":[{"text":"(  ) => ( print ! ( \"\\n\" ) ) ; ( $ fmt : expr ) => (","highlight_start":1,"highlight_end":53},{"text":"print ! ( concat ! ( $ fmt , \"\\n\" ) ) ) ; ( $ fmt : expr , $ ( $ arg : tt ) *","highlight_start":1,"highlight_end":78},{"text":") => ( print ! ( concat ! ( $ fmt , \"\\n\" ) , $ ( $ arg ) * ) ) ;","highlight_start":1,"highlight_end":65}],"label":null,"suggested_replacement":null,"expansion":null}}},"macro_decl_name":"print!","def_site_span":{"file_name":"<print macros>","byte_start":0,"byte_end":91,"line_start":1,"line_end":2,"column_start":1,"column_end":64,"is_primary":false,"tex  some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature ofspan":{"file_name":"<println macros>","byte_start":0,"byte_end":195,"line_start":1,"line_end":3,"column_start":1,"column_end":65,"is_primary":false,"text":[{"text":"(  ) => ( print ! ( \"\\n\" ) ) ; ( $ fmt : expr ) => (","highlight_start":1,"highlight_end":53},{"text":"print ! ( concat ! ( $ fmt , \"\\n\" ) ) ) ; ( $ fmt : expr , $ ( $ arg : tt ) *","highlight_start":1,"highlight_end":78},{"text":") => ( print ! ( concat ! ( $ fmt , \"\\n\" ) , $ ( $ arg ) * ) ) ;","highlight_start":1,"highlight_end":65}],"label":null,"suggested_replacement":null,"expansion":null}}},"macro_decl_name":"print!","def_site_span":{"file_name":"<print macros>","byte_start":0,"byte_end":91,"line_start":1,"line_end":2,"column_start":1,"column_end":64,"is_primary":false,"text":[{"text":"( $ ( $ arg : tt ) * ) => (","highlight_start":1,"highlight_end":28},{"text":"$ crate :: io :: _print ( format_args ! ( $ ( $ arg ) * ) ) ) ;","highlight_start":1,"highlight_end":64}],"label":null,"suggested_replacement":null,"expansion":null}}},"macro_decl_name":"format_args!","def_site_span":null}}],"children":[{"message":"the trait `std::fmt::Display` is not implemented for `Foo`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"required by `std::fmt::Display::fmt`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: `Foo` doesn't implement `std::fmt::Display`\n  --> /checkout/src/test/ui/on-unimplemented/no-debug.rs:21:23\n   |\nLL |     println!(\"{} {}\", Foo, Bar);\n   |                       ^^^ `Foo` cannot be formatted with the default formatter; try using `{:?}` (or {:#?}) for pretty-print) instead if you are using a format string\n   |\n   = help: the trait `std::fmt::Display` is not implemented for `Foo`\n   = note: required by `std::fmt::Display::fmt`\n\n"}
[00:46:17] {"message":"`no_debug::Bar` doesn't implement `std::fmt::Display`","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/on-unimplemented/no-debug.rs","byte_start":626,"byte_end":629,"line_start":21,"line_end":21,"column_start":28,"column_end":31,"is_primary":true,"text":[{"text":"    println!(\"{} {}\", Foo, Bar);","highlight_start":28,"highlight_end":31}],"label":"`no_debug::Bar` cannot be formatted with the default formatter; try using `{:?}` (or {:#?}) for pretty-print) instead if you are using a format string","suggested_replacement":null,"expansion":{"span":{"file_name":"<print macros>","byte_start":54,"byte_end":85,"line_start":2,"line_end":2,"column_start":27,"column_end":58,"is_primary":false,"text":[{"text":"$ crate :: io :: _print ( format_args ! ( $ ( $ arg ) * ) ) ) ;","highlight_start":27,"highlight_end":58}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"<println macros>","byte_start":138,"byte_end":191,"line_start":3,"line_end":3,"column_start":8,"column_end":61,"is_primary":false,"text":[{"text":") => ( print ! ( concat ! ( $ fmt , \"\\n\" ) , $ ( $ arg ) * ) ) ;","highlight_start":8,"highlight_end":61}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"/checkout/src/test/ui/on-unimplemented/no-debug.rs","byte_start":603,"byte_end":631,"line_start":21,"line_end":21,"column_start":5,"column_end":33,"is_primary":false,"text":[{"text":"    println!(\"{} {}\", Foo, Bar);","highlight_start":5,"highlight_end":33}],"label":null,"suggested_replacement":null,"expansion":null},"macro_decl_name":"println!","def_site_span":{"file_name":"<println macros>","byte_start":0,"byte_end":195,"line_start":1,"line_end":3,"column_start":1,"column_end":65,"is_primary":false,"text":[{"text":"(  ) => ( print ! ( \"\\n\" ) ) ; ( $ fmt : expr ) => (","highlight_start":1,"highlight_end":53},{"text":"print ! ( concat ! ( $ fmt , \"\\n\" ) ) ) ; ( $ fmt : expr , $ ( $ arg : tt ) *","highlight_start":1,"highlight_end":78},{"text":") => ( print ! ( concat ! ( $ fmt , \"\\n\" ) , $ ( $ arg ) * ) ) ;","highlight_start":1,"highlight_end":65}],"label":null,"suggested_replacement":null,"expansion":null}}},"macro_decl_name":"print!","def_site_span":{"file_name":"<print macros>","byte_start":0,"byte_end":91,"line_start":1,"line_end":2,"column_start":1,"column_end":64,"is_primary":false,"text":[{"text":"( $ ( $ arg : tt ) * ) => (","highlight_start":1,"highlight_end":28},{"text":"$ crate :: io :: _print ( format_args ! ( $ ( $ arg ) * ) ) ) ;","highlight_start":1,"highlight_end":64}],"label":null,"suggested_replacement":null,"expansion":null}}},"macro_decl_name":"format_args!","def_site_span":null}}],"children":[{"message":"the trait `std::fmt::Display` is not implemented for `no_debug::Bar`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"required by `std::fmt::Display::fmt`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: `no_debug::Bar` doesn't implement `std::fmt::Display`\n  --> /checkout/src/test/ui/on-unimplemented/no-debug.rs:21:28\n   |\nLL |     println!(\"{} {}\", Foo, Bar);\n   |                            ^^^ `no_debug::Bar` cannot be formatted with the default formatter; try using `{:?}` (or {:#?}) for pretty-print) instead if you are using a format string\n   |\n   = help: the trait `std::fmt::Display` is not implemented for `no_debug::Bar`\n   = note: required by `std::fmt::Display::fmt`\n\n"}
[00:46:17] {"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors\n\n"}
[00:46:17] {"message":"For more information about this error, try `rustc --explain E0277`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0277`.\n"}
[00:46:17] ------------------------------------------
[00:46:17] 
[00:46:17] thread '[ui] ui/on-unimplemented/no-debug.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2965:9
[00:46:17] note: Run with `RUST_BACKTRACE=1` for a backtrace.
---
[00:46:17] test result: FAILED. 1377 passed; 1 failed; 7 ignored; 0 measured; 0 filtered out
[00:46:17] 
[00:46:17] 
[00:46:17] 
[00:46:17] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:46:17] 
[00:46:17] 
[00:46:17] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
3997628 .
---
149536 ./.git/modules
149532 ./.git/modules/src
149116 ./src/llvm-emscripten/test
123716 ./obj/build/bootstrap/debug/incremental/bootstrap-1wl4zjaz72e5d
123712 ./obj/build/bootstrap/debug/incremental/bootstrap-1wl4zjaz72e5d/s-f0pzff0afd-jg6dkg-1ujokh614sjd2
116576 is_time:start:138124c8
find: `/home/travis/Library/Logs/DiagnosticReports': No such file or directory
travis_time:end:138124c8:start=1525438227007698431,finish=1525438227014304986,duration=6606555
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:43:26] ....................................................................................................
[00:43:32] ....................................................................................................
[00:43:38] ....................................................................................................
[00:43:44] .........................................i..........................................................
[00:43:49] .................i..................F...............................................................
[00:44:01] ....................................................................................................
[00:44:07] ................i....................................................................
[00:44:07] failures:
[00:44:07] 
[00:44:07] 
[00:44:07] ---- [ui] ui/on-unimplemented/no-debug.rs stdout ----
[00:44:07]  diff of stderr:
[00:44:07] 
[00:44:07] 2   --> $DIR/no-debug.rs:20:27
[00:44:07] 3    |
[00:44:07] 4 LL |     println!("{:?} {:?}", Foo, Bar);
[00:44:07] -    |                           ^^^ `Foo` cannot be formatted using `{:?}`; add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
[00:44:07] +    |                           ^^^ `Foo` cannot be formatted using `:?`; add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
[00:44:07] 6    |
[00:44:07] 7    = help: the trait `stdstrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/on-unimplemented/no-debug.rs","byte_start":588,"byte_end":591,"line_start":20,"line_end":20,"column_start":27,"column_end":30,"is_primary":true,"text":[{"text":"    println!(\"{:?} {:?}\", Foo, Bar);","highlight_start":27,"highlight_end":30}],"label":"`Foo` cannot be formatted using `:?`; add `#[derive(Debug)]` or manually implement `std::fmt::Debug`","suggested_replacement":null,"expansion":{"span":{"file_name":"<print macros>","byte_start":54,"byte_end":85,"line_start":2,"line_end":2,"column_start":27,"column_end":58,"is_primary":false,"text":[{"text":"$ crate :: io :: _print ( format_args ! ( $ ( $ arg ) * ) ) ) ;","highlight_start":27,"highlight_end":58}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"<println macros>","byte_start":138,"byte_end":191,"line_start":3,"line_end":3,"column_start":8,"column_end":61,"is_primary":false,"text":[{"text":") => ( print ! ( concat ! ( $ fmt , \"\\n\" ) , $ ( $ arg ) * ) ) ;","highlight_start":8,"highlight_end":61}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"/checkout/src/test/ui/on-unimplemented/no-debug.rs","byte_start":566,"byte_end":598,"line_start":20,"line_end":20,"column_start":5,"column_end":37,"is_primary":false,"text":[{"text":"    println!(\"{:?} {:?}\", Foo, Bar);","highlight_start":5,"highlight_end":37}],"label":null,"suggested_replacement":null,"expansion":null},"macro_decl_name":"println!","def_site_span":{"file_name":"<println macros>","byte_start":0,"byte_end":195,"line_start":1,"line_end":3,"column_start":1,"column_end":65,"is_primary":false,"text":[{"text":"(  ) => ( print ! ( \"\\n\" ) ) ; ( $ fmt : expr ) => (","highlight_start":1,"highlight_end":53},{"text":"print ! ( concat ! ( $ fmt , \"\\n\" ) ) ) ; ( $ fmt : expr , $ ( $ arg : tt ) *","highlight_start":1,"highlight_end":78},{"text":") => ( print ! ( concat ! ( $ fmt , \"\\n\" ) , $ ( $ arg ) * ) ) ;","highlight_start":1,"highlight_end":65}],"label":null,"suggested_replacement":null,"expansion":null}}},"macro_decl_name":"print!","def_site_span":{"file_name":"<print macros>","byte_start":0,"byte_end":91,"line_start":1,"line_end":2,"column_start":1,"column_end":64,"is_primary":false,"text":[{"text":"( $ ( $ arg : tt ) * ) => (","highlight_start":1,"highlight_end":28},{"text":"$ crate :: io :: _print ( format_args ! ( $ ( $ arg ) * ) ) ) ;","highlight_start":1,"highlight_end":64}],"label":null,"suggested_replacement":null,"expansion":null}}},"macro_decl_name":"format_args!","def_site_span":null}}],"children":[{"message":"the trait `std::fmt::Debug` is not implemented for `Foo`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"required by `std::fmt::Debug::fmt`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: `Foo` doesn't implement `std::fmt::Debug`\n  --> /checkout/src/test/ui/on-unimplemented/no-debug.rs:20:27\n   |\nLL |     println!(\"{:?} {:?}\", Foo, Bar);\n   |                           ^^^ `Foo` cannot be formatted using `:?`; add `#[derive(Debug)]` or manually implement `std::fmt::Debug`\n   |\n   = help: the trait `std::fmt::Debug` is not implemented for `Foo`\n   = note: required by `std::fmt::Debug::fmt`\n\n"}
[00:44:07] {"message":"`no_debug::Bar` doesn't implement `std::fmt::Debug`","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/on-unimplemented/no-debug.rs","byte_start":593,"byte_end":596,"line_start":20,"line_end":20,"column_start":32,"column_end":35,"is_primary":true,"text":[{"text":"    println!(\"{:?} {:?}\", Foo, Bar);","highlight_start":32,"highlight_end":35}],"label":"`no_debug::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`","suggested_replacement":null,"expansion":{"span":{"file_name":"<print macros>","byte_start":54,"byte_end":85,"line_start":2,"line_end":2,"column_start":27,"column_end":58,"is_primary":false,"text":[{"text":"$ crate :: io :: _print ( format_args ! ( $ ( $ arg ) * ) ) ) ;","highlight_start":27,"highlight_end":58}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"<println macros>","byte_start":138,"byte_end":191,"line_start":3,"line_end":3,"column_start":8,"column_end":61,"is_primary":false,"text":[{"text":") => ( print ! ( concat ! ( $ fmt , \"\\n\" ) , $ ( $ arg ) * ) ) ;","highlight_start":8,"highlight_end":61}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"/checkout/src/test/ui/on-unimplemented/no-debug.rs","byte_start":566,"byte_end":598,"line_start":20,"line_end":20,"column_start":5,"column_end":37,"is_primary":false,"text":[{"text":"    println!(\"{:?} {:?}\", Foo, Bar);","highlight_start":5,"highlight_end":37}],"label":null,"suggested_replacement":null,"expansion":null},"macro_decl_name":"println!","def_site_span":{"file_name":"<println macros>","byte_start":0,"byte_end":195,"line_start":1,"line_end":3,"column_start":1,"column_end":65,"is_primary":false,"text":[{"text":"(  ) => ( print ! ( \"\\n\" ) ) ; ( $ fmt : expr ) => (","highlight_start":1,"highlight_end":53},{"text":"print ! ( concat ! ( $ fmt , \"\\n\" ) ) ) ; ( $ fmt : expr , $ ( $ arg : tt ) *","highlight_start":1,"highlight_end":78},{"text":") => ( print ! ( concat ! ( $ fmt , \"\\n\" ) , $ ( $ arg ) * ) ) ;","highlight_start":1,"highlight_end":65}],"label":null,"suggested_replacement":null,"expansion":null}}},"macro_decl_name":"print!","def_site_span":{"file_name":"<print macros>","byte_start":0,"byte_end":91,"line_start":1,"line_end":2,"column_start":1,"column_end":64,"is_primary":false,"text":[{"text":"( $ ( $ arg : tt ) * ) => (","highlight_start":1,"highlight_end":28},{"text":"$ crate :: io :: _print ( format_args ! ( $ ( $ arg ) * ) ) ) ;","highlight_start":1,"highlight_end":64}],"label":null,"suggested_replacement":null,"expansion":null}}},"macro_decl_name":"format_args!","def_site_span":null}}],"children":[{"message":"the trait `std::fmt::Debug` is not implemented for `no_debug::Bar`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"required by `std::fmt::Debug::fmt`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: `no_debug::Bar` doesn't implement `std::fmt::Debug`\n  --> /checkout/src/test/ui/on-unimplemented/no-debug.rs:20:32\n   |\nLL |     println!(\"{:?} {:?}\", Foo, Bar);\n   |                                ^^^ `no_debug::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`\n   |\n   = help: the trait `std::fmt::Debug` is not implemented for `no_debug::Bar`\n   = note: required by `std::fmt::Debug::fmt`\n\n"}
[00:44:07] {"message":"`Foo` doesn't implement `std::fmt::Display`","code":{"code":"E0277","explanation":"\nYou tried to use a type which doesn't implement some trait in a place which\nexpected that trait. Erroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/on-unimplemented/no-debug.rs","byte_start":621,"byte_end":624,"line_start":21,"line_end":21,"column_start":23,"column_end":26,"is_primary":true,"text":[{"text":"    println!(\"{} {}\", Foo, Bar);","highlight_start":23,"highlight_end":26}],"label":"`Foo` cannot be formatted with the default formatter; try using `{:?}` (or {:#?} for pretty-print) instead if you are using a format string","suggested_replacement":null,"expansion":{"span":{"file_name":"<print macros>","byte_start":54,"byte_end":85,"line_start":2,"line_end":2,"column_start":27,"column_end":58,"is_primary":false,"text":[{"text":"$ crate :: io :: _print ( format_args ! ( $ ( $ arg ) * ) ) ) ;","highlight_start":27,"highlight_end":58}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"<println macros>","byte_start":138,"byte_end":191,"line_start":3,"line_end":3,"column_start":8,"column_end":61,"is_primary":false,"text":[{"text":") => ( print ! ( concat ! ( $ fmt , \"\\n\" ) , $ ( $ arg ) * ) ) ;","highlight_start":8,"highlight_end":61}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"/checkout/src/test/ui/on-unimplemented/no-debug.rs","byte_start":603,"byte_end":631,"line_start":21,"line_end":21,"column_start":5,"c?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function: Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function: It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/on-unimplemented/no-debug.rs","byte_start":626,"byte_end":629,"line_start":21,"line_end":21,"column_start":28,"column_end":31,"is_primary":true,"text":[{"text":"    println!(\"{} {}\", Foo, Bar);","highlight_start":28,"highlight_end":31}],"label":"`no_debug::Bar` cannot be formatted with the default formatter; try using `{:?}` (or {:#?} for pretty-print) instead if you are using a format string","suggested_replacement":null,"expansion":{"span":{"file_name":"<print macros>","byte_start":54,"byte_end":85,"line_start":2,"line_end":2,"column_start":27,"column_end":58,"is_primary":false,"text":[{"text":"$ crate :: io :: _print ( format_args ! ( $ ( $ arg ) * ) ) ) ;","highlight_start":27,"highlight_end":58}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"<println macros>","byte_start":138,"byte_end":191,"line_start":3,"line_end":3,"column_start":8,"column_end":61,"is_primary":false,"text":[{"text":") => ( print ! ( concat ! ( $ fmt , \"\\n\" ) , $ ( $ arg ) * ) ) ;","highlight_start":8,"highlight_end":61}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"/checkout/src/test/ui/on-unimplemented/no-debug.rs","byte_start":603,"byte_end":631,"line_start":21,"line_end":21,"column_start":5,"column_end":33,"is_primary":false,"text":[{"text":"    println!(\"{} {}\", Foo, Bar);","highlight_start":5,"highlight_end":33}],"label":null,"suggested_replacement":null,"expansion":null},"macro_decl_name":"println!","def_site_span":{"file_name":"<println macros>","byte_start":0,"byte_end":195,"line_start":1,"line_end":3,"column_start":1,"column_end":65,"is_primary":false,"text":[{"text":"(  ) => ( print ! ( \"\\n\" ) ) ; ( $ fmt : expr ) => (","highlight_start":1,"highlight_end":53},{"text":"print ! ( concat ! ( $ fmt , \"\\n\" ) ) ) ; ( $ fmt : expr , $ ( $ arg : tt ) *","highlight_start":1,"highlight_end":78},{"text":") => ( print ! ( concat ! ( $ fmt , \"\\n\" ) , $ ( $ arg ) * ) ) ;","highlight_start":1,"highlight_end":65}],"label":null,"suggested_replacement":null,"expansion":null}}},"macro_decl_name":"print!","def_site_span":{"file_name":"<print macros>","byte_start":0,"byte_end":91,"line_start":1,"line_end":2,"column_start":1,"column_end":64,"is_primary":false,"text":[{"text":"( $ ( $ arg : tt ) * ) => (","highlight_start":1,"highlight_end":28},{"text":"$ crate :: io :: _print ( format_args ! ( $ ( $ arg ) * ) ) ) ;","highlight_start":1,"highlight_end":64}],"label":null,"suggested_replacement":null,"expansion":null}}},"macro_decl_name":"format_args!","def_site_span":null}}],"children":[{"message":"the trait `std::fmt::Display` is not implemented for `no_debug::Bar`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"required by `std::fmt::Display::fmt`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: `no_debug::Bar` doesn't implement `std::fmt::Display`\n  --> /checkout/src/test/ui/on-unimplemented/no-debug.rs:21:28\n   |\nLL |     println!(\"{} {}\", Foo, Bar);\n   |                            ^^^ `no_debug::Bar` cannot be formatted with the default formatter; try using `{:?}` (or {:#?} for pretty-print) instead if you are using a format string\n   |\n   = help: the trait `std::fmt::Display` is not implemented for `no_debug::Bar`\n   = note: required by `std::fmt::Display::fmt`\n\n"}
[00:44:07] {"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors\n\n"}
[00:44:07] {"message":"For more information about this error, try `rustc --explain E0277`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0277`.\n"}
[00:44:07] ------------------------------------------
[00:44:07] 
[00:44:07] thread '[ui] ui/on-unimplemented/no-debug.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2965:9
[00:44:07] note: Run with `RUST_BACKTRACE=1` for a backtrace.
---
[00:44:07] test result: FAILED. 1377 passed; 1 failed; 7 ignored; 0 measured; 0 filtered out
[00:44:07] 
[00:44:07] 
[00:44:07] 
[00:44:07] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-3.9/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "3.9.1\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:44:07] 
[00:44:07] 
[00:44:07] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:44:07] Build completed unsuccessfully in 0:02:18
[00:44:07] Build completed unsuccessfully in 0:02:18
[00:44:07] make: *** [check] Error 1
[00:44:07] Makefile:58: recipe for target 'check' failed
2727364 ./obj
2727332 ./obj/build
1964344 ./obj/build/x86_64-unknown-linux-gnu
725184 ./src
---
149576 ./.git/modules
149572 ./.git/modules/src
149112 ./src/llvm-emscripten/test
123716 ./obj/build/bootstrap/debug/incremental/bootstrap-1wl4zjaz72e5d
123712 ./obj/build/bootstrap/debug/incremental/bootstrap-1wl4zjaz72e5d/s-f0q1m7ng4l-o165i2-1ujokh614sjd2
116576 44 ./obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib
71136 ./.git/modules/src/tools
70976 ./obj/build/x86_64-unknown-linux-gnu/native
70596 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc
70300 ./obj/build/x86_64-unknown-linux-gnu/native/jemalloc
70300 ./obj/build/x86_64-unknown-linux-gnu/native/jemalloc
68772 ./src/llvm/lib
65412 ./src/llvm-emscripten/test/CodeGen
60840 ./src/llvm-emscripten/lib
56088 ./obj/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/bin
55380 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release
53660 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/incremental/syntax-33ta18b3panbi
53656 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/incremental/syntax-33ta18b3panbi/s-f0q2pa0igc-1jb61rq-2n1eznxrleidp
48604 ./obj/build/x86_64-unknown-linux-gnu/stage0/bin
47892 ./obj/build/x86_64-unknown-linux-gnu/stage0-std
46920 ./src/test
46720 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/release

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@kornelski kornelski force-pushed the debughint branch 2 times, most recently from a03d236 to d297d8d Compare May 4, 2018 18:08
@kornelski
Copy link
Contributor Author

@varkor Just getting the string changed took me five tries, so I'll leave more advanced changes for another time :)

Copy link
Contributor

@estebank estebank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -542,10 +542,10 @@ impl<'a> Display for Arguments<'a> {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(
on(crate_local, label="`{Self}` cannot be formatted using `:?`; \
on(crate_local, label="`{Self}` cannot be formatted using `{{:?}}`; \
add `#[derive(Debug)]` or manually implement `{Debug}`"),
message="`{Self}` doesn't implement `{Debug}`",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change the label to be just

`{Self}` cannot be formatted using `{{:?}}`

and add

note="you can add `#[derive(Debug)]` to `{Self}` or manually implement `{Debug}` for it",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, added labels

@@ -611,7 +611,8 @@ pub trait Debug {
#[rustc_on_unimplemented(
message="`{Self}` doesn't implement `{Display}`",
label="`{Self}` cannot be formatted with the default formatter; \
try using `:?` instead if you are using a format string",
try using `{{:?}}` (or {{:#?}} for pretty-print) instead \
if you are using a format string",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, could this be a note instead?

Also, I would alter the wording slightly:

label="`{Self}` cannot be formatted with the default formatter",
note="you might be able to use `{{:?}}` (or {{:#?}} for pretty-print) instead if `{Self}` implements `Debug`",

|
= help: the trait `std::fmt::Display` is not implemented for `Foo`
= note: in format strings you may be albe to use `{:?}` (or {:#?} for pretty-print) instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"you might be albe to use" 👀

@estebank
Copy link
Contributor

estebank commented May 5, 2018

r me once the typo is fixed.

@bors delegate=kornelski

@bors
Copy link
Collaborator

bors commented May 5, 2018

✌️ @kornelski can now approve this pull request

@kornelski
Copy link
Contributor Author

@bors r+

@bors
Copy link
Collaborator

bors commented May 5, 2018

📌 Commit 1e38eee has been approved by kornelski

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 5, 2018
@kornelski
Copy link
Contributor Author

@estebank typo fixed

@bors
Copy link
Collaborator

bors commented May 5, 2018

⌛ Testing commit 1e38eee with merge fa30ae5...

bors added a commit that referenced this pull request May 5, 2018
Suggest more helpful formatting string

Based on [user feedback](https://users.rust-lang.org/t/ux-feedback-from-a-rust-newbie/17220) the minimal suggestion of `:?` is unclear.

Also `{:#?}` is much more readable than the standard debug, so this PR suggests it to help surface this nice feature.
@bors
Copy link
Collaborator

bors commented May 5, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: kornelski
Pushing fa30ae5 to master...

@bors bors merged commit 1e38eee into rust-lang:master May 5, 2018
@kornelski kornelski deleted the debughint branch May 5, 2018 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants