162306a36Sopenharmony_ci# `alloc`
262306a36Sopenharmony_ci
362306a36Sopenharmony_ciThese source files come from the Rust standard library, hosted in
462306a36Sopenharmony_cithe <https://github.com/rust-lang/rust> repository, licensed under
562306a36Sopenharmony_ci"Apache-2.0 OR MIT" and adapted for kernel use. For copyright details,
662306a36Sopenharmony_cisee <https://github.com/rust-lang/rust/blob/master/COPYRIGHT>.
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciPlease note that these files should be kept as close as possible to
962306a36Sopenharmony_ciupstream. In general, only additions should be performed (e.g. new
1062306a36Sopenharmony_cimethods). Eventually, changes should make it into upstream so that,
1162306a36Sopenharmony_ciat some point, this fork can be dropped from the kernel tree.
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciThe Rust upstream version on top of which these files are based matches
1462306a36Sopenharmony_cithe output of `scripts/min-tool-version.sh rustc`.
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci## Rationale
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ciOn one hand, kernel folks wanted to keep `alloc` in-tree to have more
2062306a36Sopenharmony_cifreedom in both workflow and actual features if actually needed
2162306a36Sopenharmony_ci(e.g. receiver types if we ended up using them), which is reasonable.
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ciOn the other hand, Rust folks wanted to keep `alloc` as close as
2462306a36Sopenharmony_ciupstream as possible and avoid as much divergence as possible, which
2562306a36Sopenharmony_ciis also reasonable.
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ciWe agreed on a middle-ground: we would keep a subset of `alloc`
2862306a36Sopenharmony_ciin-tree that would be as small and as close as possible to upstream.
2962306a36Sopenharmony_ciThen, upstream can start adding the functions that we add to `alloc`
3062306a36Sopenharmony_cietc., until we reach a point where the kernel already knows exactly
3162306a36Sopenharmony_ciwhat it needs in `alloc` and all the new methods are merged into
3262306a36Sopenharmony_ciupstream, so that we can drop `alloc` from the kernel tree and go back
3362306a36Sopenharmony_cito using the upstream one.
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ciBy doing this, the kernel can go a bit faster now, and Rust can
3662306a36Sopenharmony_cislowly incorporate and discuss the changes as needed.
37