Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp389857rdh; Sat, 23 Sep 2023 15:30:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFYgTWThXJa9DQGjjL2+7afbTWuE7+2FXQEfeICQMZREK0lzDKl3t0moPKSuwZXOHtqoC0x X-Received: by 2002:a05:6a20:9154:b0:15d:b407:b0a0 with SMTP id x20-20020a056a20915400b0015db407b0a0mr4548997pzc.26.1695508251972; Sat, 23 Sep 2023 15:30:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695508251; cv=none; d=google.com; s=arc-20160816; b=VBprTAInQRQ47ODIh6lZsa8mKfksJ5Ggls4VMv4IrxrC+BLX8qaXkigaaGWjMXYbnK S0lSuwCUc3W4VXYmR4fA9A4zLpfy6/NeCqv9/h56SRN1bJGTS+LdOnb0SmOJLfHINxMW ktyP/ODmpgOHClzI07sfgeaWqdZcz1G0hrdl7JA1mN5larY7ifMMDVfcKQlIRMCNdPUQ 2I7G1m+StaTFtnt5Vtij9QjuOc+31B179VV5zCawj2I0Ffyoo1qIw+61XNPd03/p0or4 fSbjdf16u1hiKEjdRtcen6k7b1QvI83C25w+1PIqsj1dRlMftG/kUKgO+EhBHsSZd+q0 bMbA== 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=jBl/h0an7nIUaCEYje4Eux0NrQkvTENlUgF4eKZqlAU=; fh=I22fX0u0+edBfojMy+kAOulIPWTD0KwpMU1aea2MSRo=; b=NGFiHLQlcZZZ1cPiIBQW08qdXj9C1ptHQ4z67WlwOLMYfaP5/rX3IWIBJZ7jKJgMHv fGMHuC2siabBienkMRVdDfc8d7JlttvjIF34SCgQZFu9J9ArjBVsnt8UgpThK5FcIBFV LjGVS+hEh7ofOy0M0fFF9rsjjAaWx9Flf9TkW1URU/A1rJHZJJTlM1DlJ5zdr4IB2lhm 8vk9uXi4tHVo2LeV6fga1X47bJRiTGWC4VG3FNlXiZRKGy8flwI9gfxVB7tpnhSMe5ul iZ8C5/JSdcZytAfpxmPdR5/yC81u0+qGKBzH68X+RYWRy/ApRoJBNT1XLVIhixnevTu0 JY4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HppP1Xml; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id y72-20020a638a4b000000b00563f8e3fca8si6483576pgd.49.2023.09.23.15.30.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 15:30:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HppP1Xml; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id E689883A63D1; Sat, 23 Sep 2023 07:20:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231307AbjIWOUe (ORCPT + 99 others); Sat, 23 Sep 2023 10:20:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229962AbjIWOUe (ORCPT ); Sat, 23 Sep 2023 10:20:34 -0400 Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB5371A5; Sat, 23 Sep 2023 07:20:27 -0700 (PDT) Received: by mail-yb1-xb2a.google.com with SMTP id 3f1490d57ef6-d867acf14aeso588218276.1; Sat, 23 Sep 2023 07:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695478826; x=1696083626; 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=jBl/h0an7nIUaCEYje4Eux0NrQkvTENlUgF4eKZqlAU=; b=HppP1XmlAcMPDGUfYm/vNV8fQx5Um/6QMgS6FyqihDvYbTLRwTNUNOJ/tYCNQ1d0Iu jFstWs6OAWiXP8srG5QMfSe1fbBP+dbduf2U9bx4MJgbpEqV29f4fhBi6TD8Xi0BLNDf s1Kyd05RfAtfdlnd/Rb22jIBMdyMLL+eePRPBy5hdesjlP64ewHYSWLLKNvwBeRdaCyg Rt40UDiBtMifb2Q3lUU4qjTNX+XpBpktzaiCHpUTEG4sa5ZZrlVM6FP6jE80iVHwETgP EOO0o1yYZbckio8Gdain7ZaCdwP9NCxAJ4z8wnXB2ZIBu7YfyEJvYKaWhFr5FouYiRY9 wrbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695478826; x=1696083626; 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=jBl/h0an7nIUaCEYje4Eux0NrQkvTENlUgF4eKZqlAU=; b=gja/nSJ1BfwNK63mCP/MWF6L1uvQBSgGKoYb60A8ia/iCBF+dv7OKTPRK0+7vh72BL nKziRhjV1RE1QSVd8iZlcZXqN5tu00PjGQ11aGyClSlMrCmMWXo5sa56KFyrUVVsNTVU dr5cpOjVj0CevV0/hRg8EAyHYRzyCNGbKvEMz7arpNQHFRe5PRbTTEKaW7A9IvET6I8h sUesTlOR5TFESXT+VuLqys53OREknUe7qiuyBz2rBuvtItDhB6Ts7Fen2UnPDr9sJS81 qKy9VOKGdzyoCEE/QfgbbvCqkWRexjIgJtkQHzbt1+dTIIWWcqEKYOFoFeFn87Xu2xNf EJJA== X-Gm-Message-State: AOJu0Yy4UyX0DlGzDikrKOi9Uo93jFxhdHFpFBTOb27rvh1BFYg8puDl n2I4qDdSDXMU2/QbxTk32GAnzhehXI8ZlvAWbAyYPrAFab0= X-Received: by 2002:a25:44a:0:b0:d78:6ef:9178 with SMTP id 71-20020a25044a000000b00d7806ef9178mr1535680ybe.17.1695478826643; Sat, 23 Sep 2023 07:20:26 -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: From: Wedson Almeida Filho Date: Sat, 23 Sep 2023 11:20:15 -0300 Message-ID: Subject: Re: [PATCH 2/2] rust: arc: remove `ArcBorrow` in favour of `WithRef` To: Alice Ryhl Cc: Gary Guo , rust-for-linux@vger.kernel.org, Miguel Ojeda , Alex Gaynor , Boqun Feng , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , linux-kernel@vger.kernel.org, Wedson Almeida Filho Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 pete.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 (pete.vger.email [0.0.0.0]); Sat, 23 Sep 2023 07:20:36 -0700 (PDT) X-Spam-Level: ** On Sat, 23 Sept 2023 at 11:15, Alice Ryhl wrote: > > On Sat, Sep 23, 2023 at 4:11=E2=80=AFPM Wedson Almeida Filho wrote: > > > > 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 ob= ject > > > > with a refcount, we can just use Rust's regular shared borrowing. I= n > > > > 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 `AlwaysRefCounte= d` > > > 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.) > > Will this not cause issues with DispatchFromDyn and the Receiver > trait? Maybe it's best to have Arc be a real type and just provide a > conversion? I don't think it will but I haven't really tried it yet so can't say for su= re. One thing I learned (obvious in hindsight) when doing the locks is that we can have impl blocks for specialisations of a type, so `DispatchFromDyn>` will expand to `DispatchFromDyn>>` and it should be ok. Or are you worried about something else?