This is a recently introduced ICE that appears with -Copt-level=3
using rustc 1.13.0-nightly (5531c31 2016-09-12)
rustc: /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/IR/Value.cpp:373: void llvm::Value::replaceAllUsesWith(llvm::Value*): Assertion `!contains(New, this) && "this->replaceAllUsesWith(expr(this)) is NOT valid!"' failed.
Shrunk test case below (original is in ndarray tests/dimension.rs). Use rustc -Copt-level=3 to reproduce.
fn main() {
remove_axis(&3, 0);
}
trait Dimension {
fn slice(&self) -> &[usize];
}
impl Dimension for () {
fn slice(&self) -> &[usize] { &[] }
}
impl Dimension for usize {
fn slice(&self) -> &[usize] {
unsafe {
::std::slice::from_raw_parts(self, 1)
}
}
}
fn remove_axis(value: &usize, axis: usize) -> () {
let tup = ();
let mut it = tup.slice().iter();
for (i, _) in value.slice().iter().enumerate() {
if i == axis {
continue;
}
it.next();
}
}
(Edits: Reduced test case further)
This is a recently introduced ICE that appears with -Copt-level=3
using rustc 1.13.0-nightly (5531c31 2016-09-12)
Shrunk test case below (original is in ndarray tests/dimension.rs). Use
rustc -Copt-level=3to reproduce.(Edits: Reduced test case further)