pub fn foo(arr: &mut [i32], i: usize) -> String {
    arr[i] = 123; //~ possible index out of bounds
    let result = String::from("foo"); // allocate something that needs explicit cleanup
    let _e = arr[i]; // no warning here because we can't get here unless the assignment succeeded
    result
}
// A test that needs to do cleanup if an array access is out of bounds.
A test that needs to do cleanup if an array access is out of bounds.
A test that needs to do cleanup if an array access is out of bounds .
pub fn foo(arr: &mut [i32], i: usize) -> String {
    arr[i] = 123; //~ possible index out of bounds
    let result = String::from("foo"); // allocate something that needs explicit cleanup
    let _e = arr[i]; // no warning here because we can't get here unless the assignment succeeded
    result
}
pub fn foo ( arr : & mut [ i32 ] , i : usize ) -> String { arr [ i ] = 123 ; //~ possible index out of bounds let result = String :: from ( " " ) ; // allocate something that needs explicit cleanup let _e = arr [ i ] ; // no warning here because we can't get here unless the assignment succeeded result }
A test that needs to do cleanup if an array access is out of bounds.
A test that needs to do cleanup if an array access is out of bounds .
arr
&mut [i32]
i
usize
arr
&mut [i32]
i
usize