Closed

Description
This code looks meaningless, but it's still valid code. However it can cause cargo
to panic.
// This file is: main.rs
fn main() {
let mut bytes = vec![];
bytes.append(&mut include_bytes!("main.rs").to_vec());
println!("Byte count: {}", bytes.len());
}
First build is ok. Then call shell touch main.rs
and build again, cargo
will crash with:
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 1',
/checkout/src/libcore/slice/mod.rs:2079:10
Version: cargo 1.28.0 (96a2c7d16 2018-07-13)