Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mark const fn constructors as rustc_const_stable_indirect #586

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
strict_provenance_lints
)
)]
#![cfg_attr(feature = "rustc-dep-of-std", feature(rustc_attrs))]
#![allow(
clippy::doc_markdown,
clippy::module_name_repetitions,
Expand Down Expand Up @@ -52,6 +53,7 @@ pub enum DefaultHashBuilder {}
extern crate std;

#[cfg_attr(test, macro_use)]
#[cfg_attr(feature = "rustc-dep-of-std", allow(unused_extern_crates))]
extern crate alloc;

#[cfg(feature = "nightly")]
Expand Down
2 changes: 2 additions & 0 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// map.insert(1, 2);
/// ```
#[cfg_attr(feature = "inline-more", inline)]
#[cfg_attr(feature = "rustc-dep-of-std", rustc_const_stable_indirect)]
pub const fn with_hasher(hash_builder: S) -> Self {
Self {
hash_builder,
Expand Down Expand Up @@ -538,6 +539,7 @@ impl<K, V, S, A: Allocator> HashMap<K, V, S, A> {
/// map.insert(1, 2);
/// ```
#[cfg_attr(feature = "inline-more", inline)]
#[cfg_attr(feature = "rustc-dep-of-std", rustc_const_stable_indirect)]
pub const fn with_hasher_in(hash_builder: S, alloc: A) -> Self {
Self {
hash_builder,
Expand Down
2 changes: 2 additions & 0 deletions src/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ impl<T> RawTable<T, Global> {
/// leave the data pointer dangling since that bucket is never written to
/// due to our load factor forcing us to always have at least 1 free bucket.
#[inline]
#[cfg_attr(feature = "rustc-dep-of-std", rustc_const_stable_indirect)]
pub const fn new() -> Self {
Self {
table: RawTableInner::NEW,
Expand All @@ -702,6 +703,7 @@ impl<T, A: Allocator> RawTable<T, A> {
/// leave the data pointer dangling since that bucket is never written to
/// due to our load factor forcing us to always have at least 1 free bucket.
#[inline]
#[cfg_attr(feature = "rustc-dep-of-std", rustc_const_stable_indirect)]
pub const fn new_in(alloc: A) -> Self {
Self {
table: RawTableInner::NEW,
Expand Down
2 changes: 2 additions & 0 deletions src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ impl<T, S> HashSet<T, S, Global> {
/// set.insert(2);
/// ```
#[cfg_attr(feature = "inline-more", inline)]
#[cfg_attr(feature = "rustc-dep-of-std", rustc_const_stable_indirect)]
pub const fn with_hasher(hasher: S) -> Self {
Self {
map: HashMap::with_hasher(hasher),
Expand Down Expand Up @@ -552,6 +553,7 @@ where
/// set.insert(2);
/// ```
#[cfg_attr(feature = "inline-more", inline)]
#[cfg_attr(feature = "rustc-dep-of-std", rustc_const_stable_indirect)]
pub const fn with_hasher_in(hasher: S, alloc: A) -> Self {
Self {
map: HashMap::with_hasher_in(hasher, alloc),
Expand Down
Loading