Skip to content

Commit 5d2ce52

Browse files
committed
Require rustc 1.51+ for IndexMap::from(array) and IndexSet::from(array)
rust-lang/rust#74878 and rust-lang/rust#65798 were both stabilized in 1.51.
1 parent f0159f6 commit 5d2ce52

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ fn main() {
44
Some(_) => autocfg::emit("has_std"),
55
None => autocfg::new().emit_sysroot_crate("std"),
66
}
7+
autocfg::new().emit_rustc_version(1, 51);
78
autocfg::rerun_path("build.rs");
89
}

src/map.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ where
13451345
}
13461346
}
13471347

1348-
#[cfg(has_std)]
1348+
#[cfg(all(has_std, rustc_1_51))]
13491349
impl<K, V, const N: usize> From<[(K, V); N]> for IndexMap<K, V, RandomState>
13501350
where
13511351
K: Hash + Eq,
@@ -1860,6 +1860,7 @@ mod tests {
18601860
}
18611861

18621862
#[test]
1863+
#[cfg(all(has_std, rustc_1_51))]
18631864
fn from_array() {
18641865
let map = IndexMap::from([(1, 2), (3, 4)]);
18651866
let mut expected = IndexMap::new();

src/set.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ where
843843
}
844844
}
845845

846-
#[cfg(has_std)]
846+
#[cfg(all(has_std, rustc_1_51))]
847847
impl<T, const N: usize> From<[T; N]> for IndexSet<T, RandomState>
848848
where
849849
T: Eq + Hash,
@@ -1731,6 +1731,7 @@ mod tests {
17311731
}
17321732

17331733
#[test]
1734+
#[cfg(all(has_std, rustc_1_51))]
17341735
fn from_array() {
17351736
let set1 = IndexSet::from([1, 2, 3, 4]);
17361737
let set2: IndexSet<_> = [1, 2, 3, 4].into();

0 commit comments

Comments
 (0)