Uh oh!
There was an error while loading. Please reload this page.
Unsized rvalues: implement boxed closure impls. - #55431
Conversation
rust-highfive
commented
Oct 28, 2018
r? @frewsxcv (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
rust-highfive
commented
Oct 28, 2018
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
bjorn3
commented
Oct 28, 2018
@TimNN ^ not very helpful |
alexreg
commented
Nov 5, 2018
|
Mark-Simulacrum
commented
Nov 15, 2018
I've re-assigned this to @nikomatsakis since I think it'll probably want lang/compiler team discussion or review. |
XAMPPRocky
commented
Nov 25, 2018
Triage; @nikomatsakis Hello, have you been able to get back to this PR? |
CI fails with: |
Dylan-DPC-zz
commented
Dec 3, 2018
Pinging from triage @rust-lang/compiler can anyone review this? |
eddyb
commented
Dec 3, 2018
This is not really a compiler change. Maybe @rust-lang/lang + @rust-lang/libs? |
cramertj
commented
Dec 3, 2018
@eddyb I think it is compiler-relevant since one of the core questions in the PR description is how to make use of the new impls unstable:
This isn't possible today, and it's hard for me to understand how it could become possible: we'd have to somehow gate all coercions, where clauses, transitive uses (e.g. |
eddyb
commented
Dec 3, 2018
@cramertj I think that's a lang team discussion topic - that is, whether we should just stabilize now, given that feature-gating is hard (or even impossible). |
cramertj
commented
Dec 3, 2018
@rfcbot fcp merge This change introduces the following (insta-stable) trait impls: impl<A,F:FnOnce<A> + ?Sized>FnOnce<A>forBox<F>{ .. }impl<A,F:FnMut<A> + ?Sized>FnMut<A>forBox<F>{ .. }impl<A,F:Fn<A> + ?Sized>Fn<A>forBox<F>{ .. }Defining these impls requires the use of the However, we don't have the machinery (and possibly won't ever have the machinery) to make trait impls unstable. As such, merging this PR makes These implementations have been desired for a long time but have been impossible to add until now. I'm not sure of any other reasonable ways to implement them, or any ways that we might want to change the implementations going forward in a user-observable way. |
Team member @cramertj has proposed to merge this. The next step is review by the rest of the tagged team members:
Concerns:
Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
Centril
commented
Dec 3, 2018
Is there a particular reason to stabilize these impls now rather than to wait until |
alexreg
commented
Dec 3, 2018
@Centril The surface area is much smaller for these three impls, I guess, and they cover a large portion of the urgent demand for unsized locals at the same time. |
alexcrichton
commented
Dec 4, 2018
@rfcbot concern unimplementable-if-unsized-does-not-pan-out Historically we've avoiding expanding the stable API surface area of the standard library with unstable features. One of the best examples here is specialization where we've exclusively used it so far for performance improvements and we haven't started to use it for actually expanding trait impls yet. The rationale for this is that we can probably recover performance via other means if absolutely necessary if the unstable feature (specialization) doesn't pan out. Do we have a similar recourse for this? What if the unstable feature doesn't pan out? Are we confident enough that we can provide this implementation for all of time? |
cramertj
commented
Dec 4, 2018
@alexcrichton So I'd argue this is implementable even if the current unsized-rvalues-using-alloca proposal doesn't shake out-- we can still pass Compared with specialization, where exactly which implementations are allowed and when overlaps may occur is still open to soundness-related debate, the likelihood of the API surface needing to change here is far smaller. Basically the only thing that's being promised here is "there is some way to call |
cramertj
commented
Dec 4, 2018
|
alexcrichton
commented
Dec 4, 2018
@rfcbot resolve unimplementable-if-unsized-does-not-pan-out Sounds solid to me, thanks for the explanation! |
kennytm
commented
Feb 12, 2019
Sounds like #45417 |
cramertj
commented
Feb 12, 2019
@kennytm Sorry, I see you marked this as waiting-on-author-- is there something that needs to be changed here, or is CI just flaking? |
kennytm
commented
Feb 13, 2019
@cramertj the error is #55431 (comment) on the gnux32 target, and it doesn't look like an existing spurious error. Probably hit an LLVM bug. So this is waiting for the author (or anybody else) to debug why is this happening and how to fix/workaround it. |
qnighy
commented
Feb 17, 2019
Easily reproduced in my machine by setting |
Dylan-DPC-zz
commented
Feb 25, 2019
ping from triage @qnighy any updates? |
Dylan-DPC-zz
commented
Mar 11, 2019
ping frm triage @qnighy |
cramertj
commented
Mar 11, 2019
Procedurally it seems a bit odd to me to close a perfectly fine PR due to it being unmergable as a result of happening to trigger a suspected LLVM bug. To be clear, there's no requested change to the code in this PR-- only a change to LLVM to successfully compile it. |
Centril
commented
Mar 11, 2019
@cramertj This is entirely by the book:
Once the LLVM issues can be fixed the PR should be reopened. |
cramertj
commented
Mar 11, 2019
This sounds like we're asking the author for changes. There are no changes being requested here. |
Centril
commented
Mar 11, 2019
Or generally actions (e.g. "fix LLVM") that unblocks the PR. Perhaps this should be labeled as |
earthengine
commented
Mar 20, 2019
Are there any investigations have been done on LLVM? Can anyone find a workaround (maybe not optimal; we need it to be workable)? |
…mertj Unsized rvalues: implement boxed closure impls. (2nd try) This is a rebase of S-blocked-closed PR rust-lang#55431 to current master. LLVM has moved forward since then, so maybe we can check whether the new LLVM 8.0 version unblocked this work.
…mertj Unsized rvalues: implement boxed closure impls. (2nd try) This is a rebase of S-blocked-closed PR rust-lang#55431 to current master. LLVM has moved forward since then, so maybe we can check whether the new LLVM 8.0 version unblocked this work.
Unsized rvalues: implement boxed closure impls. (2nd try) This is a rebase of S-blocked-closed PR #55431 to current master. LLVM has moved forward since then, so maybe we can check whether the new LLVM 8.0 version unblocked this work.
alexreg
commented
Apr 10, 2019
Has this bug been reported to LLVM? Does anyone have a link? |
kennytm
commented
Apr 10, 2019
alexreg
commented
Apr 11, 2019
So, it looks like this PR has effectively been implemented and merged in #59500. Great! |
This pull request contains
boxed_closure_implsthat provides long-hoped three impls:This has been blocked by several reasons; see
FnBox#28796 for details.Now that #48055 is (partly) implemented, we're ready to introduce the above impls, replacing existing
FnBoxworkarounds.There are two major concerns, however.
Major concern 1: instability
I think these impls should be introduced as an unstable feature first, mainly because it relies on unsized rvalues. However,
implitself can't stand as unstable; all existing unstable features are tied with functions, methods, or types. I tried putting#[unstable]on the impls but that didn't work.I'll mark this PR as [WIP] until it is resolved. I'll just remove[WIP]and let the compiler team decide how to deal with the instability.Major concern 2: compatibility with
FnBoxI'm not really sure, but
FnBoxmay be widely used in the nightly world. Although unstable features may regress, it's good if there's a path for gradual migration. It can be done in the following way:FnBoxa subtrait ofFnOnce. This ensures thatdyn FnBoximplementsFnOnce.FnOnceimpls forBox<impl FnOnce>andBox<dyn FnBox>.I believe that this minimizes breakage of crates that use
FnBox.Minor concern: feature name and tracking issue
I currently assign
boxed_closure_implsas the name and #48055 as the tracking issue. I'll prepare a separate tracking issue when the Major Concern 1 is resolved.