I'm referring to this particular line
|
_marker: PhantomData<crate::boxed::Box<(K, V)>>, |
Even though in no_std environments Global as a structure exists and is defined, and it only shows up in PhantomData, the use of the structure is most likely undefined if #[global_allocator] attribute is never used. Yes, there will be no calls to Global as it's only a phantom, and execution will not be affected, but just seems ill-defined at least.
For completeness: compilation of code that uses alloc::collection::BTreeMap with custom allocator under #![feature(btreemap_alloc)] is not affected, and there is no sign of runtime bugs.
I'm referring to this particular line
rust/library/alloc/src/collections/btree/map.rs
Line 183 in d3d145e
Even though in
no_stdenvironments Global as a structure exists and is defined, and it only shows up in PhantomData, the use of the structure is most likely undefined if#[global_allocator]attribute is never used. Yes, there will be no calls to Global as it's only a phantom, and execution will not be affected, but just seems ill-defined at least.For completeness: compilation of code that uses
alloc::collection::BTreeMapwith custom allocator under#![feature(btreemap_alloc)]is not affected, and there is no sign of runtime bugs.