Skip to content

Commit 7bec2c5

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 af2932f commit 7bec2c5

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

build.rs

+1
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

+2-1
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,7 @@ where
13401340
}
13411341
}
13421342

1343-
#[cfg(has_std)]
1343+
#[cfg(all(has_std, rustc_1_51))]
13441344
impl<K, V, const N: usize> From<[(K, V); N]> for IndexMap<K, V, RandomState>
13451345
where
13461346
K: Hash + Eq,
@@ -1855,6 +1855,7 @@ mod tests {
18551855
}
18561856

18571857
#[test]
1858+
#[cfg(all(has_std, rustc_1_51))]
18581859
fn from_array() {
18591860
let map = IndexMap::from([(1, 2), (3, 4)]);
18601861
let mut expected = IndexMap::new();

src/set.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ where
838838
}
839839
}
840840

841-
#[cfg(has_std)]
841+
#[cfg(all(has_std, rustc_1_51))]
842842
impl<T, const N: usize> From<[T; N]> for IndexSet<T, RandomState>
843843
where
844844
T: Eq + Hash,
@@ -1726,6 +1726,7 @@ mod tests {
17261726
}
17271727

17281728
#[test]
1729+
#[cfg(all(has_std, rustc_1_51))]
17291730
fn from_array() {
17301731
let set1 = IndexSet::from([1, 2, 3, 4]);
17311732
let set2: IndexSet<_> = [1, 2, 3, 4].into();

0 commit comments

Comments
 (0)