Revert const hacks and use const closures in std#155957
Revert const hacks and use const closures in std#155957oli-obk wants to merge 2 commits intorust-lang:mainfrom
Conversation
|
r? @jhpratt rustbot has assigned @jhpratt. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| /// Not currently planned to be exposed publicly, so just `pub(crate)`. | ||
| #[repr(transparent)] | ||
| pub(crate) struct NeverShortCircuit<T>(pub T); | ||
| // FIXME(const-hack): replace with `|a| NeverShortCircuit(f(a))` when const closures added. |
There was a problem hiding this comment.
Are these simply not needed any more?
There was a problem hiding this comment.
yeah, they were only for wrap_mut_1. but, i think the wrap_mut_1 function should still exist? it wasnt added as a const hack.
There was a problem hiding this comment.
hmm... I guess we could keep it and return a const closure from it, but is it really worth it?
There was a problem hiding this comment.
i mean i think so.. thats what was done pre const hack at least, and i dont think it was a bad design?
the fixme i wrote on the const-hack was intended to be put in wrap_mut_1
This comment has been minimized.
This comment has been minimized.
|
Does this fix #155781? |
|
I'm pretty sure it will |
| F: [const] FnMut(usize) -> T + [const] Destruct, | ||
| { | ||
| try_from_fn(NeverShortCircuit::wrap_mut_1(f)).0 | ||
| try_from_fn(const move |a| NeverShortCircuit(f(a))).0 |
There was a problem hiding this comment.
Yea, the Wrapped type was only used in these two cases
| debug_assert!(elem_layout.size() == elem_layout.pad_to_align().size()); | ||
|
|
||
| // FIXME(const-hack) return to using `map` and `map_err` once `const_closures` is implemented | ||
| match elem_layout.repeat_packed(cap) { |
There was a problem hiding this comment.
why isn't it repeat_packed?
There was a problem hiding this comment.
I think this was a very recent change and I messed up a rebase over it, fixed
911b6a6 to
9b213cb
Compare
9b213cb to
3b0794b
Compare
oh. yes! I ran into this issue but didn't realize there was an issue open for it |
This revealed some smaller bugs in stability checking that I fixed where needed:
Otherwise trivial reverts of the const hacks that were added
fixes #155781