Skip to content

Commit 1fc6fee

Browse files
committed
disable get_disjoint_mut for rust versions below 1.51
1 parent e2098d5 commit 1fc6fee

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

build.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
fn main() {
22
println!("cargo:rerun-if-changed=build.rs");
3-
println!("cargo:rustc-check-cfg=cfg(slab_no_const_vec_new,slab_no_track_caller)");
3+
println!(
4+
"cargo:rustc-check-cfg=cfg(slab_no_const_vec_new,slab_no_track_caller,slab_no_const_generics)"
5+
);
46

57
let cfg = match autocfg::AutoCfg::new() {
68
Ok(cfg) => cfg,
@@ -24,4 +26,7 @@ fn main() {
2426
if !cfg.probe_rustc_version(1, 46) {
2527
println!("cargo:rustc-cfg=slab_no_track_caller");
2628
}
29+
if !cfg.probe_rustc_version(1, 51) {
30+
println!("cargo:rustc-cfg=slab_no_const_generics");
31+
}
2732
}

src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,7 @@ impl<T> Slab<T> {
810810
/// Returns mutable references to many indices at once.
811811
/// Returns [`GetDisjointMutError`] if the indices are out of bounds,
812812
/// overlapping, or vacant.
813+
#[cfg(not(slab_no_const_generics))]
813814
pub fn get_disjoint_mut<const N: usize>(
814815
&mut self,
815816
keys: [usize; N],

tests/slab.rs

+1
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,7 @@ fn clone_from() {
735735
assert!(slab2.capacity() >= 10);
736736
}
737737

738+
#[rustversion::since(1.51)]
738739
#[test]
739740
fn get_disjoint_mut() {
740741
let mut slab = Slab::from_iter((0..5).enumerate());

0 commit comments

Comments
 (0)