Repository: rust
Issue: unexpected panic in rustc
Labels: I-ICE,O-Arm,T-compiler,C-bug

<!--
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

There is no special code, I tried to compile libc 0.2.98 as a dependency.

### 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.53.0 (53cb7b09b 2021-06-17)
binary: rustc
commit-hash: 53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b
commit-date: 2021-06-17
host: armv7-unknown-linux-gnueabihf
release: 1.53.0
LLVM version: 12.0.1
```

As you can see i try to compile on a raspberry pi
```
cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Hardware        : BCM2835
Revision        : a020d3
Serial          : 000000008034e28d
Model           : Raspberry Pi 3 Model B Plus Rev 1.3
```

### Error output

```
   Compiling autocfg v1.0.1
   Compiling libc v0.2.98
   Compiling proc-macro2 v1.0.27
   Compiling unicode-xid v0.2.2
thread 'rustc' panicked at 'index out of bounds: the len is 18 but the index is 56', compiler
metadata/src/rmeta/decoder.rs:328:61
note: run with `RUST_BACKTRACE=1` environment variable to display a 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
+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.53.0 (53cb7b09b 2021-06-17) running on armv7-unknown-linux-gnueabihf

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
thread 'rustc' panicked at 'index out of bounds: the len is 18 but the index is 56', compiler
metadata/src/rmeta/decoder.rs:328:61
note: run with `RUST_BACKTRACE=1` environment variable to display a 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
+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.53.0 (53cb7b09b 2021-06-17) running on armv7-unknown-linux-gnueabihf

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `libc`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
thread 'rustc' panicked at 'index out of bounds: the len is 18 but the index is 56', compiler
metadata/src/rmeta/decoder.rs:328:61
note: run with `RUST_BACKTRACE=1` environment variable to display a 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
+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.53.0 (53cb7b09b 2021-06-17) running on armv7-unknown-linux-gnueabihf

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: build failed
```

<!--
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>

```
   Compiling autocfg v1.0.1
   Compiling libc v0.2.98
   Compiling proc-macro2 v1.0.27
   Compiling unicode-xid v0.2.2
thread 'rustc' panicked at 'index out of bounds: the len is 18 but the index is 56', compiler/rustc_metadata/src/rmeta/decoder.rs:328:61
stack backtrace:
thread 'rustc' panicked at 'index out of bounds: the len is 18 but the index is 56', compiler/rustc_metadata/src/rmeta/decoder.rs:328:61
stack backtrace:
thread 'rustc' panicked at 'index out of bounds: the len is 18 but the index is 56', compiler/rustc_metadata/src/rmeta/decoder.rs:328:61
stack backtrace:
error: could not compile `unicode-xid`

Caused by:
  process didn't exit successfully: `rustc --crate-name unicode_xid /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/unicode-xid-0.2.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' -C metadata=e095e5353733add3 -C extra-filename=-e095e5353733add3 --out-dir /home/pi/src/pms_home/target/debug/deps -L dependency=/home/pi/src/pms_home/target/debug/deps --cap-lints allow` (signal: 4, SIGILL: illegal instruction)
warning: build failed, waiting for other jobs to finish...
   0: rust_begin_unwind
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:493:5
   0: rust_begin_unwind
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:92:14
   2: core::panicking::panic_bounds_check
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:69:5
   0: rust_begin_unwind
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
   1: core::panicking::panic_fmt
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:92:14
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:92:14
   2: core::panicking::panic_bounds_check
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:69:5
   2: core::panicking::panic_bounds_check
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:69:5
   3: rustc_metadata::rmeta::decoder::<impl rustc_serialize::serialize::Decodable<rustc_metadata::rmeta::decoder::DecodeContext> for rustc_span::span_encoding::Span>::decode
   3: rustc_metadata::rmeta::decoder::<impl rustc_serialize::serialize::Decodable<rustc_metadata::rmeta::decoder::DecodeContext> for rustc_span::span_encoding::Span>::decode
   3: rustc_metadata::rmeta::decoder::<impl rustc_serialize::serialize::Decodable<rustc_metadata::rmeta::decoder::DecodeContext> for rustc_span::span_encoding::Span>::decode
   4: rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_metadata::creader::CStore>::get_span_untracked
   4: rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_metadata::creader::CStore>::get_span_untracked
   5: rustc_resolve::build_reduced_graph::<impl rustc_resolve::Resolver>::get_module
   6: <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast::visit::Visitor>::visit_item
   5: rustc_resolve::build_reduced_graph::<impl rustc_resolve::Resolver>::get_module
   6: <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast::visit::Visitor>::visit_item
   4: rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_metadata::creader::CStore>::get_span_untracked
   5: rustc_resolve::build_reduced_graph::<impl rustc_resolve::Resolver>::get_module
   6: <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast::visit::Visitor>::visit_item
   7: rustc_ast::visit::walk_item
   7: rustc_ast::visit::walk_item
   8: <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast::visit::Visitor>::visit_item
   8: <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast::visit::Visitor>::visit_item
   7: rustc_ast::visit::walk_item
   8: <rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast::visit::Visitor>::visit_item
   9: rustc_expand::expand::AstFragment::visit_with
   9: rustc_expand::expand::AstFragment::visit_with
   9: rustc_expand::expand::AstFragment::visit_with
  10: rustc_resolve::macros::<impl rustc_expand::base::ResolverExpand for rustc_resolve::Resolver>::visit_ast_fragment_with_placeholders
  10: rustc_resolve::macros::<impl rustc_expand::base::ResolverExpand for rustc_resolve::Resolver>::visit_ast_fragment_with_placeholders
  10: rustc_resolve::macros::<impl rustc_expand::base::ResolverExpand for rustc_resolve::Resolver>::visit_ast_fragment_with_placeholders
  11: rustc_expand::expand::MacroExpander::collect_invocations
  11: rustc_expand::expand::MacroExpander::collect_invocations
  11: rustc_expand::expand::MacroExpander::collect_invocations
  12: rustc_expand::expand::MacroExpander::fully_expand_fragment
  12: rustc_expand::expand::MacroExpander::fully_expand_fragment
  12: rustc_expand::expand::MacroExpander::fully_expand_fragment
  13: rustc_expand::expand::MacroExpander::expand_crate
  13: rustc_expand::expand::MacroExpander::expand_crate
  13: rustc_expand::expand::MacroExpander::expand_crate
  14: rustc_session::utils::<impl rustc_session::session::Session>::time
  14: rustc_session::utils::<impl rustc_session::session::Session>::time
  14: rustc_session::utils::<impl rustc_session::session::Session>::time
  15: rustc_interface::passes::configure_and_expand_inner
  15: rustc_interface::passes::configure_and_expand_inner
  15: rustc_interface::passes::configure_and_expand_inner
  16: rustc_interface::passes::configure_and_expand::{{closure}}
  16: rustc_interface::passes::configure_and_expand::{{closure}}
  16: rustc_interface::passes::configure_and_expand::{{closure}}
  17: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  17: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  17: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  18: rustc_interface::passes::configure_and_expand
  18: rustc_interface::passes::configure_and_expand
  19: rustc_interface::queries::Queries::expansion
  19: rustc_interface::queries::Queries::expansion
  18: rustc_interface::passes::configure_and_expand
  19: rustc_interface::queries::Queries::expansion
  20: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  20: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  20: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  21: rustc_span::with_source_map
  21: rustc_span::with_source_map
  21: rustc_span::with_source_map
  22: rustc_interface::interface::create_compiler_and_run
  22: rustc_interface::interface::create_compiler_and_run
  22: rustc_interface::interface::create_compiler_and_run
  23: scoped_tls::ScopedKey<T>::set
  23: scoped_tls::ScopedKey<T>::set
  23: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.



error: internal compiler error: unexpected panic

error: internal compiler error: unexpected panic

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.53.0 (53cb7b09b 2021-06-17) running on armv7-unknown-linux-gnueabihf

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
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.53.0 (53cb7b09b 2021-06-17) running on armv7-unknown-linux-gnueabihf

note: the compiler unexpectedly panicked. this is a bug.
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 --crate-type lib


note: some of the compiler flags provided by cargo are hidden

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
query stack during panic:

note: rustc 1.53.0 (53cb7b09b 2021-06-17) running on armv7-unknown-linux-gnueabihf
end of query stack

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: build failed
```

</p>
</details>