From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id 94BFF385AC26 for ; Wed, 26 Oct 2022 08:15:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 94BFF385AC26 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x433.google.com with SMTP id v1so25019610wrt.11 for ; Wed, 26 Oct 2022 01:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=NFXDJZ9Ss4NnnqErRu7LCsyFoxtCMlaABsruQ/ABlJE=; b=HLUEYJQW5PrUx8Bl9JjlN4y/AZL6r1ybH5cN/ou6G03W4nBmuOWYOaLWo/pCIvOsje Ax8WHC48+HJEFmk1TdZAQvmf+LtB8iwXl1IvVCG+CBIE6xERaMqnjb6ewW34P7JSEU8t UwZ+ijWG925d6GKUepGwkAEh+5rjA3aiKs51mw1Th0z/lFgRn711qcMEimCxdUpLBPmR 5UuUoYB5yKJ3V8ErPIdau4Qgbl9nAfOUBxVwUZ8ybVe0F/F97lsUxOO9faiH7hiLcLr8 lG7ObkBoluZCYcwQa9XkFJcjYW+XBlZfvBcAKi/83lYTKbUPGJeYf7k5kg6JbE+vncK2 iIMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=NFXDJZ9Ss4NnnqErRu7LCsyFoxtCMlaABsruQ/ABlJE=; b=Ps7vv4V480FUUUovHaW20bb2oh4oo8/pSxkJCm9B41Hz/6XoXYULQWEYXEao50MvS6 9Wz4iZ/2S6olRexHBrkx+Q+EDQOn8WZ84XL70oi+208uyRltMWdn37M6ZGjosZgA5YfZ nEL7oJB27hHD+kqftRE+tdfK8/bCNcBJoOswwTn0bKAdh85qEupq1OZBM3B2fuBmks6i AzbNiZh98CM/ORNnxpEtU7LJUp7dOnLlEUqicht/JvjvpAac08y8e5AnX4QnY7/Zlayt ej9gvbbXrDcI69Qm/ZEh18JDzg8kKR0eu0GPfsxgpRqA2fKkqD/Jim3avD535/GNPcb4 BwDw== X-Gm-Message-State: ACrzQf2JqgBmztg/KpsbaxVeNuaJh/5fmf28Y7s+9t1BEEbC8bl/7AIc Z/LVMVFnOrmKBn7yP3Cgn3jZ X-Google-Smtp-Source: AMsMyM5xB3fpCcL14DJPJSksyR8yvf0ILJ9myWKGj2EKjZuZqeiAOzwN77o9lY5PsziRpstjzQgE1g== X-Received: by 2002:adf:fccd:0:b0:236:781a:8d73 with SMTP id f13-20020adffccd000000b00236781a8d73mr8349128wrs.31.1666772149341; Wed, 26 Oct 2022 01:15:49 -0700 (PDT) Received: from platypus.lan ([2001:861:5e4c:3bb0:6424:328a:1734:3249]) by smtp.googlemail.com with ESMTPSA id q16-20020a05600c46d000b003c6f426467fsm1134310wmo.40.2022.10.26.01.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 01:15:49 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org Subject: [PATCH Rust front-end v3 20/46] gccrs: Add wrapper for make_unique Date: Wed, 26 Oct 2022 10:17:45 +0200 Message-Id: <20221026081811.602573-21-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221026081811.602573-1-arthur.cohen@embecosm.com> References: <20221026081811.602573-1-arthur.cohen@embecosm.com> Reply-To: arthur.cohen@embecosm.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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: From: Philip Herron This is a wrapper for make_unique we can likely get rid of this as there 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 ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// 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 -- 2.37.2