From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 01D03182B7; Sun, 7 Sep 2025 23:33:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757288013; cv=none; b=LGt2Rr8z0yX7KNnijNh/AjaHG3x7ZBMdJN6EduLeL8r02p3LNMjoVfF1WxcOQkCKM/+MMENAsu9LDdvcs2A/gCOjcIhh//rvQIn9+u7XtNsqhH/8leBFYEwg/GUQU3yXaFg9vR1nz6KT5g0SCsARq2HqZJF0hSSRxvpvVIAQ3tI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757288013; c=relaxed/simple; bh=yXEkUGsxBZ2hRiB79snJwheipW6mBQD6jKY1M1gIhXo=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=JVn07LvX7EAGK/XdovIZl2fS6njxuB4qjlwmgwAk1T2vX0Jp1wyYHoIF0v2wQAle7gbMZI8shCyrG9X68UgpLp3YlqBHwRo5mixNYvh6FG7Pip8Qis2QRUfxwWs4fzkh/DecYACDh2QUBpT+4ARljX5WPERzqv/iAPbGOzFidlA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QkjI8oNt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QkjI8oNt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C365C4CEF0; Sun, 7 Sep 2025 23:33:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757288011; bh=yXEkUGsxBZ2hRiB79snJwheipW6mBQD6jKY1M1gIhXo=; h=Date:Subject:Cc:To:From:References:In-Reply-To:From; b=QkjI8oNt3T80W+/P4GWQtmJXsIgLeV1jv0wiMh89BR0xvBgQJEtQY/ZP8dfJTzERQ crIo7eJueq3LhKe3te3XGGtLK8bhO5f8XOlbppk3IGYgIqn0crnk6fdoVvZYZdHq1U t7rI2O0H3s9gUGZl7OK7p82zCwFgintXvriqTANYTIegwRQ6ArOECCfoKDs1/Ubgp0 O2wkY2pfhUchDecGCHnuP7NcnImgWAYL82OUp4LaVEwmNL2NAEJxj+IQ8ROCukxFgM XVxnI/xcZkYzApRlGaYWj7m8eOgy2QvaEbqHjj0M7oifp01hah48pof4tD2gj9I714 uM+9GHdryG3kQ== Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 08 Sep 2025 01:33:26 +0200 Message-Id: Subject: Re: [PATCH] rust: pin-init: add references to previously initialized fields Cc: "Boqun Feng" , "Miguel Ojeda" , "Alex Gaynor" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Andreas Hindborg" , "Alice Ryhl" , "Trevor Gross" , "Fiona Behrens" , "Alban Kurti" , "Greg Kroah-Hartman" , "Rafael J. Wysocki" , "Bjorn Helgaas" , =?utf-8?q?Krzysztof_Wilczy=C2=B4nski?= , , To: "Benno Lossin" From: "Danilo Krummrich" References: <20250905140047.3325945-1-lossin@kernel.org> In-Reply-To: On Mon Sep 8, 2025 at 12:51 AM CEST, Benno Lossin wrote: > I actually came up with a third option that looks best IMO: > > init!(MyStruct { > x: 42, > #[with_binding] > y: 24, > z: *y, > }) > > The `#[with_binding]` attribute makes the macro generate a variable `y`. > `x` & `z` don't give access to their value. (we of course should come up > with a better name). > > Any thoughts? It may be a bit verbose is some cases, but it makes things pretty obvious, = so LGTM. How about just #[bind] or #[access]?