Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2041389lqz; Tue, 2 Apr 2024 05:50:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVB/bwiLqZZOaKKl19ukaMK5Gqkur5x7fE7TfZ9tMg4zgEB0HtbsZ0e+BMZYXOg/S+6o64ParNOvtY4CNTVrNmsFCBTWNykIkNM9/Xkfg== X-Google-Smtp-Source: AGHT+IFR9uwI1EmFSG0/jPfuCQ5cgImAmw0xYZQLj3Aid+4lzNlJUphVFAgyBv0FlK0cTzGtvQEi X-Received: by 2002:a05:6a20:3fa0:b0:1a3:5c61:159 with SMTP id ay32-20020a056a203fa000b001a35c610159mr9180007pzb.53.1712062235152; Tue, 02 Apr 2024 05:50:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712062235; cv=pass; d=google.com; s=arc-20160816; b=x2lK6Aj4To99SEYSLE2c9xN1n1qDEiOMoxWCJQ13jSFqs0gCOejXZT+6GSUPGezWQ8 5p2ZNQPveULpzffvvUMwn1xJllgEy76CoLX8gaBSYKMFGBILoevzQQW30ta3XkwZf46h eE1xKPJ/xyN4zFKTZN3Q8Z8xb4PX3eE59hjijrYQz2mcgOvgzawW0durZd1DTpIEftFw uY8RQ5A9XeFmp/+nwUSz+PxGhsdtk5i4Yp60l8CKHmQ9roBJ0abulVB6DsulaAWoOZrU uzlmiqMzMwBqE2/Wu8kv15g1UvA+1fOg4xNqM68rneiyF1Ih7F8W1vJ1wcfsVApQBq3W ZLrQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:feedback-id:references :in-reply-to:message-id:subject:cc:from:to:date:dkim-signature; bh=ZUFnwo0hp9HoIfPTPou9zjyCN3N2Lvg27XoRrnqIoh0=; fh=E/9CvP9t7EJgBRha2++5Cu72DGIRTD8QILaAG4oq8TI=; b=OOZ4IHx8+WeCFZidsG3kfGhQWPgBuXzxqGQ5m6CHAhSCYT6dACD5/6iCoYIQprjC+F 0NRxLTQsv9LwNx6SQrGmvXelCSJPeUSLQbii5G5Q+HGZpi4LF6Ogd9QbHzV2LEmGPHs3 yrEME8RjygYvQ4HXgCa7I/7cGjtmaefrmj1chQnJK1iDvx3qwd9l+rV0osajLANJYtGW xL7skpt/kPxjOYEuLUEULwNKCwjcfwxrYVofV4Qwd/T9UgN7mCtLkarAmxzm11PvSfke 0KAelsCpKJi/zas0vIXjF/CsMm1SVFQhfrpj9iMmz+j4y4kxIehv8CFwkDgcncjbE2Pq k5oQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=fQ9D4KJY; arc=pass (i=1 spf=pass spfdomain=proton.me dkim=pass dkdomain=proton.me dmarc=pass fromdomain=proton.me); spf=pass (google.com: domain of linux-kernel+bounces-127971-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127971-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 187-20020a6301c4000000b005e271b946a6si10969010pgb.765.2024.04.02.05.50.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 05:50:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127971-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=fQ9D4KJY; arc=pass (i=1 spf=pass spfdomain=proton.me dkim=pass dkdomain=proton.me dmarc=pass fromdomain=proton.me); spf=pass (google.com: domain of linux-kernel+bounces-127971-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127971-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0DE0B2842DA for ; Tue, 2 Apr 2024 12:50:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28BB67F462; Tue, 2 Apr 2024 12:50:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b="fQ9D4KJY" Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A537A335A7 for ; Tue, 2 Apr 2024 12:50:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712062212; cv=none; b=l0lHbMjfak2CJvQMbfQsq6dXE8IOn9QKVuD0sl4zfISMFFnXo5OsjGspOgPPxzK9GuNGCm0FOBeleWa/BlWhVZ1/os4YrBXRQmYmnfXjYRnF+bs3dNdcnh9QKxtk3/flU72R++CU22X3I+brxJ5n5Gqsy36LklRmbqq28IK8ne8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712062212; c=relaxed/simple; bh=YVfCRrIMjM3qNuE6jVIeiRm1+M5zgpz+svQs64HzCW0=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fSm9RcEbQPMbuMxws7MNQ+pX+REQDFYdwSxEyG9yQ+p5bDIc1gt+zCHZ4Z05w4sfrfJI9mcbHm5SCOQyp2BxmdsnhzD4tOBz4TBbb1N8mEGHlHOWH5oR8QgW+d/0/BbuicjUN7Zft9S7JbiyMGxgRG68MhY4oYkYoEpnySt6A0E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me; spf=pass smtp.mailfrom=proton.me; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b=fQ9D4KJY; arc=none smtp.client-ip=185.70.43.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proton.me DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1712062207; x=1712321407; bh=ZUFnwo0hp9HoIfPTPou9zjyCN3N2Lvg27XoRrnqIoh0=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=fQ9D4KJY95UiYMArX95Cts4UjPgLLnT/HzPfMsQYBPWBDdL/yQNLKDp5xLSDyg0nW xg88m7J2ayG01IAueCEPNQl6YxVwwJ9gAYJ8zXnHIEQdTUz9Amwvo7lOlcOsp3SZzI hyFHkJ35hY2+OCToMYVaXrmfxRUNCs0S32JdEc9PvCZ/rF0Iv4XlpcU+9NtxXn7a7k Z/UTfjZ83lik9QA4RCP0NO3mOMUTXnQ9EuO8IV5VhjhP5yINlbNtZX9P/5b8dLI4o0 dvE8L/+hw5WxFYn5cygGxZJREviNxukFVacXSwC1wDcnKa3AkgyrSRyvcKh9Mz2LjY 7XEpFRJ2jhLPQ== Date: Tue, 02 Apr 2024 12:49:58 +0000 To: Boqun Feng , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org From: Benno Lossin Cc: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl , Martin Rodriguez Reboredo , Obei Sideg Subject: Re: [PATCH] rust: types: Make Opaque::get const Message-ID: <512ad3fa-37d0-470e-9f4c-bd185d9b897f@proton.me> In-Reply-To: <20240401214543.1242286-1-boqun.feng@gmail.com> References: <20240401214543.1242286-1-boqun.feng@gmail.com> Feedback-ID: 71780778:user:proton Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01.04.24 23:45, Boqun Feng wrote: > To support a potential usage: >=20 > static foo: Opaque =3D ..; // Or defined in an extern block. >=20 > ... >=20 > fn bar() { > let ptr =3D foo.get(); > } >=20 > `Opaque::get` need to be `const`, otherwise compiler will complain > because calls on statics are limited to const functions. >=20 > Also `Opaque::get` should be naturally `const` since it's a composition > of two `const` functions: `UnsafeCell::get` and `ptr::cast`. >=20 > Signed-off-by: Boqun Feng > --- > rust/kernel/types.rs | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Benno Lossin --=20 Cheers, Benno