From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1uPesu-0002j7-5L for mharc-qemu-rust@gnu.org; Thu, 12 Jun 2025 06:10:12 -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 1uPesq-0002e3-Ei; Thu, 12 Jun 2025 06:10:09 -0400 Received: from mgamail.intel.com ([192.198.163.17]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uPeso-00056I-9X; Thu, 12 Jun 2025 06:10:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1749723006; x=1781259006; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=fHYaDxdXliQaiVrsmIZ+1J1h37qR2uhP4a8EVXYux28=; b=fq4RB4KboT0GL4YIjeZ8ny6lmT2c+y0Df1+OW9yTz7lPfSW8eG+NA86Y cPFJCYLI6ACnwCwTGLwLfK3BnViXdvb4BSBTXC6S781YZLBIImkwB2rio KnBxCCxaLdkb790dFmWhEVjuBicl/ZtxzAtFOWwT9HFLQ1TLVDm4cMLdW w8IXkCoB8zP8zWBRjtbjlwdluntkbpnXvu4Mmf4aqxqb14/GqpT/25oX+ NkAfqf9rYRMAfzJ25hqsKEbIEK80xPkOC0HTXEWSDkPPl4eTUtxIItiIB D3Gvjr3/2YBJ9FYw3/ozZIzQVoWr5k5BTdtgEX+zauGx6EiB3IkTs1yV5 g==; X-CSE-ConnectionGUID: 6dW5vWkWQWKS1VV3vqyGsQ== X-CSE-MsgGUID: 2ki6bZWbQYqbiu/dScO3RQ== X-IronPort-AV: E=McAfee;i="6800,10657,11461"; a="51809717" X-IronPort-AV: E=Sophos;i="6.16,230,1744095600"; d="scan'208";a="51809717" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2025 03:10:02 -0700 X-CSE-ConnectionGUID: 6BOsLbt+TS+G283zqcXeoA== X-CSE-MsgGUID: yLpA4M7vQrOiBXP/nDRdFg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,230,1744095600"; d="scan'208";a="152239947" Received: from liuzhao-optiplex-7080.sh.intel.com (HELO localhost) ([10.239.160.39]) by orviesa003.jf.intel.com with ESMTP; 12 Jun 2025 03:10:00 -0700 Date: Thu, 12 Jun 2025 18:31:16 +0800 From: Zhao Liu To: Paolo Bonzini Cc: qemu-devel@nongnu.org, qemu-rust@nongnu.org Subject: Re: [PATCH 4/5] rust: qom: make ParentInit lifetime-invariant Message-ID: References: <20250609154423.706056-1-pbonzini@redhat.com> <20250609154423.706056-5-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=192.198.163.17; 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, DKIMWL_WL_HIGH=-0.001, 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_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-rust@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: QEMU Rust-related patches and discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jun 2025 10:10:10 -0000 > > -impl<'a, T> ParentInit<'a, T> { > > +impl<'init, T> ParentInit<'init, T> { > > #[inline] > > - pub fn with(obj: &'a mut MaybeUninit, f: impl FnOnce(ParentInit<'a, T>)) { > > - let parent_init = ParentInit(obj); > > + pub fn with(obj: &'init mut MaybeUninit, f: impl for<'id> FnOnce(ParentInit<'id, T>)) { > > + let parent_init = ParentInit(obj, PhantomData); > > I think it's also valuable to add the similar comment as GhostToken did, > mentioning this `f` can't reture ParentInit itself. My bad, I forgot there's no returned value... > > f(parent_init) > > } > > }