diff options
| author | Boqun Feng <boqun.feng@gmail.com> | 2024-04-02 00:45:36 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-09-12 12:11:25 +0300 |
| commit | d6344cc86f314ef9ab2001e89d2602359ffe1b70 (patch) | |
| tree | a7351e168086ec55610fc6dcb6382cc029e458cd /rust/macros | |
| parent | 77ee2eaee4d9329915dbd421ed1640d17ed500ce (diff) | |
| download | linux-d6344cc86f314ef9ab2001e89d2602359ffe1b70.tar.xz | |
rust: types: Make Opaque::get const
commit be2ca1e03965ffb214b6cbda0ffd84daeeb5f214 upstream.
To support a potential usage:
static foo: Opaque<Foo> = ..; // Or defined in an extern block.
...
fn bar() {
let ptr = foo.get();
}
`Opaque::get` need to be `const`, otherwise compiler will complain
because calls on statics are limited to const functions.
Also `Opaque::get` should be naturally `const` since it's a composition
of two `const` functions: `UnsafeCell::get` and `ptr::cast`.
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Wedson Almeida Filho <walmeida@microsoft.com>
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
Link: https://lore.kernel.org/r/20240401214543.1242286-1-boqun.feng@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'rust/macros')
0 files changed, 0 insertions, 0 deletions
