From nobody Sun Sep 28 16:34:09 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1758383082; cv=none; d=zohomail.com; s=zohoarc; b=H5qizrGxJOr2nLxjOKn1l3IHnjUs62jUBjFpjxpdGMQ2k5mHKteotTIeWu9lH+1kC/qoEIHd/8dXD0zM9vI6XATZU9+DcyMSHLREODxBvM0W51SPI7EjJf2IAWisaUOoJ7a/8i331TZ5wjtpqMefCliDVcdeOp0YKYLsdToyzNc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758383082; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aljCK2ZVYEwZya0/3maOXJwQJ846pER3aEMUJdyXZPk=; b=L9EcHniDDjUDBoup+w8mounlHoQOzeEIt533/swdn1gzhoaFTN2z1SfVt3L7vVvqc5bmv+Cv6dhWwrqRKvAlOmFWtPbmHpVrp1rMqkFF3N+1HrtYKZCXlKzI3tgU4x+8qNmDYIteKUBQmcHQ+PtgqvCT6X+oftTDdfjkeSj2e1Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17583830820391004.6503065375026; Sat, 20 Sep 2025 08:44:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uzzkq-00080w-2n; Sat, 20 Sep 2025 11:44:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uzzkk-0007yO-FR; Sat, 20 Sep 2025 11:43:58 -0400 Received: from mgamail.intel.com ([198.175.65.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uzzkf-0001zC-Ly; Sat, 20 Sep 2025 11:43:58 -0400 Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2025 08:43:49 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.39]) by fmviesa004.fm.intel.com with ESMTP; 20 Sep 2025 08:43:47 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1758383034; x=1789919034; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FE/A26CM7lN9wxf4s24xxF3DOe3NwCfkq0cfOOFg6wU=; b=TatoO260RYfy+GOZJM5sL50z8IdvFxMVWxbJL3A6DkmDl2m1A/ZG3a+M St5lG4YI2dr7js7jF7Ia08rywO/RzdAu44Jg1bffMKWDWjHB2PAuvZV8N LZ8Ib9qvjjHeyx9qtPflzC/mcg/FFa+xIr2D7jv4BmWATwvgerhfC5K0y o2hKqIQPKz0FC+oCwdYd8EFqU2G1zPotLBaTcEyNdjNXWYROXvg89TxdX OsvabZFamqrETzhDeeuI6Hy1yhJcP9fXfB8mZQbaN8z5pI7QjUkW7Rutu Q8lPdvnu5OPV4hyMEKroZ3eBD2thIE7m3P4HT31w6ByuN7Hyb0Lnc/UqL A==; X-CSE-ConnectionGUID: rZhrKqiVQRyHGW+qevF3/Q== X-CSE-MsgGUID: 7WROMVWtRDKh0vAbASwZ9A== X-IronPort-AV: E=McAfee;i="6800,10657,11559"; a="70955535" X-IronPort-AV: E=Sophos;i="6.18,281,1751266800"; d="scan'208";a="70955535" X-CSE-ConnectionGUID: XxLnda1HTYCpFDrH9JhOow== X-CSE-MsgGUID: m2tE3PAQQH2ZB7yFOCkhdA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,281,1751266800"; d="scan'208";a="181349462" From: Zhao Liu To: Paolo Bonzini , Manos Pitsidianakis Cc: qemu-devel@nongnu.org, qemu-rust@nongnu.org, Zhao Liu Subject: [PATCH v2 06/12] rust/qdev: Refine the documentation for QDevProp trait Date: Sun, 21 Sep 2025 00:05:14 +0800 Message-Id: <20250920160520.3699591-7-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250920160520.3699591-1-zhao1.liu@intel.com> References: <20250920160520.3699591-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=198.175.65.11; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1758383084668116600 Content-Type: text/plain; charset="utf-8" From: Manos Pitsidianakis Refine the documentation to clarify: * `unsfae` requires that `VALUE` must be valid. * using `*const` instead of `&` because the latter will cause compiler error. Signed-off-by: Manos Pitsidianakis Signed-off-by: Zhao Liu --- rust/hw/core/src/qdev.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/rust/hw/core/src/qdev.rs b/rust/hw/core/src/qdev.rs index d8113238e513..89c21e7c6b50 100644 --- a/rust/hw/core/src/qdev.rs +++ b/rust/hw/core/src/qdev.rs @@ -109,9 +109,16 @@ pub trait ResettablePhasesImpl { /// /// # Safety /// -/// This trait is marked as `unsafe` because currently having a `const` re= fer to -/// an `extern static` as a reference instead of a raw pointer results in = this -/// compiler error: +/// This trait is marked as `unsafe` because `VALUE` must be a valid raw +/// reference to a [`bindings::PropertyInfo`]. +/// +/// Note we could not use a regular reference: +/// +/// ```text +/// const VALUE: &bindings::PropertyInfo =3D ... +/// ``` +/// +/// because this results in the following compiler error: /// /// ```text /// constructing invalid value: encountered reference to `extern` static i= n `const` @@ -119,7 +126,7 @@ pub trait ResettablePhasesImpl { /// /// This is because the compiler generally might dereference a normal refe= rence /// during const evaluation, but not in this case (if it did, it'd need to -/// dereference the raw pointer so this would fail to compile). +/// dereference the raw pointer so using a `*const` would also fail to com= pile). /// /// It is the implementer's responsibility to provide a valid /// [`bindings::PropertyInfo`] pointer for the trait implementation to be = safe. --=20 2.34.1