diff --git a/build.rs b/build.rs index 9f9fa054..7c5b6d5e 100644 --- a/build.rs +++ b/build.rs @@ -4,5 +4,6 @@ fn main() { Some(_) => autocfg::emit("has_std"), None => autocfg::new().emit_sysroot_crate("std"), } + autocfg::new().emit_rustc_version(1, 51); autocfg::rerun_path("build.rs"); } diff --git a/src/map.rs b/src/map.rs index 5505476c..7ea14924 100644 --- a/src/map.rs +++ b/src/map.rs @@ -1340,7 +1340,7 @@ where } } -#[cfg(has_std)] +#[cfg(all(has_std, rustc_1_51))] impl From<[(K, V); N]> for IndexMap where K: Hash + Eq, @@ -1855,6 +1855,7 @@ mod tests { } #[test] + #[cfg(all(has_std, rustc_1_51))] fn from_array() { let map = IndexMap::from([(1, 2), (3, 4)]); let mut expected = IndexMap::new(); diff --git a/src/set.rs b/src/set.rs index 960fa24e..36a34478 100644 --- a/src/set.rs +++ b/src/set.rs @@ -838,7 +838,7 @@ where } } -#[cfg(has_std)] +#[cfg(all(has_std, rustc_1_51))] impl From<[T; N]> for IndexSet where T: Eq + Hash, @@ -1726,6 +1726,7 @@ mod tests { } #[test] + #[cfg(all(has_std, rustc_1_51))] fn from_array() { let set1 = IndexSet::from([1, 2, 3, 4]); let set2: IndexSet<_> = [1, 2, 3, 4].into();