mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
982b49494e
This is to make the diff when stabilizing it easier to review.
26 lines
610 B
Rust
26 lines
610 B
Rust
#[deny(unused_unsafe)]
|
|
fn main() {
|
|
let mut v = Vec::<i32>::with_capacity(24);
|
|
|
|
unsafe {
|
|
let f = |v: &mut Vec<_>| {
|
|
unsafe { //~ ERROR unnecessary `unsafe`
|
|
v.set_len(24);
|
|
|w: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe`
|
|
w.set_len(32);
|
|
} };
|
|
}
|
|
|x: &mut Vec<u32>| { unsafe { //~ ERROR unnecessary `unsafe`
|
|
x.set_len(40);
|
|
} };
|
|
};
|
|
|
|
v.set_len(0);
|
|
f(&mut v);
|
|
}
|
|
|
|
|y: &mut Vec<u32>| { unsafe {
|
|
y.set_len(48);
|
|
} };
|
|
}
|