Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: hir: index out of bounds #3389

Closed
andyleiserson opened this issue Mar 18, 2024 · 1 comment · Fixed by rust-lang/rust#122719
Closed

ICE: hir: index out of bounds #3389

andyleiserson opened this issue Mar 18, 2024 · 1 comment · Fixed by rust-lang/rust#122719
Assignees

Comments

@andyleiserson
Copy link

andyleiserson commented Mar 18, 2024

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

@RalfJung
Copy link
Member

RalfJung commented Mar 18, 2024 via email

@oli-obk oli-obk self-assigned this Mar 19, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 19, 2024
Rollup merge of rust-lang#122719 - oli-obk:nested_static_feed_hir, r=fee1-dead

Ensure nested statics have a HIR node to prevent various queries from ICEing

fixes rust-lang/miri#3389
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants