Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4883788rwl; Mon, 3 Apr 2023 10:58:14 -0700 (PDT) X-Google-Smtp-Source: AKy350YkZUBmaWeMzV//MjoCAbFG2h60RKPbn5i3LqRTinGzDxZdRc/GWxPEUhWANWayCOUyzWE8 X-Received: by 2002:a17:906:140e:b0:922:8fc9:d235 with SMTP id p14-20020a170906140e00b009228fc9d235mr15444086ejc.9.1680544694682; Mon, 03 Apr 2023 10:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680544694; cv=none; d=google.com; s=arc-20160816; b=c2NyoO6eEdfDADZGZwtd/tvfB6KF/VehHAoX8jvwXHc9xsLBpqWyhIBbKA5VRapuVM xocWgcVWuYaI55xagrs4A0ULuEE+Sp+UE9Idr6B2F0d/P1Mt9ARdPgjZLfAkdlclflpF k69YaxYa8RjxKyeDrIlo7slhB0SY1KF0YLgNIvUGI1EuvgsYnyLZdSDPu5MWj1QaAhRu ByUsrFA3I/eL+Dj/1EUyhZLdPfURaRc70N4bmIbUIihuX0ciI+yVBqWW8/eAjQw3G6Kt aw62VcAkS2I9jT+lwnU1afUYcYV7foz5/5cR/tPxtlox0p2Jml0h9Gj7XbChlQb0r/kD gbwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id:feedback-id:dkim-signature :dkim-signature; bh=kFfxasQMqACHhdRBnxpY8CNWnpG5XzzT/yBz49wzpc0=; b=v3tKqXL/fTKWj303sIKl7u9B6tgi299ea1N8qO1y1tHiPf93RAz8F0ZFN/R8pTvwWm C/8cKbxmQMJ2eGexHhAXbCSEOFqMpPulFDb9NEWm+AjdiVc26nAgjvCuPRqai4R9vFJw jL5EeyAdmVjBV1vk4jBmWtO6XWPQ4L5M5gYYvDify6slP1VJYijvya9jrGoTfDfsfBhX hsN0Tmwd1gbAZtA5H5rrEUIDxMH+qbgQWa9NRnOsA986lbUatEW0dF3RoM9/sZreRElr 6pkHi9ipai0VgQTe2SnEee5ZcHj31Ga3OsMydtHgC6vNydyIXvfQAh4vrCweZ76Z+JRt tZxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ryhl.io header.s=fm2 header.b=VZRTxaNr; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Hn26aqzc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ryhl.io Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jz11-20020a17090775eb00b0093f2142c91csi8706334ejc.772.2023.04.03.10.57.50; Mon, 03 Apr 2023 10:58:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ryhl.io header.s=fm2 header.b=VZRTxaNr; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Hn26aqzc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ryhl.io Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232905AbjDCR5S (ORCPT + 99 others); Mon, 3 Apr 2023 13:57:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232755AbjDCR5I (ORCPT ); Mon, 3 Apr 2023 13:57:08 -0400 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F4D91FF9; Mon, 3 Apr 2023 10:57:02 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id D411E5C00FD; Mon, 3 Apr 2023 13:57:01 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 03 Apr 2023 13:57:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ryhl.io; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1680544621; x=1680631021; bh=kFfxasQMqACHhdRBnxpY8CNWnpG5XzzT/yB z49wzpc0=; b=VZRTxaNrDgaIaBViRoC3xzGTJiPlyTjoVaNUX6Ns6nV1sWKMHDk IkZ0ddIw6sxULWNXaxBJDrBePV47QGD7FDHJeAxkEdeGzWrLHjQnObwzaMWtY396 2WVufl6fl+NfsOfufjUrqQ2nPQ/apBw95P0Yw05fEZ6Ju2s+ePU2X66nV12kku9g gULv53G1ghRCEgkFIMZos3ajsOaXz1+POgNa8Tjb11hJz0agiSioQIMnyyGO6YHV SsdmcgriTDZ9FJEE2g5FZXJNmZATfzLAvJ3e9XdzgCCq6uMfoazAceanoppfe5Xv mYu/JW/CPc7cUu5lAyyB/aqcBTKNlEEw9qw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1680544621; x=1680631021; bh=kFfxasQMqACHhdRBnxpY8CNWnpG5XzzT/yB z49wzpc0=; b=Hn26aqzc/D3AWDs+Wved3Hye70pWkPMDybsAvv0G7xEUMpgTxIp G/dHDAih0QFsuBRt6WfEumphKO11dAWdopRNPS5/j6zGzV5wT17KNWHgogcJbu8D J1BtCSgk/wMLoe0+MST4+HG8B5oFY4iUUHZHfvADJPQpPDdJtg1I+SpPH/VnAXiq lpsv0Lhbb2WOZuUpqUIOE8lTvrmt0itAnQlCVfWie0DKXxZn102gFZ4U/F8mNFIp uyrkqGa9WlrEcy6g2q5xuYopkrwpo6VWBTNFv49t4AzkBtDw4gSPXoBIgHDr4zTr NhKd8RURSHW/OFgEaFi7dPF4Awf5wMjU+1A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeijedguddvtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfhuffvvehfjggtgfesthejredttdefjeenucfhrhhomheptehl ihgtvgcutfihhhhluceorghlihgtvgesrhihhhhlrdhioheqnecuggftrfgrthhtvghrnh ephfehueeileevjeefkeetvdffveffudeuhffgtedvuefgiefgiedvjeegvdejleejnecu vehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomheprghlihgtvg esrhihhhhlrdhioh X-ME-Proxy: Feedback-ID: i56684263:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 Apr 2023 13:56:59 -0400 (EDT) Message-ID: <320e4b6f-fbb5-3b4c-1e9d-009d7156239a@ryhl.io> Date: Mon, 3 Apr 2023 19:56:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 From: Alice Ryhl Subject: Re: [PATCH v5 06/15] rust: add pin-init API core To: Benno Lossin Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=c3=b6rn_Roy_Baron?= References: <20230403154422.168633-1-y86-dev@protonmail.com> <20230403154422.168633-7-y86-dev@protonmail.com> Content-Language: en-US In-Reply-To: <20230403154422.168633-7-y86-dev@protonmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/3/23 17:45, Benno Lossin wrote: > This API is used to facilitate safe pinned initialization of structs. It > replaces cumbersome `unsafe` manual initialization with elegant safe macro > invocations. > > Due to the size of this change it has been split into six commits: > 1. This commit introducing the basic public interface: traits and > functions to represent and create initializers. > 2. Adds the `#[pin_data]`, `pin_init!`, `try_pin_init!`, `init!` and > `try_init!` macros along with their internal types. > 3. Adds the `InPlaceInit` trait that allows using an initializer to create > an object inside of a `Box` and other smart pointers. > 4. Adds the `PinnedDrop` trait and adds macro support for it in > the `#[pin_data]` macro. > 5. Adds the `stack_pin_init!` macro allowing to pin-initialize a struct on > the stack. > 6. Adds the `Zeroable` trait and `init::zeroed` function to initialize > types that have `0x00` in all bytes as a valid bit pattern. > > Co-developed-by: Gary Guo > Signed-off-by: Gary Guo > Signed-off-by: Benno Lossin > Cc: Andreas Hindborg > Cc: Alice Ryhl > Cc: Wedson Almeida Filho Reviewed-by: Alice Ryhl