Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2520947rwb; Fri, 2 Dec 2022 10:55:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf6CxWFKW6Pmn7mghhLvPuim6BBQUAjZuTjFERJe7em8m5tRHE+iYH69zD16AUowNI1bIF7U X-Received: by 2002:aa7:db19:0:b0:46b:fc0d:ddc0 with SMTP id t25-20020aa7db19000000b0046bfc0dddc0mr7182888eds.214.1670007350631; Fri, 02 Dec 2022 10:55:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670007350; cv=none; d=google.com; s=arc-20160816; b=ssvCplYp1j5p1by8enUFFqCBx83Nc9WKX5SvNYoGwlHepfp8CKClsmFk/66/oLbSGD bB6UlPCZvQJIRHs/VP2MnddstnvdKYmVLmP1Ame9zRDstpzjqL3KatZjXCtQ9xA27PjB B1k+deyyyw41KYc+yz2SHuGsK+H5tCjbHI0GNjtnFBKoZnt8Bb/o6gBakjxmlxEhV4Vw 6D0f/NU3/PAheWk/IhU8seI4T9t0I61gz+UI1KcS/UN5pTvf6kJtgTGrE1HS+zKrz47o DtnzlIAnWxCu5/2z20FQ1j85LnpOf90+PIToARHnVM8mhur+zRGAwyx9jQack5KJcBew Fhbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=CeBhZUYHhg3CPbWZDIA1bo33xmoBi75eG+8d6a4d4JY=; b=G56wGMTd345Oi6BUjmDq7K+0bwHJRoRiOg/w/AVZJXLHw4ZwyiGC0ZRVd3/9GE02lS vpLFef2Xkz/ohe91rLP5bv6isLJ6zBaSRqAeOHiUxhFsmDqgHz3a3k7X9z6Kuf/X6r9q mtwb6P9ALsSSUWpsjpi1TRpMJJbnIR471XJM5jPieHjuNN9Z+QoceKveUfXAG02KCTJD vzHYC98t7iUfnhM624/v3WBpF3wuk1Oco6AJBBdCNFo8/9nwarfxQRrzMIKzZVrXgQF9 EDoaLZatqGaS7dYt1hZ5MuEm8aTR8gybPzOtJtrBL57pi1IZvBsyLwDaRYkmDLh+J2ZZ Eutg== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr10-20020a1709073f8a00b007addf59b7f5si7218311ejc.794.2022.12.02.10.55.31; Fri, 02 Dec 2022 10:55:50 -0800 (PST) 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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234483AbiLBSbj (ORCPT + 82 others); Fri, 2 Dec 2022 13:31:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234122AbiLBSbc (ORCPT ); Fri, 2 Dec 2022 13:31:32 -0500 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94517E988D; Fri, 2 Dec 2022 10:31:31 -0800 (PST) Received: by mail-wm1-f43.google.com with SMTP id m19so4136133wms.5; Fri, 02 Dec 2022 10:31:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=CeBhZUYHhg3CPbWZDIA1bo33xmoBi75eG+8d6a4d4JY=; b=Y/oq5S7OnRLJDxbRbTYzisUArF80/DfLBpchOwLA6Mv560zDfYg++CZpyQpW0N8f+y KDiHkI6OwZJCS+wwlZpUE18WdmOuBLMuXq8S0hDvtgu+LyVCdXfA5WeL5Hm6uH9WnMoy sos2rOZ7w1XtpyZKa0uaK70iJFbom1x2lgS1X29RCore6e/tNos3ZFEtDuLQnBjZxAvq nKllZsn0ykwlmBZLZB7Z9/9hUzAzHdqBJktNNQz3g8+hlrZpdSiXjJ5Gxq4lIXDkFFZ7 nu8U6OEeGEl8gxLI7Oca7P0PuA5zTdfr15eYsYkMBvel3/A8NDSsJUuZHs3HoLACu3Qv PKHg== X-Gm-Message-State: ANoB5pkZU8Z/C9St++MrNEnqiqqkw4z0XajERrcjpWpHz1uhslbFf1hC GePFLSUpafR2FoFyZjB/T8o= X-Received: by 2002:a05:600c:1e89:b0:3d0:7d89:225a with SMTP id be9-20020a05600c1e8900b003d07d89225amr6390068wmb.167.1670005890235; Fri, 02 Dec 2022 10:31:30 -0800 (PST) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id i1-20020adfaac1000000b002238ea5750csm9459625wrc.72.2022.12.02.10.31.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 10:31:29 -0800 (PST) Date: Fri, 2 Dec 2022 18:31:27 +0000 From: Wei Liu To: ojeda@kernel.org Cc: Wedson Almeida Filho , Alex Gaynor , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Wei Liu Subject: Re: [PATCH v2 25/28] rust: add `build_error` crate Message-ID: References: <20221202161502.385525-1-ojeda@kernel.org> <20221202161502.385525-26-ojeda@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221202161502.385525-26-ojeda@kernel.org> X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Fri, Dec 02, 2022 at 05:14:56PM +0100, ojeda@kernel.org wrote: > From: Gary Guo > > The `build_error` crate provides a function `build_error` which > will panic at compile-time if executed in const context and, > by default, will cause a build error if not executed at compile > time and the optimizer does not optimise away the call. > > The `CONFIG_RUST_BUILD_ASSERT_ALLOW` kernel option allows to > relax the default build failure and convert it to a runtime > check. If the runtime check fails, `panic!` will be called. > > Its functionality will be exposed to users as a couple macros in > the `kernel` crate in the following patch, thus some documentation > here refers to them for simplicity. > > Signed-off-by: Gary Guo > [Reworded, adapted for upstream and applied latest changes] > Signed-off-by: Miguel Ojeda Reviewed-by: Wei Liu