Skip to content

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

Description

@bgourlie

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

  • stable-x86_64-pc-windows-msvc
  • rustc 1.32.0 (9fda7c2 2019-01-16)

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

Repro steps

  • Clone my project
  • cd rs-nes
  • git checkout remove-unstable-features
  • cargo check

nightly toolchain

  • nightly-x86_64-pc-windows-msvc
  • rustc 1.33.0-nightly (daa53a5 2019-01-17)

cargo check result: Process finished with exit code -1

Repro steps

  • Same as above, but on the master branch

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).

Activity

  1. nagisa commented on Jan 18, 2019

    @nagisa
    Member

    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?

  2. bgourlie commented on Jan 18, 2019

    @bgourlie
    Author

    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:

    • nightly-x86_64-pc-windows-msvc (1.33.0-nightly a2b0f24 2018-12-30)
    • nightly-x86_64-apple-darwin (rustc 1.33.0 nightly c2d381d 2019-01-10)

    remove-unstable-features branch

    • stable-x86_64-pc-windows-msvc (rustc 1.31.1 b6c32da 2018-12-18)
    • stable-x86_x64-apple-darwin (rustc 1.31.1 b6c32da 2018-12-18)
  3. nagisa commented on Jan 18, 2019

    @nagisa
    Member

    Does not reproduce on Linux.

  4. bgourlie commented on Jan 18, 2019

    @bgourlie
    Author

    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)

  5. ExpHP commented on Jan 18, 2019

    @ExpHP
    Contributor

    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)
  6. bgourlie commented on Jan 18, 2019

    @bgourlie
    Author

    Also unable to reproduce on Linux (WSL).

  7. ExpHP commented on Jan 18, 2019

    @ExpHP
    Contributor

    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 daa53a5, rs-nes 4d98499f (remove-unstable-features))
    Thread 2 (Thread 0x7fa8a6fff700 (LWP 14924)):
    #0  0x00007fa89ce685ea in <proc_macro::TokenStream as core::iter::traits::Extend<proc_macro::TokenStream>>::extend (self=0x7fa8a6fedb34, streams=...)
        at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libproc_macro/lib.rs:179
    #1  0x00007fa89ce69284 in <proc_macro2::imp::TokenStream as core::iter::traits::Extend<proc_macro2::TokenTree>>::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 <proc_macro2::TokenStream as core::iter::traits::Extend<proc_macro2::TokenTree>>::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 <proc_macro2::TokenStream as quote::ext::TokenStreamExt>::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  <proc_macro::bridge::scoped_cell::ScopedCell<T>>::set::{{closure}} () at src/libproc_macro/bridge/scoped_cell.rs:78
    #9  <proc_macro::bridge::scoped_cell::ScopedCell<T>>::replace () at src/libproc_macro/bridge/scoped_cell.rs:73
    #10 <proc_macro::bridge::scoped_cell::ScopedCell<T>>::set () at src/libproc_macro/bridge/scoped_cell.rs:78
    #11 proc_macro::bridge::client::<impl proc_macro::bridge::Bridge<'_>>::enter::{{closure}} () at src/libproc_macro/bridge/client.rs:306
    #12 <std::thread::local::LocalKey<T>>::try_with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:299
    #13 <std::thread::local::LocalKey<T>>::with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:245
    #14 proc_macro::bridge::client::<impl proc_macro::bridge::Bridge<'_>>::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 <std::panic::AssertUnwindSafe<F> 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::<impl proc_macro::bridge::client::Client<fn(proc_macro::TokenStream, proc_macro::TokenStream) -> 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 <syntax_ext::proc_macro_impl::AttrProcMacro as syntax::ext::base::AttrProcMacro>::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 <RET> 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 <scoped_tls::ScopedKey<T>>::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 <scoped_tls::ScopedKey<T>>::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 <F as alloc::boxed::FnBox<A>>::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 <std::thread::JoinHandle<T>>::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 <proc_macro::TokenStream as core::iter::traits::Extend<proc_macro::TokenStream>>::extend (self=0x7fa8a6fedb34, streams=...)
        at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libproc_macro/lib.rs:179
    #1  0x00007fa89ce69284 in <proc_macro2::imp::TokenStream as core::iter::traits::Extend<proc_macro2::TokenTree>>::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 <proc_macro2::TokenStream as core::iter::traits::Extend<proc_macro2::TokenTree>>::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 <proc_macro2::TokenStream as quote::ext::TokenStreamExt>::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  <proc_macro::bridge::scoped_cell::ScopedCell<T>>::set::{{closure}} () at src/libproc_macro/bridge/scoped_cell.rs:78
    #9  <proc_macro::bridge::scoped_cell::ScopedCell<T>>::replace () at src/libproc_macro/bridge/scoped_cell.rs:73
    #10 <proc_macro::bridge::scoped_cell::ScopedCell<T>>::set () at src/libproc_macro/bridge/scoped_cell.rs:78
    #11 proc_macro::bridge::client::<impl proc_macro::bridge::Bridge<'_>>::enter::{{closure}} () at src/libproc_macro/bridge/client.rs:306
    #12 <std::thread::local::LocalKey<T>>::try_with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:299
    #13 <std::thread::local::LocalKey<T>>::with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:245
    #14 proc_macro::bridge::client::<impl proc_macro::bridge::Bridge<'_>>::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 <std::panic::AssertUnwindSafe<F> 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::<impl proc_macro::bridge::client::Client<fn(proc_macro::TokenStream, proc_macro::TokenStream) -> 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 <syntax_ext::proc_macro_impl::AttrProcMacro as syntax::ext::base::AttrProcMacro>::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 <RET> 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 <scoped_tls::ScopedKey<T>>::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 <scoped_tls::ScopedKey<T>>::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 <F as alloc::boxed::FnBox<A>>::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 <std::thread::JoinHandle<T>>::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=<optimized out>, arena=0x0, extent=0x7fa8a4c16700, usize=<optimized out>, alignment=<optimized out>, 
        zero=<optimized out>, 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=<optimized out>, oldsize=<optimized out>, size=<optimized out>, 
        alignment=0, zero=<optimized out>, 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=<optimized out>, ptr=<optimized out>, oldsize=<optimized out>, size=<optimized out>, alignment=0, 
        tcache=0x7fa89c430140, arena=0x0, zero=<optimized out>)
        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=<optimized out>, ptr=<optimized out>, oldsize=<optimized out>, size=<optimized out>, 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 <proc_macro::bridge::server::Dispatcher<proc_macro::bridge::server::MarkedTypes<S>> 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 <proc_macro::bridge::closure::Closure<'a, A, R> 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 <proc_macro::bridge::closure::Closure<'a, A, R>>::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::<impl proc_macro::bridge::Bridge<'_>>::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 <proc_macro::bridge::scoped_cell::ScopedCell<T>>::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 <std::thread::local::LocalKey<T>>::try_with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:299
    --Type <RET> for more, q to quit, c to continue without paging--c
    #19 <std::thread::local::LocalKey<T>>::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::<impl proc_macro::bridge::Bridge<'_>>::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 <proc_macro::TokenStream as core::iter::traits::FromIterator<proc_macro::TokenStream>>::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 <proc_macro::TokenStream as core::iter::traits::Extend<proc_macro::TokenStream>>::extend (self=0x7fa8a6fedb34, streams=...) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libproc_macro/lib.rs:179
    #26 0x00007fa89ce69284 in <proc_macro2::imp::TokenStream as core::iter::traits::Extend<proc_macro2::TokenTree>>::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 <proc_macro2::TokenStream as core::iter::traits::Extend<proc_macro2::TokenTree>>::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 <proc_macro2::TokenStream as quote::ext::TokenStreamExt>::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 <proc_macro::bridge::scoped_cell::ScopedCell<T>>::set::{{closure}} () at src/libproc_macro/bridge/scoped_cell.rs:78
    #34 <proc_macro::bridge::scoped_cell::ScopedCell<T>>::replace () at src/libproc_macro/bridge/scoped_cell.rs:73
    #35 <proc_macro::bridge::scoped_cell::ScopedCell<T>>::set () at src/libproc_macro/bridge/scoped_cell.rs:78
    #36 proc_macro::bridge::client::<impl proc_macro::bridge::Bridge<'_>>::enter::{{closure}} () at src/libproc_macro/bridge/client.rs:306
    #37 <std::thread::local::LocalKey<T>>::try_with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:299
    #38 <std::thread::local::LocalKey<T>>::with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:245
    #39 proc_macro::bridge::client::<impl proc_macro::bridge::Bridge<'_>>::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 <std::panic::AssertUnwindSafe<F> 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::<impl proc_macro::bridge::client::Client<fn(proc_macro::TokenStream, proc_macro::TokenStream) -> 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 <syntax_ext::proc_macro_impl::AttrProcMacro as syntax::ext::base::AttrProcMacro>::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 <scoped_tls::ScopedKey<T>>::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 <scoped_tls::ScopedKey<T>>::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 <F as alloc::boxed::FnBox<A>>::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 <std::thread::JoinHandle<T>>::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=<optimized out>, arena=0x0, extent=0x7fa8a4c16700, usize=<optimized out>, alignment=<optimized out>, 
        zero=<optimized out>, 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=<optimized out>, oldsize=<optimized out>, size=<optimized out>, 
        alignment=0, zero=<optimized out>, 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=<optimized out>, ptr=<optimized out>, oldsize=<optimized out>, size=<optimized out>, alignment=0, 
        tcache=0x7fa89c430140, arena=0x0, zero=<optimized out>)
        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=<optimized out>, ptr=<optimized out>, oldsize=<optimized out>, size=<optimized out>, 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 <proc_macro::bridge::server::Dispatcher<proc_macro::bridge::server::MarkedTypes<S>> 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 <proc_macro::bridge::closure::Closure<'a, A, R> 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 <proc_macro::bridge::closure::Closure<'a, A, R>>::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::<impl proc_macro::bridge::Bridge<'_>>::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 <proc_macro::bridge::scoped_cell::ScopedCell<T>>::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 <std::thread::local::LocalKey<T>>::try_with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:299
    --Type <RET> for more, q to quit, c to continue without paging--c
    #19 <std::thread::local::LocalKey<T>>::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::<impl proc_macro::bridge::Bridge<'_>>::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 <proc_macro::TokenStream as core::iter::traits::FromIterator<proc_macro::TokenStream>>::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 <proc_macro::TokenStream as core::iter::traits::Extend<proc_macro::TokenStream>>::extend (self=0x7fa8a6fedb34, streams=...) at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libproc_macro/lib.rs:179
    #26 0x00007fa89ce69284 in <proc_macro2::imp::TokenStream as core::iter::traits::Extend<proc_macro2::TokenTree>>::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 <proc_macro2::TokenStream as core::iter::traits::Extend<proc_macro2::TokenTree>>::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 <proc_macro2::TokenStream as quote::ext::TokenStreamExt>::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 <proc_macro::bridge::scoped_cell::ScopedCell<T>>::set::{{closure}} () at src/libproc_macro/bridge/scoped_cell.rs:78
    #34 <proc_macro::bridge::scoped_cell::ScopedCell<T>>::replace () at src/libproc_macro/bridge/scoped_cell.rs:73
    #35 <proc_macro::bridge::scoped_cell::ScopedCell<T>>::set () at src/libproc_macro/bridge/scoped_cell.rs:78
    #36 proc_macro::bridge::client::<impl proc_macro::bridge::Bridge<'_>>::enter::{{closure}} () at src/libproc_macro/bridge/client.rs:306
    #37 <std::thread::local::LocalKey<T>>::try_with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:299
    #38 <std::thread::local::LocalKey<T>>::with () at /rustc/daa53a52a2667533d5fe59bfcc5b8614b79c3d31/src/libstd/thread/local.rs:245
    #39 proc_macro::bridge::client::<impl proc_macro::bridge::Bridge<'_>>::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 <std::panic::AssertUnwindSafe<F> 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::<impl proc_macro::bridge::client::Client<fn(proc_macro::TokenStream, proc_macro::TokenStream) -> 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 <syntax_ext::proc_macro_impl::AttrProcMacro as syntax::ext::base::AttrProcMacro>::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 <scoped_tls::ScopedKey<T>>::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 <scoped_tls::ScopedKey<T>>::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 <F as alloc::boxed::FnBox<A>>::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 <std::thread::JoinHandle<T>>::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 ()
    
  8. matthiaskrgr commented on Jan 19, 2019

    @matthiaskrgr
    Member

    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
    
  9. pnkfelix commented on Jan 24, 2019

    @pnkfelix
    Contributor

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

  10. added
    P-highHigh priority
    I-slowIssue: Problems and improvements with respect to performance of generated code.
    on Jan 24, 2019
  11. 8 remaining items

  12. petrochenkov commented on Jan 29, 2019

    @petrochenkov
    Contributor
  13. pnkfelix commented on Jan 30, 2019

    @pnkfelix
    Contributor

    Okay I think I have a fix.

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

    • The first micro-optimization was to add a prepass over streams to figure out what capacity our accumulating vec is going to require, and then build the vec with that capacity.
    • The second micro-optimization (which I suspect may be the more relevant one) was to identify when the Lrc for stream2 has a single owner (i.e. a ref-count of one); if so, then we can just move the trees directly from stream2 into vec, without cloning them.

    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)
  14. pnkfelix commented on Jan 30, 2019

    @pnkfelix
    Contributor

    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.

  15. pnkfelix commented on Jan 30, 2019

    @pnkfelix
    Contributor

    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.

  16. ExpHP commented on Jan 30, 2019

    @ExpHP
    Contributor

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

  17. pnkfelix commented on Jan 30, 2019

    @pnkfelix
    Contributor

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

  18. pnkfelix commented on Jan 30, 2019

    @pnkfelix
    Contributor
  19. removed
    O-macosOperating system: macOS
    O-windowsOperating system: Windows
    on Jan 30, 2019
  20. pnkfelix commented on Jan 31, 2019

    @pnkfelix
    Contributor

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

    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.)

  21. added a commit that references this issue on Feb 5, 2019
    a1ec22f
  22. added a commit that references this issue on Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

I-slowIssue: Problems and improvements with respect to performance of generated code.P-highHigh priorityregression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions