Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2564971rda; Wed, 25 Oct 2023 06:31:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAv4ibZswCrtx0rKAlE30V8gVVYSMXWlNcEXMeeurO/nhyw0H7aoy9zk5mwlHo9nrIenSL X-Received: by 2002:a81:65c5:0:b0:59b:fda7:9d7f with SMTP id z188-20020a8165c5000000b0059bfda79d7fmr15683076ywb.49.1698240674323; Wed, 25 Oct 2023 06:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698240674; cv=none; d=google.com; s=arc-20160816; b=GlzF2MDqdj/CkKWOIddlSm3hIrEU5Ek4xbz3M3LPuzyeofJ0KGk5RzVRTqt1Uv0YCy 2NBP7H/N4ZKXHxvzwgEu+FLetJzVDEfwCAxpTQwHECZhYyx9CS8hCe7jtC06cl1CpwXF lQJbjSN6Eje9Sjv8XvfNIJruykRLQ5dncz4GVeezAleUNjxrq7Em67c/GM16CrJnVk5a 1jVyWrHDVg+OQhPZFpj63xXaNRxaPSy+Bfju6CxYHPU6ex6AeQdVnZQAapuMGlYNJKva 8umFVCsFoUzMPAaz7P5Vl17V2s+Ytc6fNBbkVdNP0W61raK6VwfxNtNvEMhdvpOuu1/G CbQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9FCfEKDsSxj0UbnaNrhG13AiQF2xaylJwEFbU7V7KMs=; fh=0Bbd10yeIBvfMVQjxlgIyWfBngIsfr8kfSiLwTONfj8=; b=R2E981lhrUGmintHFQwfNa2l/xdt1uFfmqq0eU/AEfnB+hmVn/IH4INfWnb3SBIblW aJUEDkrspnFAUM0B3jVL9sayn8QHcFos9J85PSiFI7Ntx8S/Eo+3zeKxI88wCSHTeWj/ 0JjgDM9K3UY/+l0/S7IQUYHaarOMX512Gjy1RonNX3G7gry2u+2/2Iv2Mlsm0Y81HDhP XJzim8iWo3K5TYrwAtbdp9tInLd/voEHNRKTACN708YZM4mO1Uk6K1eH8fpTLOoIglyw XmXB/FCJquq9Xye08XhvTAqoPHhvxJyqv1pnq3Mno5RC6MclC/o4pRfb5cIgcUMqIQD0 pVKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=hIktdwxp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id z67-20020a818946000000b005a7b512d0c1si10580705ywf.141.2023.10.25.06.31.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 06:31:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=hIktdwxp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id F0DDD807DE3E; Wed, 25 Oct 2023 06:30:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344548AbjJYNaN (ORCPT + 99 others); Wed, 25 Oct 2023 09:30:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343840AbjJYNaL (ORCPT ); Wed, 25 Oct 2023 09:30:11 -0400 Received: from mail-vk1-xa31.google.com (mail-vk1-xa31.google.com [IPv6:2607:f8b0:4864:20::a31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A1CE132 for ; Wed, 25 Oct 2023 06:30:08 -0700 (PDT) Received: by mail-vk1-xa31.google.com with SMTP id 71dfb90a1353d-49dd647a477so2094542e0c.3 for ; Wed, 25 Oct 2023 06:30:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698240607; x=1698845407; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9FCfEKDsSxj0UbnaNrhG13AiQF2xaylJwEFbU7V7KMs=; b=hIktdwxpd9E3a7a/b45fH2I/23koFstKRUL0OUVCY/6eEPeerRP8Sk0f+GP044xPj2 fM+6cmb8yqX7AXWr90cqddHS7krSZZerL5gWsAy2xNonzoCTWwN6RvZ+gAYK3gT6hjil R0o+6KxKkSet9cDuNKgZJLOVEorn1vjyoWDg2nVQhiyD2MYZRqwPkk5LMladSs8MHiYr QtCiaSd72ERGxRwIgLNazjmOr/JPeyl986oAbHU4u+c0c4sZM9oXq8C81uMgLQ7fmB/c Y2p75VP372Ybhmd73h/xysJ9zHCbhfz37FQsGQGjng2wReEZah9glRoMYvgP5oirYbSR caNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698240607; x=1698845407; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9FCfEKDsSxj0UbnaNrhG13AiQF2xaylJwEFbU7V7KMs=; b=cARuosKP7JGOUmyH5MLiHg+Rp6SrU9P6jtjYF2jd9z4VhVgWxfURBPgz5+PeZM88Fn WC/53tBW4ouPxO7K1eGuQ+H8iedf29BOzfsvETfjZy1w4HRemKISce3xTeTohbU9P3QN ZBiMCdSwEJZfEzXMHg7DFCLhsX6tz8Yj7pr/dQQfAhhtKhZw54ZyUiYZlUR03vxl0vo/ QvBJiL1g8kOwgqFMgSSJ9lfWKe8z1pr0hYnvB56QZXPPGuwZxvx/WbiNaSoBqHLWlc/a XweKWm9fAIt7ryI4Z3Q4sdy6o7OZxBAsqGbSKZgM1zCK93K6M1fst0o4TlHZCK7ARDM0 iV+A== X-Gm-Message-State: AOJu0Yw4ChvDBop8I6ATD409sxdntCkMon3cyB/x2wU5zidgO93Xtcc5 ax29btL/9brk8d5Jank7UeEMRCGET9Egma+0tIbFsg== X-Received: by 2002:a05:6122:d0e:b0:49a:6742:b176 with SMTP id az14-20020a0561220d0e00b0049a6742b176mr14979846vkb.16.1698240607437; Wed, 25 Oct 2023 06:30:07 -0700 (PDT) MIME-Version: 1.0 References: <20231019171540.259173-1-benno.lossin@proton.me> <1cc11492-248e-4b37-9608-b475acde3da2@ryhl.io> <06d27457-6b6c-4392-9be1-d1fecfbfd9f3@proton.me> In-Reply-To: <06d27457-6b6c-4392-9be1-d1fecfbfd9f3@proton.me> From: Alice Ryhl Date: Wed, 25 Oct 2023 15:29:56 +0200 Message-ID: Subject: Re: [PATCH v2] rust: macros: improve `#[vtable]` documentation To: Benno Lossin Cc: Alice Ryhl , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Miguel Ojeda , Wedson Almeida Filho , Alex Gaynor Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Wed, 25 Oct 2023 06:30:22 -0700 (PDT) On Mon, Oct 23, 2023 at 9:01=E2=80=AFAM Benno Lossin wrote: > > On 21.10.23 14:45, Alice Ryhl wrote: > > On 10/19/23 19:15, Benno Lossin wrote: > >> Traits marked with `#[vtable]` need to provide default implementations > >> for optional functions. The C side represents these with `NULL` in the > >> vtable, so the default functions are never actually called. We do not > >> want to replicate the default behavior from C in Rust, because that is > >> not maintainable. Therefore we should use `build_error` in those defau= lt > >> implementations. The error message for that is provided at > >> `kernel::error::VTABLE_DEFAULT_ERROR`. > >> > >> Signed-off-by: Benno Lossin > > > > Reviewed-by: Alice Ryhl > > > > There is a minor nit below, and in reviews sent by others, but overall > > this looks fine to me. > > > >> /// # Examples > >> /// > >> /// ```ignore > >> +/// # use kernel::error::VTABLE_DEFAULT_ERROR; > >> /// use kernel::prelude::*; > > I probably wouldn't hide the import of VTABLE_DEFAULT_ERROR from this > > example. > > What do you guys think of putting the const it in the prelude? I think it's fine to just import it. Alice