Skip to content

add support for #[global_allocator] #1885

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

Merged
merged 1 commit into from
Sep 30, 2021

Conversation

beepster4096
Copy link
Contributor

This PR adds support for custom global allocators. Unfortunately, the code given in #1207 still causes errors when used with box. I believe this is because Box is special-cased in miri and stacked borrows.

@oli-obk
Copy link
Contributor

oli-obk commented Sep 16, 2021

Unfortunately, the code given in #1207 still causes errors when used with box

What is the difference between your test and the code in the issue that causes the failure? What kind of failure are we talking about? A stacked borrows failure?

@RalfJung
Copy link
Member

Yeah, Box is a magic type. But I think the problem might be a different one -- that example code uses the "header before object base address" pattern, which simply does not work in Stacked Borrows (rust-lang/unsafe-code-guidelines#256). So this has little to do with Box.

@beepster4096
Copy link
Contributor Author

beepster4096 commented Sep 28, 2021

Right, rustfmt refuses to work correctly on shims/foreign_items.rs. I'll remove the whitespace causing the format check to internal error, but we should find some workaround to make rustfmt work. (or fix rustfmt itself)

@RalfJung
Copy link
Member

rustfmt refuses to work correctly on shims/foreign_items.rs

Interesting, I did not know this. Yeah might be good to report that with rustfmt.

@RalfJung
Copy link
Member

This looks great. :) Could you squash the commits a bit?

@beepster4096
Copy link
Contributor Author

I squashed the commits up.

@RalfJung
Copy link
Member

Awesome, thanks a lot. :)

@bors r+

@bors
Copy link
Contributor

bors commented Sep 30, 2021

📌 Commit e6a27a6 has been approved by RalfJung

@bors
Copy link
Contributor

bors commented Sep 30, 2021

⌛ Testing commit e6a27a6 with merge adc26a3...

@bors
Copy link
Contributor

bors commented Sep 30, 2021

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing adc26a3 to master...

@bors bors merged commit adc26a3 into rust-lang:master Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants