Conversation
FnBox is unlikely to be ever stabilized, as unsized_locals fixes Box<dyn FnOnce()> to work.
jebrosen
left a comment
There was a problem hiding this comment.
I was hesitant to make this change when it had just become possible, but it seems to have been around a while now and isn't going away. It also might be worth waiting for rust-lang/rust#55431 which should let us do this without needing #[feature(unsized_locals)] ourselves.
| fn on_attach(&self, rocket: Rocket) -> Result<Rocket, Rocket> { | ||
| if let AdHocKind::Attach(ref mutex) = self.kind { | ||
| let mut option = mutex.lock().expect("AdHoc::Attach lock"); | ||
| option.take() |
There was a problem hiding this comment.
The extra let binding should be unnecessary -- just replace the line .call_box((rocket,)) with (rocket).
There was a problem hiding this comment.
It is unnecessary, however it looks ugly when having a function call in a multi-line chain like this.
|
Also, from what I understand, the plan in rustc is to deprecate and remove |
|
@xfix Where is that happening? We should ideally ask for that to be postponed. |
|
The last I checked:
So I don't think this will happen too quickly and we can probably wait a bit longer. I think the only reason not to merge this would be that |
|
Even then, if |
|
With rust-lang/rust#59500 merged, this should be possible without the feature gate once the next nightly is released. That would require increasing the minimum rustc version, more so than this PR already does. |
|
Merged in 7ab1c42. |
FnBoxis unlikely to be ever stabilized, asunsized_localsfixesBox<dyn FnOnce()>to work.