Skip to content

Commit 1baa359

Browse files
authored
Merge pull request #586 from RalfJung/rustc_const_stable_indirect
mark const fn constructors as rustc_const_stable_indirect
2 parents e3311d9 + 855feb0 commit 1baa359

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
strict_provenance_lints
2525
)
2626
)]
27+
#![cfg_attr(feature = "rustc-dep-of-std", feature(rustc_attrs))]
2728
#![allow(
2829
clippy::doc_markdown,
2930
clippy::module_name_repetitions,
@@ -52,6 +53,7 @@ pub enum DefaultHashBuilder {}
5253
extern crate std;
5354

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

5759
#[cfg(feature = "nightly")]

src/map.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ impl<K, V, S> HashMap<K, V, S> {
453453
/// map.insert(1, 2);
454454
/// ```
455455
#[cfg_attr(feature = "inline-more", inline)]
456+
#[cfg_attr(feature = "rustc-dep-of-std", rustc_const_stable_indirect)]
456457
pub const fn with_hasher(hash_builder: S) -> Self {
457458
Self {
458459
hash_builder,
@@ -538,6 +539,7 @@ impl<K, V, S, A: Allocator> HashMap<K, V, S, A> {
538539
/// map.insert(1, 2);
539540
/// ```
540541
#[cfg_attr(feature = "inline-more", inline)]
542+
#[cfg_attr(feature = "rustc-dep-of-std", rustc_const_stable_indirect)]
541543
pub const fn with_hasher_in(hash_builder: S, alloc: A) -> Self {
542544
Self {
543545
hash_builder,

src/raw/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ impl<T> RawTable<T, Global> {
677677
/// leave the data pointer dangling since that bucket is never written to
678678
/// due to our load factor forcing us to always have at least 1 free bucket.
679679
#[inline]
680+
#[cfg_attr(feature = "rustc-dep-of-std", rustc_const_stable_indirect)]
680681
pub const fn new() -> Self {
681682
Self {
682683
table: RawTableInner::NEW,
@@ -702,6 +703,7 @@ impl<T, A: Allocator> RawTable<T, A> {
702703
/// leave the data pointer dangling since that bucket is never written to
703704
/// due to our load factor forcing us to always have at least 1 free bucket.
704705
#[inline]
706+
#[cfg_attr(feature = "rustc-dep-of-std", rustc_const_stable_indirect)]
705707
pub const fn new_in(alloc: A) -> Self {
706708
Self {
707709
table: RawTableInner::NEW,

src/set.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ impl<T, S> HashSet<T, S, Global> {
465465
/// set.insert(2);
466466
/// ```
467467
#[cfg_attr(feature = "inline-more", inline)]
468+
#[cfg_attr(feature = "rustc-dep-of-std", rustc_const_stable_indirect)]
468469
pub const fn with_hasher(hasher: S) -> Self {
469470
Self {
470471
map: HashMap::with_hasher(hasher),
@@ -552,6 +553,7 @@ where
552553
/// set.insert(2);
553554
/// ```
554555
#[cfg_attr(feature = "inline-more", inline)]
556+
#[cfg_attr(feature = "rustc-dep-of-std", rustc_const_stable_indirect)]
555557
pub const fn with_hasher_in(hasher: S, alloc: A) -> Self {
556558
Self {
557559
map: HashMap::with_hasher_in(hasher, alloc),

0 commit comments

Comments
 (0)