diff options
| author | bors <bors@rust-lang.org> | 2020-07-28 23:45:05 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-07-28 23:45:05 +0000 |
| commit | 4cca9505ea9faab261c2769032101cda6a04c212 (patch) | |
| tree | 315fbb56ddc0990b91b5a29f55b3f382425ca4a1 /src/test/rustdoc-ui/coverage/doc-examples.rs | |
| parent | a7eff79135de09a49b50acb029925275a7b42ccb (diff) | |
| parent | 0a51a9fb0013b33ddec221343b2fbfcd475b286f (diff) | |
| download | rust-4cca9505ea9faab261c2769032101cda6a04c212.tar.gz rust-4cca9505ea9faab261c2769032101cda6a04c212.zip | |
Auto merge of #74791 - tmiasko:raw-waker-inline, r=LukasKalbertodt
Add #[inline] to RawWaker::new
`RawWaker::new` is used when creating a new waker or cloning an existing one,
for example as in code below. The `RawWakerVTable::new` can be const evaluated,
but `RawWaker::new` itself cannot since waker pointer is not known at compile
time. Add `#[inline]` to avoid overhead of a function call.
```rust
unsafe fn clone_waker<W: Wake + Send + Sync + 'static>(waker: *const ()) -> RawWaker {
unsafe { Arc::incr_strong_count(waker as *const W) };
RawWaker::new(
waker as *const (),
&RawWakerVTable::new(clone_waker::<W>, wake::<W>, wake_by_ref::<W>, drop_waker::<W>),
)
}
```
Diffstat (limited to 'src/test/rustdoc-ui/coverage/doc-examples.rs')
0 files changed, 0 insertions, 0 deletions
