2021-05-27 18:37:49 +00:00
|
|
|
// revisions: mir thir
|
|
|
|
// [thir]compile-flags: -Zthir-unsafeck
|
|
|
|
|
2017-11-05 18:04:18 +00:00
|
|
|
#[deny(unused_unsafe)]
|
|
|
|
fn main() {
|
|
|
|
let mut v = Vec::<i32>::with_capacity(24);
|
|
|
|
|
|
|
|
unsafe {
|
|
|
|
let f = |v: &mut Vec<_>| {
|
2017-11-20 12:13:27 +00:00
|
|
|
unsafe { //~ ERROR unnecessary `unsafe`
|
2017-11-05 18:04:18 +00:00
|
|
|
v.set_len(24);
|
2017-11-20 12:13:27 +00:00
|
|
|
|w: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe`
|
2017-11-05 18:04:18 +00:00
|
|
|
w.set_len(32);
|
|
|
|
} };
|
|
|
|
}
|
2017-11-20 12:13:27 +00:00
|
|
|
|x: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe`
|
2017-11-05 18:04:18 +00:00
|
|
|
x.set_len(40);
|
|
|
|
} };
|
|
|
|
};
|
|
|
|
|
|
|
|
v.set_len(0);
|
|
|
|
f(&mut v);
|
|
|
|
}
|
|
|
|
|
|
|
|
|y: &mut Vec<u32>| { unsafe {
|
|
|
|
y.set_len(48);
|
|
|
|
} };
|
|
|
|
}
|