Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9539435rwp; Thu, 20 Jul 2023 06:30:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlHZMdGgJqvVnOCUpjOu9/w8+1Q8CT6aGMR0FKCxA9HcN33uGJAofxUMOwdIT7VlNO4is8uY X-Received: by 2002:a05:6a00:1583:b0:681:c372:5aa4 with SMTP id u3-20020a056a00158300b00681c3725aa4mr28952819pfk.27.1689859809954; Thu, 20 Jul 2023 06:30:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689859809; cv=none; d=google.com; s=arc-20160816; b=QibVwHr8gSWy905hQDUGG31hC2CHNPbB737EFEtL1KC5g5DrG3fOBuYWpWQTzXUkGa d/v3bD78gBsM0r6PY2x3yeONIfayLRICvaqO3VU6YjrvNnPVktGXEXS1HVqFxjamZdna QENxrHzVC3lwH0ttMkV8no8m7UXlAfMRjDFwkH5gNx/UO7yXncq/EAyEdSL4vMsgvUpE mTJMJQR4ifpROiJ7BFqtZDxd7kaQBKyUsuQl07y5R2eYZS6wD9LO8ZqBbHsdshgJe9+x 59YCGd4Ddkgh0BU+3H9ljlc0c2g3Ppa5uyJYe/Seezr/2dEk6vJIcLPriyGKWf+hJZHm D3gQ== 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=jZDyfQVqAO0bnYa7VYw9MMaKrL6NuobnBPEQu7nAapA=; fh=tY0sgAiDB/HPwQeJymbixAWC+lTXNVnP4xpob7IwNxA=; b=xQq4LEaXd9PikNAaU3f+NrxI2WEKR5p/mllW17qrUI31y58OOwd9dGFGbXN0AlIhpz FRJR5h3bLRR2mbkfsNSQjnmWBFaVQl7YCvg9oHaQjDQLTsrbJRbPlQwbDbIOx+yNqpPp mWBc2nAXj/GcCT68bUDfSPBEQCv/+GJGPxiPLFmnxT69goU9/zkqyTNZOiQ90XgiNIjh dr0nYPPK8jy9fHPO0XJ+8vW/Kx3sQ4lzVWhrqmEjygyEZL4KxXWHXIFTma/ECvQ/qu2i YYcVUrjp21loONT1D2ZdyvY9HI5KjdRhN3339I+ZcWnqgyqWqTzmcHmUIitj7BN6JM+r HV+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=b6DzRutO; 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 t16-20020a056a00139000b00665dfbf3b1esi969035pfg.270.2023.07.20.06.29.56; Thu, 20 Jul 2023 06:30:09 -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=b6DzRutO; 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 S231759AbjGTNRA (ORCPT + 99 others); Thu, 20 Jul 2023 09:17:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231635AbjGTNQ4 (ORCPT ); Thu, 20 Jul 2023 09:16:56 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16DA526BA for ; Thu, 20 Jul 2023 06:16:53 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-57704af0e64so7479197b3.0 for ; Thu, 20 Jul 2023 06:16:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689859012; x=1690463812; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=jZDyfQVqAO0bnYa7VYw9MMaKrL6NuobnBPEQu7nAapA=; b=b6DzRutOpRlchzhGc+vWqutvZPPlCW3TQf+U9eOy+pcYyCjPEjS83wJDT+mdAcH9WS ZKa2pOq77PfNzKjFJeVwBMyLfacxlFfOUdD20e/AOBtvomkN6yOFjVc5/eYRgrx+3l7d 3ejGayJL4s3SMDgZFhcQ5GwPji6pqyjsIW+1b1tC53n1xDH2P9QNV7otpXOyxZGO772D ZxbDafbsKOn49/SC3si7WnXYIu6/Ki7S83+EjdnudP/wTEGox6vKP7+EvdIQDScKBWgw x1Ugue/ctvM4GE26AaDdqJwsK3jh18x1OFYNbPkBImnt09s7m3hTGf2grI49QkwZ5XV5 6pmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689859012; x=1690463812; 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=jZDyfQVqAO0bnYa7VYw9MMaKrL6NuobnBPEQu7nAapA=; b=GkRVUWYp+tc0AlXYocU+axaD6wTKVunTRhzBovwF18xyss/jBkZRlOIX6I3A1rbO9z u3YI29LOcQwphk/XJfIniyiIlPq7+RjPKuyfif/iNTcoLnsdSO0if/9vIr2ygwCD4QFT bg/UsisBf4HZIxNyByhFamnXiZOklQ0G8cC5cyaUGg1TuNMx/K/4z9fxiIaW4gObhlN0 E3ep58RqO+22pKYigmoWSU+WkkwXZoNXRNsIcPpcm8ruziy+gA+MqKPkAoUk0mLy2mdK ZgQTbgjqEQ87VTOtQECrz9Omqx2uEcJ9Pe6xV9iW11+vTgsa3mfwPC2PNJBYrdgnPlLK EibA== X-Gm-Message-State: ABy/qLaACIaIt/nIrgfeoT3YOvxfPEWuBda0G9PmfqTZbtbb834CHyTh x0px+DFkV7K6S282VNIiFmEzP+xrQy3knvs= X-Received: from aliceryhl.c.googlers.com ([fda3:e722:ac3:cc00:31:98fb:c0a8:6c8]) (user=aliceryhl job=sendgmr) by 2002:a81:b70d:0:b0:581:7b58:5e70 with SMTP id v13-20020a81b70d000000b005817b585e70mr59224ywh.5.1689859012266; Thu, 20 Jul 2023 06:16:52 -0700 (PDT) Date: Thu, 20 Jul 2023 13:16:48 +0000 In-Reply-To: <20230719141918.543938-4-benno.lossin@proton.me> Mime-Version: 1.0 References: <20230719141918.543938-4-benno.lossin@proton.me> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230720131648.3542031-1-aliceryhl@google.com> Subject: Re: [PATCH v2 03/12] rust: init: make guards in the init macros hygienic 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, 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_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=ham 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: > Use hygienic identifiers for the guards instead of the field names. This > makes the init macros feel more like normal struct initializers, since > assigning identifiers with the name of a field does not create > conflicts. > Also change the internals of the guards, no need to make the `forget` > function `unsafe`, since users cannot access the guards anyways. Now the > guards are carried directly on the stack and have no extra `Cell` > field that marks if they have been forgotten or not, instead they are > just forgotten via `mem::forget`. > > Suggested-by: Asahi Lina > Signed-off-by: Benno Lossin Reviewed-by: Alice Ryhl