Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp26074606rwd; Mon, 3 Jul 2023 05:14:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlF23D7aqKjQg1OTXy+Ok/LCDpK6g3rjE+sYcGOGVJAiH+a82EFuLu5z6g/kdS9SGvj2moBO X-Received: by 2002:a05:6a00:158b:b0:668:94a2:2ec7 with SMTP id u11-20020a056a00158b00b0066894a22ec7mr11031483pfk.25.1688386482936; Mon, 03 Jul 2023 05:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688386482; cv=none; d=google.com; s=arc-20160816; b=J/RnwHnc0OUJctO8Plpd4qyIV6uca6Pc77hDv4h21GN9oIG/idXi5xFeMgqcXnXHTD dYd+BtE8MPcfrnSZ7GV2bv+bq23iTs9aXBjFoYbpfYhWwMUR15ztTu85uUHqEP7P9L0U qB1d0qsuqQdszTuhLJC5wNyTa0zd1hSVbC3ZApK4bvfX3hyIJhvqgDOlgiZezQao3Gut zsO/oKFUalxThuS/5un3BeZ92hNfTpIIbLl32P2S/MhpE1Wn83VmW+NMevcjbQXsPQux zbggvD09onf1d3PRrK31pfNZKDYJ6ppoqbwy8Mq7DVxhRSha0bv2y5FVBkvL8UHt1pl4 uS8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=2SzNF2Xp9ZY8Wj02jDl62Q9tRowvgKYaFK1hebcuMF8=; fh=4UqI/kvNTvsr9QSkVLe2ifnOl5UVxS1YO2a4aIos1vw=; b=kxRXrYnWHeMOtkCmuOU3RMgpMU7SZ1XIM26YBnuRL0pSR1rpSK7IoeQBWKA6d3KJKh J3K48at5QE98eECc9by0s8aQjcuGKpSYOZR8utoF7OwnqOlbqhgVfAz/M+Ggu7/ytB0Q ksVVJ7bsYZj3iDABd4qTZA7RDOGrsR+lTFYFywI52lwAyxP9Z+/wuHgYzuqm1i4OsAeo GylR+pQ3XFNETXCg22MSv5srtkZuevcGK2Vo5IlTdVXyvezsAIgRi8vjCqYsUGzxg0Jd StwoJrjSmct2x5EqJRu6FiDXbti+8No+pmx1HaFT6vk0UqljNpr/DyLQCB1bcPwpheUD RgQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=pgdnlTh7; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p7-20020a056a000b4700b0067d204bf281si13282427pfo.3.2023.07.03.05.14.30; Mon, 03 Jul 2023 05:14:42 -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=@google.com header.s=20221208 header.b=pgdnlTh7; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231391AbjGCLuJ (ORCPT + 99 others); Mon, 3 Jul 2023 07:50:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231414AbjGCLuI (ORCPT ); Mon, 3 Jul 2023 07:50:08 -0400 Received: from mail-ej1-x64a.google.com (mail-ej1-x64a.google.com [IPv6:2a00:1450:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15068194 for ; Mon, 3 Jul 2023 04:50:07 -0700 (PDT) Received: by mail-ej1-x64a.google.com with SMTP id a640c23a62f3a-988907e1b15so380161966b.3 for ; Mon, 03 Jul 2023 04:50:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1688385005; x=1690977005; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=2SzNF2Xp9ZY8Wj02jDl62Q9tRowvgKYaFK1hebcuMF8=; b=pgdnlTh7+dQSQr4HXDzPTcsLOQlcjEHZQKHGP8SUHPN3/ATvqnlbPaxBaM0s7GaUvw RNvdRo93wXLXicgZGyBhr6ZaC7R7ulc3EeshDcjqG+ymW8vmixEwqNuGgEZgFwma+dXs PuAJ3SfbY6DIDtw7FWQQehgD5uzUfk/kymMLnXbNQaYbsaHYBje2TTwgvzNaVUl5hyAu mjU5Htde/TqTtks02Ohuj1rUzDg6n9J+Od7vyRrVjEeU723xdaTuLfKYG9rmCbv1HqKq Qwo0hAGqQyNLiF1/67JGjZjZUaJ7oZpn8LbSv7zzUM7/f5VgOaTJPHaDBhaZfaAScZtR Tp1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688385005; x=1690977005; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2SzNF2Xp9ZY8Wj02jDl62Q9tRowvgKYaFK1hebcuMF8=; b=jF8vHLm84CB7uEg8Gw8oLXipTRy8DJGVQzjVxRZ0zNiBQ/JOdwR5PThiTULEADpz7o QvQQ+vrI1F0qi4LD3CZtqOp5/SNczaWtZv9HRH1WRPub0OIYb4cozhAyThdCifh5em25 cLbpFH7rpDl24hEWjKMNgjZk2TwyBf5E6Lmklhd7nyh3ojdnFdXfVIscf6YLD6VQvh/n morpItZumvu2HDtQ6ow1C1oRZtr+6Cik4mPSnMbrM1DpHl8LrXixU47hojtehj+LN3RI NvAZM3ZvDOIQiGM3I6MX4eoRgDy49ObzwDk/VNOBcaI85GFrf/gGO5WRS95O8edQXM1T PlQQ== X-Gm-Message-State: ABy/qLaKjaA88Ru5IP0R0NkxHNgDIfVdvcWtUuAYIXQCXlZ0OrspzLZl fho+I5cXy9Ae3Z/HBwLDJ0b+l3wkgDrwqHE= X-Received: from aliceryhl.c.googlers.com ([fda3:e722:ac3:cc00:31:98fb:c0a8:6c8]) (user=aliceryhl job=sendgmr) by 2002:a17:906:4bcd:b0:992:4ba4:dc4a with SMTP id x13-20020a1709064bcd00b009924ba4dc4amr24697ejv.13.1688385005551; Mon, 03 Jul 2023 04:50:05 -0700 (PDT) Date: Mon, 3 Jul 2023 11:50:00 +0000 In-Reply-To: <20230624092330.157338-2-benno.lossin@proton.me> Mime-Version: 1.0 References: <20230624092330.157338-2-benno.lossin@proton.me> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230703115000.2006682-1-aliceryhl@google.com> Subject: [PATCH 2/7] rust: add derive macro for `Zeroable` From: Alice Ryhl To: benno.lossin@proton.me Cc: alex.gaynor@gmail.com, aliceryhl@google.com, bjorn3_gh@protonmail.com, boqun.feng@gmail.com, gary@garyguo.net, lina@asahilina.net, linux-kernel@vger.kernel.org, nmi@metaspace.dk, ojeda@kernel.org, patches@lists.linux.dev, rust-for-linux@vger.kernel.org, wedsonaf@gmail.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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 Benno Lossin writes: > Add a derive proc-macro for the `Zeroable` trait. The macro supports > structs where every field implements the `Zeroable` trait. This way > `unsafe` implementations can be avoided. > > The macro is split into two parts: > - a proc-macro to parse generics into impl and ty generics, > - a declarative macro that expands to the impl block. > > Suggested-by: Asahi Lina > Signed-off-by: Benno Lossin Reviewed-by: Alice Ryhl