Repository navigation
core::mem::swap used to work, then broke (and later accidentally got unbroken again). #804
Description
Activity
- changed the title
[-]Fails to compile `come::mem::swap` that is scceeded previously[/-][+]Fails to compile `core::mem::swap` that is scceeded previously[/+]on Nov 21, 2021 In #716 we updated to a version that supports
mem::replaceagain, thanks to rust-lang/rust#87827, butmem::swapindeed did not get fixed the same way - if someone wants to try and land upstream something like that PR but formem::swap, feel free to.I gave up on it because of how rare
mem::swapis compared tomem::replace(which gets used everywhere incore, e.g.Option::take(self)ismem::replace(self, None)and range iterators also depend on it).There's a more general fix at rust-lang/rust#86699 but it requires a bunch of unstable feature-gating stuff I haven't gone back to for.
Reacted by hatoo- addeda: rust-langIssues specific to rust-lang/rust.Issues specific to rust-lang/rust.t: externalIssues not about rust-gpu itself, but related enough to be tracked.Issues not about rust-gpu itself, but related enough to be tracked.
on Dec 8, 2021 Closing as won't fix, it's very unlikely we will address this in the forseeable future.
- addeds: qptr may fixThis might be fixed by the "qptr" experiment (https://github.com/EmbarkStudios/spirt/pull/24)This might be fixed by the "qptr" experiment (https://github.com/EmbarkStudios/spirt/pull/24)
on Mar 29, 2023 This actually works in Rust-GPU 0.4, and more specifically since
nightly-2022-02-28, thanks to:- For MIRI, cfg out the swap vectorization logic from 94212 rust-lang/rust#94412
(the function being modified there,swap_simple, is always used on SPIR-V, and the change that actually unblocked it wasptr::copy_nonoverlapping(y, x, 1)being replaced with aptr::{read,write}pair)
But at the same time, I wanted to propose to upstream that they can remove the
target_arch = "spirv"hack, as it got brought up in this issue:Now I'm worried that people may be relying on it, since it works, but I'm not sure how to check.
coreitself seems to mostly use for sorting/partitioning-like tasks.Oh, according to sourcegraph, it's definitely gotten used, oh well.
So we might want to do nothing for now, and only remove the upstream hack if
qptrcan supersede it.- For MIRI, cfg out the swap vectorization logic from 94212 rust-lang/rust#94412
- changed the title
[-]Fails to compile `core::mem::swap` that is scceeded previously[/-][+]`core::mem::swap` used to work, then broke (and later accidentally got unbroken again).[/+]on Oct 1, 2023 This issue is now being tracked at: Rust-GPU/rust-gpu#117
Expected Behaviour
Codes that uses
core::mem::swapwill compile. it's OK in previous version at least b9867d0.
Example & Steps To Reproduce
It's OK in the previous version. Please see https://github.com/hatoo/rust-gpu-issue/tree/swap-succ.
System Info
Backtrace
Backtrace