blob: 0987e7fe02822a1f343043e36ae7626dd8a0c732 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
//@ run-fail
//@ 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);
}
}
|