You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running cargo check does not detect "index out of bounds" error in the following code:
fnmain(){let a:[i32;5] = [1,2,3,4,5];let element = a[9999];println!("{}", element);}
I expected to see this happen:
Same output that the cargo build returns:
error: this operation will panic at runtime
--> src/main.rs:3:19
|
3 |let element = a[9999];| ^^^^^^^ index out of bounds: the length is 5 but the index is 9999
|
Instead, this happened:
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
Running cargo check --release also returns a positive result:
This is expected behaviour, cc #81224. Checking for unconditional panics requires running some of the MIR opt pipeline, which would slow down cargo check
Running
cargo check
does not detect "index out of bounds" error in the following code:I expected to see this happen:
Same output that the
cargo build
returns:Instead, this happened:
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
Running
cargo check --release
also returns a positive result:Finished release [optimized] target(s) in 0.00s
Meta
rustc --version --verbose
:cargo --version --verbose
:The text was updated successfully, but these errors were encountered: