Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2632241rdb; Mon, 4 Dec 2023 03:16:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtLjI760ojKDCgiP31H2S3Hjdc6letyMEEMVHhqZ4GDbps0YGMr6sV0dAR4+RA8FPkt5Hr X-Received: by 2002:a92:d852:0:b0:35d:481c:5bcd with SMTP id h18-20020a92d852000000b0035d481c5bcdmr2706398ilq.16.1701688562226; Mon, 04 Dec 2023 03:16:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701688562; cv=none; d=google.com; s=arc-20160816; b=bXVCNjRUhTFGcZnykjqDKvRUqyAMDgn67FD8VYTgKbzuHsXzQmPdAJm+kwb+m5Fqf5 0iNJxSm/WdFORBHniJKQVRS22iG4kvSS0QZ9qc8uJfl6pmmYWOMCa5f9Rrg2VMNMWb/Q IPUY+d2T51m29YFXLz1/6QndEtDQ9SRA5ekpElth+10Odk0LZcyI9Vclq2Yaoh9bC0Dw KpwBkBmTj8+5q2bFUS2kxts0xKC6zGYj+orh5lS58f731egfkq67NIwd2UmoOWVcITqN a0K5e0xcZQUSJG3hIu/fPGFfRAO10z8Mutrp/LTNZTfzSRIg5mwDdZ0rkLGUF2FP81gZ cIyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :feedback-id:references:in-reply-to:message-id:subject:cc:from:to :date:dkim-signature; bh=vkp04PZwWHUkLIZ1OExVvH6dLTQjFbLCFc6Sin2elcA=; fh=RgDUCnRx52cigm4kjneQ5pKreBWxAqnmRY9R0ad9Oqg=; b=KMrMi461Cm3dP2jyzsPqnIPlPLZ7CIbeAfLqBpxls4nN7ngaSywUg8Uxrqz+yJRaIa 7KtncACmjjgpAUE3wuSFRcRmHYNZLDoLdq4skhkVSU/63DEkTemdWYmn3L5xGzB/o715 gyvrFJ8HptAYvK/YldVI6AzUDBVk5mqEnI0bkkhGUNs8QuFgKkwfF/zeQoP0tAgyUBqE gQ+CKoBrFcIJzqH76srqxsW9h+69b7Ojxw1BYpXERqCUAIzUFq+vPvDEBkPTVzTIlQ3o arBv0ZhGyYOwJI/YRakPWy9Yn653NP1r0nvrtLjM/FJNaGA7BgyWMNfdjWCgOdkGnBKE z/2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@proton.me header.s=wdytburcmjh6jg34thzange6ou.protonmail header.b=HDrnl0ty; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id q26-20020a63f95a000000b005b95ccd1b4dsi7406435pgk.82.2023.12.04.03.16.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 03:16:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@proton.me header.s=wdytburcmjh6jg34thzange6ou.protonmail header.b=HDrnl0ty; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 857CA80758C2; Mon, 4 Dec 2023 03:15:59 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230012AbjLDLPn (ORCPT + 99 others); Mon, 4 Dec 2023 06:15:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbjLDLPm (ORCPT ); Mon, 4 Dec 2023 06:15:42 -0500 Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch [185.70.40.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A814BD5; Mon, 4 Dec 2023 03:15:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=wdytburcmjh6jg34thzange6ou.protonmail; t=1701688543; x=1701947743; bh=vkp04PZwWHUkLIZ1OExVvH6dLTQjFbLCFc6Sin2elcA=; 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=HDrnl0tyex7UpL+oWPgEhTI89lR54awUuNhLx3hfw3lUyx3NeYoOqTlQfaxbysOO1 g3fgzPJv4geFCu9t2xAKsctEPDjGmXCAoyUZ/0zymh7iV08/GMZy1A2hIKDpe5Cpcx g5PrtK+cILUqz8RDhc+8bU0DszWHZAomVGxuXCgN9EZGtHBszLro7AYJdBrHSAc2nM OLw4/eWq01biCOHw9gB+7bS5dEm7zAfzugmE2ntL3JXTA5rAGGCeO5fhtLb/eFIQhp 3qUgTkDaa9fnz3SxZqrcXW3VSu9f4sJzWxRpaY3CO6DAx4rwB5AGZA7iljZtWaYVYn D9Nkm+IWs+/ww== Date: Mon, 04 Dec 2023 11:15:26 +0000 To: Jarkko Sakkinen From: Benno Lossin Cc: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl , Martin Rodriguez Reboredo , Asahi Lina , Sumera Priyadarsini , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] rust: macros: `parse_generics` add `decl_generics` Message-ID: In-Reply-To: References: <20231125125024.1235933-1-benno.lossin@proton.me> <84da128f-17b3-4193-8389-176a8c961d64@proton.me> Feedback-ID: 71780778:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 04 Dec 2023 03:15:59 -0800 (PST) On 12/2/23 18:33, Jarkko Sakkinen wrote: > On Sat Nov 25, 2023 at 5:39 PM EET, Benno Lossin wrote: >> On 25.11.23 14:39, Jarkko Sakkinen wrote: >>> On Sat, 2023-11-25 at 12:50 +0000, Benno Lossin wrote: >>>> parameters. This patch also changes how `impl_generics` are made up, >>>> as >>>> these should be used with `impl<$impl_generics>`, they will omit the >>>> default values. >>> >>> What is decl_generics and what are the other _generics variables? >>> This lacks explanation what sort of change is implemented and why. >> >> The terms `impl_generics` and `ty_generics` are taken from [2]. This >> patch adds a third kind which also contains any default values of const >> generic parameters. I named them `decl_generics`, because they only >> appear on type declarations. >> >> [2]: https://docs.rs/syn/latest/syn/struct.Generics.html#method.split_fo= r_impl >=20 > Thanks a lot of taking time for explaining all these concepts in a such > a detail. Appreciate it! And I apologize for my a bit intrusive > response. No worries! > I really think that "more vocal and verbose" than "legacy C" patches > would be a great policy for Rust specific patches. This would help > audience who understand kernel but are not as in Rust to give more > feedback on the patches. I mean tech is still the same whatever we > used to implement the code that enables it. I agree. One thing that we are already doing is encouraging documentation, see [1]. We also use `-Wmissing_docs` which makes the compiler emit a warning when you have a public item (a function, constant, type etc.) that has no documentation. Rust documentation is placed directly next to the source code. This helps keep it up to date and makes it easier to find documentation. [1]: https://docs.kernel.org/rust/coding-guidelines.html#code-documentation Additionally we can make commit messages more elaborate. Though we probably need help with choosing the topics and depth of the explanations. Since when you are already familiar with something, it is often difficult to know what is hard to understand. This also holds for documentation. That being said, I think that we should not document common Rust patterns and properties. I think you understand that we do not want to write code like this over-the-top example: void init_foo(struct foo *foo) { // `foo->value` is short for `(*foo).value` foo->value =3D 42; } I am of course open to help anyone understand the Rust code that we upstream, by giving pointers to the relevant Rust resources (e.g. the Rust book or std library documentation) or explaining our custom code. We might even find something that should be documented better and then I will be happy to do so. --=20 Cheers, Benno