Auto merge of #104455 - the8472:dont-drain-on-drop, r=Amanieu
Don't drain-on-drop in DrainFilter impls of various collections. This removes drain-on-drop behavior from various unstable DrainFilter impls (not yet for HashSet/Map) because that behavior [is problematic](https://github.com/rust-lang/rust/issues/43244#issuecomment-641638196) (because it can lead to panic-in-drop when user closures panic) and may become forbidden if [this draft RFC passes](https://github.com/rust-lang/rfcs/pull/3288). closes #101122 [ACP](https://github.com/rust-lang/libs-team/issues/136) affected tracking issues * #43244 * #70530 * #59618 Related hashbrown update: https://github.com/rust-lang/hashbrown/pull/374
This commit is contained in:
commit
6ee4265ca6
43 changed files with 449 additions and 577 deletions
|
@ -2494,7 +2494,7 @@ fn show_candidates(
|
|||
for path_strings in [&mut accessible_path_strings, &mut inaccessible_path_strings] {
|
||||
path_strings.sort_by(|a, b| a.0.cmp(&b.0));
|
||||
let core_path_strings =
|
||||
path_strings.drain_filter(|p| p.0.starts_with("core::")).collect::<Vec<_>>();
|
||||
path_strings.extract_if(|p| p.0.starts_with("core::")).collect::<Vec<_>>();
|
||||
path_strings.extend(core_path_strings);
|
||||
path_strings.dedup_by(|a, b| a.0 == b.0);
|
||||
}
|
||||
|
|
|
@ -496,7 +496,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
|
|||
// Try to filter out intrinsics candidates, as long as we have
|
||||
// some other candidates to suggest.
|
||||
let intrinsic_candidates: Vec<_> = candidates
|
||||
.drain_filter(|sugg| {
|
||||
.extract_if(|sugg| {
|
||||
let path = path_names_to_string(&sugg.path);
|
||||
path.starts_with("core::intrinsics::") || path.starts_with("std::intrinsics::")
|
||||
})
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![feature(assert_matches)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(drain_filter)]
|
||||
#![feature(extract_if)]
|
||||
#![feature(if_let_guard)]
|
||||
#![feature(iter_intersperse)]
|
||||
#![feature(let_chains)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue