Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp784711rwb; Wed, 28 Sep 2022 09:04:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4kF1OKUJin7uu+AhFmEQEagJs/nRPfsW7KIkvMWFzA8fxIuIN0AmDzQTFQGUFbA9YSfwIi X-Received: by 2002:aa7:de91:0:b0:451:ecf8:e3b6 with SMTP id j17-20020aa7de91000000b00451ecf8e3b6mr33516614edv.402.1664381057895; Wed, 28 Sep 2022 09:04:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664381057; cv=none; d=google.com; s=arc-20160816; b=cCNc/FpdjXt2fgvnbdCM/N104znOqHKkKOgSXOcV+t2nd8pCHLZC5m+8gYNHMTyjWR r8hwTutVmPYWGANlm5o4N/E34sDi73P2BkcoOWKq8ZVf1RGsF7jTemEuiw9UyPa9OIFd MUCs6v34esfp6g0+Tr7beuvb/9DQZWHfD55b4gIplPMeudhFjaz0aDtVfxomVio8Vfd2 Vay2+qvknoiGn5454VSIYxYiWsGIvf+Pf7dhqG3YqxVneAsbxkVEpa/yKABG4kQYJhN/ ZzbaVoe74ssAKTAhG7s18tMzz0czkzQGBprK9qbtVqWXsgx+qdZw1ghQxzQ/CDsMEBpT IGKg== 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=U4dfxCOtpXm2iIv192KdpqzJp/F1yD6Pk1tXFLgpuUI=; b=K7QfJXFxw+lS4+LllAyFK3Hesy+bBzZEmmJwF8tbcPHpxL47KziU5mojMZrnZva6ig loAcCadoFytCb784ICFv3ldYroV4Rk1DQb9eN1ApuoCfL8/IebL/UkrPlI4UHJrCL6Kw lH5hHU+3uLtIv29Kprj/dfbz1ImuCCiW4sM/TfEgrfKzAC3NHzFlmY7V6Lt435iV2HFV QdwfGV08SuBn6ijD/Sfctj1Y5s2ZMzo5rv81WbTSkwm2Ww9HE6yRn1Gs3r35NMZozs7m TjAgUhu+lrUD+U3BbHAbtRQ0XwI2oF6mGg2OGMJ+rwYhE6yQt4uQTOAFR7IgG157ajRq aiQQ== 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 jg4-20020a170907970400b0073d91a38b35si6261240ejc.789.2022.09.28.09.03.48; Wed, 28 Sep 2022 09:04:17 -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; 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 S234695AbiI1Pbg (ORCPT + 99 others); Wed, 28 Sep 2022 11:31:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234328AbiI1PbK (ORCPT ); Wed, 28 Sep 2022 11:31:10 -0400 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95E965E665; Wed, 28 Sep 2022 08:29:54 -0700 (PDT) Received: by mail-wr1-f41.google.com with SMTP id z6so20420542wrq.1; Wed, 28 Sep 2022 08:29:53 -0700 (PDT) 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; bh=U4dfxCOtpXm2iIv192KdpqzJp/F1yD6Pk1tXFLgpuUI=; b=Z9CQjXskAc6LrZDIE2I9A4QZ8wXjAcCsltHUH2Drbj6M63Fc0ZXOa7t37ZJ30YThco tOXNgsPRYaYPoV0u0t69ol3Q324MVNuRq3jArjvb+tLsXeZN0rhtG9CBjRG487IoKPs/ JQRdtgnOM2hEKnai66rIhDXyTXFFslUvSknYyyaTrtUbG6uWIUINteaj7lkehOjZflLs ynIP4vQeMw9zkP5GrnOjTfK53Y/j/P5yT/QZ3ebihsZj6OY6ddrKri7ql2OZvrF701NU JiK/JNqp5Q7o2YG9hBUwULhjESt/f3eugPJLGXemek1TOgAQUV6pnmUQCvRj9j0Hd6sf Klqg== X-Gm-Message-State: ACrzQf2bgodYsJ/sPp9L2WRbfXBufejZPhnbXLLaSqg7gU8K/DKsVbBw T0TeLdeCeC0UjRIg02HZGzI= X-Received: by 2002:adf:f7c7:0:b0:22c:be66:dd6f with SMTP id a7-20020adff7c7000000b0022cbe66dd6fmr6155609wrq.144.1664378985754; Wed, 28 Sep 2022 08:29:45 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id j19-20020a05600c1c1300b003a5ca627333sm2391110wms.8.2022.09.28.08.29.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 08:29:45 -0700 (PDT) Date: Wed, 28 Sep 2022 15:29:43 +0000 From: Wei Liu To: Miguel Ojeda Cc: Linus Torvalds , Greg Kroah-Hartman , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, patches@lists.linux.dev, Jarkko Sakkinen , Alex Gaynor , Finn Behrens , Adam Bratschi-Kaye , Wedson Almeida Filho , Sumera Priyadarsini , Gary Guo , Matthew Bakhtiari , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Boqun Feng , Wei Liu Subject: Re: [PATCH v10 10/27] rust: add `macros` crate Message-ID: References: <20220927131518.30000-1-ojeda@kernel.org> <20220927131518.30000-11-ojeda@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220927131518.30000-11-ojeda@kernel.org> X-Spam-Status: No, score=-1.4 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 Tue, Sep 27, 2022 at 03:14:41PM +0200, Miguel Ojeda wrote: > This crate contains all the procedural macros ("proc macros") > shared by all the kernel. > > Procedural macros allow to create syntax extensions. They run at > compile-time and can consume as well as produce Rust syntax. > > For instance, the `module!` macro that is used by Rust modules > is implemented here. It allows to easily declare the equivalent > information to the `MODULE_*` macros in C modules, e.g.: > > module! { > type: RustMinimal, > name: b"rust_minimal", > author: b"Rust for Linux Contributors", > description: b"Rust minimal sample", > license: b"GPL", > } I don't use / know much of procedural macros, so I don't feel like I'm qualified to review this patch. Just a general question: what is the house rule for adding new proc macros? They are powerful tools. I can see their value in `module!` because writing all that boilerplate by hand is just painful. Yet they are not straightforward to understand. It is difficult, just by looking at the macro, to fully grasp what the final code looks like (though the rsi target will help). Is there a concern that proc macro gets abused? Thanks, Wei.