Skip to content

Commit 3333c7e

Browse files
committed
Auto merge of #147037 - matthiaskrgr:rollup-xtgqzuu, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang/rust#116882 (rustdoc: hide `#[repr]` if it isn't part of the public ABI) - rust-lang/rust#135771 ([rustdoc] Add support for associated items in "jump to def" feature) - rust-lang/rust#141032 (avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`) - rust-lang/rust#142401 (Add proper name mangling for pattern types) - rust-lang/rust#146293 (feat: non-panicking `Vec::try_remove`) - rust-lang/rust#146859 (BTreeMap: Don't leak allocators when initializing nodes) - rust-lang/rust#146924 (Add doc for `NonZero*` const creation) - rust-lang/rust#146933 (Make `render_example_with_highlighting` return an `impl fmt::Display`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 2fbe8a3 + 7f20479 commit 3333c7e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/pass/vec.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,15 @@ fn miri_issue_2759() {
169169
input.replace_range(0..0, "0");
170170
}
171171

172+
/// This was skirting the edge of UB, let's make sure it remains on the sound side.
173+
/// Context: <https://github.com/rust-lang/rust/pull/141032>.
174+
fn extract_if() {
175+
let mut v = vec![Box::new(0u64), Box::new(1u64)];
176+
for item in v.extract_if(.., |x| **x == 0) {
177+
drop(item);
178+
}
179+
}
180+
172181
fn main() {
173182
assert_eq!(vec_reallocate().len(), 5);
174183

@@ -199,4 +208,5 @@ fn main() {
199208
swap_remove();
200209
reverse();
201210
miri_issue_2759();
211+
extract_if();
202212
}

0 commit comments

Comments
 (0)