From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 8B3DC38432D9; Wed, 7 Dec 2022 09:14:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8B3DC38432D9 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.96,223,1665475200"; d="scan'208";a="88800821" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 07 Dec 2022 01:14:20 -0800 IronPort-SDR: Urq9gg/urs8c3xd2GVf+KUemzzcSP60E52rtGoyye4PtXLATs6EeEcF3YBrLN70sHAlSh5UHMk 2ZHeIghbsqKnu7UyfQOIhBlTRufoGtHe3GB9f1B/fC19PQ7sdMO64FutpeK01kCBECAWsFe45m CPAee9OPYnZFX3MJ2PU+wtTSC+pImWay8IfMV9ExwbZtC1qfK63kfJfM1aOeqTlBw7CkYkAvRr JFi9EfYKNJ8spFIDBZLKdeWBtTphjxV3KaZxkZtaX8if2be/n+tjgjMaML7URDQbcHOpO7liRg 4cQ= From: Thomas Schwinge To: Arsen =?utf-8?Q?Arsenovi=C4=87?= CC: , Philip Herron , , , David Malcolm Subject: Re: [PATCH Rust front-end v4 20/46] gccrs: Add wrapper for make_unique In-Reply-To: <87r0xbioim.fsf@aarsen.me> References: <20221206101417.778807-1-arthur.cohen@embecosm.com> <20221206101417.778807-21-arthur.cohen@embecosm.com> <87r0xbioim.fsf@aarsen.me> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Wed, 7 Dec 2022 10:14:11 +0100 Message-ID: <87k033k23g.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,KAM_SHORT,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! On 2022-12-07T09:50:40+0100, Arsen Arsenovi=C4=87 via Gcc-patches wrote: > arthur.cohen@embecosm.com writes: > >> This is a wrapper for make_unique. We can likely get rid of this, as the= re >> are other implementations available, or simply keep using the unique_ptr >> constructor. >> --- >> gcc/rust/util/rust-make-unique.h | 35 ++++++++++++++++++++++++++++++++ >> 1 file changed, 35 insertions(+) >> create mode 100644 gcc/rust/util/rust-make-unique.h >> >> diff --git a/gcc/rust/util/rust-make-unique.h b/gcc/rust/util/rust-make-= unique.h >> new file mode 100644 >> index 00000000000..7b79e625ff1 >> --- /dev/null >> +++ b/gcc/rust/util/rust-make-unique.h >> @@ -0,0 +1,35 @@ >> +// Copyright (C) 2020-2022 Free Software Foundation, Inc. >> + >> +// This file is part of GCC. >> + >> +// GCC is free software; you can redistribute it and/or modify it under >> +// the terms of the GNU General Public License as published by the Free >> +// Software Foundation; either version 3, or (at your option) any later >> +// version. >> + >> +// GCC is distributed in the hope that it will be useful, but WITHOUT A= NY >> +// WARRANTY; without even the implied warranty of MERCHANTABILITY or >> +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Licens= e >> +// for more details. >> + >> +// You should have received a copy of the GNU General Public License >> +// along with GCC; see the file COPYING3. If not see >> +// . >> + >> +#ifndef RUST_MAKE_UNIQUE_H >> +#define RUST_MAKE_UNIQUE_H >> + >> +#include "rust-system.h" >> + >> +namespace Rust { >> + >> +template >> +std::unique_ptr >> +make_unique (Ts &&...params) >> +{ >> + return std::unique_ptr (new T (std::forward (params)...)); >> +} >> + >> +} // namespace Rust >> + >> +#endif // RUST_MAKE_UNIQUE_H > > I think this was added recently, see commit > 00d7c8ff16e6838273cea808ffbe22e98104f9d5 and gcc/make-unique.h. I too had seen that, but decided to wait for until after the GCC/Rust merge, to not add more complexity to that one. It's OK, in my opinion, to add 'gcc/rust/util/rust-make-unique.h' now, and then later re-factor/get rid of that, to use 'gcc/make-unique.h' instead. Anyway, thanks for pointing that out, of course! :-) Gr=C3=BC=C3=9Fe Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955