Make FlatMapInPlaceVec an unsafe trait.#155951
Make FlatMapInPlaceVec an unsafe trait.#155951nnethercote wants to merge 1 commit intorust-lang:mainfrom
FlatMapInPlaceVec an unsafe trait.#155951Conversation
Because the memory safety of `FlatMapInPlace::flat_map_in_place` depends on `FlatMapInPlaceVec` impls behaving correctly.
|
Thanks to @programmerjake for pointing this out. |
|
@bors r=kivooeo rollup |
Is the "correct way to implement this trait" explained in more detail somewhere else, or is that statement just referring to the obvious limitation of "operations must be pure/idempotent outside of the expected mutation"? It seems strange to have a comment requiring you to promise that you implemented the trait correctly, but no comments about what "correctly" means for this trait. |
|
The meaning of correct operation is left implicit because it's obvious. E.g. |
…ec, r=kivooeo Make `FlatMapInPlaceVec` an unsafe trait. Because the memory safety of `FlatMapInPlace::flat_map_in_place` depends on `FlatMapInPlaceVec` impls behaving correctly. r? @chenyukang
…ec, r=kivooeo Make `FlatMapInPlaceVec` an unsafe trait. Because the memory safety of `FlatMapInPlace::flat_map_in_place` depends on `FlatMapInPlaceVec` impls behaving correctly. r? @chenyukang
Rollup of 9 pull requests Successful merges: - #151742 (Remove redundant information in `rustc_abi::Variants`) - #155856 (std_detect: support detecting more features on aarch64 Windows) - #155861 (Suggest `[const] Trait` bounds in more places) - #155899 (`dlltool`: Set the working directory to workaround `--temp-prefix` bug) - #155916 (Update with new LLVM 22 target for `wasm32-wali-linux-musl` target) - #155935 (remap OUT_DIR paths to fix build script path leakage in crate metadata. ) - #155950 (use the new `//@ needs-asm-mnemonic: ret` more) - #155949 (Update `opt_ast_lowering_delayed_lints` query to allow "stealing" lints, allowing to use `FnOnce` instead of `Fn`) - #155951 (Make `FlatMapInPlaceVec` an unsafe trait.)
Because the memory safety of
FlatMapInPlace::flat_map_in_placedepends onFlatMapInPlaceVecimpls behaving correctly.r? @chenyukang