about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-01-19 19:27:01 +0100
committerGitHub <noreply@github.com>2024-01-19 19:27:01 +0100
commit455382d8df6e6faa169468a3af07aabf165f3559 (patch)
treecc898ea8f7189e62484d229e92762e0ea8e808c3 /compiler/rustc_codegen_llvm/src
parent2587100a9b13f88f6f0089cbfa1673bf169d269c (diff)
parentc48cdfe8ee582e3e67c9ffc036d8046add812565 (diff)
downloadrust-455382d8df6e6faa169468a3af07aabf165f3559.tar.gz
rust-455382d8df6e6faa169468a3af07aabf165f3559.zip
Rollup merge of #119984 - kpreid:waker-noop, r=dtolnay
Change return type of unstable `Waker::noop()` from `Waker` to `&Waker`.

The advantage of this is that it does not need to be assigned to a variable to be used in a `Context` creation, which is the most common thing to want to do with a noop waker. It also avoids unnecessarily executing the dynamically dispatched drop function when the noop waker is dropped.

If an owned noop waker is desired, it can be created by cloning, but the reverse is harder to do since it requires declaring a constant. Alternatively, both versions could be provided, like `futures::task::noop_waker()` and `futures::task::noop_waker_ref()`, but that seems to me to be API clutter for a very small benefit, whereas having the `&'static` reference available is a large reduction in boilerplate.

[Previous discussion on the tracking issue starting here](https://github.com/rust-lang/rust/issues/98286#issuecomment-1862159766)
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions