So, I recently completed a major refactoring of my application. Now while trying to compile, I'm getting an ICE: issue #27602 (thread 'rustc' panicked at 'assertion failed: index.end <= self.len()', ../src/libcore/slice.rs:544)
(Link omitted since the forum software informs me that "Sorry, new users can only put 2 links in a post" even though I only had one link.)
What I'm looking for is some guidance on figuring out exactly what I need to do to identify which part of my code is tickling the issue. I'm perfectly willing to implement a workaround, but I literally don't know where to start.
So, has anyone else been stuck on an ICE, and, if so, how did you go about getting unstuck?
(I'm willing to build and debug the compiler, but that's a time sink I would very much rather avoid.)
Well, the simplest way is to start compiling random subsets of your code and see if they still work.
One good way to do that is to comment out function bodies and replace them with a panic!("unimplemented!") or something, and otherwise hack up your project. I usually take a copy of my whole source tree before trying such madness.
An often quick way of finding the general areas of problems (in rustc) is to run with the RUST_BACKTRACE environment variable set - it should give you a stack-trace from inside rustc when it ICEs. (It's not always especially useful though.)
It shouldn't require recompiling rustc either - you can probably just do RUST_BACKTRACE=1 cargo build.
A few years ago, ICEs were much more common, especially since I wasn't writing good Rust code yet -- often ICEs happen from unusual or wrong code, so they went away after I stopped writing that