In https://github.com/rust-lang/rust/pull/157428/changes#r3620330696, @theemathas and I found that the Clone impl of Box is behind cfg(not(no_global_oom_handling)). This is weird, because Box is #[fundamental]. Downstream users can do this:
#![no_std]
use alloc::boxed::Box;
extern crate alloc;
#[derive(Clone)]
struct LocalType;
impl Clone for Box<LocalType> {
fn clone(&self) -> Self {
panic!("wat")
}
}
This successfully builds with RUSTFLAGS="--cfg no_global_oom_handling -Cpanic=abort" cargo +nightly build -Z build-std=core,alloc.
Fullish list of affected impls under the orphan rule (using #\[cfg\(.*\)\]\n(\s*#\[.*\]\n)*\s*impl):
Clone for Box<T, A>
FromIterator<T> for Rc<[T]>/Arc<[T]>/Vec<T>/Box<[T]>
From<Box<T, A>> for Rc<T, A>/Arc<T, A>
From<T> for Rc<T>/Arc<T>/Box<T>
Default for Box<T>
Default for Pin<Box<T>>
Extend<T> for Vec<T, A>
Extend<&'a T> for Vec<T, A>
Concat<T> for [T]
Join<&T> for [T]
From<E> for Box<dyn Error + 'a>
From<E> for Box<dyn Error + Send + Sync + 'a>
From<T> for ThinBox<T> (with thin_box feature)
ToString for T
In https://github.com/rust-lang/rust/pull/157428/changes#r3620330696, @theemathas and I found that the
Cloneimpl ofBoxis behindcfg(not(no_global_oom_handling)). This is weird, becauseBoxis#[fundamental]. Downstream users can do this:This successfully builds with
RUSTFLAGS="--cfg no_global_oom_handling -Cpanic=abort" cargo +nightly build -Z build-std=core,alloc.Fullish list of affected impls under the orphan rule (using
#\[cfg\(.*\)\]\n(\s*#\[.*\]\n)*\s*impl):Clone for Box<T, A>FromIterator<T> for Rc<[T]>/Arc<[T]>/Vec<T>/Box<[T]>From<Box<T, A>> for Rc<T, A>/Arc<T, A>From<T> for Rc<T>/Arc<T>/Box<T>Default for Box<T>Default for Pin<Box<T>>Extend<T> for Vec<T, A>Extend<&'a T> for Vec<T, A>Concat<T> for [T]Join<&T> for [T]From<E> for Box<dyn Error + 'a>From<E> for Box<dyn Error + Send + Sync + 'a>From<T> for ThinBox<T>(withthin_boxfeature)ToString for T