From patchwork Tue Feb 7 18:52:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 5097 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3023778wrn; Tue, 7 Feb 2023 11:03:56 -0800 (PST) X-Google-Smtp-Source: AK7set+1SHooyOVXm9uQ5uG6b2sjuwTytVjOnF99896D19sGSe3/lR8PW4UGRclSX8hYCGJrLU7q X-Received: by 2002:a17:906:6547:b0:883:c829:fc5e with SMTP id u7-20020a170906654700b00883c829fc5emr4901066ejn.68.1675796636574; Tue, 07 Feb 2023 11:03:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675796636; cv=none; d=google.com; s=arc-20160816; b=j6qp9fBabfa1diFqoAkWz2qY4yf45P1w3bnSikPxQLBGce8LZ54cpGH8WwiXlUL6ba FfQz5XF7bTnEMectPWAfEesU5Prmi8AtOruavi3UZydCsvJHJoY6CWSoNpJvhZ3kOa6g IGjvZ5UMwlKd0G2Fp/5FAgztTtNbbX9InXGGb5pgdW8C/A4nhejl+vpmhdnHkhOE26TZ y361a+/W4khwsgXe5IzioetflfWEHajhotOkKxuixHIdZ0PtfGaU1wGX3s3QvUNo4FW7 DvNBLRiuJwKN1bmD/JryCQtdIcscqBM6q2ofeasYoEcWTFmwFO+Pm1io4d86fR3euRW9 XHHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:feedback-id:dkim-signature; bh=nqRoVqD3VOOrAVkOM3lGwJV6X/xZ3prSf3p+3tCe4H4=; b=eDnJ6Dfc7QqLIrb5M/zw0Oh2z1yo2hAF+WNgVre6CFQk3UBAa6gri0Wpjnm8LWWcjD cNuYuDb/eCgE1FgVCzN70z79GYDGTxRXNhxeoaX5oXY7ZLbnZTi+g4RY2rT/Q/CppgcE 9GaRcAdKUZ9ID/0H6x601A5zIvrKLlIaUmgEln17u9c4ediUi6P6N5rcGXWjhT4dLP4r 55JJD2pNMExWd8X1Jkn9gci/rLCuCOM9Z/4eP+/xMTInBAYTNOF2oXGqI8N2evNxuHT5 Xjra2go9PWXullZxRjM69iM03xFRZmxXiMoB96IKgCuyM775IvOjkiPEd6RFSZj0v6tT HLIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=i7cNcUSU; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id uj10-20020a170907c98a00b0087bdb2961aesi16035677ejc.349.2023.02.07.11.03.33; Tue, 07 Feb 2023 11:03:56 -0800 (PST) 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=20210112 header.b=i7cNcUSU; 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 S232364AbjBGSwv (ORCPT + 99 others); Tue, 7 Feb 2023 13:52:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229625AbjBGSwt (ORCPT ); Tue, 7 Feb 2023 13:52:49 -0500 Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41CE8103; Tue, 7 Feb 2023 10:52:47 -0800 (PST) Received: by mail-qv1-xf33.google.com with SMTP id k28so9724334qve.5; Tue, 07 Feb 2023 10:52:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:feedback-id:from:to:cc:subject:date:message-id:reply-to; bh=nqRoVqD3VOOrAVkOM3lGwJV6X/xZ3prSf3p+3tCe4H4=; b=i7cNcUSU4o7LvravnjUg2NRDGYvqi3CUowCoaT0qQbWPfBg0WVv6aHXFDEnoIhLM6t +uvQHA3j1JoxBp2v2SMFcKSD4WqWGpO6HjMiDInR50ls6hV+AC+jiGaQWud4rrzdopsK I7WvPqp9C+8t/ptfhPn2NjxWMbhQO6fQri5/ZkhPreryIQXCafzjd31WmHrmbxJVdUHU BCp/KLgndnmkjz5fYVgrh25qLG6jLYHiISFBETpz2r+gd+FAvxOQJb8nU9t4hvKim2T4 BAkn2hJSC6Rq4Wwmi3Rtp+592dZ086HOnOaXO1wMQAISm9x9i4BaXZJgiZTPcNPFu1kN 69vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:feedback-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nqRoVqD3VOOrAVkOM3lGwJV6X/xZ3prSf3p+3tCe4H4=; b=8EFgCtGq8RCxs8tpjDW3rI2nU1O8+U1DhEpS032tvCxFqF/dLvcjPDe6dbNDExCbwp HZbrUEknDn6Urq0OFM7rgcPN+UM9ppI/hRMTSEbDGC4rZD6c+304VvNMZd5QLkgLBQH2 lEQ9Jnb1cdlY5xSo3b2iDWdEWjemrOBFjvqsQ5zs4WoBe+Zj/sZlucsgIaZCJ0Nxfxff GhNmNtTXXrdvLChTdrMhFQsCko0YfgBFvCyZIH33Gu6RTh96DlNRimjr5BpmE3Fk1zBj 2f9ab4HpvNnCLxOEHgHcB/Nw6snJWJUaBw3bSQURE6tLhFcElckui+RItfqlqoHt0S+D 2ShA== X-Gm-Message-State: AO0yUKV40h39HSU7rJ4csiWPxQAXACdPRDDsWZXt649bA6miYdzj6Ygb +p6jM5KrrZ84/fjwv7ZnTdU= X-Received: by 2002:a05:6214:f6e:b0:56b:f210:8d5d with SMTP id iy14-20020a0562140f6e00b0056bf2108d5dmr7881641qvb.0.1675795966385; Tue, 07 Feb 2023 10:52:46 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id l20-20020a37f514000000b0072835b8e4a8sm9902597qkk.75.2023.02.07.10.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Feb 2023 10:52:45 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailauth.nyi.internal (Postfix) with ESMTP id 0F85327C005A; Tue, 7 Feb 2023 13:52:44 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 07 Feb 2023 13:52:45 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudegkedgudduhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpeeuohhquhhn ucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrth htvghrnhepgeegueekgefhvedukedtveejhefhkeffveeufeduiedvleetledtkeehjefg ieevnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsohhquhhnodhmvghsmhhtphgruhhthhhp vghrshhonhgrlhhithihqdeiledvgeehtdeigedqudejjeekheehhedvqdgsohhquhhnrd hfvghngheppehgmhgrihhlrdgtohhmsehfihigmhgvrdhnrghmvg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 7 Feb 2023 13:52:43 -0500 (EST) From: Boqun Feng To: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org Cc: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Vincenzo Palazzo , Will Deacon , Peter Zijlstra , Mark Rutland , Greg Kroah-Hartman , =?utf-8?q?Sergio_Gonz?= =?utf-8?q?=C3=A1lez_Collado?= , Finn Behrens Subject: [PATCH v2 0/2] rust: sync: Arc: Implement Debug and Display Date: Tue, 7 Feb 2023 10:52:14 -0800 Message-Id: <20230207185216.1314638-1-boqun.feng@gmail.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757200133908885043?= X-GMAIL-MSGID: =?utf-8?q?1757200133908885043?= previous version: v1: https://lore.kernel.org/rust-for-linux/20230201232244.212908-1-boqun.feng@gmail.com/ Changes since v1: * Remove the refcount for Debug impl as per Peter and Greg. * Since the refcount_read() bits are removed, therefore squash all 4 patches into one (I keep the Reviewed-by tags for anyone that gave to both patch #1 and patch #4 in v1). Thanks for everyone for the reviewing ;-) I found that our Arc doesn't implement `Debug` or `Display` when I tried to play with them, therefore add these implementation. With these changes, I could get the following print with the sample code in patch #2: [..] rust_print: 1 [..] rust_print: "hello, world" [..] rust_print: [samples/rust/rust_print.rs:34] c = "hello, world" [..] rust_print: "hello, world" Suggestions and comments are welcome! Regards, Boqun