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

Optimize catch_unwind to match C++ try/catch #67502

Merged
merged 16 commits into from Mar 14, 2020
Merged

Conversation

@Mark-Simulacrum
Copy link
Member

Mark-Simulacrum commented Dec 22, 2019

This refactors the implementation of catching unwinds to allow LLVM to inline the "try" closure directly into the happy path, avoiding indirection. This means that the catch_unwind implementation is (after this PR) zero-cost unless a panic is thrown.

https://rust.godbolt.org/z/cZcUSB is an example of the current codegen in a simple case. Notably, the codegen is exactly the same if -Cpanic=abort is passed, which is clearly not great.

This PR, on the other hand, generates the following assembly:

# -Cpanic=unwind:
	push   rbx
	mov    ebx,0x2a
	call   QWORD PTR [rip+0x1c53c]        # <happy>
	mov    eax,ebx
	pop    rbx
	ret
	mov    rdi,rax
	call   QWORD PTR [rip+0x1c537]        # cleanup function call
	call   QWORD PTR [rip+0x1c539]        # <unfortunate>
	mov    ebx,0xd
	mov    eax,ebx
	pop    rbx
	ret

# -Cpanic=abort:
	push   rax
	call   QWORD PTR [rip+0x20a1]        # <happy>
	mov    eax,0x2a
	pop    rcx
	ret

Fixes #64224, and resolves #64222.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 22, 2019

r? @shepmaster

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

@Mark-Simulacrum

This comment has been minimized.

Copy link
Member Author

Mark-Simulacrum commented Dec 22, 2019

I suspect that the best reviewer here is r? @alexcrichton.

I am not sure whether we want to accept this. I created this patch while trying to investigate #64224; it is a slight simplification of the generated assembly, but not really anything too major (as might be expected).

@bors

This comment was marked as resolved.

Copy link
Contributor

bors commented Dec 23, 2019

☔️ The latest upstream changes (presumably #67540) made this pull request unmergeable. Please resolve the merge conflicts.

@Mark-Simulacrum Mark-Simulacrum force-pushed the Mark-Simulacrum:opt-catch branch 3 times, most recently from afcbceb to 5de0856 Dec 23, 2019
@Mark-Simulacrum Mark-Simulacrum changed the title Overlap caught panic with closure data Optimize catch_unwind to match C++ try/catch Dec 26, 2019
src/libpanic_unwind/emcc.rs Outdated Show resolved Hide resolved
src/libstd/panicking.rs Outdated Show resolved Hide resolved
src/libstd/panicking.rs Outdated Show resolved Hide resolved
src/libstd/panicking.rs Outdated Show resolved Hide resolved
src/libpanic_unwind/lib.rs Outdated Show resolved Hide resolved
src/libstd/panicking.rs Outdated Show resolved Hide resolved
@Mark-Simulacrum Mark-Simulacrum force-pushed the Mark-Simulacrum:opt-catch branch from 7da6a5a to 8ff0922 Dec 26, 2019
@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

rust-highfive commented Dec 26, 2019

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, 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.
2019-12-26T16:18:02.6939652Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-26T16:18:02.6952370Z ##[command]git config gc.auto 0
2019-12-26T16:18:02.6955430Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-26T16:18:02.6957426Z ##[command]git config --get-all http.proxy
2019-12-26T16:18:02.6960412Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/67502/merge:refs/remotes/pull/67502/merge
---
2019-12-26T17:18:59.8883587Z .................................................................................................... 1600/9454
2019-12-26T17:19:04.6581314Z .................................................................................................... 1700/9454
2019-12-26T17:19:14.2840309Z .............................................................................................i...... 1800/9454
2019-12-26T17:19:22.7633936Z .................................................................................................... 1900/9454
2019-12-26T17:19:29.8049014Z ...............................................................................iiiii................ 2000/9454
2019-12-26T17:19:51.6753772Z .................................................................................................... 2200/9454
2019-12-26T17:19:54.0756694Z .................................................................................................... 2300/9454
2019-12-26T17:19:56.6773311Z .................................................................................................... 2400/9454
2019-12-26T17:20:03.0072145Z .................................................................................................... 2500/9454
---
2019-12-26T17:23:03.3324968Z ..........i...............i......................................................................... 4900/9454
2019-12-26T17:23:13.4498286Z .................................................................................................... 5000/9454
2019-12-26T17:23:19.1726150Z ......................................................i............................................. 5100/9454
2019-12-26T17:23:28.7762580Z .................................................................................................... 5200/9454
2019-12-26T17:23:35.1456649Z .....................ii.ii...........i.............................................................. 5300/9454
2019-12-26T17:23:44.0944078Z .................................................................................................... 5500/9454
2019-12-26T17:23:54.9394285Z .................................................................................................... 5600/9454
2019-12-26T17:24:02.1469513Z ...i................................................................................................ 5700/9454
2019-12-26T17:24:07.8399773Z .................................................................................................... 5800/9454
2019-12-26T17:24:07.8399773Z .................................................................................................... 5800/9454
2019-12-26T17:24:17.8703782Z ...........................................................................................ii...i..i 5900/9454
2019-12-26T17:24:30.5776281Z i...........i....................................................................................... 6000/9454
2019-12-26T17:24:48.2667361Z .................................................................................................... 6200/9454
2019-12-26T17:24:55.7709511Z .........................................................................................F.......... 6300/9454
2019-12-26T17:24:55.7709511Z .........................................................................................F.......... 6300/9454
2019-12-26T17:25:09.8699322Z ..................i..ii............................................................................. 6400/9454
2019-12-26T17:25:29.8256764Z .............................FF..F............................................................i..... 6600/9454
2019-12-26T17:25:32.0440710Z .................................................................................................... 6700/9454
2019-12-26T17:25:34.3508387Z ..............................................................................................i..... 6800/9454
2019-12-26T17:25:36.9896678Z .................................................................................................... 6900/9454
---
2019-12-26T17:27:15.5252036Z .................................................................................................... 7500/9454
2019-12-26T17:27:20.2751553Z .................................................................................................... 7600/9454
2019-12-26T17:27:26.7995208Z .................................................................................................... 7700/9454
2019-12-26T17:27:37.2354542Z .................................................................................................... 7800/9454
2019-12-26T17:27:43.8126140Z .........................iiii....................................................................... 7900/9454
2019-12-26T17:27:58.4735769Z .................................................................................................... 8100/9454
2019-12-26T17:28:08.2366846Z .................................................................................................... 8200/9454
2019-12-26T17:28:22.0832479Z .................................................................................................... 8300/9454
2019-12-26T17:28:29.2318346Z .................................................................................................... 8400/9454
---
2019-12-26T17:30:25.4434514Z failures:
2019-12-26T17:30:25.4434709Z 
2019-12-26T17:30:25.4435173Z ---- [ui] ui/no-landing-pads.rs stdout ----
2019-12-26T17:30:25.4435348Z 
2019-12-26T17:30:25.4435501Z error: test run failed!
2019-12-26T17:30:25.4435705Z status: signal: 6
2019-12-26T17:30:25.4436482Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/no-landing-pads/a" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/no-landing-pads/a"
2019-12-26T17:30:25.4437141Z ------------------------------------------
2019-12-26T17:30:25.4437301Z 
2019-12-26T17:30:25.4437672Z ------------------------------------------
2019-12-26T17:30:25.4437842Z stderr:
---
2019-12-26T17:30:25.4440684Z ---- [ui] ui/panic-runtime/abort-link-to-unwinding-crates.rs stdout ----
2019-12-26T17:30:25.4440836Z 
2019-12-26T17:30:25.4441203Z error: test compilation failed although it shouldn't!
2019-12-26T17:30:25.4441402Z status: exit code: 1
2019-12-26T17:30:25.4442424Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/panic-runtime/abort-link-to-unwinding-crates.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-C" "panic=abort" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/auxiliary"
2019-12-26T17:30:25.4443034Z ------------------------------------------
2019-12-26T17:30:25.4443213Z 
2019-12-26T17:30:25.4443567Z ------------------------------------------
2019-12-26T17:30:25.4443732Z stderr:
2019-12-26T17:30:25.4443732Z stderr:
2019-12-26T17:30:25.4444101Z ------------------------------------------
2019-12-26T17:30:25.4444273Z error: linking with `cc` failed: exit code: 1
2019-12-26T17:30:25.4444426Z    |
2019-12-26T17:30:25.4451314Z    = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a.abort_link_to_unwinding_crates.7rcbfp3g-cgu.0.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a.abort_link_to_unwinding_crates.7rcbfp3g-cgu.1.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a.abort_link_to_unwinding_crates.7rcbfp3g-cgu.10.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a.abort_link_to_unwinding_crates.7rcbfp3g-cgu.11.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a.abort_link_to_unwinding_crates.7rcbfp3g-cgu.12.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a.abort_link_to_unwinding_crates.7rcbfp3g-cgu.2.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a.abort_link_to_unwinding_crates.7rcbfp3g-cgu.3.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a.abort_link_to_unwinding_crates.7rcbfp3g-cgu.4.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a.abort_link_to_unwinding_crates.7rcbfp3g-cgu.5.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a.abort_link_to_unwinding_crates.7rcbfp3g-cgu.6.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a.abort_link_to_unwinding_crates.7rcbfp3g-cgu.7.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a.abort_link_to_unwinding_crates.7rcbfp3g-cgu.8.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a.abort_link_to_unwinding_crates.7rcbfp3g-cgu.9.rcgu.o" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/a.1vb5ndsi2uz2y594.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/auxiliary" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort-link-to-unwinding-crates/auxiliary/libexit_success_if_unwind.rlib" "-Wl,--start-group" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-b586cf616217cb61.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_abort-54ce8b4246cb06b0.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-50762b7d1f500aae.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-43af671ddf03ee81.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace-0d59c4282cbc8e4b.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-661fc2e981ab6285.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-0cd4fe277e96d107.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-8ec6d240e6d918f8.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-818d3bf4d09f33eb.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-3f4b91103c2ee14f.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-289cdd5064e4da02.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-87f2141e797e5ef0.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-987003bc1262d91a.rlib" "-Wl,--end-group" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-6d0715333b74ba49.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil" "-Wl,-rpath,$ORIGIN/../../../../stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-rpath,/checkout/obj/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--enable-new-dtags"
2019-12-26T17:30:25.4453133Z    = note: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-b586cf616217cb61.rlib(std-b586cf616217cb61.std.2pbd4t20-cgu.0.rcgu.o): In function `std::panicking::try::cleanup':
2019-12-26T17:30:25.4453656Z            std.2pbd4t20-cgu.0:(.text._ZN3std9panicking3try7cleanup17hd2a574b8686b676cE+0xd): undefined reference to `__rust_panic_cleanup'
2019-12-26T17:30:25.4453892Z            collect2: error: ld returned 1 exit status
2019-12-26T17:30:25.4454149Z 
2019-12-26T17:30:25.4454308Z error: aborting due to previous error
2019-12-26T17:30:25.4454425Z 
2019-12-26T17:30:25.4454538Z 
2019-12-26T17:30:25.4454538Z 
2019-12-26T17:30:25.4454918Z ------------------------------------------
2019-12-26T17:30:25.4455071Z 
2019-12-26T17:30:25.4455227Z 
2019-12-26T17:30:25.4455638Z ---- [ui] ui/panic-runtime/abort.rs stdout ----
2019-12-26T17:30:25.4456648Z 
2019-12-26T17:30:25.4457172Z error: test compilation failed although it shouldn't!
2019-12-26T17:30:25.4458449Z status: exit code: 1
2019-12-26T17:30:25.4459454Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/panic-runtime/abort.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-C" "panic=abort" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/auxiliary"
2019-12-26T17:30:25.4459888Z ------------------------------------------
2019-12-26T17:30:25.4459922Z 
2019-12-26T17:30:25.4460163Z ------------------------------------------
2019-12-26T17:30:25.4460208Z stderr:
2019-12-26T17:30:25.4460208Z stderr:
2019-12-26T17:30:25.4460426Z ------------------------------------------
2019-12-26T17:30:25.4460476Z error: linking with `cc` failed: exit code: 1
2019-12-26T17:30:25.4460536Z    |
2019-12-26T17:30:25.4465701Z    = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a.abort.7rcbfp3g-cgu.0.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a.abort.7rcbfp3g-cgu.1.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a.abort.7rcbfp3g-cgu.10.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a.abort.7rcbfp3g-cgu.11.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a.abort.7rcbfp3g-cgu.12.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a.abort.7rcbfp3g-cgu.2.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a.abort.7rcbfp3g-cgu.3.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a.abort.7rcbfp3g-cgu.4.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a.abort.7rcbfp3g-cgu.5.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a.abort.7rcbfp3g-cgu.6.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a.abort.7rcbfp3g-cgu.7.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a.abort.7rcbfp3g-cgu.8.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a.abort.7rcbfp3g-cgu.9.rcgu.o" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/a.1ksge58qc8gpwchm.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/abort/auxiliary" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-b586cf616217cb61.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_abort-54ce8b4246cb06b0.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-50762b7d1f500aae.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-43af671ddf03ee81.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace-0d59c4282cbc8e4b.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-661fc2e981ab6285.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-0cd4fe277e96d107.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-8ec6d240e6d918f8.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-818d3bf4d09f33eb.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-3f4b91103c2ee14f.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-289cdd5064e4da02.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-87f2141e797e5ef0.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-987003bc1262d91a.rlib" "-Wl,--end-group" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-6d0715333b74ba49.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil" "-Wl,-rpath,$ORIGIN/../../../../stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-rpath,/checkout/obj/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--enable-new-dtags"
2019-12-26T17:30:25.4467329Z    = note: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-b586cf616217cb61.rlib(std-b586cf616217cb61.std.2pbd4t20-cgu.0.rcgu.o): In function `std::panicking::try::cleanup':
2019-12-26T17:30:25.4467718Z            std.2pbd4t20-cgu.0:(.text._ZN3std9panicking3try7cleanup17hd2a574b8686b676cE+0xd): undefined reference to `__rust_panic_cleanup'
2019-12-26T17:30:25.4467781Z            collect2: error: ld returned 1 exit status
2019-12-26T17:30:25.4467873Z 
2019-12-26T17:30:25.4467916Z error: aborting due to previous error
2019-12-26T17:30:25.4467944Z 
2019-12-26T17:30:25.4467970Z 
2019-12-26T17:30:25.4467970Z 
2019-12-26T17:30:25.4468211Z ------------------------------------------
2019-12-26T17:30:25.4468243Z 
2019-12-26T17:30:25.4468268Z 
2019-12-26T17:30:25.4468498Z ---- [ui] ui/panic-runtime/link-to-abort.rs stdout ----
2019-12-26T17:30:25.4468549Z 
2019-12-26T17:30:25.4468779Z error: test compilation failed although it shouldn't!
2019-12-26T17:30:25.4468827Z status: exit code: 1
2019-12-26T17:30:25.4469665Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/panic-runtime/link-to-abort.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/link-to-abort/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-C" "panic=abort" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/link-to-abort/auxiliary"
2019-12-26T17:30:25.4470006Z ------------------------------------------
2019-12-26T17:30:25.4470039Z 
2019-12-26T17:30:25.4470256Z ------------------------------------------
2019-12-26T17:30:25.4470301Z stderr:
2019-12-26T17:30:25.4470301Z stderr:
2019-12-26T17:30:25.4470534Z ------------------------------------------
2019-12-26T17:30:25.4470583Z error: linking with `cc` failed: exit code: 1
2019-12-26T17:30:25.4470626Z    |
2019-12-26T17:30:25.4474681Z    = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/link-to-abort/a.link_to_abort.7rcbfp3g-cgu.0.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/link-to-abort/a.link_to_abort.7rcbfp3g-cgu.1.rcgu.o" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/link-to-abort/a" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/link-to-abort/a.4hgw2zitnpvuzihs.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/panic-runtime/link-to-abort/auxiliary" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-b586cf616217cb61.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_abort-54ce8b4246cb06b0.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-50762b7d1f500aae.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-43af671ddf03ee81.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace-0d59c4282cbc8e4b.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-661fc2e981ab6285.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-0cd4fe277e96d107.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-8ec6d240e6d918f8.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-818d3bf4d09f33eb.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-3f4b91103c2ee14f.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-289cdd5064e4da02.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-87f2141e797e5ef0.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-987003bc1262d91a.rlib" "-Wl,--end-group" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-6d0715333b74ba49.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil" "-Wl,-rpath,$ORIGIN/../../../../stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-rpath,/checkout/obj/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--enable-new-dtags"
2019-12-26T17:30:25.4475856Z    = note: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-b586cf616217cb61.rlib(std-b586cf616217cb61.std.2pbd4t20-cgu.0.rcgu.o): In function `std::panicking::try::cleanup':
2019-12-26T17:30:25.4476229Z            std.2pbd4t20-cgu.0:(.text._ZN3std9panicking3try7cleanup17hd2a574b8686b676cE+0xd): undefined reference to `__rust_panic_cleanup'
2019-12-26T17:30:25.4476291Z            collect2: error: ld returned 1 exit status
2019-12-26T17:30:25.4476570Z 
2019-12-26T17:30:25.4476646Z error: aborting due to previous error
2019-12-26T17:30:25.4476675Z 
2019-12-26T17:30:25.4476711Z 
2019-12-26T17:30:25.4476711Z 
2019-12-26T17:30:25.4476968Z ------------------------------------------
2019-12-26T17:30:25.4477017Z 
2019-12-26T17:30:25.4477043Z 
2019-12-26T17:30:25.4477264Z ---- [ui] ui/test-panic-abort.rs stdout ----
2019-12-26T17:30:25.4477296Z 
2019-12-26T17:30:25.4477538Z error: test compilation failed although it shouldn't!
2019-12-26T17:30:25.4477607Z status: exit code: 1
2019-12-26T17:30:25.4478440Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/test-panic-abort.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--test" "-Cpanic=abort" "-Zpanic_abort_tests" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/auxiliary" "-A" "unused"
2019-12-26T17:30:25.4478769Z ------------------------------------------
2019-12-26T17:30:25.4478816Z 
2019-12-26T17:30:25.4479037Z ------------------------------------------
2019-12-26T17:30:25.4479081Z stderr:
2019-12-26T17:30:25.4479081Z stderr:
2019-12-26T17:30:25.4479294Z ------------------------------------------
2019-12-26T17:30:25.4479527Z error: linking with `cc` failed: exit code: 1
2019-12-26T17:30:25.4479575Z    |
2019-12-26T17:30:25.4485651Z    = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a.test_panic_abort.7rcbfp3g-cgu.0.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a.test_panic_abort.7rcbfp3g-cgu.1.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a.test_panic_abort.7rcbfp3g-cgu.10.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a.test_panic_abort.7rcbfp3g-cgu.11.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a.test_panic_abort.7rcbfp3g-cgu.12.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a.test_panic_abort.7rcbfp3g-cgu.2.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a.test_panic_abort.7rcbfp3g-cgu.3.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a.test_panic_abort.7rcbfp3g-cgu.4.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a.test_panic_abort.7rcbfp3g-cgu.5.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a.test_panic_abort.7rcbfp3g-cgu.6.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a.test_panic_abort.7rcbfp3g-cgu.7.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a.test_panic_abort.7rcbfp3g-cgu.8.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a.test_panic_abort.7rcbfp3g-cgu.9.rcgu.o" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/a.4jwkzzjxw5w87ant.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/test-panic-abort/auxiliary" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-2ad3a661ee4cd26e.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libterm-3867360917dc180d.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-5d9095139821c0e2.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode_width-8e948ed2950a8bcf.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_std-3cff50dcefbc28ec.rlib" "-Wl,--start-group" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-b586cf616217cb61.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_abort-54ce8b4246cb06b0.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-50762b7d1f500aae.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-43af671ddf03ee81.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace-0d59c4282cbc8e4b.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-661fc2e981ab6285.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-0cd4fe277e96d107.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-8ec6d240e6d918f8.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-818d3bf4d09f33eb.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-3f4b91103c2ee14f.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-289cdd5064e4da02.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-87f2141e797e5ef0.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-987003bc1262d91a.rlib" "-Wl,--end-group" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-6d0715333b74ba49.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil" "-Wl,-rpath,$ORIGIN/../../../stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-rpath,/checkout/obj/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--enable-new-dtags"
2019-12-26T17:30:25.4487451Z    = note: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-b586cf616217cb61.rlib(std-b586cf616217cb61.std.2pbd4t20-cgu.0.rcgu.o): In function `std::panicking::try::cleanup':
2019-12-26T17:30:25.4487812Z            std.2pbd4t20-cgu.0:(.text._ZN3std9panicking3try7cleanup17hd2a574b8686b676cE+0xd): undefined reference to `__rust_panic_cleanup'
2019-12-26T17:30:25.4487891Z            collect2: error: ld returned 1 exit status
2019-12-26T17:30:25.4487963Z 
2019-12-26T17:30:25.4488005Z error: aborting due to previous error
2019-12-26T17:30:25.4488053Z 
2019-12-26T17:30:25.4488079Z 
---
2019-12-26T17:30:25.4494110Z 
2019-12-26T17:30:25.4494187Z 
2019-12-26T17:30:25.4494635Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:385:22
2019-12-26T17:30:25.4494753Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-12-26T17:30:25.4513191Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "/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-7/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -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" "7.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"
2019-12-26T17:30:25.4513768Z 
2019-12-26T17:30:25.4513799Z 
2019-12-26T17:30:25.4554322Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-12-26T17:30:25.4554410Z Build completed unsuccessfully in 1:05:53
2019-12-26T17:30:25.4554410Z Build completed unsuccessfully in 1:05:53
2019-12-26T17:30:25.4578245Z == clock drift check ==
2019-12-26T17:30:25.4596286Z   local time: Thu Dec 26 17:30:25 UTC 2019
2019-12-26T17:30:25.7527868Z   network time: Thu, 26 Dec 2019 17:30:25 GMT
2019-12-26T17:30:25.7528738Z == end clock drift check ==
2019-12-26T17:30:26.7994663Z 
2019-12-26T17:30:26.8100582Z ##[error]Bash exited with code '1'.
2019-12-26T17:30:26.8141938Z ##[section]Starting: Checkout
2019-12-26T17:30:26.8144064Z ==============================================================================
2019-12-26T17:30:26.8144149Z Task         : Get sources
2019-12-26T17:30:26.8144217Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@Mark-Simulacrum Mark-Simulacrum force-pushed the Mark-Simulacrum:opt-catch branch from 8bb8bfe to ba58f64 Dec 27, 2019
@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

rust-highfive commented Dec 27, 2019

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, 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.
2019-12-27T14:34:57.5944011Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-27T14:34:57.5959483Z ##[command]git config gc.auto 0
2019-12-27T14:34:57.5961544Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-27T14:34:57.5963225Z ##[command]git config --get-all http.proxy
2019-12-27T14:34:57.5971969Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/67502/merge:refs/remotes/pull/67502/merge
---
2019-12-27T15:32:02.2052380Z .................................................................................................... 1600/9457
2019-12-27T15:32:06.5908879Z .................................................................................................... 1700/9457
2019-12-27T15:32:15.9185889Z ...............................................................................................i.... 1800/9457
2019-12-27T15:32:24.0489901Z .................................................................................................... 1900/9457
2019-12-27T15:32:30.7279231Z .................................................................................iiiii.............. 2000/9457
2019-12-27T15:32:50.3980740Z .................................................................................................... 2200/9457
2019-12-27T15:32:52.4449090Z .................................................................................................... 2300/9457
2019-12-27T15:32:54.6867916Z .................................................................................................... 2400/9457
2019-12-27T15:33:00.0876978Z .................................................................................................... 2500/9457
---
2019-12-27T15:35:49.8488550Z ............i...............i....................................................................... 4900/9457
2019-12-27T15:35:58.5716169Z .................................................................................................... 5000/9457
2019-12-27T15:36:03.4254339Z ........................................................i........................................... 5100/9457
2019-12-27T15:36:12.4132306Z .................................................................................................... 5200/9457
2019-12-27T15:36:18.9683813Z .......................ii.ii...........i............................................................ 5300/9457
2019-12-27T15:36:28.1063519Z .................................................................................................... 5500/9457
2019-12-27T15:36:38.8073396Z .................................................................................................... 5600/9457
2019-12-27T15:36:45.4482515Z .....i.............................................................................................. 5700/9457
2019-12-27T15:36:51.3190438Z .................................................................................................... 5800/9457
2019-12-27T15:36:51.3190438Z .................................................................................................... 5800/9457
2019-12-27T15:37:00.2816284Z .............................................................................................ii...i. 5900/9457
2019-12-27T15:37:12.0385718Z .ii...........i..................................................................................... 6000/9457
2019-12-27T15:37:29.8990139Z .................................................................................................... 6200/9457
2019-12-27T15:37:37.2585579Z ...........................................................................................F........ 6300/9457
2019-12-27T15:37:37.2585579Z ...........................................................................................F........ 6300/9457
2019-12-27T15:37:51.1443903Z ....................i..ii........................................................................... 6400/9457
2019-12-27T15:38:09.5310244Z .................................................................................................i.. 6600/9457
2019-12-27T15:38:11.8414194Z .................................................................................................... 6700/9457
2019-12-27T15:38:14.3434520Z .................................................................................................i.. 6800/9457
2019-12-27T15:38:17.1895500Z .................................................................................................... 6900/9457
---
2019-12-27T15:39:52.1059256Z .................................................................................................... 7500/9457
2019-12-27T15:39:56.5677021Z .................................................................................................... 7600/9457
2019-12-27T15:40:02.6482077Z .................................................................................................... 7700/9457
2019-12-27T15:40:12.0587953Z .................................................................................................... 7800/9457
2019-12-27T15:40:19.3432668Z ............................iiii.................................................................... 7900/9457
2019-12-27T15:40:33.9176805Z .................................................................................................... 8100/9457
2019-12-27T15:40:42.8201853Z .................................................................................................... 8200/9457
2019-12-27T15:40:55.5307116Z .................................................................................................... 8300/9457
2019-12-27T15:41:02.2880730Z .................................................................................................... 8400/9457
---
2019-12-27T15:42:54.8246299Z failures:
2019-12-27T15:42:54.8246713Z 
2019-12-27T15:42:54.8247208Z ---- [ui] ui/no-landing-pads.rs stdout ----
2019-12-27T15:42:54.8248007Z 
2019-12-27T15:42:54.8248225Z error: test run failed!
2019-12-27T15:42:54.8248362Z status: signal: 6
2019-12-27T15:42:54.8249569Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/no-landing-pads/a" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/no-landing-pads/a"
2019-12-27T15:42:54.8251782Z ------------------------------------------
2019-12-27T15:42:54.8252474Z 
2019-12-27T15:42:54.8253101Z ------------------------------------------
2019-12-27T15:42:54.8253881Z stderr:
---
2019-12-27T15:42:54.8319195Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:385:22
2019-12-27T15:42:54.8319758Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-12-27T15:42:54.8334660Z 
2019-12-27T15:42:54.8334937Z 
2019-12-27T15:42:54.8336988Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "/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-7/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -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" "7.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"
2019-12-27T15:42:54.8337556Z 
2019-12-27T15:42:54.8337698Z 
2019-12-27T15:42:54.8346459Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-12-27T15:42:54.8346682Z Build completed unsuccessfully in 1:01:33
2019-12-27T15:42:54.8346682Z Build completed unsuccessfully in 1:01:33
2019-12-27T15:42:54.8395494Z == clock drift check ==
2019-12-27T15:42:54.8412770Z   local time: Fri Dec 27 15:42:54 UTC 2019
2019-12-27T15:42:55.1145990Z   network time: Fri, 27 Dec 2019 15:42:55 GMT
2019-12-27T15:42:55.1153688Z == end clock drift check ==
2019-12-27T15:42:56.0775081Z 
2019-12-27T15:42:56.0891910Z ##[error]Bash exited with code '1'.
2019-12-27T15:42:56.0945623Z ##[section]Starting: Checkout
2019-12-27T15:42:56.0947045Z ==============================================================================
2019-12-27T15:42:56.0947089Z Task         : Get sources
2019-12-27T15:42:56.0947126Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@Mark-Simulacrum

This comment has been minimized.

Copy link
Member Author

Mark-Simulacrum commented Dec 27, 2019

I believe the test failure here is because we treat -Zno-landing-pads and -Cpanic=abort equivalently today, which has worked so far because -Zno-landing-pads was never passed to the libpanic_unwind compiler. These two options mean different things though: -Zno-landing-pads means that a panic will not run destructors, but will still unwind, whereas -Cpanic=abort will just immediately abort.

I'm not actually sure if there's much use to -Zno-landing-pads -- is there a situation where you want to unwind but not actually run destructors and so forth? I think the answer is no, or at least, it doesn't make much sense to me. I would suggest that we drop that flag entirely.

That would mean that the test in question would also be deleted; we do not expect that a crate with -Cpanic=abort can catch panics (even at thread boundaries).

@Mark-Simulacrum

This comment has been minimized.

Copy link
Member Author

Mark-Simulacrum commented Dec 28, 2019

@bors try for easier testing

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 28, 2019

⌛️ Trying commit ba58f64 with merge d19982e...

bors added a commit that referenced this pull request Dec 28, 2019
Optimize catch_unwind to match C++ try/catch

This refactors the implementation of catching unwinds to allow LLVM to inline the "try" closure directly into the happy path, avoiding indirection. This means that the catch_unwind implementation is (after this PR) zero-cost unless a panic is thrown.

https://rust.godbolt.org/z/cZcUSB is an example of the current codegen in a simple case. Notably, the codegen is *exactly the same* if `-Cpanic=abort` is passed, which is clearly not great.

This PR, on the other hand, generates the following assembly:

```asm
# -Cpanic=unwind:
	push   rbx
	mov    ebx,0x2a
	call   QWORD PTR [rip+0x1c53c]        # <happy>
	mov    eax,ebx
	pop    rbx
	ret
	mov    rdi,rax
	call   QWORD PTR [rip+0x1c537]        # cleanup function call
	call   QWORD PTR [rip+0x1c539]        # <unfortunate>
	mov    ebx,0xd
	mov    eax,ebx
	pop    rbx
	ret

# -Cpanic=abort:
	push   rax
	call   QWORD PTR [rip+0x20a1]        # <happy>
	mov    eax,0x2a
	pop    rcx
	ret
```

Fixes #64224, and resolves #64222.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 28, 2019

☀️ Try build successful - checks-azure
Build commit: d19982e (d19982ed64d76225c52b773a53d593e6e96282e8)

@Amanieu Amanieu force-pushed the Mark-Simulacrum:opt-catch branch from 6269792 to 5be658a Dec 29, 2019
@Amanieu

This comment has been minimized.

Copy link
Contributor

Amanieu commented Dec 29, 2019

Should be good to merge at this point. I moved some unrelated commits fixing some memory leaks to a separate PR (#67711).

Copy link
Member

alexcrichton left a comment

One thing I'm worried about here is that this PR changes the standard library to unconditionally use the try intrinsic no matter what panic mode is selected. Previously the try intrinsic was only codegen'd into the panic_unwind crate, but now it'll also be codegen'd when using panic=abort.

I don't think that this is a huge huge problem but I do think that we very much want to avoid any invoke instructions at all in panic=abort mode. Some targets in LLVM die really quickly on the invoke instruction I think. Could you double check the raw IR output in debug mode in panic=abort mode to make sure no invoke instruction exists?

This may require updating the codegen of the try intrinsic to just be call in panic=abort mode which I suspect would be a relatively simple change. It may also already be done, I'm not sure!

@@ -29,6 +28,31 @@ use crate::io::set_panic;
#[cfg(test)]
use realstd::io::set_panic;

// This must be kept in sync with the implementations in libpanic_unwind.
//
// This is *not* checked in anyway; the compiler does not allow us to use a

This comment has been minimized.

Copy link
@alexcrichton

alexcrichton Jan 6, 2020

Member

s/anyway/any way/

// type/macro/anything from panic_unwind, since we're then linking in the
// panic_unwind runtime even during -Cpanic=abort.
//
// Essentially this must be the type of `imp::Payload` in libpanic_unwind.

This comment has been minimized.

Copy link
@alexcrichton

alexcrichton Jan 6, 2020

Member

Would it be possible to extract the definition of Payload to a foo.rs file which we could include with #[path] here?

@Amanieu

This comment has been minimized.

Copy link
Contributor

Amanieu commented Jan 6, 2020

This may require updating the codegen of the try intrinsic to just be call in panic=abort mode which I suspect would be a relatively simple change. It may also already be done, I'm not sure!

This is already the case: try lowers to call with -Z no-landing-pads (which panic=abort enables).

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 6, 2020

Great! That's perfect

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 7, 2020

The job mingw-check of your PR failed (pretty log, 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.
2020-01-07T15:54:02.4589818Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-01-07T15:54:02.4675058Z ##[command]git config gc.auto 0
2020-01-07T15:54:02.4759986Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-01-07T15:54:02.4829368Z ##[command]git config --get-all http.proxy
2020-01-07T15:54:02.4970119Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/67502/merge:refs/remotes/pull/67502/merge
---
2020-01-07T15:58:40.4496895Z     Checking alloc v0.0.0 (/checkout/src/liballoc)
2020-01-07T15:58:40.7700380Z     Checking cfg-if v0.1.8
2020-01-07T15:58:40.8156581Z     Checking rustc-demangle v0.1.16
2020-01-07T15:58:41.2595695Z     Checking panic_abort v0.0.0 (/checkout/src/libpanic_abort)
2020-01-07T15:58:41.2967617Z error: couldn't read src/libpanic_abort/../libpanic_unwind/payload.rs: No such file or directory (os error 2)
2020-01-07T15:58:41.2967972Z   --> src/libpanic_abort/lib.rs:24:1
2020-01-07T15:58:41.2968240Z    |
2020-01-07T15:58:41.2968501Z 24 | include!("../libpanic_unwind/payload.rs");
2020-01-07T15:58:41.2969002Z    | 
2020-01-07T15:58:41.2969233Z   ::: <::core::macros::builtin::include macros>:1:1
2020-01-07T15:58:41.2969418Z    |
2020-01-07T15:58:41.2969418Z    |
2020-01-07T15:58:41.2969716Z 1  | ($ file : expr) => { { } } ; ($ file : expr,) => { { } } ;
2020-01-07T15:58:41.2970035Z    | ---------------------------------------------------------- in this expansion of `include!`
2020-01-07T15:58:41.2990782Z error: aborting due to previous error
2020-01-07T15:58:41.2996142Z 
2020-01-07T15:58:41.3048740Z error: could not compile `panic_abort`.
2020-01-07T15:58:41.3049040Z warning: build failed, waiting for other jobs to finish...
---
2020-01-07T15:58:42.8482419Z   local time: Tue Jan  7 15:58:42 UTC 2020
2020-01-07T15:58:43.1308741Z   network time: Tue, 07 Jan 2020 15:58:43 GMT
2020-01-07T15:58:43.1314377Z == end clock drift check ==
2020-01-07T15:58:44.4231747Z 
2020-01-07T15:58:44.4340624Z ##[error]Bash exited with code '1'.
2020-01-07T15:58:44.4370787Z ##[section]Starting: Checkout
2020-01-07T15:58:44.4373469Z ==============================================================================
2020-01-07T15:58:44.4373544Z Task         : Get sources
2020-01-07T15:58:44.4373593Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@Amanieu

This comment has been minimized.

Copy link
Contributor

Amanieu commented Mar 12, 2020

Beta has been branched, so...

@bors r=Mark-Simulacrum

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 12, 2020

📌 Commit 9f3679f has been approved by Mark-Simulacrum

@Amanieu

This comment has been minimized.

Copy link
Contributor

Amanieu commented Mar 12, 2020

@bors rollup=never

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 12, 2020

⌛️ Testing commit 9f3679f with merge 40f1118...

bors added a commit that referenced this pull request Mar 12, 2020
Optimize catch_unwind to match C++ try/catch

This refactors the implementation of catching unwinds to allow LLVM to inline the "try" closure directly into the happy path, avoiding indirection. This means that the catch_unwind implementation is (after this PR) zero-cost unless a panic is thrown.

https://rust.godbolt.org/z/cZcUSB is an example of the current codegen in a simple case. Notably, the codegen is *exactly the same* if `-Cpanic=abort` is passed, which is clearly not great.

This PR, on the other hand, generates the following assembly:

```asm
# -Cpanic=unwind:
	push   rbx
	mov    ebx,0x2a
	call   QWORD PTR [rip+0x1c53c]        # <happy>
	mov    eax,ebx
	pop    rbx
	ret
	mov    rdi,rax
	call   QWORD PTR [rip+0x1c537]        # cleanup function call
	call   QWORD PTR [rip+0x1c539]        # <unfortunate>
	mov    ebx,0xd
	mov    eax,ebx
	pop    rbx
	ret

# -Cpanic=abort:
	push   rax
	call   QWORD PTR [rip+0x20a1]        # <happy>
	mov    eax,0x2a
	pop    rcx
	ret
```

Fixes #64224, and resolves #64222.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 12, 2020

💥 Test timed out

@Amanieu

This comment has been minimized.

Copy link
Contributor

Amanieu commented Mar 13, 2020

@bors retry

@Dylan-DPC

This comment has been minimized.

Copy link
Member

Dylan-DPC commented Mar 13, 2020

@bors p=1

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 13, 2020

⌛️ Testing commit 9f3679f with merge be055d9...

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 14, 2020

☀️ Test successful - checks-azure
Approved by: Mark-Simulacrum
Pushing be055d9 to master...

@bors bors added the merged-by-bors label Mar 14, 2020
@bors bors merged commit be055d9 into rust-lang:master Mar 14, 2020
5 checks passed
5 checks passed
homu Test successful
Details
pr Build #20200307.24 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
@@ -274,27 +269,59 @@ pub unsafe fn r#try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>>
//

This comment has been minimized.

Copy link
@RalfJung

RalfJung Mar 14, 2020

Member

Looks like the "2." comment above is no longer accurate? The code now does ManuallyDrop::into_inner(data.p) in the "panicked" case, which looks very symmetric to the "didn't panic case": in both cases we move "it out of data and return it", it's just a different thing we move out.

@RalfJung

This comment has been minimized.

Copy link
Member

RalfJung commented Mar 14, 2020

r=Mark-Simulacrum

Now Mark is both author and reviewer of this PR. ;)

EDIT: Ah, most commits are authored by @Amanieu, looks like Mark just submitted it. I see.

bors added a commit that referenced this pull request Mar 14, 2020
adjust Miri to needs of changed unwinding strategy

As expected, #67502 broke unwinding in Miri. To fix it we have to adjust parts of the engine and the panic runtime, which this PR does. The Miri-side changes are in rust-lang/miri#1227.

Cc @oli-obk @Aaron1011 @Mark-Simulacrum @Amanieu
@elichai elichai mentioned this pull request Mar 29, 2020
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.