blob: c6bdee7dc67e2744ed60086e21537d421ef04fbd (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
//@ run-crash
//@ compile-flags: -Cdebug-assertions=yes
//@ error-pattern: unsafe precondition(s) violated: Vec::set_len requires that new_len <= capacity()
fn main() {
let mut vec: Vec<i32> = Vec::with_capacity(5);
// Test set_len with length > capacity
unsafe {
vec.set_len(10);
}
}
|