Repository navigation
ICE: removal index (is 0) should be < len (is 0) / glacier fixed/81899.rs #88434
Description
Activity
- addedC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
on Aug 28, 2021 This one also crashes beta and stable release channel.
code from glacier fixed/81899.rs
Huh, why was this not detected earlier if it was tracked in glacier as fixed?
If you add a
'staticannotation to the trait bound onF, then it no longer ICEs. Here's the code:// build-pass // Regression test for issue 88434 const _CONST: &[u8] = &f(&[], |_| {}); const fn f<F>(_: &[u8], _: F) -> &[u8] where F: FnMut(&'static u8), { panic!() } fn main() {}Output:
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable --> src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs:6:12 | 6 | const fn f<F>(_: &[u8], _: F) -> &[u8] | ^ | = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0658]: panicking in constant functions is unstable --> src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs:10:5 | 10 | panic!() | ^^^^^^^^ | = note: see issue #51999 <https://github.com/rust-lang/rust/issues/51999> for more information = help: add `#![feature(const_panic)]` to the crate attributes to enable = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`.And if you add the two feature attributes the above messages ask you to enable, it still does not ICE, but correctly errors with "evaluation of constant value failed."
warning: function is never used: `f` --> src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs:8:10 | 8 | const fn f<F>(_: &[u8], _: F) -> &[u8] | ^ | = note: `#[warn(dead_code)]` on by default error[E0080]: evaluation of constant value failed --> src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs:12:5 | 6 | const _CONST: &[u8] = &f(&[], |_| {}); | -------------- inside `_CONST` at src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs:6:24 ... 12 | panic!() | ^^^^^^^^ | | | the evaluated program panicked at 'explicit panic', src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs:12:5 | inside `f::<[closure@src/test/ui/borrowck/issue-88434-removal-index-should-be-less.rs:6:31: 6:37]>` at /home/noble/Desktop/rust/library/std/src/panic.rs:18:9 | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0080`.Based on some debugging which I described here, I think this ICE has to do with the lifetime
'ain the boundF: for<'a> FnMut(&'a u8), although I'm not exactly sure how.I am new to the Rust compiler, and I just chose this issue because it seemed like a good first issue to work on, so I will read the Rustc development guide more (thanks to @camelid for sharing this) and try to further debug this.
@Noble-Mushtak If you plan to work on this issue, I recommend claiming it so other people know that and don't start working on it too. You can claim the issue by commenting with
@rustbot claim. More details about how to use rustbot are in the rustc-dev-guide.You may also want to read the "Getting Started" section of the guide.
Reacted by Noble Mushtak@rustbot claim
- addedglacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
on Sep 10, 2021
Code
code from glacier fixed/81899.rs
Meta
rustc --version --verbose:Error output
Backtrace