Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4616323rwd; Tue, 23 May 2023 09:58:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7tKg3mHwwuQjC/obIkeQyIrOcexy5rdV57VIJAL95nWKU5M/Q3qBHFEIL7JDdXK9aXWWSj X-Received: by 2002:a17:90a:5792:b0:24d:f2f5:f571 with SMTP id g18-20020a17090a579200b0024df2f5f571mr14787425pji.36.1684861138656; Tue, 23 May 2023 09:58:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684861138; cv=none; d=google.com; s=arc-20160816; b=rcQsFfxKAWXOC1dyqCon4POPPQE45hY5K7ZMLESdcirxa2Z8m1eBtoM3CzpV/j7EOF M3tlWeCrZBnB7O4ikexEs97hzFQSQs8lrmwBp/SUvmtT+FXAfYBxpyLdQ/F3HVZwmYYU Q9WXYh9PY8kZysyZ9YYgOJ2nRcnIohkBm68t9HAxx+kJKMOfjrJ8sK7o5CpeUpb/S1Md 2JyAmaLGd1VPw4mCQKqiZ1ic4046WxWiDqgAnxkhPM3rp67StcCxQgtuHwEGdtmh0gJ+ MD7++P8tJHmocznyLFOYNSo8A5Ivf5SUoQLE11FCnx8M+PXtV/ga9srJ84LAxEGedVpw /7eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=UGIAcK//rWFEB52G558om/gyBjR/E70Z681VXJvEV7Q=; b=gG0Erq4OdD78wTciX7MiIU+YAZnNZcc2qH5w7ZpmEr9+X/Ai1nbJLYqqt99THpa4k2 JaXI6SgPcN9ZbDtgWaU4WfYagvt/fNh/x63Ibo+wyQewmjqdIU0+71PfstH/qej0osUp a+NXU7Ki25t6PUc7PHf4Vw3znQfefJ2k29bxHohCr1I11AUyTJSLEmUugWv1Gt9o4Ahb z6b2BgoA7BbXJG3g+OWK7URMQBd1VzUOXge3bHUD7w4t/6NnPz+Bg7htavjthnzvJJbo Vq6+7kxcglc8uUrdCSjzk7iqT3kDAOw8NK2B6mk54R/V8MCfDDSBtovzCrtd4VZFliNv JEVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Lv8JXm0M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j190-20020a6380c7000000b00534951b1b84si5196863pgd.582.2023.05.23.09.58.43; Tue, 23 May 2023 09:58:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Lv8JXm0M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229739AbjEWQmC (ORCPT + 99 others); Tue, 23 May 2023 12:42:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229716AbjEWQmA (ORCPT ); Tue, 23 May 2023 12:42:00 -0400 Received: from mail-oa1-x2c.google.com (mail-oa1-x2c.google.com [IPv6:2001:4860:4864:20::2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F1F2E5; Tue, 23 May 2023 09:41:59 -0700 (PDT) Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-19cf62eb14aso1429814fac.3; Tue, 23 May 2023 09:41:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684860119; x=1687452119; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=UGIAcK//rWFEB52G558om/gyBjR/E70Z681VXJvEV7Q=; b=Lv8JXm0M39MGa8L2iwrHyTeoixTXheqlvWR2nOc9xEuyBESJ2cICWfTFj+iDvvT71n Ox44V/OpikZ3IzC4LvN5VcHgN5a742UW5bN0u6r9iVKNEyhK8ZE1EHDhfvSglbeV1ap6 faQc546Ef/EFw5SSH3Gs4BkYMmsQ0ycm6I2ncUEvSSCUCkndvce5k4/pXaOdP31qd0bQ gsFb8t0Pta0E0tPKT2ZdkPsUla94eyf9J8pMU2c6ObH3UmlaGvfB53pcO0o7UjAasly5 NlaAz0uaJu1C1QRFVNd7OtZwTthbJel09z2nsEmJ5pAi7XWS/tvQk07VeSxMnJOiuKo0 HDfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684860119; x=1687452119; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UGIAcK//rWFEB52G558om/gyBjR/E70Z681VXJvEV7Q=; b=BnW7AyfgjbkPoDQ0CW/r4A+6nFvoQX32kKjzLizJDrw1qhI+E2oFenO8/FBWJQ7ypi HdNDroSeJ6vhJbK2ax+2gl/xiavfYntEAiY9djnXY8+jNxOmnk4j9mQaBPQdkrrnGr6d 1hv8lXeIACgxli54pWgOLwtXMiV8/cyx61Rf2b3Xkldf9GvNRA0bY+obBbkwRV1CSdon 0umW603BOCKaa+t04FFdERRPU4OIWuEvoUuJhxdinFkpwJWei2o0r1uQOJWgQJaLh8uL vQU49Quvy218pKc+bvPOIlU3YBLvMHoXaui5U7nbq5AOgJ1/7lsYfkccNBp7ur8Up0tk shZQ== X-Gm-Message-State: AC+VfDyKQBqHfX70h+0073FRAlNujX1MT4AvtZljudo3sLzoTByNBLe7 gJaWK5S1bH6/XtJiM/se+g3q5tuwzNA= X-Received: by 2002:a05:6808:1cf:b0:38e:54ef:47fb with SMTP id x15-20020a05680801cf00b0038e54ef47fbmr6747774oic.48.1684860118720; Tue, 23 May 2023 09:41:58 -0700 (PDT) Received: from [192.168.54.90] (static.220.238.itcsa.net. [190.15.220.238]) by smtp.gmail.com with ESMTPSA id j185-20020aca3cc2000000b003983f683f41sm478479oia.21.2023.05.23.09.41.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 May 2023 09:41:58 -0700 (PDT) Message-ID: <640a6624-73d9-5650-4570-d822e7515900@gmail.com> Date: Tue, 23 May 2023 13:27:46 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v2 1/4] rust: sync: reword the `Arc` safety comment for `Send` To: Alice Ryhl , Miguel Ojeda , Wedson Almeida Filho , Alex Gaynor Cc: Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=c3=b6rn_Roy_Baron?= , Benno Lossin , Ingo Molnar , Peter Zijlstra , Will Deacon , Mark Rutland , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Andreas Hindborg References: <20230523144418.1250547-1-aliceryhl@google.com> <20230523144418.1250547-2-aliceryhl@google.com> Content-Language: en-US From: Martin Rodriguez Reboredo In-Reply-To: <20230523144418.1250547-2-aliceryhl@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On 5/23/23 11:44, Alice Ryhl wrote: > The safety comment on `impl Send for Arc` talks about "directly" > accessing the value, when it really means "accessing the value with a > mutable reference". This commit clarifies that. > > Suggested-by: Boqun Feng > Signed-off-by: Alice Ryhl > Reviewed-by: Andreas Hindborg > Reviewed-by: Boqun Feng > --- > [...] > > // SAFETY: It is safe to send `Arc` to another thread when the underlying `T` is `Sync` because > // it effectively means sharing `&T` (which is safe because `T` is `Sync`); additionally, it needs > -// `T` to be `Send` because any thread that has an `Arc` may ultimately access `T` directly, for > -// example, when the reference count reaches zero and `T` is dropped. > +// `T` to be `Send` because any thread that has an `Arc` may ultimately access `T` using a > +// mutable reference, for example, when the reference count reaches zero and `T` is dropped. > unsafe impl Send for Arc {} > > // SAFETY: It is safe to send `&Arc` to another thread when the underlying `T` is `Sync` for the Reviewed-by: Martin Rodriguez Reboredo