xref: /openbmc/linux/rust/alloc/README.md (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
1057b8d25SMiguel Ojeda# `alloc`
2057b8d25SMiguel Ojeda
3057b8d25SMiguel OjedaThese source files come from the Rust standard library, hosted in
4057b8d25SMiguel Ojedathe <https://github.com/rust-lang/rust> repository, licensed under
5057b8d25SMiguel Ojeda"Apache-2.0 OR MIT" and adapted for kernel use. For copyright details,
6057b8d25SMiguel Ojedasee <https://github.com/rust-lang/rust/blob/master/COPYRIGHT>.
7057b8d25SMiguel Ojeda
8057b8d25SMiguel OjedaPlease note that these files should be kept as close as possible to
9057b8d25SMiguel Ojedaupstream. In general, only additions should be performed (e.g. new
10057b8d25SMiguel Ojedamethods). Eventually, changes should make it into upstream so that,
11057b8d25SMiguel Ojedaat some point, this fork can be dropped from the kernel tree.
12057b8d25SMiguel Ojeda
13*f438c1ddSMiguel OjedaThe Rust upstream version on top of which these files are based matches
14*f438c1ddSMiguel Ojedathe output of `scripts/min-tool-version.sh rustc`.
15*f438c1ddSMiguel Ojeda
16057b8d25SMiguel Ojeda
17057b8d25SMiguel Ojeda## Rationale
18057b8d25SMiguel Ojeda
19057b8d25SMiguel OjedaOn one hand, kernel folks wanted to keep `alloc` in-tree to have more
20057b8d25SMiguel Ojedafreedom in both workflow and actual features if actually needed
21057b8d25SMiguel Ojeda(e.g. receiver types if we ended up using them), which is reasonable.
22057b8d25SMiguel Ojeda
23057b8d25SMiguel OjedaOn the other hand, Rust folks wanted to keep `alloc` as close as
24057b8d25SMiguel Ojedaupstream as possible and avoid as much divergence as possible, which
25057b8d25SMiguel Ojedais also reasonable.
26057b8d25SMiguel Ojeda
27057b8d25SMiguel OjedaWe agreed on a middle-ground: we would keep a subset of `alloc`
28057b8d25SMiguel Ojedain-tree that would be as small and as close as possible to upstream.
29057b8d25SMiguel OjedaThen, upstream can start adding the functions that we add to `alloc`
30057b8d25SMiguel Ojedaetc., until we reach a point where the kernel already knows exactly
31057b8d25SMiguel Ojedawhat it needs in `alloc` and all the new methods are merged into
32057b8d25SMiguel Ojedaupstream, so that we can drop `alloc` from the kernel tree and go back
33057b8d25SMiguel Ojedato using the upstream one.
34057b8d25SMiguel Ojeda
35057b8d25SMiguel OjedaBy doing this, the kernel can go a bit faster now, and Rust can
36057b8d25SMiguel Ojedaslowly incorporate and discuss the changes as needed.
37