Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp135527lqe; Thu, 4 Apr 2024 01:53:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXRKRR7FmHJ9My3sLvU/R8ubkux/7xBwlHcRnKobx+CdvyyFZjvJcY0J87f+kfyZ8A6wXMUYXOZal7GstNbOktZHJ3URWdog6nQjI/FBw== X-Google-Smtp-Source: AGHT+IGNCpVm4t0Uay5BBEMSZS0Gl4Och9qD1KssoF+izK6xZXZLRcrIlKMx4KVLT+vGHMFW9D8M X-Received: by 2002:a05:6a00:4b42:b0:6e6:9af4:409a with SMTP id kr2-20020a056a004b4200b006e69af4409amr1808924pfb.33.1712220821096; Thu, 04 Apr 2024 01:53:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712220821; cv=pass; d=google.com; s=arc-20160816; b=tVwPppO1sJ9tCAIZIk45MS8Kfe2fcPvpUxoTCS/9qjc+wIdhJVvL5U628aMBTUYck1 hpFpTYwYJlzrs/jf228rxOZOYaitBlsUJaSfVkrcBHrfAwnnQumAPoYoWVYDk+Gb5L9E nUtaOztVbHKvt3eBteQlt06n0hAbYyJ70/1X9wO/o3usRFQMDSNk9ky0mSvKoWIe1z9f t3wQhKV9q6FBblxMcbgNBAs8+zq6G/FcrZToNwHJIqvr7+qfdzkjgiWMAfhbhom1Y1X/ bcUxwOFYvfyWMflGIjoxp/P8Np4lJvQtGNPdEZhIXeFtGRMWI8OFU+FuAS4VHpQCcutu JcsA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:feedback-id:references :in-reply-to:message-id:subject:cc:from:to:date:dkim-signature; bh=QnqiA7cqOqWHyrF7A1C3zhzdsaPCJ71GOtHW696ZnKQ=; fh=FQcgQPOmGl3rZg8VF3+1ji0KZEvpy/XdHFqbDjtxxkQ=; b=0R6Kpk/Ngm7mOeWUAyzNsUJzB4Ufi/hS6lQBVI0gj9kNz5LuZNRMyp61/vNiriizaz kuY5FWMzhoQFtdDTTSk8jPoqRSgFDrx1luM2ARXhxb7GHZmxquMaM3anlB31dxEad8WR sZ3J9GnvEQxc334XOQuUh3ilhKmFjmxz4PTFNnKpFfMORp0iHcXosatx1dY8PqiZgRv8 lFK+w/zuL+oKVKTNVIdgnDXzAlio4oU4tPm9Q7K5UP7glOQHSuoB4A+y4Cjh9jRI/ke/ TypyYulSX4Y6UUJfM1qafPzeC9lhPKvTvoouQ0KtsUBdMSssJyPJQ2Q455fkoN/CyHrP DHHg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@proton.me header.s=k36xzs2vbbcnhm7bjcihyouree.protonmail header.b=ZQY+fOGL; arc=pass (i=1 spf=pass spfdomain=proton.me dkim=pass dkdomain=proton.me dmarc=pass fromdomain=proton.me); spf=pass (google.com: domain of linux-kernel+bounces-131137-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131137-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x41-20020a056a0018a900b006e54b34bfc7si15312825pfh.299.2024.04.04.01.53.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 01:53:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131137-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@proton.me header.s=k36xzs2vbbcnhm7bjcihyouree.protonmail header.b=ZQY+fOGL; arc=pass (i=1 spf=pass spfdomain=proton.me dkim=pass dkdomain=proton.me dmarc=pass fromdomain=proton.me); spf=pass (google.com: domain of linux-kernel+bounces-131137-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131137-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C350328FBEB for ; Thu, 4 Apr 2024 08:53:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E1797318A; Thu, 4 Apr 2024 08:53:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b="ZQY+fOGL" Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) (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 DC0304597A for ; Thu, 4 Apr 2024 08:53:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712220813; cv=none; b=t0meR3bEzSykL/VzOWAw7lErMhVSpnA70cC/wLCmo9ur5HlJgzBS2qTwMNFbm8bK9v89+cE5Ue5Sv62LM0grfRDHHgnn67V2pUAIzj4PFKTl7Rke8wkJvJU6vUPeBHodkQfseFj61Cq96wnVWkDR8qReYmY3prZ4FogkkVJvdUg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712220813; c=relaxed/simple; bh=QnqiA7cqOqWHyrF7A1C3zhzdsaPCJ71GOtHW696ZnKQ=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=V2WgWyebf8Dsa2d+/0f8TmTn5ldsHNUCNj3c1WkBvzvXnxZA//G9x6zNluzu36bjzaqqtAdWDpNJDJjq+v/NppLc8qQ64EUmg2vO4Enc712SS+UIi/7ll9iqWwGAHzQKdziIfuKFhFSikEL13bezLMo0CRwV57RV/xDntUU1iVY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me; spf=pass smtp.mailfrom=proton.me; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b=ZQY+fOGL; arc=none smtp.client-ip=185.70.43.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proton.me DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=k36xzs2vbbcnhm7bjcihyouree.protonmail; t=1712220810; x=1712480010; bh=QnqiA7cqOqWHyrF7A1C3zhzdsaPCJ71GOtHW696ZnKQ=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=ZQY+fOGLftwavMBKHACHzh9s0Y91H5obfbsw6fw5H+crmXOk5pZI8LXOHr+z+l5vv 0d7/NQct7rZ52LKr4dYu+CiubbUS8cR7sXAMBRlRU6bd0qaXS9hJKl7R1Kdjrb7Ayt 8RYKbusYlRPN2oLFCiiMu4dtOji2Asucv44zKhF5f5okGJ1D8OCcVxG+T9uOLt6NqO U64H3FYS0C/ARjLKzjKcSnPp2QY5FBIHZvKscDBji3qv4Fw2E282Msz+qN2/kkUjFX yCu9esAhSWxPEPApanpPLDijR7qnOrImdmMG+TNrlBY2sZG+gXwE95xFtzza/NpQpD Zyn1D44d5C2vg== Date: Thu, 04 Apr 2024 08:53:22 +0000 To: Boqun Feng From: Benno Lossin Cc: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl , Martin Rodriguez Reboredo , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rust: init: change the generated name of guard variables Message-ID: <331cfa9d-9687-4922-a7f8-5579173d66c0@proton.me> In-Reply-To: References: <20240403194321.88716-1-benno.lossin@proton.me> Feedback-ID: 71780778:user:proton 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-Transfer-Encoding: quoted-printable On 04.04.24 00:38, Boqun Feng wrote: > On Wed, Apr 03, 2024 at 10:09:49PM +0000, Benno Lossin wrote: >> On 03.04.24 23:20, Boqun Feng wrote: >>> On Wed, Apr 03, 2024 at 07:43:37PM +0000, Benno Lossin wrote: >>>> The initializers created by the `[try_][pin_]init!` macros utilize the >>>> guard pattern to drop already initialized fields, when initialization >>>> fails mid-way. These guards are generated to have the same name as the >>>> field that they handle. To prevent namespacing issues when the field >>> >>> Do you have an example of this kind of issues? >> >> https://lore.kernel.org/rust-for-linux/1e8a2a1f-abbf-44ba-8344-705a9cbb1= 627@proton.me/ >> >=20 > Ok, so a new binding cannot shadow the name of a constant, that's a bit > surprising, but seems makes sense. >=20 > The solution is not ideal (for example, a constant can have the name > "__something_guard"), but nothing better we could I guess. Yeah that would also be problematic. I think the problem from the thread is best solved by making the constant there upper case, so it would also avoid this issue. But debugging the error in the macro is a bit annoying, so if someone encounters this again, they don't have to deal with that. --=20 Cheers, Benno