Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp336104rdh; Sat, 23 Sep 2023 12:35:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENk3Ab0Q+YCobi8mMP5o6daFFJR3winJw2tm7UfPPkjTCWXMH46oeaTSkCKKdk/hM2wkeG X-Received: by 2002:a05:6a20:244a:b0:14c:3218:c1bd with SMTP id t10-20020a056a20244a00b0014c3218c1bdmr3628975pzc.11.1695497755169; Sat, 23 Sep 2023 12:35:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695497755; cv=none; d=google.com; s=arc-20160816; b=Ap3waFmDxsoX2AzxO4i1+qzmkD4UKN013PbdMHnwuAUljWSVdAFB96CzbbK9H3sCWm 5W7g5lXxoAxDn5e0HGMmoPtl95WH7k+S6zJ0sn0YUEHRmG6flreGKrI9QlDDiCQrw0OY rHEbWMGICgr3bbt4xV8bZW7XeQKQuPi1A74dOSTvF0MiVbPSZBRAF3CBP2hFqIn7yEJp e5Y1hdIT+Vg/jWd5PXbir2judImkB/lCcPz9Xrp0KzwgYMn4ZMZMaHUvBrkCv12dfska m+EDznSFQjG0Xo3KD8l/XD1yLg0XjTzPb7+MJo2YZkoRWKB63GcUUzve5iEHfpUojWv9 nj8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=XJfGRDLZlJ3GE0W4DAhvHHTAFHaYgV6lA7zrG+qb0E8=; fh=xEIoKxzkcaSnHAiyHeXJK76ouPVhMOytHvfopR5vlBw=; b=iZUJKxPFKO7e/njcBM+J7rgQbX8GiNyP//vrfWKkPYz/AGN1Mi5HAoBKvX9sVCOEoP wghYQr66tkzPDSQT0kFidr8m9Ua6hjm5Qd7om1UFHhZlMqOBtaBW4tfUqOTgQcbLTvnq 7nxxIIStkdP1EkmDnL3Eyx8gFwc2RfJ/lY++WNOUPt6EMh3klKA9lWxc8OmjODD/aCFP Odo4/jIgwsvogMFjkC8r4DCA19w8JTBfqoOGir9MXfV9xVE8lL+6Uu8g4aFN8QL8zRv4 iPJKbhIZVI7OjDK/3Ga0b8O6FyzYTTkWIJcIYsvl5mPmYK1MDivn0c+ADvqyacO/9wI2 a+Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=meFoafKK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id my18-20020a17090b4c9200b002770c306d55si4992392pjb.87.2023.09.23.12.35.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 12:35:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=meFoafKK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 82A8C826103F; Sat, 23 Sep 2023 07:11:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231591AbjIWOLw (ORCPT + 99 others); Sat, 23 Sep 2023 10:11:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231307AbjIWOLv (ORCPT ); Sat, 23 Sep 2023 10:11:51 -0400 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C5119E; Sat, 23 Sep 2023 07:11:45 -0700 (PDT) Received: by mail-yb1-xb2e.google.com with SMTP id 3f1490d57ef6-d8020510203so4203010276.2; Sat, 23 Sep 2023 07:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695478304; x=1696083104; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=XJfGRDLZlJ3GE0W4DAhvHHTAFHaYgV6lA7zrG+qb0E8=; b=meFoafKK/k2lSBOUkXoFg8ZKHxt3dBmuBxUJTy7+2o16z5cSqgSA+8BKWugZS/YD2i SnmLlXHyFWDgNf4pXwUbjk4Kp2TPlhQO/umgFDQFrVkQ6GrYQy21/+vUphpFDAX9s0vX EwCnkxJLEwRyWu3sIzcbdQyQdLYbXAtL/V6sFqdaJpnVjbIKskNJEVQmiwMlaaMbnbk2 jzo3VO95280AIWdyPR7U7prtVYByLrg6LVH6rUBCGkoLE3WrWwlfEWGr/AkhpD7qe+Jp uvLR0GrJCC+GFJ/604nHEDsHl674aqThfaLxYS5eULhrLE0kyqym47u5KjZrbwkY9LlR mpEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695478304; x=1696083104; h=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=XJfGRDLZlJ3GE0W4DAhvHHTAFHaYgV6lA7zrG+qb0E8=; b=dBwsWrVw3nCgwv5fwOVBmQvqsr6zYgLsdm7JCKR4KOuegR8E/8dfDSVE+oPwHerC+c RBijZvuPyNovl3Z4CLdf8OT6zddSCwry64CTuOc6HyFc4tP6obIMugkDI+F3fSBJAxvX 20n6W6ttFDkiTQKy1IgJYRLZQdRD2ReA3ZRKkggac6qwUJVGe3yZvKFuqtDeGMtyr2l9 wLfOk9I8bUXmpZG5ERt6BaLCGsJmvf/2Alho5TSpUg91E4rffGXY4zI43/pVCyBspv/U 5cp0VWgxVUBz+kEtsiRRADzqdyKLirP2SeYVfgm7CZ+PzLFAcPAJ4TvZ+eS0oQ4jG+wO /tuQ== X-Gm-Message-State: AOJu0YzNL+xFqNCfsIPRKtpGK4TPhM0amXTYXmeXLv21IgrFz4K4xura 4Z3Xg6CRV7Vt87jMBF/DWuaU3WBsznFp+qAdTxw= X-Received: by 2002:a25:d342:0:b0:d80:1263:2752 with SMTP id e63-20020a25d342000000b00d8012632752mr1814013ybf.60.1695478304335; Sat, 23 Sep 2023 07:11:44 -0700 (PDT) MIME-Version: 1.0 References: <20230921213440.202017-1-wedsonaf@gmail.com> <20230921213440.202017-3-wedsonaf@gmail.com> <20230923081251.2f702cc7@gary-lowrisc-laptop> In-Reply-To: <20230923081251.2f702cc7@gary-lowrisc-laptop> From: Wedson Almeida Filho Date: Sat, 23 Sep 2023 11:11:33 -0300 Message-ID: Subject: Re: [PATCH 2/2] rust: arc: remove `ArcBorrow` in favour of `WithRef` To: Gary Guo Cc: rust-for-linux@vger.kernel.org, Miguel Ojeda , Alex Gaynor , Boqun Feng , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , linux-kernel@vger.kernel.org, Wedson Almeida Filho Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Sat, 23 Sep 2023 07:11:53 -0700 (PDT) X-Spam-Level: ** On Fri, 22 Sept 2023 at 21:13, Gary Guo wrote: > > On Thu, 21 Sep 2023 18:34:40 -0300 > Wedson Almeida Filho wrote: > > > From: Wedson Almeida Filho > > > > With GATs, we don't need a separate type to represent a borrowed object > > with a refcount, we can just use Rust's regular shared borrowing. In > > this case, we use `&WithRef` instead of `ArcBorrow<'_, T>`. > > > > Co-developed-by: Boqun Feng > > Signed-off-by: Boqun Feng > > Signed-off-by: Wedson Almeida Filho > > Reviewed-by: Gary Guo > > The implementation looks good to me, thanks Wedson. > > A minor thing that worth considering is to implement `AlwaysRefCounted` > to `WithRef` and reimplement `Arc` with `ARef>` or add > conversion functions between them. > > It feels natural to have this this impl (because `WithRef` is indeed > always ref counted), but on the other hand I don't currently foresee > anyone to currently want to use this API :( Yes, I like the idea of defining `Arc` as `ARef>`. My concern had to do with error messages for type aliases but you or Benno (or Bjorn?) had a link to plans from the compiler team to improve this. And we're using type aliases for our locks anyway. So this change is in my queue. (As well as the changes to the guard we discussed a couple of months ago.) Thanks, -Wedson