Repository: rust
Issue: futures caused signal: 4, SIGILL: illegal instruction when compiling
Labels: I-ICE,T-compiler,C-bug,E-needs-mcve

<!--
Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
how to create smaller examples.

http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/

-->

### Code

I'm new to rust and interestingly the base tokio example I was using worked - it went bad when I added the futures crate.

```
lsb_release --all

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye
```

```toml
[dependencies]
futures = "0.3.21"
tokio = { version = "1.20.1", features = ["full"] }
```

```Rust
use futures::Future;
use tokio::io::AsyncWrite;
use tokio::net::{TcpListener, TcpStream};

#[tokio::main]
async fn main() {
    // Bind the listener to the address
    let listener = TcpListener::bind("127.0.0.1:6379").await.unwrap();

    loop {
        // The second item contains the IP and port of the new connection.
        let (socket, addr) = listener.accept().await.unwrap();
        println!("{addr:?}");
        process(socket).await;
    }
}

async fn process(stream: TcpStream) {
    stream.poll_write(&[1]);
}

```


### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc 1.62.1 (e092d0b6b 2022-07-16)
binary: rustc
commit-hash: e092d0b6b43f2de967af0887873151bb1c0b18d3
commit-date: 2022-07-16
host: x86_64-unknown-linux-gnu
release: 1.62.1
LLVM version: 14.0.5
```

### Error output

```
   Compiling futures-util v0.3.21
   Compiling futures-executor v0.3.21
thread 'rustc' panicked at 'invalid enum variant tag while decoding `MacroKind`, expected 0..3', /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/compiler/rustc_span/src/hygiene.rs:1074:49
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
   2: <rustc_metadata::creader::CStore>::module_children_untracked
   3: <rustc_resolve::Resolver>::resolve_ident_in_module_unadjusted_ext
   4: <rustc_resolve::imports::ImportResolver>::resolve_import::{closure#0}
   5: <rustc_resolve::imports::ImportResolver>::resolve_imports
   6: <rustc_resolve::Resolver as rustc_expand::base::ResolverExpand>::resolve_imports
   7: <rustc_expand::expand::MacroExpander>::fully_expand_fragment
   8: <rustc_expand::expand::MacroExpander>::expand_crate
   9: <rustc_session::session::Session>::time::<core::result::Result<rustc_ast::ast::Crate, rustc_errors::ErrorGuaranteed>, rustc_interface::passes::configure_and_expand::{closure#1}>
  10: rustc_interface::passes::configure_and_expand
  11: <rustc_interface::queries::Queries>::expansion
  12: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
  13: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  14: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>
  15: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
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.62.1 (e092d0b6b 2022-07-16) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `futures-executor`

Caused by:
  process didn't exit successfully: `rustc --crate-name futures_executor --edition=2018 /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-executor-0.3.21/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="std"' -C metadata=83bf7af4b1ce906e -C extra-filename=-83bf7af4b1ce906e --out-dir /home/john/dev/rusty-mux/target/debug/deps -L dependency=/home/john/dev/rusty-mux/target/debug/deps --extern futures_core=/home/john/dev/rusty-mux/target/debug/deps/libfutures_core-3697e384c296492f.rmeta --extern futures_task=/home/john/dev/rusty-mux/target/debug/deps/libfutures_task-f2215787f05af5b7.rmeta --extern futures_util=/home/john/dev/rusty-mux/target/debug/deps/libfutures_util-d9b9f05e9258d23d.rmeta --cap-lints allow` (signal: 4, SIGILL: illegal instruction)
warning: build failed, waiting for other jobs to finish...
error: could not compile `futures-util`

Caused by:
  process didn't exit successfully: `rustc --crate-name futures_util --edition=2018 /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.21/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="alloc"' --cfg 'feature="async-await"' --cfg 'feature="async-await-macro"' --cfg 'feature="channel"' --cfg 'feature="futures-channel"' --cfg 'feature="futures-io"' --cfg 'feature="futures-macro"' --cfg 'feature="futures-sink"' --cfg 'feature="io"' --cfg 'feature="memchr"' --cfg 'feature="sink"' --cfg 'feature="slab"' --cfg 'feature="std"' -C metadata=d9b9f05e9258d23d -C extra-filename=-d9b9f05e9258d23d --out-dir /home/john/dev/rusty-mux/target/debug/deps -L dependency=/home/john/dev/rusty-mux/target/debug/deps --extern futures_channel=/home/john/dev/rusty-mux/target/debug/deps/libfutures_channel-a060315d12a53212.rmeta --extern futures_core=/home/john/dev/rusty-mux/target/debug/deps/libfutures_core-3697e384c296492f.rmeta --extern futures_io=/home/john/dev/rusty-mux/target/debug/deps/libfutures_io-a56bf77cdb051e94.rmeta --extern futures_macro=/home/john/dev/rusty-mux/target/debug/deps/libfutures_macro-1d4391f0d92a0e0e.so --extern futures_sink=/home/john/dev/rusty-mux/target/debug/deps/libfutures_sink-d2ea50ce21a72f9b.rmeta --extern futures_task=/home/john/dev/rusty-mux/target/debug/deps/libfutures_task-f2215787f05af5b7.rmeta --extern memchr=/home/john/dev/rusty-mux/target/debug/deps/libmemchr-8aa45ca67d010578.rmeta --extern pin_project_lite=/home/john/dev/rusty-mux/target/debug/deps/libpin_project_lite-977d67b6b8236fa4.rmeta --extern pin_utils=/home/john/dev/rusty-mux/target/debug/deps/libpin_utils-db6c123b47443cd5.rmeta --extern slab=/home/john/dev/rusty-mux/target/debug/deps/libslab-ac326b8cb7af0299.rmeta --cap-lints allow` (signal: 4, SIGILL: illegal instruction)
```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
   0: rust_begin_unwind
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
   2: <rustc_metadata::creader::CStore>::module_children_untracked
   3: <rustc_resolve::Resolver>::resolve_ident_in_module_unadjusted_ext
   4: <rustc_resolve::imports::ImportResolver>::resolve_import::{closure#0}
   5: <rustc_resolve::imports::ImportResolver>::resolve_imports
   6: <rustc_resolve::Resolver as rustc_expand::base::ResolverExpand>::resolve_imports
   7: <rustc_expand::expand::MacroExpander>::fully_expand_fragment
   8: <rustc_expand::expand::MacroExpander>::expand_crate
   9: <rustc_session::session::Session>::time::<core::result::Result<rustc_ast::ast::Crate, rustc_errors::ErrorGuaranteed>, rustc_interface::passes::configure_and_expand::{closure#1}>
  10: rustc_interface::passes::configure_and_expand
  11: <rustc_interface::queries::Queries>::expansion
  12: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
  13: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  14: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>
  15: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
```

</p>
</details>