rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.27k stars 12.71k forks source link

Project fails (or takes long time) to compile on latest stable and nightly (hang/stackoverflow) #57735

Closed bgourlie closed 5 years ago

bgourlie commented 5 years ago

While attempting to compile my application (or simply run cargo check), rustc will crash, with slightly different results depending on whether it's the stable or nightly branch.

OS: Windows 10 x64 version 1809 build 17763.253

stable toolchain

cargo check result: thread 'main' has overflowed its stack

Repro steps

nightly toolchain

cargo check result: Process finished with exit code -1

Repro steps

Suspected cause

I've narrowed down the issue to a procedural macro that I've had no issues compiling in the past (on nightly). It generates a large match statement which made me think that this recent change may be related, but I have no evidence to support it other than the fact that it changes how the compiler behaves wrt large match statements.

It's also worth noting that I created the remove-unstable-features branch specifically to see if this was only an issue on nightly. It's possible that the error seen on stable is a manifestation of not using unstable features I had been relying on (box patterns, in this case).

nagisa commented 5 years ago

I've had no issues compiling in the past (on nightly)

Is there perhaps at least a vague idea of what nightly it was that used to work well?

bgourlie commented 5 years ago

I can confirm that cargo check succeeds on the following toolchains (apologies, I should have checked on my un-updated laptops prior to submitting this ticket!):

master branch:

remove-unstable-features branch

nagisa commented 5 years ago

Does not reproduce on Linux.

bgourlie commented 5 years ago

Updated my toolchains on OS X, was able to reproduce on stable, on nightly it succeeded but takes an incredibly long time (12 minutes, 41 seconds on 2.2ghz Intel i7)

ExpHP commented 5 years ago

Unable to reproduce. I am also on linux. (triple: x86_64-unknown-linux-gnu)

git clone https://github.com/bgourlie/rs-nes.git
cd rs-nes
git checkout 4d98499f # HEAD of remove-unstable-features at time of posting
cargo +stable check # using rustc 1.32.0 (9fda7c223 2019-01-16)
bgourlie commented 5 years ago

Also unable to reproduce on Linux (WSL).

ExpHP commented 5 years ago

Okay. I can confirm that it takes a suspiciously long time to cargo check on nightly even on linux (either on rs-nes master or remove-unstable-features). It does eventually finish successfully.

I attached gdb to a running process and sampled some backtraces:

cargo check gdb backtraces (nightly rustc daa53a52a, rs-nes 4d98499f (remove-unstable-features)) ``` Thread 2 (Thread 0x7fa8a6fff700 (LWP 14924)): #0 0x00007fa89ce685ea in >::extend (self=0x7fa8a6fedb34, streams=...) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libproc_macro/lib.rs:179 #1 0x00007fa89ce69284 in >::extend (self=0x7fa8a6fedb30, streams=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.4.24/src/unstable.rs:245 #2 0x00007fa89ce6766b in >::extend (self=0x7fa8a6fedb30, streams=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.4.24/src/lib.rs:170 #3 0x00007fa89ce67d9b in ::append (self=0x7fa8a6fedb30, token=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-0.6.10/src/ext.rs:41 #4 0x00007fa89ce5fcea in quote::__rt::push_comma (tokens=0x7fa8a6fedb30, span=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-0.6.10/src/lib.rs:163 #5 0x00007fa89ce47518 in rs_nes_macros::ppu_loop_impl () at rs-nes-macros/src/lib.rs:155 #6 0x00007fa89ce53fb3 in rs_nes_macros::ppu_loop (input=...) at rs-nes-macros/src/lib.rs:490 #7 0x00007fa8a872cdc8 in proc_macro::bridge::client::__run_expand2::{{closure}}::{{closure}} () at src/libproc_macro/bridge/client.rs:409 #8 >::set::{{closure}} () at src/libproc_macro/bridge/scoped_cell.rs:78 #9 >::replace () at src/libproc_macro/bridge/scoped_cell.rs:73 #10 >::set () at src/libproc_macro/bridge/scoped_cell.rs:78 #11 proc_macro::bridge::client::>::enter::{{closure}} () at src/libproc_macro/bridge/client.rs:306 #12 >::try_with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:299 #13 >::with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:245 #14 proc_macro::bridge::client::>::enter () at src/libproc_macro/bridge/client.rs:306 #15 proc_macro::bridge::client::__run_expand2::{{closure}} () at src/libproc_macro/bridge/client.rs:401 #16 as core::ops::function::FnOnce<()>>::call_once () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panic.rs:309 #17 std::panicking::try::do_call () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panicking.rs:297 #18 0x00007fa8ae06b4ea in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:92 #19 0x00007fa8a8732d75 in std::panicking::try () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panicking.rs:276 #20 std::panic::catch_unwind () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panic.rs:388 #21 proc_macro::bridge::client::__run_expand2 () at src/libproc_macro/bridge/client.rs:400 #22 0x00007fa8abc74d1e in proc_macro::bridge::server::run_server () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #23 0x00007fa8abc384b7 in proc_macro::bridge::server:: proc_macro::TokenStream>>::run () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #24 0x00007fa8abcfb4a5 in ::expand () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #25 0x00007fa8a943cb84 in syntax::ext::expand::MacroExpander::expand_invoc () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #26 0x00007fa8a94364de in syntax::ext::expand::MacroExpander::expand_fragment () --Type for more, q to quit, c to continue without paging-- from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #27 0x00007fa8a9435624 in syntax::ext::expand::MacroExpander::expand_crate () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #28 0x00007fa8ae3d86a5 in rustc_driver::driver::phase_2_configure_and_expand_inner::{{closure}} () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #29 0x00007fa8ae3cf72d in rustc::util::common::time () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #30 0x00007fa8ae436f4e in rustc_driver::driver::phase_2_configure_and_expand () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #31 0x00007fa8ae432842 in rustc_driver::driver::compile_input () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #32 0x00007fa8ae38ec21 in rustc_driver::run_compiler_with_pool () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #33 0x00007fa8ae39afc6 in >::set () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #34 0x00007fa8ae38da6b in rustc_driver::run_compiler () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #35 0x00007fa8ae39a9bb in >::set () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #36 0x00007fa8ae40d343 in std::sys_common::backtrace::__rust_begin_short_backtrace () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #37 0x00007fa8ae06b4ea in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:92 #38 0x00007fa8ae424ec1 in >::call_box () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #39 0x00007fa8ae06a2ae in _$LT$alloc..boxed..Box$LT$$LP$dyn$u20$alloc..boxed..FnBox$LT$A$C$$u20$Output$u3d$R$GT$$u20$$u2b$$u20$$u27$a$RP$$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::hd0c21f6d144d255f () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/liballoc/boxed.rs:744 #40 std::sys_common::thread::start_thread () at src/libstd/sys_common/thread.rs:14 #41 std::sys::unix::thread::Thread::new::thread_start () at src/libstd/sys/unix/thread.rs:81 #42 0x00007fa8adf93a9d in start_thread () from /usr/lib/libpthread.so.0 #43 0x00007fa8adeb4b23 in clone () from /usr/lib/libc.so.6 Thread 1 (Thread 0x7fa8a790e380 (LWP 14923)): #0 0x00007fa8adf94f6d in __pthread_timedjoin_ex () from /usr/lib/libpthread.so.0 #1 0x00007fa8ae06a36d in std::sys::unix::thread::Thread::join () at src/libstd/sys/unix/thread.rs:168 #2 0x00007fa8ae40e1b3 in >::join () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #3 0x00007fa8ae38ba39 in rustc_driver::run () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #4 0x00007fa8ae3998fc in rustc_driver::main () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #5 0x00005589dd3ac453 in std::rt::lang_start::{{closure}} () #6 0x00007fa8ae059863 in std::rt::lang_start_internal::{{closure}} () at src/libstd/rt.rs:49 #7 std::panicking::try::do_call () at src/libstd/panicking.rs:297 #8 0x00007fa8ae06b4ea in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:92 #9 0x00007fa8ae05a476 in std::panicking::try () at src/libstd/panicking.rs:276 #10 std::panic::catch_unwind () at src/libstd/panic.rs:388 #11 std::rt::lang_start_internal () at src/libstd/rt.rs:48 #12 0x00005589dd3ac442 in main () ======================================================================== Thread 2 (Thread 0x7fa8a6fff700 (LWP 14924)): #0 0x00007fa89ce685ea in >::extend (self=0x7fa8a6fedb34, streams=...) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libproc_macro/lib.rs:179 #1 0x00007fa89ce69284 in >::extend (self=0x7fa8a6fedb30, streams=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.4.24/src/unstable.rs:245 #2 0x00007fa89ce6766b in >::extend (self=0x7fa8a6fedb30, streams=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.4.24/src/lib.rs:170 #3 0x00007fa89ce67d9b in ::append (self=0x7fa8a6fedb30, token=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-0.6.10/src/ext.rs:41 #4 0x00007fa89ce5fcea in quote::__rt::push_comma (tokens=0x7fa8a6fedb30, span=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-0.6.10/src/lib.rs:163 #5 0x00007fa89ce47518 in rs_nes_macros::ppu_loop_impl () at rs-nes-macros/src/lib.rs:155 #6 0x00007fa89ce53fb3 in rs_nes_macros::ppu_loop (input=...) at rs-nes-macros/src/lib.rs:490 #7 0x00007fa8a872cdc8 in proc_macro::bridge::client::__run_expand2::{{closure}}::{{closure}} () at src/libproc_macro/bridge/client.rs:409 #8 >::set::{{closure}} () at src/libproc_macro/bridge/scoped_cell.rs:78 #9 >::replace () at src/libproc_macro/bridge/scoped_cell.rs:73 #10 >::set () at src/libproc_macro/bridge/scoped_cell.rs:78 #11 proc_macro::bridge::client::>::enter::{{closure}} () at src/libproc_macro/bridge/client.rs:306 #12 >::try_with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:299 #13 >::with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:245 #14 proc_macro::bridge::client::>::enter () at src/libproc_macro/bridge/client.rs:306 #15 proc_macro::bridge::client::__run_expand2::{{closure}} () at src/libproc_macro/bridge/client.rs:401 #16 as core::ops::function::FnOnce<()>>::call_once () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panic.rs:309 #17 std::panicking::try::do_call () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panicking.rs:297 #18 0x00007fa8ae06b4ea in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:92 #19 0x00007fa8a8732d75 in std::panicking::try () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panicking.rs:276 #20 std::panic::catch_unwind () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panic.rs:388 #21 proc_macro::bridge::client::__run_expand2 () at src/libproc_macro/bridge/client.rs:400 #22 0x00007fa8abc74d1e in proc_macro::bridge::server::run_server () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #23 0x00007fa8abc384b7 in proc_macro::bridge::server:: proc_macro::TokenStream>>::run () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #24 0x00007fa8abcfb4a5 in ::expand () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #25 0x00007fa8a943cb84 in syntax::ext::expand::MacroExpander::expand_invoc () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #26 0x00007fa8a94364de in syntax::ext::expand::MacroExpander::expand_fragment () --Type for more, q to quit, c to continue without paging--c from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #27 0x00007fa8a9435624 in syntax::ext::expand::MacroExpander::expand_crate () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #28 0x00007fa8ae3d86a5 in rustc_driver::driver::phase_2_configure_and_expand_inner::{{closure}} () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #29 0x00007fa8ae3cf72d in rustc::util::common::time () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #30 0x00007fa8ae436f4e in rustc_driver::driver::phase_2_configure_and_expand () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #31 0x00007fa8ae432842 in rustc_driver::driver::compile_input () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #32 0x00007fa8ae38ec21 in rustc_driver::run_compiler_with_pool () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #33 0x00007fa8ae39afc6 in >::set () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #34 0x00007fa8ae38da6b in rustc_driver::run_compiler () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #35 0x00007fa8ae39a9bb in >::set () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #36 0x00007fa8ae40d343 in std::sys_common::backtrace::__rust_begin_short_backtrace () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #37 0x00007fa8ae06b4ea in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:92 #38 0x00007fa8ae424ec1 in >::call_box () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #39 0x00007fa8ae06a2ae in _$LT$alloc..boxed..Box$LT$$LP$dyn$u20$alloc..boxed..FnBox$LT$A$C$$u20$Output$u3d$R$GT$$u20$$u2b$$u20$$u27$a$RP$$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::hd0c21f6d144d255f () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/liballoc/boxed.rs:744 #40 std::sys_common::thread::start_thread () at src/libstd/sys_common/thread.rs:14 #41 std::sys::unix::thread::Thread::new::thread_start () at src/libstd/sys/unix/thread.rs:81 #42 0x00007fa8adf93a9d in start_thread () from /usr/lib/libpthread.so.0 #43 0x00007fa8adeb4b23 in clone () from /usr/lib/libc.so.6 Thread 1 (Thread 0x7fa8a790e380 (LWP 14923)): #0 0x00007fa8adf94f6d in __pthread_timedjoin_ex () from /usr/lib/libpthread.so.0 #1 0x00007fa8ae06a36d in std::sys::unix::thread::Thread::join () at src/libstd/sys/unix/thread.rs:168 #2 0x00007fa8ae40e1b3 in >::join () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #3 0x00007fa8ae38ba39 in rustc_driver::run () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #4 0x00007fa8ae3998fc in rustc_driver::main () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #5 0x00005589dd3ac453 in std::rt::lang_start::{{closure}} () #6 0x00007fa8ae059863 in std::rt::lang_start_internal::{{closure}} () at src/libstd/rt.rs:49 #7 std::panicking::try::do_call () at src/libstd/panicking.rs:297 #8 0x00007fa8ae06b4ea in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:92 #9 0x00007fa8ae05a476 in std::panicking::try () at src/libstd/panicking.rs:276 #10 std::panic::catch_unwind () at src/libstd/panic.rs:388 #11 std::rt::lang_start_internal () at src/libstd/rt.rs:48 #12 0x00005589dd3ac442 in main () =============================================== Thread 2 (Thread 0x7fa8a6fff700 (LWP 14924)): #0 0x00007fa8ade5cc72 in __memmove_sse2_unaligned_erms () from /usr/lib/libc.so.6 #1 0x00005589dd3d5c14 in _rjem_je_large_ralloc (tsdn=, arena=0x0, extent=0x7fa8a4c16700, usize=, alignment=, zero=, tcache=0x7fa8a6ffe0c0) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-52018b331c920d2b/out/jemalloc/src/large.c:299 #2 0x00005589dd3b87bb in _rjem_je_arena_ralloc (tsdn=0x7fa8a6ffdf00, arena=0x0, ptr=, oldsize=, size=, alignment=0, zero=, tcache=0x7fa8a6ffe0c0) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-52018b331c920d2b/out/jemalloc/src/arena.c:1647 #3 0x00005589dd3af964 in iralloct (tsdn=, ptr=, oldsize=, size=, alignment=0, tcache=0x7fa89c430140, arena=0x0, zero=) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-52018b331c920d2b/out/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h:190 #4 iralloc (tsd=, ptr=, oldsize=, size=, alignment=0, zero=false) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-52018b331c920d2b/out/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h:197 #5 realloc (ptr=0x7fa89c931340, size=4910400) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-52018b331c920d2b/out/jemalloc/src/jemalloc.c:2338 #6 0x00007fa8a95cae11 in syntax::tokenstream::TokenStream::from_streams () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #7 0x00007fa8a95cf031 in syntax::tokenstream::TokenStreamBuilder::build () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #8 0x00007fa8abcd344d in std::panicking::try::do_call () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #9 0x00007fa8ae06b4ea in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:92 #10 0x00007fa8abc76a39 in > as proc_macro::bridge::server::DispatcherTrait>::dispatch () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #11 0x00007fa8abcfc813 in as core::convert::From<&'a mut F>>::from::call () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #12 0x00007fa8a8752d23 in >::call () at src/libproc_macro/bridge/closure.rs:30 #13 proc_macro::bridge::client::TokenStreamBuilder::build::{{closure}} () at src/libproc_macro/bridge/client.rs:233 #14 proc_macro::bridge::client::>::with::{{closure}} () at src/libproc_macro/bridge/client.rs:317 #15 proc_macro::bridge::client::BridgeState::with::{{closure}}::{{closure}} () at src/libproc_macro/bridge/client.rs:282 #16 >::replace () at src/libproc_macro/bridge/scoped_cell.rs:73 #17 proc_macro::bridge::client::BridgeState::with::{{closure}} () at src/libproc_macro/bridge/client.rs:280 #18 >::try_with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:299 --Type for more, q to quit, c to continue without paging--c #19 >::with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:245 #20 proc_macro::bridge::client::BridgeState::with () at src/libproc_macro/bridge/client.rs:279 #21 proc_macro::bridge::client::>::with () at src/libproc_macro/bridge/client.rs:310 #22 proc_macro::bridge::client::TokenStreamBuilder::build () at src/libproc_macro/bridge/client.rs:226 #23 0x00007fa89ce68bec in >::from_iter (streams=...) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libproc_macro/lib.rs:164 #24 0x00007fa89ce62dd1 in core::iter::iterator::Iterator::collect (self=...) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libcore/iter/iterator.rs:1468 #25 0x00007fa89ce685ea in >::extend (self=0x7fa8a6fedb34, streams=...) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libproc_macro/lib.rs:179 #26 0x00007fa89ce69284 in >::extend (self=0x7fa8a6fedb30, streams=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.4.24/src/unstable.rs:245 #27 0x00007fa89ce6766b in >::extend (self=0x7fa8a6fedb30, streams=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.4.24/src/lib.rs:170 #28 0x00007fa89ce67d9b in ::append (self=0x7fa8a6fedb30, token=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-0.6.10/src/ext.rs:41 #29 0x00007fa89ce5fcea in quote::__rt::push_comma (tokens=0x7fa8a6fedb30, span=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-0.6.10/src/lib.rs:163 #30 0x00007fa89ce47518 in rs_nes_macros::ppu_loop_impl () at rs-nes-macros/src/lib.rs:155 #31 0x00007fa89ce53fb3 in rs_nes_macros::ppu_loop (input=...) at rs-nes-macros/src/lib.rs:490 #32 0x00007fa8a872cdc8 in proc_macro::bridge::client::__run_expand2::{{closure}}::{{closure}} () at src/libproc_macro/bridge/client.rs:409 #33 >::set::{{closure}} () at src/libproc_macro/bridge/scoped_cell.rs:78 #34 >::replace () at src/libproc_macro/bridge/scoped_cell.rs:73 #35 >::set () at src/libproc_macro/bridge/scoped_cell.rs:78 #36 proc_macro::bridge::client::>::enter::{{closure}} () at src/libproc_macro/bridge/client.rs:306 #37 >::try_with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:299 #38 >::with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:245 #39 proc_macro::bridge::client::>::enter () at src/libproc_macro/bridge/client.rs:306 #40 proc_macro::bridge::client::__run_expand2::{{closure}} () at src/libproc_macro/bridge/client.rs:401 #41 as core::ops::function::FnOnce<()>>::call_once () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panic.rs:309 #42 std::panicking::try::do_call () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panicking.rs:297 #43 0x00007fa8ae06b4ea in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:92 #44 0x00007fa8a8732d75 in std::panicking::try () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panicking.rs:276 #45 std::panic::catch_unwind () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panic.rs:388 #46 proc_macro::bridge::client::__run_expand2 () at src/libproc_macro/bridge/client.rs:400 #47 0x00007fa8abc74d1e in proc_macro::bridge::server::run_server () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #48 0x00007fa8abc384b7 in proc_macro::bridge::server:: proc_macro::TokenStream>>::run () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #49 0x00007fa8abcfb4a5 in ::expand () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #50 0x00007fa8a943cb84 in syntax::ext::expand::MacroExpander::expand_invoc () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #51 0x00007fa8a94364de in syntax::ext::expand::MacroExpander::expand_fragment () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #52 0x00007fa8a9435624 in syntax::ext::expand::MacroExpander::expand_crate () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #53 0x00007fa8ae3d86a5 in rustc_driver::driver::phase_2_configure_and_expand_inner::{{closure}} () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #54 0x00007fa8ae3cf72d in rustc::util::common::time () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #55 0x00007fa8ae436f4e in rustc_driver::driver::phase_2_configure_and_expand () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #56 0x00007fa8ae432842 in rustc_driver::driver::compile_input () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #57 0x00007fa8ae38ec21 in rustc_driver::run_compiler_with_pool () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #58 0x00007fa8ae39afc6 in >::set () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #59 0x00007fa8ae38da6b in rustc_driver::run_compiler () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #60 0x00007fa8ae39a9bb in >::set () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #61 0x00007fa8ae40d343 in std::sys_common::backtrace::__rust_begin_short_backtrace () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #62 0x00007fa8ae06b4ea in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:92 #63 0x00007fa8ae424ec1 in >::call_box () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #64 0x00007fa8ae06a2ae in _$LT$alloc..boxed..Box$LT$$LP$dyn$u20$alloc..boxed..FnBox$LT$A$C$$u20$Output$u3d$R$GT$$u20$$u2b$$u20$$u27$a$RP$$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::hd0c21f6d144d255f () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/liballoc/boxed.rs:744 #65 std::sys_common::thread::start_thread () at src/libstd/sys_common/thread.rs:14 #66 std::sys::unix::thread::Thread::new::thread_start () at src/libstd/sys/unix/thread.rs:81 #67 0x00007fa8adf93a9d in start_thread () from /usr/lib/libpthread.so.0 #68 0x00007fa8adeb4b23 in clone () from /usr/lib/libc.so.6 Thread 1 (Thread 0x7fa8a790e380 (LWP 14923)): #0 0x00007fa8adf94f6d in __pthread_timedjoin_ex () from /usr/lib/libpthread.so.0 #1 0x00007fa8ae06a36d in std::sys::unix::thread::Thread::join () at src/libstd/sys/unix/thread.rs:168 #2 0x00007fa8ae40e1b3 in >::join () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #3 0x00007fa8ae38ba39 in rustc_driver::run () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #4 0x00007fa8ae3998fc in rustc_driver::main () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #5 0x00005589dd3ac453 in std::rt::lang_start::{{closure}} () #6 0x00007fa8ae059863 in std::rt::lang_start_internal::{{closure}} () at src/libstd/rt.rs:49 #7 std::panicking::try::do_call () at src/libstd/panicking.rs:297 #8 0x00007fa8ae06b4ea in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:92 #9 0x00007fa8ae05a476 in std::panicking::try () at src/libstd/panicking.rs:276 #10 std::panic::catch_unwind () at src/libstd/panic.rs:388 #11 std::rt::lang_start_internal () at src/libstd/rt.rs:48 =============================================== Thread 2 (Thread 0x7fa8a6fff700 (LWP 14924)): #0 0x00007fa8ade5cc72 in __memmove_sse2_unaligned_erms () from /usr/lib/libc.so.6 #1 0x00005589dd3d5c14 in _rjem_je_large_ralloc (tsdn=, arena=0x0, extent=0x7fa8a4c16700, usize=, alignment=, zero=, tcache=0x7fa8a6ffe0c0) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-52018b331c920d2b/out/jemalloc/src/large.c:299 #2 0x00005589dd3b87bb in _rjem_je_arena_ralloc (tsdn=0x7fa8a6ffdf00, arena=0x0, ptr=, oldsize=, size=, alignment=0, zero=, tcache=0x7fa8a6ffe0c0) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-52018b331c920d2b/out/jemalloc/src/arena.c:1647 #3 0x00005589dd3af964 in iralloct (tsdn=, ptr=, oldsize=, size=, alignment=0, tcache=0x7fa89c430140, arena=0x0, zero=) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-52018b331c920d2b/out/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h:190 #4 iralloc (tsd=, ptr=, oldsize=, size=, alignment=0, zero=false) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-52018b331c920d2b/out/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h:197 #5 realloc (ptr=0x7fa89c931340, size=4910400) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-52018b331c920d2b/out/jemalloc/src/jemalloc.c:2338 #6 0x00007fa8a95cae11 in syntax::tokenstream::TokenStream::from_streams () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #7 0x00007fa8a95cf031 in syntax::tokenstream::TokenStreamBuilder::build () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #8 0x00007fa8abcd344d in std::panicking::try::do_call () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #9 0x00007fa8ae06b4ea in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:92 #10 0x00007fa8abc76a39 in > as proc_macro::bridge::server::DispatcherTrait>::dispatch () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #11 0x00007fa8abcfc813 in as core::convert::From<&'a mut F>>::from::call () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #12 0x00007fa8a8752d23 in >::call () at src/libproc_macro/bridge/closure.rs:30 #13 proc_macro::bridge::client::TokenStreamBuilder::build::{{closure}} () at src/libproc_macro/bridge/client.rs:233 #14 proc_macro::bridge::client::>::with::{{closure}} () at src/libproc_macro/bridge/client.rs:317 #15 proc_macro::bridge::client::BridgeState::with::{{closure}}::{{closure}} () at src/libproc_macro/bridge/client.rs:282 #16 >::replace () at src/libproc_macro/bridge/scoped_cell.rs:73 #17 proc_macro::bridge::client::BridgeState::with::{{closure}} () at src/libproc_macro/bridge/client.rs:280 #18 >::try_with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:299 --Type for more, q to quit, c to continue without paging--c #19 >::with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:245 #20 proc_macro::bridge::client::BridgeState::with () at src/libproc_macro/bridge/client.rs:279 #21 proc_macro::bridge::client::>::with () at src/libproc_macro/bridge/client.rs:310 #22 proc_macro::bridge::client::TokenStreamBuilder::build () at src/libproc_macro/bridge/client.rs:226 #23 0x00007fa89ce68bec in >::from_iter (streams=...) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libproc_macro/lib.rs:164 #24 0x00007fa89ce62dd1 in core::iter::iterator::Iterator::collect (self=...) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libcore/iter/iterator.rs:1468 #25 0x00007fa89ce685ea in >::extend (self=0x7fa8a6fedb34, streams=...) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libproc_macro/lib.rs:179 #26 0x00007fa89ce69284 in >::extend (self=0x7fa8a6fedb30, streams=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.4.24/src/unstable.rs:245 #27 0x00007fa89ce6766b in >::extend (self=0x7fa8a6fedb30, streams=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.4.24/src/lib.rs:170 #28 0x00007fa89ce67d9b in ::append (self=0x7fa8a6fedb30, token=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-0.6.10/src/ext.rs:41 #29 0x00007fa89ce5fcea in quote::__rt::push_comma (tokens=0x7fa8a6fedb30, span=...) at /home/lampam/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-0.6.10/src/lib.rs:163 #30 0x00007fa89ce47518 in rs_nes_macros::ppu_loop_impl () at rs-nes-macros/src/lib.rs:155 #31 0x00007fa89ce53fb3 in rs_nes_macros::ppu_loop (input=...) at rs-nes-macros/src/lib.rs:490 #32 0x00007fa8a872cdc8 in proc_macro::bridge::client::__run_expand2::{{closure}}::{{closure}} () at src/libproc_macro/bridge/client.rs:409 #33 >::set::{{closure}} () at src/libproc_macro/bridge/scoped_cell.rs:78 #34 >::replace () at src/libproc_macro/bridge/scoped_cell.rs:73 #35 >::set () at src/libproc_macro/bridge/scoped_cell.rs:78 #36 proc_macro::bridge::client::>::enter::{{closure}} () at src/libproc_macro/bridge/client.rs:306 #37 >::try_with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:299 #38 >::with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:245 #39 proc_macro::bridge::client::>::enter () at src/libproc_macro/bridge/client.rs:306 #40 proc_macro::bridge::client::__run_expand2::{{closure}} () at src/libproc_macro/bridge/client.rs:401 #41 as core::ops::function::FnOnce<()>>::call_once () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panic.rs:309 #42 std::panicking::try::do_call () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panicking.rs:297 #43 0x00007fa8ae06b4ea in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:92 #44 0x00007fa8a8732d75 in std::panicking::try () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panicking.rs:276 #45 std::panic::catch_unwind () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/panic.rs:388 #46 proc_macro::bridge::client::__run_expand2 () at src/libproc_macro/bridge/client.rs:400 #47 0x00007fa8abc74d1e in proc_macro::bridge::server::run_server () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #48 0x00007fa8abc384b7 in proc_macro::bridge::server:: proc_macro::TokenStream>>::run () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #49 0x00007fa8abcfb4a5 in ::expand () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax_ext-065cea48e300124c.so #50 0x00007fa8a943cb84 in syntax::ext::expand::MacroExpander::expand_invoc () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #51 0x00007fa8a94364de in syntax::ext::expand::MacroExpander::expand_fragment () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #52 0x00007fa8a9435624 in syntax::ext::expand::MacroExpander::expand_crate () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libsyntax-2e8dd76d87693318.so #53 0x00007fa8ae3d86a5 in rustc_driver::driver::phase_2_configure_and_expand_inner::{{closure}} () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #54 0x00007fa8ae3cf72d in rustc::util::common::time () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #55 0x00007fa8ae436f4e in rustc_driver::driver::phase_2_configure_and_expand () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #56 0x00007fa8ae432842 in rustc_driver::driver::compile_input () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #57 0x00007fa8ae38ec21 in rustc_driver::run_compiler_with_pool () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #58 0x00007fa8ae39afc6 in >::set () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #59 0x00007fa8ae38da6b in rustc_driver::run_compiler () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #60 0x00007fa8ae39a9bb in >::set () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #61 0x00007fa8ae40d343 in std::sys_common::backtrace::__rust_begin_short_backtrace () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #62 0x00007fa8ae06b4ea in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:92 #63 0x00007fa8ae424ec1 in >::call_box () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #64 0x00007fa8ae06a2ae in _$LT$alloc..boxed..Box$LT$$LP$dyn$u20$alloc..boxed..FnBox$LT$A$C$$u20$Output$u3d$R$GT$$u20$$u2b$$u20$$u27$a$RP$$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$::call_once::hd0c21f6d144d255f () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/liballoc/boxed.rs:744 #65 std::sys_common::thread::start_thread () at src/libstd/sys_common/thread.rs:14 #66 std::sys::unix::thread::Thread::new::thread_start () at src/libstd/sys/unix/thread.rs:81 #67 0x00007fa8adf93a9d in start_thread () from /usr/lib/libpthread.so.0 #68 0x00007fa8adeb4b23 in clone () from /usr/lib/libc.so.6 Thread 1 (Thread 0x7fa8a790e380 (LWP 14923)): #0 0x00007fa8adf94f6d in __pthread_timedjoin_ex () from /usr/lib/libpthread.so.0 #1 0x00007fa8ae06a36d in std::sys::unix::thread::Thread::join () at src/libstd/sys/unix/thread.rs:168 #2 0x00007fa8ae40e1b3 in >::join () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #3 0x00007fa8ae38ba39 in rustc_driver::run () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #4 0x00007fa8ae3998fc in rustc_driver::main () from /home/lampam/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-c5efcb7334989aff.so #5 0x00005589dd3ac453 in std::rt::lang_start::{{closure}} () #6 0x00007fa8ae059863 in std::rt::lang_start_internal::{{closure}} () at src/libstd/rt.rs:49 #7 std::panicking::try::do_call () at src/libstd/panicking.rs:297 #8 0x00007fa8ae06b4ea in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:92 #9 0x00007fa8ae05a476 in std::panicking::try () at src/libstd/panicking.rs:276 #10 std::panic::catch_unwind () at src/libstd/panic.rs:388 #11 std::rt::lang_start_internal () at src/libstd/rt.rs:48 #12 0x00005589dd3ac442 in main () ```
matthiaskrgr commented 5 years ago

When cargo checking with RUSTFLAGS="-Ztime-passes", I can see that the expand crate step takes an unusually big amount of time:

    Checking rs_nes v0.0.1 (/tmp/rs-nes/rs-nes)
  time: 0.009; rss: 54MB    parsing
  time: 0.000; rss: 54MB    attributes injection
  time: 0.000; rss: 54MB    garbage collect incremental cache directory
  time: 0.000; rss: 54MB    recursion limit
  time: 0.000; rss: 54MB    crate injection
  time: 0.000; rss: 54MB    plugin loading
  time: 0.000; rss: 54MB    plugin registration
  time: 0.000; rss: 54MB    background load prev dep-graph
  time: 0.002; rss: 55MB    pre ast expansion lint checks
    time: 176.138; rss: 100MB   expand crate
    time: 0.000; rss: 100MB check unused macros
  time: 176.138; rss: 100MB expansion
  time: 0.000; rss: 100MB   maybe building test harness
  time: 0.001; rss: 100MB   maybe creating a macro crate
  time: 0.007; rss: 100MB   creating allocators
  time: 0.004; rss: 100MB   AST validation
  time: 0.016; rss: 102MB   name resolution
  time: 0.003; rss: 102MB   complete gated feature checking
  time: 0.000; rss: 102MB   blocked while dep-graph loading finishes
  time: 0.020; rss: 116MB   lowering ast -> hir
  time: 0.016; rss: 116MB   early lint checks
    time: 0.008; rss: 125MB validate hir map
  time: 0.051; rss: 125MB   indexing hir
  time: 0.000; rss: 125MB   load query result cache
  time: 0.000; rss: 125MB   looking for entry point
  time: 0.000; rss: 125MB   dep graph tcx init
  time: 0.000; rss: 125MB   looking for plugin registrar
  time: 0.000; rss: 125MB   looking for derive registrar
  time: 0.001; rss: 127MB   loop checking
  time: 0.002; rss: 127MB   attribute checking
  time: 0.004; rss: 127MB   stability checking
  time: 0.010; rss: 131MB   type collecting
  time: 0.000; rss: 131MB   outlives testing
  time: 0.000; rss: 131MB   impl wf inference
  time: 0.045; rss: 142MB   coherence checking
  time: 0.000; rss: 142MB   variance testing
pnkfelix commented 5 years ago

triage. P-high. Assigning to self for further bisection on OS X (to hopefully confirm or reject the reporter's hypothesis regarding #57494

pnkfelix commented 5 years ago

On my Mac OS X laptop, the source of the slowdown appears to be tied to the expansion-time construction (or maybe compilation) of the following line:

const CYCLES_MAP: [u8; #total_cycles] = [#(#compact_cycle_number_map),*];

Or at least, when I replace that array with one that just says:

const CYCLES_MAP: [u8; #total_cycles] = [0; #total_cycles];

then the overall compilation via cargo check completes quite quickly.


eprintln! instrumentation reveals that during the expansion in question, the const array in question has 89,342 entries (i.e. total_cycles == 89342).

pnkfelix commented 5 years ago

I am now focusing on bisection; I found that I was able to comment out most of the other code, effectively generating a much reduced test case, which I will try to extract into its own crate (or perhaps pair of source files? we'll see) in a bit.

pnkfelix commented 5 years ago

Here is a gist that captures the test case I've reduced this to for now (unfortunately gist does not allow forward-slashes in the names so I've used spaces instead of slashes as the directory separator): https://gist.github.com/pnkfelix/06a63f45fda5066245b9b516eea68598


Regarding that reduced test case, here's what I've observed so far:

That is, running `cargo check` in `demo/`, with dependencies already built for both rust versions, I see this: ``` % rustup default nightly-2019-01-13 && touch src/lib.rs && touch ../ppu_loop/src/lib.rs info: using existing install for 'nightly-2019-01-13-x86_64-apple-darwin' info: default toolchain set to 'nightly-2019-01-13-x86_64-apple-darwin' nightly-2019-01-13-x86_64-apple-darwin unchanged - rustc 1.33.0-nightly (75a369c5b 2019-01-12) % time cargo check Compiling ppu_loop v0.1.0 (/Users/fklock/Dev/Mozilla/issue57335/ppu_loop) Checking demo v0.1.0 (/Users/fklock/Dev/Mozilla/issue57335/demo) expansion ppu_loop_impl total_cycles: 17000 Finished dev [unoptimized + debuginfo] target(s) in 1.57s real 0m1.616s user 0m1.109s sys 0m0.443s % rustup default nightly-2019-01-14 && touch src/lib.rs && touch ../ppu_loop/src/lib.rs info: using existing install for 'nightly-2019-01-14-x86_64-apple-darwin' info: default toolchain set to 'nightly-2019-01-14-x86_64-apple-darwin' nightly-2019-01-14-x86_64-apple-darwin unchanged - rustc 1.33.0-nightly (2fadb0a16 2019-01-13) % time cargo check Compiling ppu_loop v0.1.0 (/Users/fklock/Dev/Mozilla/issue57335/ppu_loop) Checking demo v0.1.0 (/Users/fklock/Dev/Mozilla/issue57335/demo) expansion ppu_loop_impl total_cycles: 17000 Finished dev [unoptimized + debuginfo] target(s) in 33.07s real 0m33.115s user 0m14.167s sys 0m18.665s ```

In the reduced test case, I tried adjusting the size of the array in the generated code by changing the values of SCANLINES and CYCLES_PER_SCANLINE. (You can see that in the version I posted above, there is eprintln! instrumentation reporting that the total_cycles is 17,000.)

Here is a summary of how the `cargo check` time changes as `total_cycles` changes. (This is based on single runs, no statistical averaging or whatnot, so take it all with a grain of salt.) total_cycles | | real time | user time | sys time ------------- | --- | --- | --- | --- 1,000 | | 1.170s | 0.907s | 0.263s 2,000 | | 1.241s | 0.965s | 0.264s 3,000 | | 1.703s | 1.178s | 0.517s 4,000 | | 2.347s | 1.438s | 0.875s 5,000 | | 3.100s | 1.757s | 1.325s 6,000 | | 3.972s | 2.138s | 1.819s 7,000 | | 5.130s | 2.635s | 2.469s 8,000 | | 6.414s | 3.156s | 3.216s 9,000 | | 7.927s | 3.773s | 4.089s 10,000 | | 9.695s | 4.763s | 5.032s 11,000 | | 11.167s | 5.156s | 5.973s 12,000 | | 13.142s | 5.954s | 7.130s 13,000 | | 15.347s | 6.862s | 8.412s 14,000 | | 17.599s | 7.739s | 9.718s 15,000 | | 20.102s | 8.734s | 11.222s 16,000 | | 22.727s | 10.057s | 12.567s 17,000 | | 26.309s | 11.313s | 14.807s 18,000 | | 28.580s | 12.311s | 16.065s 19,000 | | 32.359s | 13.691s | 18.480s 20,000 | | 35.701s | 15.127s | 20.360s

The main reason why I've included the above table (in the details block) is it looks like there may be a non-linear relationship from total_cycles to the elapsed time. each row increases the total_cycles by 1,000, but the delta for time increase starts at around 1.5 seconds but grows to 3 seconds by the end. (I also included the table because on some of my runs, the step from 16,000 to 17,000 jumped by quite a lot. But after repeated runs it appears that may have been noise.)

pnkfelix commented 5 years ago

Between the two nightlies I referenced in the above comment, here are the PR's that were merged:

% git log 75a369c5b..2fadb0a16 --author=bors --format=oneline

Of the PR's referenced above, my spidey-sense is most-immediately firing in response to seeing #57004 "(Make TokenStream less recursive.) "

pnkfelix commented 5 years ago

Okay further bisection indicates that the regression was injected by 2cf736f.

Spidey-sense continues to fire in response to #57004. I'm going to look into reverting that on its own and see what happens.

pnkfelix commented 5 years ago

According to an Instruments run profiling the invocation of rustc on my demo test code, the vast majority of the time is being spent here: https://github.com/rust-lang/rust/blob/106b3e9fa4d53efc4e8eab47d1043789c88f99a5/src/libsyntax/tokenstream.rs#L262

I'm going to review #57004 and follow-on code a little, see if I can determine whether we can get rid of that eager traversal and cloning of the contents of the vector of streams.

petrochenkov commented 5 years ago

cc @nnethercote

pnkfelix commented 5 years ago

Okay I think I have a fix.

I made two different micro-optimizations to the code path I identified in my previous comment.

After rebuilding the compiler with those micro-optimizations, my demo code compiles much faster than before.

Here's the current diff. I'm going to try to identify which of the two micro-optimizations was the important one:

diff --git a/src/libsyntax/tokenstream.rs b/src/libsyntax/tokenstream.rs
index f5d2d6f18e..db6b701b83 100644
--- a/src/libsyntax/tokenstream.rs
+++ b/src/libsyntax/tokenstream.rs
@@ -255,11 +255,19 @@ impl TokenStream {
             0 => TokenStream::empty(),
             1 => streams.pop().unwrap(),
             _ => {
-                let mut vec = vec![];
+                let tree_count = streams.iter()
+                    .map(|ts| match &ts.0 { None => 0, Some(s) => s.len() })
+                    .sum();
+                let mut vec = Vec::with_capacity(tree_count);
                 for stream in streams {
                     match stream.0 {
                         None => {},
-                        Some(stream2) => vec.extend(stream2.iter().cloned()),
+                        Some(stream2) => {
+                            match Lrc::try_unwrap(stream2) {
+                                Ok(trees) => vec.extend(trees.into_iter()),
+                                Err(stream2) => vec.extend(stream2.iter().cloned()),
+                            }
+                        }
                     }
                 }
                 TokenStream::new(vec)
pnkfelix commented 5 years ago

One mystery to me is why the problem was not replicated on Linux. If I am correct that one or both of the micro-optimizations listed above fixes this issue, then we should be observing a similar execution time hit on Linux systems, I imagine...

... although ... maybe it is the with_capacity call that is fixing things on OS X, and memory allocation on Linux is simply so much better than on OS X that it is able to mask the problem there?

Update: I overlooked @ExpHP 's report that the slowdown does reproduce on Linux.

pnkfelix commented 5 years ago

Okay I have now determined that on my OS X machine, it is the with_capacity delta that makes the difference here. The attempt to avoid cloning the trees within a singly-owned vector doesn't help at all for my reduced demo.

ExpHP commented 5 years ago

Well, there were two problems here, right? One that does not replicate on Linux (crash), and one that does (super slow cargo check)

pnkfelix commented 5 years ago

Oh, I'm sorry, I overlooked @ExpHP 's comment that they reproduced the slowdown on Linux.

pnkfelix commented 5 years ago

cc https://github.com/rust-lang-nursery/rustc-perf/issues/277

pnkfelix commented 5 years ago

Just to make sure I cover all the issues here, I have now replicated the stack overflow on OS X atop commit 9fda7c2237

A backtrace shows that the overflow is happening during a particularly deep series of drop calls. (Chances seem high that this is related in some manner to how the token-tree/token-stream was (re)structured.)