mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Benno Lossin <benno.lossin@proton.me>
To: Boqun Feng <boqun.feng@gmail.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Martin Rodriguez Reboredo" <yakoyoku@gmail.com>,
	"Obei Sideg" <linux@obei.io>
Subject: Re: [PATCH] rust: types: Make Opaque::get const
Date: Tue, 02 Apr 2024 12:49:58 +0000	[thread overview]
Message-ID: <512ad3fa-37d0-470e-9f4c-bd185d9b897f@proton.me> (raw)
In-Reply-To: <20240401214543.1242286-1-boqun.feng@gmail.com>

On 01.04.24 23:45, Boqun Feng wrote:
> 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>
> ---
>   rust/kernel/types.rs | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Benno Lossin <benno.lossin@proton.me>

-- 
Cheers,
Benno


  parent reply	other threads:[~2024-04-02 12:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-01 21:45 Boqun Feng
2024-04-01 23:21 ` Wedson Almeida Filho
2024-04-02  9:46 ` Alice Ryhl
2024-04-02 12:49 ` Benno Lossin [this message]
2024-05-05 22:26 ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=512ad3fa-37d0-470e-9f4c-bd185d9b897f@proton.me \
    --to=benno.lossin@proton.me \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@obei.io \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wedsonaf@gmail.com \
    --cc=yakoyoku@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®