Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp373570rdh; Sat, 23 Sep 2023 14:36:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsW0MTxyWgmQ6oeWJPY/f6pozESP+/JJTrIcAiCkqWJkVkxfF1b1od/QnBFWJ9jkYgMB0k X-Received: by 2002:a05:6e02:1946:b0:346:7c6d:c667 with SMTP id x6-20020a056e02194600b003467c6dc667mr4605723ilu.13.1695505000593; Sat, 23 Sep 2023 14:36:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695505000; cv=none; d=google.com; s=arc-20160816; b=zyHL5XCLViVGonQRTFObuhJuR49srG1fesPTIwp4N62Lcb/PvcA2LN1UOVDPUrLexm 78oYCIIKBESfeFt8VWBjkAEDXLf5wdsI7VX8kRAiJBll97cvik0ptZgBPZTySAWlYg3w 9q4GcaXRL9kVJA7BAR5ijwWypf0Hno6Qz/b6LqqFCAHKA3PULraL8kyUcrFaDcH56PQK qYasS7Ii8jyTn0JA9SsYTmC+LgO1HAJ8tWszhel2IyvIm5LDbraDuOk8rwhLG8x/nU8i 94o64L0h73Bb5guLIYQKTT//Wyo0Z3SOMnKpt/EgU0Lqd2zE3WylhLJ9DSgpmvyc27u4 TmHw== 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=VtQdjhgh5ojDAXxkKIrpNd9etS22b5WxpzQrfxu7mZA=; fh=mzPmNGimwreBaj/mJgXghGPYgC2mhEs+sXIvf36MdcQ=; b=wvDXN2PI4SZWU5X+z5hpBfe4u/lK40RlQvXokpZvGofX7FPFUyfaOx517L+WMOCpwg wx3aN2B/eQceMTW3isW9coyD90NYJKyguv9a+vdxEELSIcsGfnlCPmeujH6umUTDJH1E 1J/jWhDaE/5bsgVrJMRbiHPfBx1xUluaDnPu7R07uwcXqGQy8M4RaCnfrA7iEbWCZw22 ELLR13r4qmT7BE9Ly1Hx4HYeAw+RgBnWzJe01NDgIrV5TfCtM4mBHNRXeruF/q31ZVRN AT1GSvFLCPdEGlRALOHtbK2jAR9Bp6dnUNGeBrmS6QuV94k2ONmbvrPAssTAARJulmId GGDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=0LLhwo2E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id o15-20020a656a4f000000b00563a0c1bf06si7388406pgu.428.2023.09.23.14.36.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 14:36:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=0LLhwo2E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 797A9807C657; Sat, 23 Sep 2023 07:15:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231671AbjIWOPk (ORCPT + 99 others); Sat, 23 Sep 2023 10:15:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231591AbjIWOPj (ORCPT ); Sat, 23 Sep 2023 10:15:39 -0400 Received: from mail-vs1-xe2e.google.com (mail-vs1-xe2e.google.com [IPv6:2607:f8b0:4864:20::e2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C35849E for ; Sat, 23 Sep 2023 07:15:33 -0700 (PDT) Received: by mail-vs1-xe2e.google.com with SMTP id ada2fe7eead31-4527d65354bso1571969137.0 for ; Sat, 23 Sep 2023 07:15:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695478533; x=1696083333; 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=VtQdjhgh5ojDAXxkKIrpNd9etS22b5WxpzQrfxu7mZA=; b=0LLhwo2EvpXxPjfaKRJR0e8ylG41gWdXP3U+dR+OCrLMX6YzOvLJc8KWNqPBndoln6 IX7KL+COUnq5kIOVDjQban1fgecXOuIqlQozT1PICH9TK86ugJWxC6E+AcZkXLU0BYu1 DeiesMdkbqWIWcCD3uj3UjfxtEXP0OsUF/sthGURtvWVM4zZKQqSKbWvgUl2wFnNj+pD jP3hbjpXFMcK+cOS7vBGnOnGe4r1Fk5kg0OaRHpC1wfEvq0ikJ0kT+Yh7SL7LlDMFktx NGbwnFXBa/g0s5zGov4DlLiMBdyAzad30fTwukTzCRLW/snSfyo5HtTbN6VJlVNkT6bp 0PMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695478533; x=1696083333; 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=VtQdjhgh5ojDAXxkKIrpNd9etS22b5WxpzQrfxu7mZA=; b=IVkRafOduBTvcMZtio0GdlmkpRWlFnRqkzPBAyjRDuvrd1PjSXSD4bQpHU2JUu60Vn LXJADcXYiHRaxGKLQXqeQlZEK3ohgnz7czAFAV9e35VUVfG8pv+uA6XmZzj6nJFBoSKV ZHl2fjN9q/cE8pqmMKaSWc211YX7VkeY2KYzeF5IJzJXPI3V0z7U4EgICkrO556poZki /6GzWLrqdp293OEXTuOXswzcbDHuBZsNWlNpV5b1ekqnqJZ6BfYjyueQUeMXO5NVhS7x NZM+XbAdUgBL4ecF4fdbBHXIOLIr6mveYl2zBlYDcvhc738LWDDIPEeYMw5oaAGuOHw9 Ldog== X-Gm-Message-State: AOJu0Yyx7oJwXjC3fjYcn0q8qM7GCHNNCxuOGBJyWitzWr3NsLJmtCoV XAlk/O3vjr2srLivnxVGbsym8USIxRtqOyAsqSLisQ== X-Received: by 2002:a05:6102:2448:b0:452:607d:8603 with SMTP id g8-20020a056102244800b00452607d8603mr1470464vss.1.1695478532667; Sat, 23 Sep 2023 07:15:32 -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: Alice Ryhl Date: Sat, 23 Sep 2023 16:15:21 +0200 Message-ID: Subject: Re: [PATCH 2/2] rust: arc: remove `ArcBorrow` in favour of `WithRef` To: Wedson Almeida Filho 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=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Sat, 23 Sep 2023 07:15:40 -0700 (PDT) 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 obje= ct > > > 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.) 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? Alice