diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-11-18 16:04:03 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-11-26 11:23:40 +1100 |
| commit | be7c6a3b43a8d200ba29f5a768e32287bb95aec2 (patch) | |
| tree | ceab40e23c07c861a0188fedec772669fa5c332d /compiler/rustc_codegen_llvm/src/back/write.rs | |
| parent | 1914dbe69465132a545fbc4cd0400a02a56a8a77 (diff) | |
| download | rust-be7c6a3b43a8d200ba29f5a768e32287bb95aec2.tar.gz rust-be7c6a3b43a8d200ba29f5a768e32287bb95aec2.zip | |
Make it possible for `ResultsCursor` to borrow a `Results`.
`ResultsCursor` currently owns its `Results`. But sometimes the `Results` is needed again afterwards. So there is `ResultsCursor::into_results` for extracting the `Results`, which leads to some awkwardness. This commit adds `ResultsHandle`, a `Cow`-like type that can either borrow or own a a `Results`. `ResultsCursor` now uses it. This is good because some `ResultsCursor`s really want to own their `Results`, while others just want to borrow it. We end with with a few more lines of code, but get some nice cleanups. - `ResultsCursor::into_results` and `Formatter::into_results` are removed. - `write_graphviz_results` now just borrows a `Results`, instead of the awkward "take ownership of a `Results` and then return it unchanged" pattern. This reinstates the cursor flexibility that was lost in #118230 -- which removed the old `ResultsRefCursor` and `ResultsCloneCursor` types -- but in a much simpler way. Hooray!
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back/write.rs')
0 files changed, 0 insertions, 0 deletions
