Skip to content

ICE: hir: index out of bounds #3389

Closed
rust-lang/rust
#122719
@andyleiserson

Description

@andyleiserson

I suspect this is related to rust-lang/rust#122399.

I pushed a minimal test case to andyleiserson@4c9d9ac. I'm including the content of the test case below. But to get the issue to reproduce, I had to add it as a crate in test-cargo-miri -- adding it as a regular test was not sufficient. My original repro (from which I distilled this test case) was git clone -b v0.12.1 https://github.com/rustls/rcgen.git && cd rcgen && cargo +nightly miri test.

const OID_RSA_ENCRYPTION: &[u64] = &[1, 2, 840, 113549, 1, 1, 1];

pub struct SignatureAlgorithm {
    pub oids: &'static [&'static [u64]],
}

pub static PKCS_RSA_SHA256: SignatureAlgorithm = SignatureAlgorithm {
    // Does not repro with this constant inlined.
    oids: &[&OID_RSA_ENCRYPTION],
};

The observed behavior is an ICE (reported as stderr mismatch when running run-test.py):

thread 'rustc' panicked at /rustc/a615cea3339046c7ab2d75cd253727d1fd42dd0b/compiler/rustc_middle/src/hir/mod.rs:157:84:
index out of bounds: the len is 7 but the index is 7

The ICE also includes the following context:

query stack during panic:
#0 [local_def_id_to_hir_id] getting HIR ID of `PKCS_RSA_SHA256::{constant#0}`
#1 [exported_symbols] collecting exported symbols for crate `0`
end of query stack

rustc-ice-2024-03-18T21_21_30-94784.txt

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions