Skip to content

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

@DimiDimit

Description

@DimiDimit

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@6184f23, 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions