From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C3DF1A9B24; Wed, 10 Sep 2025 14:02:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757512946; cv=none; b=o4pAz+7q85BhK608fRyPpeF9Kaby90LN+7yEHfHuZOoV5tFne+tA1/Z9m2B92rWGVV2YQO5u507CUKUvXydOlEsDSrnceHmZUDj1RIGIgRiYDTqDwK81qcac+0Vj8WFn86e+hYOEtR5w3Y8XumkxRFByUbUdUXvKSUmDoMxqixA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757512946; c=relaxed/simple; bh=9ARQuYCGB8AhIE7mr4IbEDFHBMw7yatZFPWu9ioVuoU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Vgt1XBnsDUfKcb8y4x8ldsUERX7/KADydgLV1v3PpQHlM0ZFen7AKGUu3/LKYGP5Pt+TGzMaCkfMBt1fvETrCKbUlxPJV1U2DmAai7RlJnp9lFC+rS9vI30I+KbYX6TcdwQJN9YwRvsCOcUkJFMWw2PH+zC+yMrxsX0zwv1PqkU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QbwFBoee; arc=none smtp.client-ip=209.85.210.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QbwFBoee" Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-74be52f5447so1793931a34.1; Wed, 10 Sep 2025 07:02:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1757512944; x=1758117744; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :feedback-id:from:to:cc:subject:date:message-id:reply-to; bh=FrrFNmNMpEkidHHmhCAHvtUJbeCN3pNPTqmHTfyNlr4=; b=QbwFBoeeCr6Vsdv/0B6Tx1kgebK6YbnumB/d48AN2xQIco01e/e1CXvHWFitGM18UT oXhE8dIkgX3hbO3ugrvmzzpVJj3B6FPoxmso5goPYjK0a6oglo/K4BNpyMxHMRZRRBjb xBBDAC3t44gx1fByljyfs5026Sblgbjga7eahsr+o2dXy0zC5/Y0tYGnVhkP+ODWNKeI yUhiuaNfl2Myl3e88dzfAgewn2uixRPCaiKwbDOCe/CxzFkzLZcGgsvncDOtPVPl0Ezk njK4C3Y4Kycwoedfwpr8UjPi3VtTy9opDKbTM4GtIfBVcvMaFKUwIiKOf4ftFE2w/Slj Bkxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757512944; x=1758117744; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :feedback-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FrrFNmNMpEkidHHmhCAHvtUJbeCN3pNPTqmHTfyNlr4=; b=Z3MkdthXtqfbcPT6XXCG9RRrXf+8eH5urULHzB5Rn2o0On61N9oe1qnRbdROhD6tdN cTbav47sJ5TK/mJqkRua74YotZuOHubF7E2QehJ9JutkV22ZyCqCa+YAwmbTkpaENHVb V/pJ1y3Kr2SdStsQjSC27MQckgPzEPJdxtLZLIs1cB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pLndp9TXO6tGVmKvfk9vFq/I4JBBIKk7/5gx02J9Q== X-Received: by 2002:a05:6830:2584:b0:744:f0db:a1a6 with SMTP id 46e09a7af769-74c7841473emr9319568a34.34.1757512943597; Wed, 10 Sep 2025 07:02:23 -0700 (PDT) Received: from fauth-a1-smtp.messagingengine.com (fauth-a1-smtp.messagingengine.com. [103.168.172.200]) by smtp.gmail.com with ESMTPSA id af79cd13be357-81b5ed72c49sm289088985a.51.2025.09.10.07.02.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Sep 2025 07:02:23 -0700 (PDT) Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfauth.phl.internal (Postfix) with ESMTP id 43631F40067; Wed, 10 Sep 2025 10:02:21 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 10 Sep 2025 10:02:21 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvfeegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfhfgggtugfgjgesthekredttddtjeenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtth gvrhhnpeejhfeikeekffejgeegueevffdtgeefudetleegjeelvdffteeihfelfeehvdeg keenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgv rhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfh gvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgvpdhnsggprhgtphhtthho pedugedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheplhhoshhsihhnsehkvghrnh gvlhdrohhrghdprhgtphhtthhopegrlhhitggvrhihhhhlsehgohhoghhlvgdrtghomhdp rhgtphhtthhopegurghkrheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepohhjvggurg eskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprghlvgigrdhgrgihnhhorhesghhmrghi lhdrtghomhdprhgtphhtthhopehgrghrhiesghgrrhihghhuohdrnhgvthdprhgtphhtth hopegsjhhorhhnfegpghhhsehprhhothhonhhmrghilhdrtghomhdprhgtphhtthhopegr rdhhihhnuggsohhrgheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepthhmghhrohhssh esuhhmihgthhdrvgguuh X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Sep 2025 10:02:20 -0400 (EDT) Date: Wed, 10 Sep 2025 07:02:19 -0700 From: Boqun Feng To: Benno Lossin Cc: Alice Ryhl , Danilo Krummrich , Miguel Ojeda , Alex Gaynor , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Andreas Hindborg , Trevor Gross , Fiona Behrens , Alban Kurti , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] rust: pin-init: add `#[bind]` attribute to access previously initialized fields Message-ID: References: <20250910100755.2361281-1-lossin@kernel.org> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Sep 10, 2025 at 02:19:00PM +0200, Benno Lossin wrote: > On Wed Sep 10, 2025 at 12:40 PM CEST, Alice Ryhl wrote: > > On Wed, Sep 10, 2025 at 12:36 PM Benno Lossin wrote: > >> > >> On Wed Sep 10, 2025 at 12:17 PM CEST, Alice Ryhl wrote: > >> > On Wed, Sep 10, 2025 at 12:07:53PM +0200, Benno Lossin wrote: > >> >> Assigning a field a value in an initializer macro can be marked with the > >> >> `#[bind]` attribute. Doing so creates a `let` binding with the same > >> >> name. This `let` binding has the type `Pin<&mut T>` if the field is > >> >> structurally pinned or `&mut T` otherwise (where `T` is the type of the > >> >> field). > >> >> > >> >> Signed-off-by: Benno Lossin > >> > > >> > Is there a reason we can't apply this to all fields and avoid the > >> > attribute? > >> > >> Adding the attribute was due to Boqun's concern on v1 [1]. I think it > >> might be surprising too, but I'm also happy with no attribute. > >> > >> [1]: https://lore.kernel.org/all/aLshd0_C-1rh3FAg@tardis-2.local > > > > IMO the ideal is if it works without an attribute. Perhaps trying that > > in the kernel is a reasonable experiment to find out whether that's > > reasonable to do for the general language feature? > > @Boqun what is your opinion on this? > If we plan to make the in-place initializer language feature behave similar, as I asked here [1], then dropping `#[bind]` seems good to me. [1]: https://lore.kernel.org/rust-for-linux/aLshd0_C-1rh3FAg@tardis-2.local/ Thanks! Regards, Boqun > I'm open to take v2 or v1, whatever you guys prefer. > > --- > Cheers, > Benno