Skip to content
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

Roadmap #48

Open
5 of 18 tasks
TimDiekmann opened this issue Mar 12, 2020 · 16 comments
Open
5 of 18 tasks

Roadmap #48

TimDiekmann opened this issue Mar 12, 2020 · 16 comments

Comments

@TimDiekmann
Copy link
Member

TimDiekmann commented Mar 12, 2020

I would like to come to the listed issues in the more or less indicated order. Linked issues are not necessarily confirmed, please consult the issues for more details.

AllocRef:

Allocator aware types:

GlobalAlloc:

Documentation:

Other:

@TimDiekmann TimDiekmann added Tracking Issue A-Alloc Trait Issues regarding the Alloc trait labels Mar 12, 2020
@TimDiekmann TimDiekmann self-assigned this Mar 12, 2020
@TimDiekmann TimDiekmann pinned this issue Mar 12, 2020
@TimDiekmann
Copy link
Member Author

Updated OP.

@Wodann
Copy link

Wodann commented Apr 25, 2020

@TimDiekmann what are next steps? Are we waiting for potential feedback from users on our changes to the API before we proceed?

@TimDiekmann
Copy link
Member Author

I'm currently testing the API with alloc-compose. I also testing out, on how well taking &self is working. While most allocators could use &self instead of &mut self this has a major downside: Cell is !Sync, so using internal mutability for Sync allocators have to use atomics or other structs, which introduce more overhead. For the same reason, Bump from bumpalo is also !Sync.

@Amanieu
Copy link
Member

Amanieu commented Apr 25, 2020

I think those downside of &self are actually advantages, see #55.

@SimonSapin
Copy link
Contributor

SimonSapin commented Apr 26, 2020

  • deprecate GlobalAlloc

Actively emitting deprecation warnings causes churn. What benefit does this bring in exchange?

  • add #[doc(hidden)] to GlobalAlloc

GlobalAlloc is stable, so there will always be legacy code that uses it (even if with deprecating warnings). Hiding its docs would be confusing to future readers of such code, for what benefit? Compared to documenting that using AllocRef instead is preferred.

@TimDiekmann
Copy link
Member Author

Isn't that the point of deprecation warnings? Error::source was introduced in 1.30, Error::cause was deprecated in 1.33. I expect many more people to use the Error trait than the GlobalAlloc trait. Sure, we could also just leave GlobalAlloc alone 🙂

Hiding its docs would be confusing to future readers of such code

Fair point.

@Wodann
Copy link

Wodann commented Aug 5, 2020

@TimDiekmann Could you update the roadmap with recent changes and what's left for us to do?

Also, can we proceed with #7 now that unstable generic trait instantiations are supported?

@TimDiekmann TimDiekmann changed the title Roadmap for AllocRef Roadmap Aug 5, 2020
@TimDiekmann
Copy link
Member Author

Updated the roadmap.

Also, can we proceed with #7 now that unstable generic trait instantiations are supported?

rust-lang/rust#72314 is not merged yet as @varkor asked for a few more tests. I will open a new issue for each collection when it's merged.

@Wodann
Copy link

Wodann commented Aug 5, 2020

Thanks for cleaning up the roadmap and outstanding issues 👍

@TimDiekmann TimDiekmann added A-Meta and removed A-Alloc Trait Issues regarding the Alloc trait labels Aug 19, 2020
@TimDiekmann
Copy link
Member Author

@Wodann FYI: We have started to implement #7.

@berkus
Copy link

berkus commented Dec 7, 2020

Should AllocRef be renamed Allocator now or it's a different AllocRef?

@TimDiekmann
Copy link
Member Author

#76
rust-lang/rust#79286

@MarinPostma
Copy link

Hey I see that the last message in this issue is 3yo, what's the current status? Is there any way to get involved and help move the needle a bit?

@yanchith
Copy link

@MarinPostma If you use nightly, allocators are very much usable already (and have been since 2021-ish). I figure most people that need allocators already use them, and you can too.

You can make your own allocators and your own allocator-aware collections, and these days even most of alloc/std collections already work custom allocators (#7), with String being the notable holdout (there's a history of attempts to make it happen, current HEAD here rust-lang/rust#101551).

Regarding allocators on stable: if you look at issues in this repository, you'll see we are still a long way off. Personally, I'd want to have some kind of MVP stabilized sooner, possibly at the expense of completely resolving questions such as #15.

Regarding involvement: I don't know of any easy things that need doing. #7 was such a list, but fruit has been picked.

@wmmc88
Copy link

wmmc88 commented Mar 29, 2024

Regarding allocators on stable: if you look at issues in this repository, you'll see we are still a long way off.

As a stopgap, I've seen many people adopt the use of https://github.com/zakarumych/allocator-api2 to get these apis in stable. This includes larger crates like hashbrown

@jmillikin
Copy link

jmillikin commented May 22, 2024

In the spirit of seeking an MVP, is there anything blocking the stabilization of the "required" subset of core::alloc::Allocator?

For example, consider an Allocator with only two methods: allocate() and deallocate(). Are there any compatibility or stability concerns with stabilizing those two, and then leaving the optional methods for later?

pub unsafe trait Allocator {
    fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>;

    unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout);
}

The goal here would be to enable use of Allocator with third-party crates that do their own alloc management, e.g. for arenas or custom Box-like types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants