Skip to content
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

allow multiple args to `dbg!(..)` #59826

Merged
merged 3 commits into from Apr 20, 2019

Conversation

@llogiq
Copy link
Contributor

commented Apr 9, 2019

This closes #59763

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented Apr 9, 2019

r? @cramertj

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

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented Apr 9, 2019

The job x86_64-gnu-llvm-6.0 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.
travis_time:end:0b17cf95:start=1554844080182348266,finish=1554844081220549697,duration=1038201431
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
travis_time:start:test_assembly
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:17:17] 
[01:17:17] running 9 tests
[01:17:17] iiiiiiiii
[01:17:17] 
[01:17:17]  finished in 0.164
[01:17:17] travis_fold:end:test_assembly

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:17:35] 
[01:17:35] running 121 tests
[01:18:05] .iiiii...i.....i..i...i..i.i.i..i.ii...i.....i..i....i..........iiii..........i...ii...i.......ii.i. 100/121
[01:18:11] i.i......iii.i.....ii
[01:18:11] 
[01:18:11]  finished in 36.180
[01:18:11] travis_fold:end:test_debuginfo

---
[01:38:46] i................................................................................................... 100/999
[01:39:01] .................................................................................................... 200/999
[01:39:11] ............iii......i......i...i......i............................................................ 300/999
[01:39:16] .................................................................................................... 400/999
[01:39:26] ............................i.i.................................F....iiii........ii................. 500/999
[01:39:43] .................................................................................................... 700/999
[01:39:53] .....................iiii........................................................................... 800/999
[01:40:08] .................................................................................................... 900/999
[01:40:17] .............................................iiii..................................................
[01:40:17] .............................................iiii..................................................
[01:40:17] failures:
[01:40:17] 
[01:40:17] ---- macros.rs - dbg (line 320) stdout ----
[01:40:17] error[E0423]: expected function, found macro `assert_eq`
[01:40:17]  --> macros.rs:321:1
[01:40:17]   |
[01:40:17] 4 | assert_eq(dbg!(1usize, 2usize), (1, 2));
[01:40:17]   | ^^^^^^^^^ help: use `!` to invoke the macro: `assert_eq!`
[01:40:17] error: aborting due to previous error
[01:40:17] 
[01:40:17] For more information about this error, try `rustc --explain E0423`.
[01:40:17] thread 'macros.rs - dbg (line 320)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:310:13
---
[01:40:17] 
[01:40:17] error: test failed, to rerun pass '--doc'
[01:40:17] 
[01:40:17] 
[01:40:17] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "std" "--" "--quiet"
[01:40:17] 
[01:40:17] 
[01:40:17] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:40:17] Build completed unsuccessfully in 0:36:00
[01:40:17] Build completed unsuccessfully in 0:36:00
[01:40:17] Makefile:48: recipe for target 'check' failed
[01:40:17] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:12cecbf8
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Tue Apr  9 22:48:29 UTC 2019
---
travis_time:end:04718703:start=1554850111921619544,finish=1554850111927409688,duration=5790144
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0b70c7e0
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:138b2998
travis_time:start:138b2998
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:2c9b233f
$ dmesg | grep -i kill

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)

@Centril
Copy link
Member

left a comment

I think a better implementation of this, as I originally envisaged, was to have each part of the tuple on a separate line for better readability. Moreover, dbg!(1,) and dbg!(2, 3,) is supported by this change whereas it is not by your implementation.

Show resolved Hide resolved src/libstd/macros.rs Outdated
Show resolved Hide resolved src/libstd/macros.rs Outdated
@Centril

This comment has been minimized.

Copy link
Member

commented Apr 9, 2019

@Centril

This comment has been minimized.

Copy link
Member

commented Apr 9, 2019

Moreover, the UI tests for dbg! should be extended to cover the new behavior once we settle on a behavior, assuming we want to make this change.

@llogiq llogiq force-pushed the llogiq:multi-dbg branch from 419d603 to 8816a9a Apr 10, 2019

Apply suggestions from code review
Use dbg! recursively on each item

Co-Authored-By: llogiq <bogusandre@gmail.com>
@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

commented Apr 10, 2019

The job x86_64-gnu-llvm-6.0 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.
travis_time:end:05563470:start=1554868913098569244,finish=1554868914132548417,duration=1033979173
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[01:06:31] .................................................................................................... 4400/5530
[01:06:35] .................................................................................................... 4500/5530
[01:06:38] .................................................................................................... 4600/5530
[01:06:42] .................................................................................................... 4700/5530
[01:06:48] ...F................................................................................................ 4800/5530
[01:06:54] .................................................................................................... 5000/5530
[01:06:59] .................................................................................................... 5100/5530
[01:07:02] .................................................................................................... 5200/5530
[01:07:06] .................................................................................................... 5300/5530
[01:07:06] .................................................................................................... 5300/5530
[01:07:09] .................................................................................................... 5400/5530
[01:07:11] ....................................................................i............................... 5500/5530
[01:07:12] ..............................
[01:07:12] failures:
[01:07:12] 
[01:07:12] ---- [ui] ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs stdout ----
[01:07:12] 
[01:07:12] error: test compilation failed although it shouldn't!
[01:07:12] status: exit code: 1
[01:07:12] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs" "-Zthreads=1" "--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/rfc-2361-dbg-macro/dbg-macro-expected-behavior/a" "-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/rfc-2361-dbg-macro/dbg-macro-expected-behavior/auxiliary" "-A" "unused"
[01:07:12] ------------------------------------------
[01:07:12] 
[01:07:12] ------------------------------------------
[01:07:12] stderr:
[01:07:12] stderr:
[01:07:12] ------------------------------------------
[01:07:12] {"message":"can't compare `&str` with `(&str,)`","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":"<::core::macros::assert_eq macros>","byte_start":123,"byte_end":125,"line_start":5,"line_end":5,"column_start":19,"column_end":21,"is_primary":true,"text":[{"text":"if ! ( * left_val == * right_val ) {","highlight_start":19,"highlight_end":21}],"label":"no implementation for `&str == (&str,)`","suggested_replacement":null,"suggestion_applicability":null,"expansion":{"span":{"file_name":"/checkout/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs","byte_start":1436,"byte_end":1471,"line_start":59,"line_end":59,"column_start":5,"column_end":40,"is_primary":false,"text":[{"text":"    assert_eq!(\"Yeah\", dbg!(\"Yeah\", ));","highlight_start":5,"highlight_end":40}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},"macro_decl_name":"assert_eq!","def_site_span":{"file_name":"<::core::macros::assert_eq macros>","byte_start":0,"byte_end":687,"line_start":1,"line_end":21,"column_start":1,"column_end":77,"is_primary":false,"text":[{"text":"( $ left : expr , $ right : expr ) => (","highlight_start":1,"highlight_end":40},{"text":"{","highlight_start":1,"highlight_end":2},{"text":"match ( & $ left , & $ right ) {","highlight_start":1,"highlight_end":33},{"text":"( left_val , right_val ) => {","highlight_start":1,"highlight_end":30},{"text":"if ! ( * left_val == * right_val ) {","highlight_start":1,"highlight_end":37},{"text":"panic ! (","highlight_start":1,"highlight_end":10},{"text":"r#\"assertion failed: `(left == right)`","highlight_start":1,"highlight_end":39},{"text":"  left: `{:?}`,","highlight_start":1,"highlight_end":16},{"text":" right: `{:?}`\"# , & *","highlight_start":1,"highlight_end":23},{"text":"left_val , & * right_val ) } } } } ) ; ( $ left : expr , $ right : expr , ) =>","highlight_start":1,"highlight_end":79},{"text":"( { assert_eq ! ( $ left , $ right ) } ) ; (","highlight_start":1,"highlight_end":45},{"text":"$ left : expr , $ right : expr , $ ( $ arg : tt ) + ) => (","highlight_start":1,"highlight_end":59},{"text":"{","highlight_start":1,"highlight_end":2},{"text":"match ( & ( $ left ) , & ( $ right ) ) {","highlight_start":1,"highlight_end":41},{"text":"( left_val , right_val ) => {","highlight_start":1,"highlight_end":30},{"text":"if ! ( * left_val == * right_val ) {","highlight_start":1,"highlight_end":37},{"text":"panic ! (","highlight_start":1,"highlight_end":10},{"text":"r#\"assertion failed: `(left == right)`","highlight_start":1,"highlight_end":39},{"text":"  left: `{:?}`,","highlight_start":1,"highlight_end":16},{"text":" right: `{:?}`: {}\"# ,","highlight_start":1,"highlight_end":23},{"text":"& * left_val , & * right_val , format_args ! ( $ ( $ arg ) + ) ) } } } } ) ;","highlight_start":1,"highlight_end":77}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}}}],"children":[{"message":"the trait `std::cmp::PartialEq<(&str,)>` is not implemented for `&str`","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: can't compare `&str` with `(&str,)`\n  --> /checkout/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs:59:5\n   |\nLL |     assert_eq!(\"Yeah\", dbg!(\"Yeah\", ));\n   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `&str == (&str,)`\n   |\n   = help: the trait `std::cmp::PartialEq<(&str,)>` is not implemented for `&str`\n   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)\n\n"}
[01:07:12] {"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"}
[01:07:12] 
[01:07:12] ------------------------------------------
[01:07:12] 
---
[01:07:12] 
[01:07:12] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:516:22
[01:07:12] 
[01:07:12] 
[01:07:12] 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-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--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" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:07:12] 
[01:07:12] 
[01:07:12] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:07:12] Build completed unsuccessfully in 0:04:20
[01:07:12] Build completed unsuccessfully in 0:04:20
[01:07:12] Makefile:48: recipe for target 'check' failed
[01:07:12] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:02772f15
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed Apr 10 05:09:17 UTC 2019
---
travis_time:end:03744de9:start=1554872959032350652,finish=1554872959039750671,duration=7400019
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0286d668
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:01b5a916
$ dmesg | grep -i kill

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)

@llogiq llogiq force-pushed the llogiq:multi-dbg branch from ef78c68 to 2e3df51 Apr 10, 2019

@alexcrichton

This comment has been minimized.

Copy link
Member

commented Apr 10, 2019

r? @SimonSapin

I think you authored the original RFC, so you're probably best to look at this

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented Apr 10, 2019

The job x86_64-gnu-llvm-6.0 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.
travis_time:end:0090840b:start=1554912061081256661,finish=1554912064486806059,duration=3405549398
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[01:09:54] .................................................................................................... 4400/5530
[01:09:57] .................................................................................................... 4500/5530
[01:10:01] .................................................................................................... 4600/5530
[01:10:05] .................................................................................................... 4700/5530
[01:10:11] ..................................F................................................................. 4800/5530
[01:10:18] .................................................................................................... 5000/5530
[01:10:23] .................................................................................................... 5100/5530
[01:10:26] .................................................................................................... 5200/5530
[01:10:30] .................................................................................................... 5300/5530
---
[01:10:37] ------------------------------------------
[01:10:37] stderr:
[01:10:37] ------------------------------------------
[01:10:37] thread 'main' panicked at 'assertion failed: `(left == right)`
[01:10:37]   left: `[":21] Unit = Unit", ":22] a = Unit", ":28] Point{x: 42, y: 24,} = Point {", "    x: 42,", "    y: 24,", "}", ":29] b = Point {", "    x: 42,", "    y: 24,", "}", ":37]", ":41] &a = NoCopy(", "    1337,", ")", ":41] dbg!(& a) = NoCopy(", "    1337,", ")", ":46] f(&42) = 42", "before", ":51] { foo += 1; eprintln!(\"before\"); 7331 } = 7331", ":59] \"Yeah\" = \"Yeah\"", ":62] 1 = 1", ":62] 2 = 2", ":66] 1u8 = 1", ":66] 2u32 = 2", ":66] \"Yeah\" = \"Yeah\""]`,
[01:10:37]  right: `[":21] Unit = Unit", ":22] a = Unit", ":28] Point{x: 42, y: 24,} = Point {", "    x: 42,", "    y: 24,", "}", ":29] b = Point {", "    x: 42,", "    y: 24,", "}", ":37]", ":41] &a = NoCopy(", "    1337,", ")", ":41] dbg!(& a) = NoCopy(", "    1337,", ")", ":46] f(&42) = 42", "before", ":51] { foo += 1; eprintln!(\"before\"); 7331 } = 7331", ":59] dbg!(\"Yeah\",) = \"Yeah\"", ":62] dbg!(1) = 1", ":63] dbg!(2) = 2", ":66] dbg!(1) = 1", ":66] dbg!(2) = 2", ":67] dbg!(\"Yeah\",) = \"Yeah\""]`', /checkout/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs:71:5
[01:10:37] 
[01:10:37] ------------------------------------------
[01:10:37] 
[01:10:37] thread '[ui] ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3425:9
---
[01:10:37] 
[01:10:37] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:516:22
[01:10:37] 
[01:10:37] 
[01:10:37] 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-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--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" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:10:37] 
[01:10:37] 
[01:10:37] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:10:37] Build completed unsuccessfully in 0:04:30
[01:10:37] Build completed unsuccessfully in 0:04:30
[01:10:37] make: *** [check] Error 1
[01:10:37] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:265cb39c
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed Apr 10 17:11:51 UTC 2019
---
travis_time:end:11e888aa:start=1554916313018693427,finish=1554916313023562649,duration=4869222
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:005db29a
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:022f1bac
travis_time:start:022f1bac
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:179d97db
$ dmesg | grep -i kill

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)

@SimonSapin

This comment has been minimized.

Copy link
Contributor

commented Apr 10, 2019

In the RFC, I specifically proposed not doing this:

https://github.com/rust-lang/rfcs/blob/master/text/2361-dbg-macro.md#accepting-a-single-expression-instead-of-many

I think it creates an undesirable “discontinuity”: if dbg!(x, y, z) returns the 3-tuple (x, y, y) and dbg!(x, y) returns the 2-tuple (x, y) (and dbg!() returns the zero-tuple ()) then the consistent continuation is that dbg!(x) returns the 1-tuple (x,). But it has been stabilized as returning x, and a 1-tuple is probably less convenient anyway.

I can’t find it again, but I vaguely remember an argument that you could look at dbg!(x) as dbg! (x), and (x) by itself is x with unnecessary parens, not a tuple. But I disagree with this framing: the foo!(…) syntax of expression-position macro invocation is much more similar to function call syntax than to tuple syntax. (Using a 1-tuple to represent the arguments of a single-argument function appears again in the desugared notation for the Fn(T) trait, which is Fn<(T,)>.)

This PR seems to be going for emulating tuple syntax: it makes dbg!(x,) behave differently than dbg!(x) and return (x,) instead of x. But in a function call, a trailing comma after arguments is not significant. I think we should not make it significant in a function-like macro that takes comma-separated expressions as arguments.


TL;DR: I feel I would still prefer that dbg!(…) only accepts one (or zero) expression, and that making it return a tuple involves passing it an actual tuple value.

That said, is there consensus except for me that the convenience of debugging multiple values with fewer sigils is worth accepting this weird inconsistency?

If so, I’d prefer we embrace the inconsistency and make dbg!(x,) the same as dbg!(x). And maybe the filename and line number should not be repeated for every element of the tuple?

CC @rust-lang/libs

@Centril

This comment has been minimized.

Copy link
Member

commented Apr 10, 2019

I can’t find it again, but I vaguely remember an argument that you could look at dbg!(x) as dbg! (x), and (x) by itself is x with unnecessary parens, not a tuple.

Yes, that is the framing I was going for. It provides a good internal consistency. Perhaps not the one you want, but I think it works well in practice to do what the users wants 99% of the time.

This PR seems to be going for emulating tuple syntax: it makes dbg!(x,) behave differently than dbg!(x) and return (x,) instead of x. But in a function call, a trailing comma after arguments is not significant. I think we should not make it significant in a function-like macro that takes comma-separated expressions as arguments.

What is the failure mode here? i.e. in what way do you think this will trip users up?

Note that if you write dbg!(x); or dbg!(x,); it will not matter that you actually received back a tuple as the semicolon turns the type into () in any case.

To actually have a problem, you need to actually use the result:

let x = dbg!(x,);

(x must still be passed along to have a problem)

I think this is unlikely and is only probable as the result of a typo. When it happens the compiler already gives a good error message:

fn main() {
    let _: u8 = dbg!(1,);
}

results in:

error[E0308]: mismatched types
  --> src/main.rs:18:9
   |
18 |         ($(dbg!($val)),+,)
   |         ^^^^^^^^^^^^^^^^^^ expected u8, found tuple
...
23 |     let _: u8 = dbg!(1,);
   |                 -------- in this macro invocation
   |
   = note: expected type `u8`
              found type `({integer},)`

If so, I’d prefer we embrace the inconsistency and make dbg!(x,) the same as dbg!(x). And maybe the filename and line number should not be repeated for every element of the tuple?

Note that this only makes the macro more complex, not less. One good advantage of this PR is that it provides a simple implementation that should also be simple to explain: simply remove dbg! and the thing you have without is the value you get back out and of that type. This rule would have zero exceptions with this PR.

@Centril

This comment has been minimized.

Copy link
Member

commented Apr 10, 2019

As for whether to accept multiple arguments or not, I think that the purpose of dbg! is quick and convenient debugging. To not accept multiple arguments goes against that as the user must actively remember that they can pass a tuple instead (and it gives less readable output). That a diagnostic was suggested in #59763 is in my mind evidence that accepting multiple arguments is intuitive and expected.

@BurntSushi

This comment has been minimized.

Copy link
Member

commented Apr 10, 2019

If this PR is accepted, is the type of dbg!(a, b) and dbg!((a, b)) the same?

I do agree with @SimonSapin that if we're going to allow multiple arguments, then the trailing comma in the case of the first argument should behave like a function call. While let x = dbg!(y,); is unlikely to happen in practice, something like this is much more feasible:

let x = dbg!(
    some_long_single_argument_expression,
);

And if that doesn't work---regardless of whether we permit multiple arguments or not---I would honestly be pretty surprised. I'd expect things like this to work as expected as well:

let x = dbg!(
    some_long_single_argument_expression,
    another_long_single_argument_expression,
);

I don't have too many strong opinions on whether we permit multiple arguments. It does honestly seem nice, and the case of wanting a unit tuple is a bit weird/rare anyway, so if you did need that, you'd just have to get used to writing dbg!((x,)) I guess.

@llogiq

This comment has been minimized.

Copy link
Contributor Author

commented Apr 16, 2019

I'm thinking about changing the definition to a proc macro that would allow us to use the line and column numbers of the debugged expressions instead of the macro call. This might make it easier to read the output.

@SimonSapin

This comment has been minimized.

Copy link
Contributor

commented Apr 17, 2019

The libs team discussed this in today’s triage meeting. Consensus was to:

  • Make the macro accept multiple arguments, returning a tuple, despite the discontinuity with dbg!(x) not returning a 1-tuple. (Not that a 1-tuple would be desirable.)
  • Document separately the three cases (zero argument, one argument, and 2+ arguments) and respective return types.
  • Make the macro accept a trailing comma (except for the zero-argument case) which is never significant, like in function call syntax. In particular, dbg!(x,) returns x, not (x,).
  • Document the macro’s syntax as arguments (which evokes a function call), not in terms of tuple syntax with a dbg! prefix.

@llogiq, could you update the PR accordingly?

@Centril

This comment has been minimized.

Copy link
Member

commented Apr 17, 2019

  • In particular, dbg!(x) returns x, not (x,).

@SimonSapin You mean dbg!(x,) here, right?

@llogiq

This comment has been minimized.

Copy link
Contributor Author

commented Apr 17, 2019

I read this as dbg!(x,) == dbg!(x) (yes, that means for 1-tuples we need double braces).

@SimonSapin

This comment has been minimized.

Copy link
Contributor

commented Apr 17, 2019

Ah yes, that was a typo. Fixed.

@SimonSapin

This comment has been minimized.

Copy link
Contributor

commented Apr 17, 2019

I’m personally still undecided (and forgot to bring it up in the meeting) whether it’s better if the file name and line number are printed once per macro call or once per argument.

@Centril

This comment has been minimized.

Copy link
Member

commented Apr 17, 2019

@SimonSapin Since that's not part of the stable guarantees it seems to me that we can do the simple thing now and iterate / "feel" our way through.

@SimonSapin

This comment has been minimized.

Copy link
Contributor

commented Apr 17, 2019

Sure, it’s not set in stone and we can change our minds later. I think it’s still worth discussing now, though! Do you have thoughts either way?

@Centril

This comment has been minimized.

Copy link
Member

commented Apr 17, 2019

Do you have thoughts either way?

It's tricky... on the one hand, having output like:

[src/main.rs:2] a = 1
[src/main.rs:2] b = 2
[src/main.rs:2] c = 3

feels nicely aligned... on the other it feels repetitive.

A sketch for an alternative for multi-argument output:

[src/main.rs:2]
[ a = 1
[ b = 2
[ c = 3

@llogiq llogiq force-pushed the llogiq:multi-dbg branch from 5e9190e to b293b70 Apr 18, 2019

@llogiq

This comment has been minimized.

Copy link
Contributor Author

commented Apr 18, 2019

I've implemented the libs team's suggestions as @SimonSapin wrote them up. I did not yet change the output of the macro, we can iterate on that later.

@Centril Centril added this to the 1.36 milestone Apr 18, 2019

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Apr 18, 2019

The job x86_64-gnu-llvm-6.0 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.
travis_time:end:0ddcaee3:start=1555616568253926015,finish=1555616675891011285,duration=107637085270
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[01:03:52] .................................................................................................... 4400/5544
[01:03:56] .................................................................................................... 4500/5544
[01:03:59] .................................................................................................... 4600/5544
[01:04:02] .................................................................................................... 4700/5544
[01:04:08] ................F................................................................................... 4800/5544
[01:04:14] .................................................................................................... 5000/5544
[01:04:18] .................................................................................................... 5100/5544
[01:04:22] .................................................................................................... 5200/5544
[01:04:25] .................................................................................................... 5300/5544
[01:04:25] .................................................................................................... 5300/5544
[01:04:28] .................................................................................................... 5400/5544
[01:04:30] ..................................................................................i................. 5500/5544
[01:04:32] ............................................
[01:04:32] failures:
[01:04:32] 
[01:04:32] ---- [ui] ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs stdout ----
[01:04:32] 
[01:04:32] error: test compilation failed although it shouldn't!
[01:04:32] status: exit code: 1
[01:04:32] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs" "-Zthreads=1" "--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/rfc-2361-dbg-macro/dbg-macro-expected-behavior/a" "-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/rfc-2361-dbg-macro/dbg-macro-expected-behavior/auxiliary" "-A" "unused"
[01:04:32] ------------------------------------------
[01:04:32] 
[01:04:32] ------------------------------------------
[01:04:32] stderr:
[01:04:32] stderr:
[01:04:32] ------------------------------------------
[01:04:32] error[E0308]: mismatched types
[01:04:32]   --> /checkout/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs:59:5
[01:04:32]    |
[01:04:32] LL |     assert_eq!(("Yeah",), dbg!("Yeah", ));
[01:04:32]    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found &str
[01:04:32]    |
[01:04:32]    = note: expected type `(&str,)`
[01:04:32]    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
[01:04:32] 
[01:04:32] error: aborting due to previous error
[01:04:32] 
---
[01:04:32] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:517:22
[01:04:32] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:04:32] 
[01:04:32] 
[01:04:32] 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-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--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" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:04:32] 
[01:04:32] 
[01:04:32] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:04:32] Build completed unsuccessfully in 0:04:10
[01:04:32] Build completed unsuccessfully in 0:04:10
[01:04:32] Makefile:48: recipe for target 'check' failed
[01:04:32] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:2c7c7910
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Thu Apr 18 20:49:16 UTC 2019
---
travis_time:end:0bab5f40:start=1555620557990595354,finish=1555620557997139523,duration=6544169
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0a444510
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0d81b3fb
$ dmesg | grep -i kill

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)

@llogiq llogiq force-pushed the llogiq:multi-dbg branch from b293b70 to 38fbc6e Apr 18, 2019

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Apr 18, 2019

The job x86_64-gnu-llvm-6.0 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.
travis_time:end:0d50958d:start=1555620998813192340,finish=1555621091404847517,duration=92591655177
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[01:08:59] .................................................................................................... 4400/5544
[01:09:02] .................................................................................................... 4500/5544
[01:09:05] .................................................................................................... 4600/5544
[01:09:09] .................................................................................................... 4700/5544
[01:09:16] .............................................F...................................................... 4800/5544
[01:09:22] .................................................................................................... 5000/5544
[01:09:27] .................................................................................................... 5100/5544
[01:09:30] .................................................................................................... 5200/5544
[01:09:34] .................................................................................................... 5300/5544
---
[01:09:41] ------------------------------------------
[01:09:41] stderr:
[01:09:41] ------------------------------------------
[01:09:41] thread 'main' panicked at 'assertion failed: `(left == right)`
[01:09:41]   left: `[":21] Unit = Unit", ":22] a = Unit", ":28] Point{x: 42, y: 24,} = Point {", "    x: 42,", "    y: 24,", "}", ":29] b = Point {", "    x: 42,", "    y: 24,", "}", ":37]", ":41] &a = NoCopy(", "    1337,", ")", ":41] dbg!(& a) = NoCopy(", "    1337,", ")", ":46] f(&42) = 42", "before", ":51] { foo += 1; eprintln!(\"before\"); 7331 } = 7331", ":59] (\"Yeah\",) = (", "    \"Yeah\",", ")", ":62] 1 = 1", ":62] 2 = 2", ":66] 1u8 = 1", ":66] 2u32 = 2", ":66] \"Yeah\" = \"Yeah\""]`,
[01:09:41]  right: `[":21] Unit = Unit", ":22] a = Unit", ":28] Point{x: 42, y: 24,} = Point {", "    x: 42,", "    y: 24,", "}", ":29] b = Point {", "    x: 42,", "    y: 24,", "}", ":37]", ":41] &a = NoCopy(", "    1337,", ")", ":41] dbg!(& a) = NoCopy(", "    1337,", ")", ":46] f(&42) = 42", "before", ":51] { foo += 1; eprintln!(\"before\"); 7331 } = 7331", ":59] \"Yeah\" = \"Yeah\"", ":62] 1 = 1", ":62] 2 = 2", ":66] 1u8 = 1", ":66] 2u32 = 2", ":66] \"Yeah\" = \"Yeah\""]`', /checkout/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs:71:5
[01:09:41] 
[01:09:41] ------------------------------------------
[01:09:41] 
[01:09:41] 
---
[01:09:41] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:517:22
[01:09:41] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:09:41] 
[01:09:41] 
[01:09:41] 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-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--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" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:09:41] 
[01:09:41] 
[01:09:41] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:09:41] Build completed unsuccessfully in 0:04:30
[01:09:41] Build completed unsuccessfully in 0:04:30
[01:09:41] make: *** [check] Error 1
[01:09:41] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0203609f
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Thu Apr 18 22:08:02 UTC 2019

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)

@llogiq llogiq force-pushed the llogiq:multi-dbg branch from 38fbc6e to deddc83 Apr 19, 2019

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Apr 19, 2019

The job x86_64-gnu-llvm-6.0 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.
travis_time:end:073534f6:start=1555660836560910484,finish=1555660938363978887,duration=101803068403
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[01:09:37] .................................................................................................... 4400/5546
[01:09:40] .................................................................................................... 4500/5546
[01:09:44] .................................................................................................... 4600/5546
[01:09:48] .................................................................................................... 4700/5546
[01:09:54] ................F................................................................................... 4800/5546
[01:10:01] .................................................................................................... 5000/5546
[01:10:05] .................................................................................................... 5100/5546
[01:10:09] .................................................................................................... 5200/5546
[01:10:12] .................................................................................................... 5300/5546
[01:10:12] .................................................................................................... 5300/5546
[01:10:15] .................................................................................................... 5400/5546
[01:10:18] ....................................................................................i............... 5500/5546
[01:10:20] ..............................................
[01:10:20] failures:
[01:10:20] 
[01:10:20] ---- [ui] ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs stdout ----
[01:10:20] 
[01:10:20] error: test compilation failed although it shouldn't!
[01:10:20] status: exit code: 1
[01:10:20] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs" "-Zthreads=1" "--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/rfc-2361-dbg-macro/dbg-macro-expected-behavior/a" "-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/rfc-2361-dbg-macro/dbg-macro-expected-behavior/auxiliary" "-A" "unused"
[01:10:20] ------------------------------------------
[01:10:20] 
[01:10:20] ------------------------------------------
[01:10:20] stderr:
[01:10:20] stderr:
[01:10:20] ------------------------------------------
[01:10:20] error: expected one of `,`, `.`, `?`, `]`, or an operator, found `":62] 1 = 1"`
[01:10:20]    |
[01:10:20] LL |         ")"
[01:10:20] LL |         ")"
[01:10:20]    |            - expected one of `,`, `.`, `?`, `]`, or an operator here
[01:10:20] LL | 
[01:10:20] LL |         ":62] 1 = 1",
[01:10:20] 
[01:10:20] error: aborting due to previous error
[01:10:20] 
[01:10:20] 
---
[01:10:20] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:517:22
[01:10:20] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:10:20] 
[01:10:20] 
[01:10:20] 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-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--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" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:10:20] 
[01:10:20] 
[01:10:20] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:10:20] Build completed unsuccessfully in 0:04:35
[01:10:20] Build completed unsuccessfully in 0:04:35
[01:10:20] Makefile:48: recipe for target 'check' failed
[01:10:20] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0988c221
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Fri Apr 19 09:12:47 UTC 2019
---
travis_time:end:00cc5096:start=1555665169227119437,finish=1555665169234797122,duration=7677685
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:290a109d
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0aa5925d
$ dmesg | grep -i kill

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)

@llogiq llogiq force-pushed the llogiq:multi-dbg branch from deddc83 to b641fd3 Apr 19, 2019

@llogiq

This comment has been minimized.

Copy link
Contributor Author

commented Apr 20, 2019

@SimonSapin if you are OK with this I'd like to land this as is now and iterate on the output in a follow-up PR.

@SimonSapin

This comment has been minimized.

Copy link
Contributor

commented Apr 20, 2019

Looks good, thanks!

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

commented Apr 20, 2019

📌 Commit b641fd3 has been approved by SimonSapin

@bors

This comment has been minimized.

Copy link
Contributor

commented Apr 20, 2019

⌛️ Testing commit b641fd3 with merge 33fe113...

bors added a commit that referenced this pull request Apr 20, 2019

Auto merge of #59826 - llogiq:multi-dbg, r=SimonSapin
allow multiple args to `dbg!(..)`

This closes #59763
@bors

This comment has been minimized.

Copy link
Contributor

commented Apr 20, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: SimonSapin
Pushing 33fe113 to master...

@bors bors added the merged-by-bors label Apr 20, 2019

@bors bors merged commit b641fd3 into rust-lang:master Apr 20, 2019

2 checks passed

Travis CI - Pull Request Build Passed
Details
homu Test successful
Details

@Centril Centril removed the needs-fcp label Apr 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.