From c40d6530b95732913ee6c65185784f2ebe56d242 Mon Sep 17 00:00:00 2001 From: Jake Hughes Date: Thu, 31 Oct 2024 20:06:17 +0000 Subject: [PATCH] Enable finalizer elision for HashMap backing --- src/lib.rs | 3 +++ src/raw/mod.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index f03ddb6ad..796c55433 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,6 +9,7 @@ //! [here]: https://github.com/abseil/abseil-cpp/blob/master/absl/container/internal/raw_hash_set.h //! [CppCon talk]: https://www.youtube.com/watch?v=ncHmEUmJZf4 +#![feature(gc)] #![no_std] #![cfg_attr( feature = "nightly", @@ -44,8 +45,10 @@ extern crate std; #[cfg_attr(test, macro_use)] +#[allow(unused_extern_crates)] extern crate alloc; + #[cfg(feature = "nightly")] #[cfg(doctest)] doc_comment::doctest!("../README.md"); diff --git a/src/raw/mod.rs b/src/raw/mod.rs index c8e8e2912..94e78edc9 100644 --- a/src/raw/mod.rs +++ b/src/raw/mod.rs @@ -1,6 +1,7 @@ use crate::alloc::alloc::{handle_alloc_error, Layout}; use crate::scopeguard::{guard, ScopeGuard}; use crate::TryReserveError; +use core::gc::DropMethodFinalizerElidable; use core::iter::FusedIterator; use core::marker::PhantomData; use core::mem; @@ -3658,6 +3659,8 @@ impl Default for RawTable { } } +unsafe impl DropMethodFinalizerElidable for RawTable {} + #[cfg(feature = "nightly")] unsafe impl<#[may_dangle] T, A: Allocator> Drop for RawTable { #[cfg_attr(feature = "inline-more", inline)]