Files
linux/rust/kernel
Boqun Feng be2ca1e039 rust: types: Make Opaque::get const
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 <[email protected]>
Reviewed-by: Alice Ryhl <[email protected]>
Reviewed-by: Wedson Almeida Filho <[email protected]>
Reviewed-by: Benno Lossin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
2024-05-05 13:19:37 +02:00
..
2024-01-27 14:28:00 +00:00
2023-05-31 17:35:03 +02:00
2023-12-21 20:54:17 +01:00
2023-12-21 20:54:17 +01:00
2023-05-31 17:35:03 +02:00
2024-02-18 21:22:27 +01:00
2024-05-05 13:19:37 +02:00