-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reimplement the most important structs and traits for testing #19
Conversation
There's an independent, but stable-only, version of this in https://crates.io/crates/allocator_api |
Yeah I think it's better to keep the code separate from the wg repo. |
@Ericson2314 Why? |
@glandium I'm aware of your crate, but as you mentioned it's for the stable toolchain and
@Ericson2314 I don't think we should split up code and discussions. With the code in this repo, it's possible to make PRs, discuss them, and merge the change if we want to keep those. |
Currently, this includes `Alloc`, `AllocErr`, `CannotRealocInPlace`, `Excess`, `Layout`, `LayoutErr`, `Global` and `Box`. Additionally, the following functions are adjusted to work with our `Layout`: `alloc`, `alloc_zeroed`, `dealloc`, `realloc`, and `handle_alloc_error`. However, a few things had to be adjusted to match the `alloc` crate as soon as possible: - the `Drop` trait of `Box` calls `box_free` directly. - for `Fn`, `FnOnce`, `FnMut`, and `FnBox` `F` has to implement `Copy`
Another thing for discussion:
|
If something has enough consensus to be merged here (and approval of the libs team), why wouldn't we want to perform the change in rust-lang/rust instead ? |
Playing around with |
So I don't know if this would be very useful. At best, this allows us to say: "hey, this change seems ok, for this thing that's not liballoc", which given how thorny allocators are, doesn't really need to translate to the real world in any meaningful way. I would be on board with properly forking rust-lang/rust/src/liballoc for the purpose of experimentation somewhere, with its tests, benchmarks, and ideally, also implementations of the That would allow us to not only see how the changes proposed as PR impact not only some parts of liballoc, but all of liballoc, its users, run the tests, run the benchmarks, etc. to be able to have some hard data about their impact. Whether we do this in this repo, or in a different one (e.g. rust-lang/wg-allocators-liballoc), I don't think matters much. |
@SimonSapin so we can merge upstream into the code and make PRs from the code. All the things @gnzlbg said. |
Why this is not possible with this repository? For now we only use this repository for the issue tracker. |
If you merge this into master here as opposed to a separate branch, then when you go to merge back into the main repo it will pull in this readme and what-not? |
If we just fork rust-Lang/rust we could easily keep the repo in sync. For
our purposes we don’t have to build stage0, only the liballoc crate via
cargo using nightly rust, right?
|
In order to test features, it makes sense to me to reimplement the important parts from rust-lang/rust. After changes to the API were decided in the discussions/issues, the code base should reflect those changes and everyone is aware of the current state.
Currently, this includes
Alloc
,AllocErr
,CannotRealocInPlace
,Excess
,Layout
,LayoutErr
,Global
andBox
.Additionally, the following functions are adjusted to work with our
Layout
:alloc
,alloc_zeroed
,dealloc
,realloc
, andhandle_alloc_error
.However, a few things had to be adjusted to match the
alloc
crate as soon as possible:Drop
trait ofBox
callsbox_free
directly.Fn
,FnOnce
,FnMut
, andFnBox
F
has to implementCopy
I did not set up an CI, this is up to the repository owner 🙂