rmanoka / async-scoped

A scope for async_std and tokio to spawn non-static futures
122 stars 14 forks source link

Compilation error after Rust nightly 2021-01-10 #6

Closed DimiDimit closed 3 years ago

DimiDimit commented 3 years ago

Compiling on any nightly version after 2021-01-10 errors out:

   Compiling async-scoped v0.6.0 (/tmp/async-scoped)
error: custom attribute panicked
   --> src/tests.rs:6:86
    |
6   |               #[cfg_attr(all(feature = "use-tokio", not( feature = "use-async-std" )), tokio::test(flavor = "multi_thread", worker_threads=1...
    |                                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
21  | / test_fixtures! {
22  | |     async fn test_scope() {
23  | |         let not_copy = String::from("hello world!");
24  | |         let not_copy_ref = &not_copy;
...   |
291 | |     }
292 | | }
    | |_- in this macro invocation
    |
    = help: message: internal error: entered unreachable code
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

error: could not compile `async-scoped`

(This is for use-tokio, the error for use-async-std is very similar:)

5   |               #[cfg_attr(feature = "use-async-std", async_std::test)]
    |                                                     ^^^^^^^^^^^^^^^

After some trial and error I traced the problem to commit rust-lang/rust@6184f23950fb4aa14884ce310d948dc6fca269a3, which merges rust-lang/rust#80830.

I'm not sure whether this is an issue with rustc, tokio/async-std or async-scoped, I couldn't find an existing issue about it, so I decided to submit it here for the time being.

For now, I've pushed a workaround to my fork which just adds #![cfg(test)] to the tests.rs file, which means that the tests won't be compiled during normal usage, hence avoiding the error.

rmanoka commented 3 years ago

@DimiDimit I don't have this compiler (the most recent nightly with rls seems to be 2020-12-31, which is what I use). The macro that errors out is simply delegating to either async_std::test or tokio::test attributes to run the the tests. Could you test the compiler with a sample function and directly using one of these attributes?

Eg.

#[test]
#[tokio::test(flavor = "multi_thread", worker_threads=1)]
fn hello_world() {
  eprintln!("Hello world!");
}
DimiDimit commented 3 years ago

I forgot to add this, but expanding the test_fixtures! macro manually through the wonders of copy-paste works perfectly fine, but using it errors out. I could've also used that as my workaround, now that I think about it. I found that the #[cfg_attr] makes no difference for this error.

Also, this is an unexpected compiler panic which means it's apparently a bug with rustc.

rmanoka commented 3 years ago

Interesting. In the interest of finding a MWE to take to the rustc team, does the following eg. compile?

#[macro_use]
macro_rules! testing {
    ($($item:item)*) => {
        $(
            #[cfg_attr(feature = "use-async-std", test)]
            $item
        )*
    }
}

testing! {
    fn hello_world() {
        eprintln!("Hello world!")
    }
}

You would test this by: cargo test --features use-async-std -- hello_world --nocapture.

DimiDimit commented 3 years ago

That actually compiles and runs just fine! Oddly enough, commenting out the following tests in src/tests.rs makes it compile: scope_lifetime, cancellation_soundness, backpressure and test_async_deadlock.

running 4 tests
test tests::test_scope_and_collect ... ok
test tests::test_scope_and_block ... ok
test tests::test_scope ... ok
test tests::scope_async ... ok

test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.10s
DimiDimit commented 3 years ago

Oh, I see!! It has to do with doc comments (notice the async_std::test, just test works fine):

#[macro_use]
macro_rules! testing {
    ($($item:item)*) => {
        $(
            #[cfg_attr(feature = "use-async-std", async_std::test)]
            $item
        )*
    }
}

testing! {
    // Normal comments work just fine.
    /// Doc comment? Nope, compilation error.
    async fn hello_world() {
        eprintln!("Hello world!")
    }
}

It just so happens that those particular tests had doc comments.

rmanoka commented 3 years ago

Oh interesting. You mean the above testing example compiles with test, but not async_std::test or tokio::test whenever there are doc comments? Possibly something to do with the specifics of how the two proc macros are implemented.

DimiDimit commented 3 years ago

Yes. I also tried trace_macros!(true) and the output was the same both for the old and new nightlies, so it seems it is indeed the proc macros.

rmanoka commented 3 years ago

Thanks for investigating this; we should either raise this issue in async_std or rust-lang/rust. Meanwhile, I'll update this crate with your suggested fix (using #[cfg(test)] for the mod tests) so that the crate at least builds with latest nightlies.

DimiDimit commented 3 years ago

I compiled rustc with debug = true, then ran with RUST_BACKTRACE=1 and here's the output:

Backtrace

``` Compiling async-scoped v0.6.0 (/tmp/async-scoped) thread 'rustc' panicked at 'internal error: entered unreachable code', compiler/rustc_expand/src/proc_macro_server.rs:193:20 stack backtrace: thread 'rustc' panicked at 'internal error: entered unreachable code', compiler/rustc_expand/src/proc_macro_server.rs:193:20 stack backtrace: 0: rust_begin_unwind at /tmp/rust/library/std/src/panicking.rs:493:5 1: core::panicking::panic_fmt at /tmp/rust/library/core/src/panicking.rs:92:14 2: core::panicking::panic at /tmp/rust/library/core/src/panicking.rs:50:5 3: as rustc_expand::proc_macro_server::FromInternal<((rustc_ast::tokenstream::TokenTree,rustc_ast::tokenstream::Spacing),&rustc_session::parse::ParseSess,&mut alloc::vec::Vec>)>>::from_internal at /tmp/rust/compiler/rustc_expand/src/proc_macro_server.rs:193:20 4: ::next::{{closure}} at /tmp/rust/compiler/rustc_expand/src/proc_macro_server.rs:449:22 5: core::option::Option::or_else at /tmp/rust/library/core/src/option.rs:784:21 6: ::next at /tmp/rust/compiler/rustc_expand/src/proc_macro_server.rs:447:24 0: rust_begin_unwind at /tmp/rust/library/std/src/panicking.rs:493:5 1: core::panicking::panic_fmt at /tmp/rust/library/core/src/panicking.rs:92:14 2: core::panicking::panic at /tmp/rust/library/core/src/panicking.rs:50:5 7: as proc_macro::bridge::server::TokenStreamIter>::next at /tmp/rust/library/proc_macro/src/bridge/server.rs:72:34 8: > as proc_macro::bridge::server::DispatcherTrait>::dispatch::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/server.rs:106:33 9: core::ops::function::FnOnce::call_once at /tmp/rust/library/core/src/ops/function.rs:227:5 10: as core::ops::function::FnOnce<()>>::call_once at /tmp/rust/library/std/src/panic.rs:322:9 3: as rustc_expand::proc_macro_server::FromInternal<((rustc_ast::tokenstream::TokenTree,rustc_ast::tokenstream::Spacing),&rustc_session::parse::ParseSess,&mut alloc::vec::Vec>)>>::from_internal at /tmp/rust/compiler/rustc_expand/src/proc_macro_server.rs:193:20 11: std::panicking::try::do_call at /tmp/rust/library/std/src/panicking.rs:379:40 12: std::panicking::try at /tmp/rust/library/std/src/panicking.rs:343:19 4: ::next::{{closure}} at /tmp/rust/compiler/rustc_expand/src/proc_macro_server.rs:449:22 5: core::option::Option::or_else at /tmp/rust/library/core/src/option.rs:784:21 6: ::next at /tmp/rust/compiler/rustc_expand/src/proc_macro_server.rs:447:24 7: as proc_macro::bridge::server::TokenStreamIter>::next at /tmp/rust/library/proc_macro/src/bridge/server.rs:72:34 8: > as proc_macro::bridge::server::DispatcherTrait>::dispatch::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/server.rs:106:33 9: core::ops::function::FnOnce::call_once at /tmp/rust/library/core/src/ops/function.rs:227:5 10: as core::ops::function::FnOnce<()>>::call_once at /tmp/rust/library/std/src/panic.rs:322:9 11: std::panicking::try::do_call at /tmp/rust/library/std/src/panicking.rs:379:40 12: std::panicking::try at /tmp/rust/library/std/src/panicking.rs:343:19 13: std::panic::catch_unwind at /tmp/rust/library/std/src/panic.rs:396:14 14: > as proc_macro::bridge::server::DispatcherTrait>::dispatch at /tmp/rust/library/proc_macro/src/bridge/server.rs:115:33 15: ::run_bridge_and_client::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/server.rs:153:32 16: as core::convert::From<&mut F>>::from::call at /tmp/rust/library/proc_macro/src/bridge/closure.rs:19:13 13: std::panic::catch_unwind at /tmp/rust/library/std/src/panic.rs:396:14 14: > as proc_macro::bridge::server::DispatcherTrait>::dispatch at /tmp/rust/library/proc_macro/src/bridge/server.rs:115:33 15: ::run_bridge_and_client::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/server.rs:153:32 16: as core::convert::From<&mut F>>::from::call at /tmp/rust/library/proc_macro/src/bridge/closure.rs:19:13 17: proc_macro::bridge::closure::Closure::call at /tmp/rust/library/proc_macro/src/bridge/closure.rs:27:18 18: proc_macro::bridge::client::TokenStreamIter::next::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:244:25 19: proc_macro::bridge::client::::with::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:336:47 20: proc_macro::bridge::client::BridgeState::with::{{closure}}::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:293:17 21: proc_macro::bridge::scoped_cell::ScopedCell::replace at /tmp/rust/library/proc_macro/src/bridge/scoped_cell.rs:75:9 17: proc_macro::bridge::closure::Closure::call at /tmp/rust/library/proc_macro/src/bridge/closure.rs:27:18 22: proc_macro::bridge::client::BridgeState::with::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:291:13 23: std::thread::local::LocalKey::try_with at /tmp/rust/library/std/src/thread/local.rs:272:16 24: std::thread::local::LocalKey::with at /tmp/rust/library/std/src/thread/local.rs:248:9 25: proc_macro::bridge::client::BridgeState::with at /tmp/rust/library/proc_macro/src/bridge/client.rs:290:9 26: proc_macro::bridge::client::::with at /tmp/rust/library/proc_macro/src/bridge/client.rs:329:9 27: proc_macro::bridge::client::TokenStreamIter::next at /tmp/rust/library/proc_macro/src/bridge/client.rs:237:17 28: ::next at /tmp/rust/library/proc_macro/src/lib.rs:240:13 29: ::next at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.24/src/wrapper.rs:304:46 18: proc_macro::bridge::client::TokenStreamIter::next::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:244:25 19: proc_macro::bridge::client::::with::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:336:47 20: proc_macro::bridge::client::BridgeState::with::{{closure}}::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:293:17 21: proc_macro::bridge::scoped_cell::ScopedCell::replace at /tmp/rust/library/proc_macro/src/bridge/scoped_cell.rs:75:9 30: ::next at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.24/src/lib.rs:1213:13 22: proc_macro::bridge::client::BridgeState::with::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:291:13 23: std::thread::local::LocalKey::try_with at /tmp/rust/library/std/src/thread/local.rs:272:16 24: std::thread::local::LocalKey::with at /tmp/rust/library/std/src/thread/local.rs:248:9 25: proc_macro::bridge::client::BridgeState::with at /tmp/rust/library/proc_macro/src/bridge/client.rs:290:9 26: proc_macro::bridge::client::::with at /tmp/rust/library/proc_macro/src/bridge/client.rs:329:9 27: proc_macro::bridge::client::TokenStreamIter::next at /tmp/rust/library/proc_macro/src/bridge/client.rs:237:17 28: ::next at /tmp/rust/library/proc_macro/src/lib.rs:240:13 29: ::next at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.24/src/wrapper.rs:304:46 30: ::next at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.24/src/lib.rs:1213:13 31: syn::buffer::TokenBuffer::inner_new at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.58/src/buffer.rs:53:19 32: syn::buffer::TokenBuffer::new2 at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.58/src/buffer.rs:112:9 33: ::parse2 at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.58/src/parse.rs:1207:19 34: syn::parse::Parser::parse at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.58/src/parse.rs:1161:9 35: syn::parse_macro_input::parse at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.58/src/parse_macro_input.rs:139:5 36: async_attributes::test at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/async-attributes-1.1.1/src/lib.rs:99:17 37: core::ops::function::FnOnce::call_once at /tmp/rust/library/core/src/ops/function.rs:227:5 31: syn::buffer::TokenBuffer::inner_new 38: proc_macro::bridge::client::Client proc_macro::TokenStream>::expand2::run::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:426:17 at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.58/src/buffer.rs:53:19 32: syn::buffer::TokenBuffer::new2 at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.58/src/buffer.rs:112:9 39: proc_macro::bridge::client::run_client::{{closure}}::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:377:26 40: proc_macro::bridge::scoped_cell::ScopedCell::set::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/scoped_cell.rs:80:33 41: proc_macro::bridge::scoped_cell::ScopedCell::replace at /tmp/rust/library/proc_macro/src/bridge/scoped_cell.rs:75:9 42: proc_macro::bridge::scoped_cell::ScopedCell::set at /tmp/rust/library/proc_macro/src/bridge/scoped_cell.rs:80:9 43: proc_macro::bridge::client::::enter::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:325:35 44: std::thread::local::LocalKey::try_with at /tmp/rust/library/std/src/thread/local.rs:272:16 45: std::thread::local::LocalKey::with at /tmp/rust/library/std/src/thread/local.rs:248:9 33: ::parse2 at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.58/src/parse.rs:1207:19 34: syn::parse::Parser::parse at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.58/src/parse.rs:1161:9 35: syn::parse_macro_input::parse at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.58/src/parse_macro_input.rs:139:5 46: proc_macro::bridge::client::::enter at /tmp/rust/library/proc_macro/src/bridge/client.rs:325:9 47: proc_macro::bridge::client::run_client::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:370:9 48: as core::ops::function::FnOnce<()>>::call_once at /tmp/rust/library/std/src/panic.rs:322:9 36: async_attributes::test at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/async-attributes-1.1.1/src/lib.rs:99:17 37: core::ops::function::FnOnce::call_once at /tmp/rust/library/core/src/ops/function.rs:227:5 38: proc_macro::bridge::client::Client proc_macro::TokenStream>::expand2::run::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:426:17 39: proc_macro::bridge::client::run_client::{{closure}}::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:377:26 49: std::panicking::try::do_call at /tmp/rust/library/std/src/panicking.rs:379:40 50: __rust_try 40: proc_macro::bridge::scoped_cell::ScopedCell::set::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/scoped_cell.rs:80:33 51: std::panicking::try at /tmp/rust/library/std/src/panicking.rs:343:19 52: std::panic::catch_unwind at /tmp/rust/library/std/src/panic.rs:396:14 41: proc_macro::bridge::scoped_cell::ScopedCell::replace at /tmp/rust/library/proc_macro/src/bridge/scoped_cell.rs:75:9 53: proc_macro::bridge::client::run_client at /tmp/rust/library/proc_macro/src/bridge/client.rs:369:5 42: proc_macro::bridge::scoped_cell::ScopedCell::set at /tmp/rust/library/proc_macro/src/bridge/scoped_cell.rs:80:9 54: proc_macro::bridge::client::Client proc_macro::TokenStream>::expand2::run at /tmp/rust/library/proc_macro/src/bridge/client.rs:425:13 43: proc_macro::bridge::client::::enter::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:325:35 55: ::run_bridge_and_client at /tmp/rust/library/proc_macro/src/bridge/server.rs:155:9 56: proc_macro::bridge::server::run_server at /tmp/rust/library/proc_macro/src/bridge/server.rs:291:9 44: std::thread::local::LocalKey::try_with at /tmp/rust/library/std/src/thread/local.rs:272:16 45: std::thread::local::LocalKey::with at /tmp/rust/library/std/src/thread/local.rs:248:9 57: proc_macro::bridge::server:: proc_macro::TokenStream>>::run at /tmp/rust/library/proc_macro/src/bridge/server.rs:334:9 58: ::expand at /tmp/rust/compiler/rustc_expand/src/proc_macro.rs:53:9 46: proc_macro::bridge::client::::enter at /tmp/rust/library/proc_macro/src/bridge/client.rs:325:9 47: proc_macro::bridge::client::run_client::{{closure}} at /tmp/rust/library/proc_macro/src/bridge/client.rs:370:9 48: as core::ops::function::FnOnce<()>>::call_once at /tmp/rust/library/std/src/panic.rs:322:9 49: std::panicking::try::do_call at /tmp/rust/library/std/src/panicking.rs:379:40 50: __rust_try 51: std::panicking::try at /tmp/rust/library/std/src/panicking.rs:343:19 52: std::panic::catch_unwind at /tmp/rust/library/std/src/panic.rs:396:14 59: rustc_expand::expand::MacroExpander::expand_invoc at /tmp/rust/compiler/rustc_expand/src/expand.rs:753:44 60: rustc_expand::expand::MacroExpander::fully_expand_fragment at /tmp/rust/compiler/rustc_expand/src/expand.rs:497:53 53: proc_macro::bridge::client::run_client at /tmp/rust/library/proc_macro/src/bridge/client.rs:369:5 54: proc_macro::bridge::client::Client proc_macro::TokenStream>::expand2::run at /tmp/rust/library/proc_macro/src/bridge/client.rs:425:13 55: ::run_bridge_and_client 61: rustc_expand::expand::MacroExpander::expand_crate at /tmp/rust/compiler/rustc_expand/src/expand.rs:390:15 at /tmp/rust/library/proc_macro/src/bridge/server.rs:155:9 56: proc_macro::bridge::server::run_server at /tmp/rust/library/proc_macro/src/bridge/server.rs:291:9 57: proc_macro::bridge::server:: proc_macro::TokenStream>>::run at /tmp/rust/library/proc_macro/src/bridge/server.rs:334:9 58: ::expand at /tmp/rust/compiler/rustc_expand/src/proc_macro.rs:53:9 62: rustc_interface::passes::configure_and_expand_inner::{{closure}}::{{closure}} at /tmp/rust/compiler/rustc_interface/src/passes.rs:302:50 63: rustc_data_structures::profiling::VerboseTimingGuard::run at /tmp/rust/compiler/rustc_data_structures/src/profiling.rs:570:9 64: rustc_session::utils::::time at /tmp/rust/compiler/rustc_session/src/utils.rs:9:9 65: rustc_interface::passes::configure_and_expand_inner::{{closure}} at /tmp/rust/compiler/rustc_interface/src/passes.rs:302:21 66: rustc_data_structures::profiling::VerboseTimingGuard::run at /tmp/rust/compiler/rustc_data_structures/src/profiling.rs:570:9 67: rustc_session::utils::::time at /tmp/rust/compiler/rustc_session/src/utils.rs:9:9 59: rustc_expand::expand::MacroExpander::expand_invoc at /tmp/rust/compiler/rustc_expand/src/expand.rs:753:44 60: rustc_expand::expand::MacroExpander::fully_expand_fragment 68: rustc_interface::passes::configure_and_expand_inner at /tmp/rust/compiler/rustc_expand/src/expand.rs:497:53 at /tmp/rust/compiler/rustc_interface/src/passes.rs:254:13 69: rustc_interface::passes::configure_and_expand::{{closure}} at /tmp/rust/compiler/rustc_interface/src/passes.rs:118:19 61: rustc_expand::expand::MacroExpander::expand_crate at /tmp/rust/compiler/rustc_expand/src/expand.rs:390:15 70: alloc::boxed:: for core::pin::Pin>>::resume at /tmp/rust/library/alloc/src/boxed.rs:1606:9 71: rustc_data_structures::box_region::PinnedGenerator::new at /tmp/rust/compiler/rustc_data_structures/src/box_region.rs:44:26 72: rustc_interface::passes::BoxedResolver::new at /tmp/rust/compiler/rustc_data_structures/src/box_region.rs:101:41 73: rustc_interface::passes::configure_and_expand at /tmp/rust/compiler/rustc_interface/src/passes.rs:114:30 62: rustc_interface::passes::configure_and_expand_inner::{{closure}}::{{closure}} at /tmp/rust/compiler/rustc_interface/src/passes.rs:302:50 63: rustc_data_structures::profiling::VerboseTimingGuard::run at /tmp/rust/compiler/rustc_data_structures/src/profiling.rs:570:9 64: rustc_session::utils::::time at /tmp/rust/compiler/rustc_session/src/utils.rs:9:9 65: rustc_interface::passes::configure_and_expand_inner::{{closure}} at /tmp/rust/compiler/rustc_interface/src/passes.rs:302:21 66: rustc_data_structures::profiling::VerboseTimingGuard::run at /tmp/rust/compiler/rustc_data_structures/src/profiling.rs:570:9 67: rustc_session::utils::::time at /tmp/rust/compiler/rustc_session/src/utils.rs:9:9 74: rustc_interface::queries::Queries::expansion::{{closure}} at /tmp/rust/compiler/rustc_interface/src/queries.rs:180:13 75: rustc_interface::queries::Query::compute at /tmp/rust/compiler/rustc_interface/src/queries.rs:39:28 76: rustc_interface::queries::Queries::expansion at /tmp/rust/compiler/rustc_interface/src/queries.rs:176:9 68: rustc_interface::passes::configure_and_expand_inner at /tmp/rust/compiler/rustc_interface/src/passes.rs:254:13 69: rustc_interface::passes::configure_and_expand::{{closure}} at /tmp/rust/compiler/rustc_interface/src/passes.rs:118:19 70: alloc::boxed:: for core::pin::Pin>>::resume at /tmp/rust/library/alloc/src/boxed.rs:1606:9 71: rustc_data_structures::box_region::PinnedGenerator::new at /tmp/rust/compiler/rustc_data_structures/src/box_region.rs:44:26 77: rustc_driver::run_compiler::{{closure}}::{{closure}} at /tmp/rust/compiler/rustc_driver/src/lib.rs:393:13 78: rustc_interface::queries::::enter at /tmp/rust/compiler/rustc_interface/src/queries.rs:418:19 72: rustc_interface::passes::BoxedResolver::new at /tmp/rust/compiler/rustc_data_structures/src/box_region.rs:101:41 79: rustc_driver::run_compiler::{{closure}} 73: rustc_interface::passes::configure_and_expand at /tmp/rust/compiler/rustc_driver/src/lib.rs:341:22 at /tmp/rust/compiler/rustc_interface/src/passes.rs:114:30 80: rustc_interface::interface::create_compiler_and_run::{{closure}} at /tmp/rust/compiler/rustc_interface/src/interface.rs:197:13 81: rustc_span::with_source_map at /tmp/rust/compiler/rustc_span/src/lib.rs:787:5 82: rustc_interface::interface::create_compiler_and_run at /tmp/rust/compiler/rustc_interface/src/interface.rs:191:5 83: rustc_interface::interface::run_compiler::{{closure}} at /tmp/rust/compiler/rustc_interface/src/interface.rs:213:12 84: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}::{{closure}} at /tmp/rust/compiler/rustc_interface/src/util.rs:152:13 85: scoped_tls::ScopedKey::set at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137:9 86: rustc_span::with_session_globals at /tmp/rust/compiler/rustc_span/src/lib.rs:103:5 87: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}} at /tmp/rust/compiler/rustc_interface/src/util.rs:150:9 88: rustc_interface::util::scoped_thread::{{closure}} at /tmp/rust/compiler/rustc_interface/src/util.rs:125:24 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. 74: rustc_interface::queries::Queries::expansion::{{closure}} at /tmp/rust/compiler/rustc_interface/src/queries.rs:180:13 75: rustc_interface::queries::Query::compute at /tmp/rust/compiler/rustc_interface/src/queries.rs:39:28 error: internal compiler error: unexpected panic note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md note: rustc 1.51.0-dev running on x86_64-unknown-linux-gnu note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C linker=/usr/bin/clang -C incremental -C link-arg=-fuse-ld=lld note: some of the compiler flags provided by cargo are hidden query stack during panic: 76: rustc_interface::queries::Queries::expansion end of query stack at /tmp/rust/compiler/rustc_interface/src/queries.rs:176:9 77: rustc_driver::run_compiler::{{closure}}::{{closure}} at /tmp/rust/compiler/rustc_driver/src/lib.rs:393:13 78: rustc_interface::queries::::enter at /tmp/rust/compiler/rustc_interface/src/queries.rs:418:19 79: rustc_driver::run_compiler::{{closure}} at /tmp/rust/compiler/rustc_driver/src/lib.rs:341:22 80: rustc_interface::interface::create_compiler_and_run::{{closure}} at /tmp/rust/compiler/rustc_interface/src/interface.rs:197:13 81: rustc_span::with_source_map at /tmp/rust/compiler/rustc_span/src/lib.rs:787:5 82: rustc_interface::interface::create_compiler_and_run at /tmp/rust/compiler/rustc_interface/src/interface.rs:191:5 error: custom attribute panicked --> src/tests.rs:5:13 | 5 | #[async_std::test] | ^^^^^^^^^^^^^^^^^^ ... 11 | / test_fixtures! { 12 | | /// Doc comment. 13 | | async fn test() { 14 | | eprintln!("Hello world!"); 15 | | } 16 | | } | |_- in this macro invocation | = help: message: internal error: entered unreachable code = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) 83: rustc_interface::interface::run_compiler::{{closure}} at /tmp/rust/compiler/rustc_interface/src/interface.rs:213:12 84: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}::{{closure}} at /tmp/rust/compiler/rustc_interface/src/util.rs:152:13 85: scoped_tls::ScopedKey::set at /home/dimitar/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137:9 86: rustc_span::with_session_globals at /tmp/rust/compiler/rustc_span/src/lib.rs:103:5 87: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}} at /tmp/rust/compiler/rustc_interface/src/util.rs:150:9 88: rustc_interface::util::scoped_thread::{{closure}} at /tmp/rust/compiler/rustc_interface/src/util.rs:125:24 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. error: internal compiler error: unexpected panic note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md note: rustc 1.51.0-dev running on x86_64-unknown-linux-gnu note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C linker=/usr/bin/clang -C incremental -C link-arg=-fuse-ld=lld --crate-type lib note: some of the compiler flags provided by cargo are hidden query stack during panic: end of query stack error: custom attribute panicked --> src/tests.rs:5:13 | 5 | #[async_std::test] | ^^^^^^^^^^^^^^^^^^ ... 11 | / test_fixtures! { 12 | | /// Doc comment. 13 | | async fn test() { 14 | | eprintln!("Hello world!"); 15 | | } 16 | | } | |_- in this macro invocation | = help: message: internal error: entered unreachable code = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error error: aborting due to previous error error: could not compile `async-scoped` To learn more, run the command again with --verbose. warning: build failed, waiting for other jobs to finish... error: build failed ```

In short, we end up in compiler/rustc_expand/src/proc_macro_server.rs:193:

    Eof => unreachable!(),

I also had a look at async_std::test, and it's trivial so we can rule async_std out completely. Judging by everything up until now as well as this:

note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

I think we can safely say it's an issue with rustc and submit it there. I'll do the honors.

DimiDimit commented 3 years ago

rust-lang/rust#81007

rmanoka commented 3 years ago

Looks like recent nightlies have fixed the ICE (verified on 22ddcd1a1 2021-01-22).

DimiDimit commented 3 years ago

I can confirm that it is indeed fixed after rust-lang/rust@11b1e37, and evened out my fork with upstream.