Change:
} #[test] <ins> #[allow(dead_code)] fn test_sync() { fn map<T: Sync>(v: &BTreeMap<T, T>) -> impl Sync + '_ { v } fn into_iter<T: Sync>(v: BTreeMap<T, T>) -> impl Sync { v.into_iter() } fn into_keys<T: Sync + Ord>(v: BTreeMap<T, T>) -> impl Sync { v.into_keys() } fn into_values<T: Sync + Ord>(v: BTreeMap<T, T>) -> impl Sync { v.into_values() } fn drain_filter<T: Sync + Ord>(v: &mut BTreeMap<T, T>) -> impl Sync + '_ { v.drain_filter(|_, _| false) } fn iter<T: Sync>(v: &BTreeMap<T, T>) -> impl Sync + '_ { v.iter() } fn iter_mut<T: Sync>(v: &mut BTreeMap<T, T>) -> impl Sync + '_ { v.iter_mut() } fn keys<T: Sync>(v: &BTreeMap<T, T>) -> impl Sync + '_ { v.keys() } fn values<T: Sync>(v: &BTreeMap<T, T>) -> impl Sync + '_ { v.values() } fn values_mut<T: Sync>(v: &mut BTreeMap<T, T>) -> impl Sync + '_ { v.values_mut() } fn range<T: Sync + Ord>(v: &BTreeMap<T, T>) -> impl Sync + '_ { v.range(..) } fn range_mut<T: Sync + Ord>(v: &mut BTreeMap<T, T>) -> impl Sync + '_ { v.range_mut(..) } fn entry<T: Sync + Ord + Default>(v: &mut BTreeMap<T, T>) -> impl Sync + '_ { v.entry(Default::default()) } fn occupied_entry<T: Sync + Ord + Default>(v: &mut BTreeMap<T, T>) -> impl Sync + '_ { match v.entry(Default::default()) { Occupied(entry) => entry, _ => unreachable!(), } } fn vacant_entry<T: Sync + Ord + Default>(v: &mut BTreeMap<T, T>) -> impl Sync + '_ { match v.entry(Default::default()) { Vacant(entry) => entry, _ => unreachable!(), } } } #[test] #[allow(dead_code)] fn test_send() { fn map<T: Send>(v: BTreeMap<T, T>) -> impl Send { v } fn into_iter<T: Send>(v: BTreeMap<T, T>) -> impl Send { v.into_iter() } fn into_keys<T: Send + Ord>(v: BTreeMap<T, T>) -> impl Send { v.into_keys() } fn into_values<T: Send + Ord>(v: BTreeMap<T, T>) -> impl Send { v.into_values() } fn drain_filter<T: Send + Ord>(v: &mut BTreeMap<T, T>) -> impl Send + '_ { v.drain_filter(|_, _| false) } fn iter<T: Send + Sync>(v: &BTreeMap<T, T>) -> impl Send + '_ { v.iter() } fn iter_mut<T: Send + Sync>(v: &mut BTreeMap<T, T>) -> impl Send + '_ { v.iter_mut() } fn keys<T: Send + Sync>(v: &BTreeMap<T, T>) -> impl Send + '_ { v.keys() } fn values<T: Send + Sync>(v: &BTreeMap<T, T>) -> impl Send + '_ { v.values() } fn values_mut<T: Send + Sync>(v: &mut BTreeMap<T, T>) -> impl Send + '_ { v.values_mut() } fn range<T: Send + Sync + Ord>(v: &BTreeMap<T, T>) -> impl Send + '_ { v.range(..) } fn range_mut<T: Send + Sync + Ord>(v: &mut BTreeMap<T, T>) -> impl Send + '_ { v.range_mut(..) } fn entry<T: Send + Ord + Default>(v: &mut BTreeMap<T, T>) -> impl Send + '_ { v.entry(Default::default()) } fn occupied_entry<T: Send + Ord + Default>(v: &mut BTreeMap<T, T>) -> impl Send + '_ { match v.entry(Default::default()) { Occupied(entry) => entry, _ => unreachable!(), } } fn vacant_entry<T: Send + Ord + Default>(v: &mut BTreeMap<T, T>) -> impl Send + '_ { match v.entry(Default::default()) { Vacant(entry) => entry, _ => unreachable!(), } } } #[test] </ins> fn test_occupied_entry_key() { let mut a = BTreeMap::new(); let key = "hello there";

Discussion:
The code below does not compile on new versions of (bisect below) searched nightlies: from nightly-2020-09-11 to nightly-2020-09-12 regressed nightly: nightly-2020-09-12 searched commits: from to regressed commit: <details<summarybisected with <a href=''cargo-bisect-rustc</av0.5.2</summaryHost triple: x86_64-unknown-linux-gnu Reproduce with: </details
cc
We probably just need to and likewise for Sync. Conceptually it's no different to a &mut T, so that should be reasonable.
can we assign the issue to you given that you've already provided a PR?
I'm going to self-assign, I don't expect to hit any roadblocks with the PR though, it's already bors-ready.