-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Future-proof the compiler for Box<T, A>. #47043
Conversation
For the record, Work is https://github.com/QuiltOS/rust/tree/allocator-error and described at #32838 (comment) I'll kick off the rustc before I go to sleep, and test against my branch in the morning Thanks again @eddyb! |
@eddyb tested and everything indeed builds! I guess I should make a toy executable next? |
Added one more commit to allow changing |
@eddyb, with or without the functionality you specified (which I put in in #[unstable(feature = "asdfasdf", issue = "12345678")]
#[derive(Debug)]
pub struct FooAlloc(usize);
#[unstable(feature = "asdfasdf", issue = "12345678")]
unsafe impl ::allocator::Alloc for FooAlloc {
type Err = !;
unsafe fn alloc(&mut self, layout: ::allocator::Layout) -> Result<*mut u8, Self::Err> {
::abort_adapter::AbortAdapter(::heap::Heap).alloc(layout)
}
unsafe fn dealloc(&mut self, ptr: *mut u8, layout: ::allocator::Layout) {
::abort_adapter::AbortAdapter(::heap::Heap).dealloc(ptr, layout)
}
}
#[unstable(feature = "asdfasdf", issue = "12345678")]
pub fn foo(x: Box<String, FooAlloc>, y: bool) { if y { let _x = *x; } } I get, when compiled with the old
With the fixed |
@rust-lang/infra There's no way for this to get into beta, is there? |
@eddyb this can be backported like most other backports, right? |
@alexcrichton I'd think so. it works with the standard library as it exists today. |
To be clear, I mean get into the nightly and then make the cut into the next beta. Backporting it after the cut seems okay-ish, assuming it gets a proper review from @nikomatsakis or someone else. |
Hmm yeah the point would be to have it in beta for the sake of bootstrapping nightly, not to eventually get it into beta so that it makes stable but nightly needs to wait for the next beta. |
@bors r+ This is a big PR to backport, though, and not entirely trivial. |
📌 Commit 99bf699 has been approved by |
⌛ Testing commit 99bf699 with merge a48c0980b61fdac7ee026c9e34a7d47e1d6fafcd... |
💔 Test failed - status-appveyor |
The backtrace tests failed on
|
@alexcrichton IIRC, 32-bit x86 with MSVC uses a different unwinding scheme than GNU. |
Hm maybe? It's true that the unwinding scheme of i686 MSVC is totally unique to that target, and I believe the method we acquire backtraces with does indeed require debug info (but unwinding doesn't require deubginfo). I wouldn't know where to start looking unfortunately though. |
📌 Commit 0ee960f has been approved by |
⌛ Testing commit 0ee960f06f395b98520953546451ae82c15cb15b with merge 3dabf28fadecd61801897fcbbcdb482a57d810e9... |
💔 Test failed - status-appveyor |
@bors r=nikomatsakis (now with the LLVM pointer types for |
📌 Commit 5043534 has been approved by |
⌛ Testing commit 5043534 with merge 52ccf67a08c616959a3ff1fea81101a77a262acb... |
💔 Test failed - status-appveyor |
Oddly enough, with each try the backtraces get longer, but they're still mostly |
Ping from triage, @eddyb! Any luck figuring out the build issues? |
@shepmaster Nope, although I could try to take a fresh look and poke at it some more. |
☔ The latest upstream changes (presumably #47209) made this pull request unmergeable. Please resolve the merge conflicts. |
Triage ping for you @eddyb ! Looks like there are some merge conflicts for you too. |
Since this PR has been inactive for more than 2 weeks, I'm closing it to keep the queue clean. Feel free to reopen anytime once the build issues have been figured out. |
Partial future-proofing for Box<T, A> In some ways, this is similar to @eddyb's PR #47043 that went stale, but doesn't cover everything. Notably, this still leaves Box internalized as a pointer in places, so practically speaking, only ZSTs can be practically added to the Box type with the changes here (the compiler ICEs otherwise). The Box type is not changed here, that's left for the future because I want to test that further first, but this puts things in place in a way that hopefully will make things easier.
@Ericson2314 is playing around with
Box<T, A = Heap>
and there is still some special-casing in the compiler aroundBox
, some of which is removed by this PR.Ideally we can merge this before the beta cutoff to avoid needing a
cfg(stage0)
copy ofBox
.r? @alexcrichton