Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1929697lqb; Mon, 27 May 2024 02:06:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXGgIzWXP/TlhrfYTtrej+2zZPnZL4dN/tS7ud8j5eGprZhFrubyPosjNbO72fkdiPgB6tR+eLoGTnup8V0XCg2C8YubXZ6A+zEH8+c/g== X-Google-Smtp-Source: AGHT+IHWHVZz1gxl5gFZIHpH2uQefbMhTdA1wC2pfKrPeHONO+1saM/0le800TaOz+uW98YaGACg X-Received: by 2002:a17:90b:2395:b0:2b2:b02d:3ffd with SMTP id 98e67ed59e1d1-2bf5e18a697mr7408684a91.15.1716800802528; Mon, 27 May 2024 02:06:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716800802; cv=pass; d=google.com; s=arc-20160816; b=Yr/5+AEQ7AetnUOGYXfy1taTxZc99i4LhivAs7sa2sPwv+2rm/B3j8IExF/uIwTqsX bD4t+id8CTSNwkVxL5etmOkghDpsft7i0ycmOEIm5uoVLJTaPO2aGiyfufkUujCIFLFZ wV2oBrNnjOesrlF5tNPDX0D2iQY6L2fTFy4WpbxhAqpzMVgDF8vfmZm0q9jchHNWEmiF MjhLOpCtMTOlss6R/xzGw7qidowi7kebe9gyoctbEzChhbWyR+DefzKplIHzhBRWuwvv GnycudlNHfgLXzeqzZfbZmF/SDpIByxWBePfqqzFj1McT32jtaS6+hc9IYBiaSR4YAH6 9FrA== 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=eWYAa62mplnIee/PxwqE9tQ+/yU4Kvz6fi5bUurZVcE=; fh=ZyE9Pbvv4g6xNJjVt5rvWlIrW5p/Rq9IkNVdS7HTLI4=; b=YzeNk+lZ4bU8RlOXrVynU8z/cLFB2DCK/W0EnkcYTUt0n24A6xvsPitaY4yjpJSmaq hGrnapxge/i7lNYijWT4ac/GLjr7bcRkgWYSXclWXQY/kBBY/T0DVybRkhQXpr96lfET OUA3iyXw2VztktL+0IiOYTlthuLDDBIGdyQAUpF7mzOOPaGbmKCGedcXdD7f7rLztSQC kJE3oFjG0TKkPZznzc2HBsf06XW2Y1Ztrpv/EpniqsblHCX/TOmxkeohJ8YCGKZ52lmO zHiZOOHv7FScg7eqFB4I8QYSO7b++1HtU57oP05LOWZH4v0Ag4jJ6DkTUy57sEybP1Bj z3bg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@proton.me header.s=s7sakbwcgrhzfdh7vyosr47e5y.protonmail header.b=iEOAw9qe; 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-190286-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190286-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bf5fe60702si5799327a91.143.2024.05.27.02.06.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 02:06:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-190286-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@proton.me header.s=s7sakbwcgrhzfdh7vyosr47e5y.protonmail header.b=iEOAw9qe; 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-190286-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190286-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4B4C1B2180A for ; Mon, 27 May 2024 09:06:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 956557764E; Mon, 27 May 2024 09:05:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b="iEOAw9qe" Received: from mail-40133.protonmail.ch (mail-40133.protonmail.ch [185.70.40.133]) (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 7B78E6A357 for ; Mon, 27 May 2024 09:05:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.40.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716800753; cv=none; b=SejIsCuc21p5rZEEIPw1DqlDq/It2f/1+aXtDscyVsbUA98IbQM/D0EC1JweNM9iYQ14OEOWw3Cp52pzV5QYL1WCvqEuO5XAEa2yxkHrpvFK+/aAuEGyDonKjqCsXwgYhj4BqTI/qbdZmzyeXN6Ls2AbKC7arv//syzuK6NTV4o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716800753; c=relaxed/simple; bh=6HascMYOkFkuQtYLQ9eeZm6r9t6P/M/iXsDNN7DFtkk=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Wgyf+Ei6RmzMZhakbQ8ss0LTxDNGr4i0x8+YZjnJfzKJcvKanO5CEXqXMrFsQRaCggPiOnvQpidQZYpWNUJlOUDMP7Hajvyq5ZczgcVaY7ScdaMzFEDwyJ9BLwcgVhprTpej8WdK9W5JZ7LM4vCWcCKUHdlt7WZrGrGYns0whFw= 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=iEOAw9qe; arc=none smtp.client-ip=185.70.40.133 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=s7sakbwcgrhzfdh7vyosr47e5y.protonmail; t=1716800743; x=1717059943; bh=eWYAa62mplnIee/PxwqE9tQ+/yU4Kvz6fi5bUurZVcE=; 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=iEOAw9qeFwIc5CxABtDYxWkNq1aNje0ZtEH1FVggmHGmD2OCLWTWs3H82yerWuHr/ ZycWOaj49sUO3IZhjeXvn3h5c90mYvIrfZSxHitbWmIuemuwQZOJPJm7wQQSjx5eym Zz3vwQeIKU4cPkz60aDKWGmAajvDY1EqlxS85b0IcflD5ykKCSo+ifuirFVagSb3do WUHeNWi8XCX9SnqIsywtMqJXBvzISev5AzpfudUBVDAM3Sm3fPyRQh+dEVbKE8mLT7 VnI5+rlv1F/EOCP4x71l+L7b3qsBzv0pfvK1VIFwTwq/mFdWc7fFIpKfKLhKAFMGd3 rZPxPJrvJpN9g== Date: Mon, 27 May 2024 09:05:38 +0000 To: Alice Ryhl , mu001999 From: Benno Lossin Cc: ojeda@kernel.org, boqun.feng@gmail.com, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rust: kernel: make impl_has_work compatible with more complex generics Message-ID: In-Reply-To: References: Feedback-ID: 71780778:user:proton X-Pm-Message-ID: 54dc41b8a922308e1de60a831883488517210686 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 22.05.24 14:37, Alice Ryhl wrote: > On Wed, May 22, 2024 at 2:27=E2=80=AFPM mu001999 w= rote: >> impl_has_work! { >> - impl HasWork for ClosureWork { self.work } >> + impl{T} HasWork for ClosureWork { self.work } >> } >=20 > I ended up doing something similar for the generics in some of the > linked list patches. Does anyone know if it's possible to support this > without giving up the syntax? I tried to come up with something some time ago, but it was not really nice. You have to parse the entire generics manually, which ends up looking horrible. I have been thinking some time now that a `generics` fragment would actually be really useful in declarative macros. I also thought that if we get even more `Has*` traits for intrusive datastructures, we could add a unified derive macro that allows you to just do: #[derive(Intrusive)] struct MyStruct { #[intrusive] work: Work, #[intrusive] timer: Timer, /* ... */ } But I thought that as long as we have only two intrusive structures, we don't need this. --- Cheers, Benno