about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/example/std_example.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-05-13 06:30:25 +0000
committerbors <bors@rust-lang.org>2024-05-13 06:30:25 +0000
commit982c9c1e8148034ee523a62926ef39c84fa48fea (patch)
tree0b7f159de9d73f68196ad66ea4e9dd90efa7efee /compiler/rustc_codegen_cranelift/example/std_example.rs
parentba956ef4b00c91579cff9b2220358ee3a46d982f (diff)
parent74e1b46ab23fe1f2deb414968340ca35e7882ae0 (diff)
downloadrust-982c9c1e8148034ee523a62926ef39c84fa48fea.tar.gz
rust-982c9c1e8148034ee523a62926ef39c84fa48fea.zip
Auto merge of #125055 - nnethercote:Comment-FIXME, r=compiler-errors
Avoid clone in `Comments::next`

`Comments::next`, in `rustc_ast_pretty`, has this comment:
```
// FIXME: This shouldn't probably clone lmao
```
The obvious thing to try is to return `Option<&Comment>` instead of `Option<Comment>`. But that leads to multiple borrows all over the place, because `Comments` must be borrowed from `PrintState` and then processed by `&mut self` methods within `PrintState`.

This PR instead rearranges things so that comments are consumed as they are used, preserving the `Option<Comment>` return type without requiring any cloning.

r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_codegen_cranelift/example/std_example.rs')
0 files changed, 0 insertions, 0 deletions