Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp365072pxb; Fri, 16 Apr 2021 07:35:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzS0Le3HGo4tWOWFd7je+SDmXJRUiOh/FHd+2gQSKx1eJBMMKaLiySpNBz+Mkz2Xxe9LPi X-Received: by 2002:a05:6402:706:: with SMTP id w6mr3484337edx.15.1618583716260; Fri, 16 Apr 2021 07:35:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618583716; cv=none; d=google.com; s=arc-20160816; b=TK2qzYGe3R/Abe9hWcDxpdBM0CI6F1kAlo9sKkIwlfE+SuiPAtj0hEnmzDFd7riKfT HDd6GhdogxwzeAhuzSLy6V7ZENrrX015DqK6Xox5b20r4NJOjdlYbXCadElkvSsLaAtW 1BCJzd8y/4xYXEj3u5YKUbj/UDIxbJS66nwGrCUMaeTSwNEGGz96R6f3lTQN0RNx/Faj jsf//cKrXOFPTceU8PYByV8UR5QBXonZrbgd2hAs+lv8XdKYr0qLMFy70U8YVTMRA/q2 bTpmQN2IZXOMEVNxZFG18hMFbiGjUsvv9i5mUwFiBRKiepF1NXIwjjhPhLtdgFtx72iD 7Rnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=t2GyCAH28OFUKirekIiqG8QH/lg+7x2E9PX/3Ek0zoE=; b=UgeK9YK9yJuQJcEI8R+FlFkNGIFOkX8ks5rVGkmFNPb1+fo4zysWXdxCaGM+Shc90o QhYelepkRclu+KfUOR+rxaKY5z6dwDv144TcdUGeCqi81ZHt/IuE9E9I4/hqjXFfTGSk UqwAqcxY3E1aqFYoobOA8bmbHgvmU3JfSd52yauXG5iHmcZeT0FTsox7XWEXAWpZSmwj X5r67OhPqwq/tGME9YVifr1q6t20icGI9C35psPi6VW1hzC0P+ORp8kHHKrR5U/kj4QC wpCkBnWNJ2MUIPVJsrhcYzjoGgCP59EHB3e1l8Z6TrpA7h/Crq0rrL3O0Tn1lWtJwCzn LtWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DN4360cP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l15si2445510edb.89.2021.04.16.07.34.52; Fri, 16 Apr 2021 07:35:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DN4360cP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S244660AbhDPOVk (ORCPT + 99 others); Fri, 16 Apr 2021 10:21:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243051AbhDPOVj (ORCPT ); Fri, 16 Apr 2021 10:21:39 -0400 Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85077C061574; Fri, 16 Apr 2021 07:21:14 -0700 (PDT) Received: by mail-yb1-xb32.google.com with SMTP id x76so20277360ybe.5; Fri, 16 Apr 2021 07:21:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=t2GyCAH28OFUKirekIiqG8QH/lg+7x2E9PX/3Ek0zoE=; b=DN4360cPG7/skv/Q3gCUFB73HgA3nzH+525Cgqh/o/Sulu0m4bTBwnHevUocDCwwi6 3qKax591nZdA0Ojb9AD3uRCojJykqMb+8bJHhI+Nqkdf9/DJwxtNq/NR8pC79rWyC7T1 auBKfUYycwbn6OXqgA5WR9zkM+uswdjdM6SUkV3McSJaZpHLKY2JiBOGP3ueW9iJnAMn IZP+dT6lmrZi0uK5RGzHWWA2ni+Ngn7SPxd0Cw3UO6vxmRc8FwVBxda/Hzpud1hVUjpp sQe2N34/JXAfj5aBTxyAzE6SlWTMIbR3o1kVakAQkmK1xkhe78cdZz3SjJdxDi+o9oak ZLvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=t2GyCAH28OFUKirekIiqG8QH/lg+7x2E9PX/3Ek0zoE=; b=LrvISHeis84s5EpObdJmQtUvdow83rCZ2l6GuVs+ksEBGg2sNTKZrxkxsd6CN3N60h CJQbc5KSJBAWz27XrrrMGZupizmVt4q3c9RHVdeD+J3NHT6n3MTbmlpVG2AyASviub4M YgXmcLcD2kQztsXJr07p9E6vbNchLgXAbGVctAgFey3AO80oNiMBo2JStKdi6o6DRA1u fW8V1OhjZaPuIDm5KnMm1aQtkoDXSbQwV+xEIWGjvXEIEz9dXOvnHCTRR+D4OAgAwfht ZtXsoZsjA07Zo01oHxt8C5E9Dy5/IqdrGcgHqP7sh6moDbySESY1TfX0QfOLUl/rAlxc hk9Q== X-Gm-Message-State: AOAM532oXh8MOsgVm+B8j6fGbPm1N4EMOw41x/vIq71IhOoPLunJ+nQE taBSWwsW3e0rc+m5KenubDeOrLjiAMvpaiWesrs= X-Received: by 2002:a25:6803:: with SMTP id d3mr12588384ybc.422.1618582873937; Fri, 16 Apr 2021 07:21:13 -0700 (PDT) MIME-Version: 1.0 References: <20210414184604.23473-1-ojeda@kernel.org> In-Reply-To: From: Miguel Ojeda Date: Fri, 16 Apr 2021 16:21:02 +0200 Message-ID: Subject: Re: [PATCH 00/13] [RFC] Rust support To: Peter Zijlstra Cc: Miguel Ojeda , Linus Torvalds , Greg Kroah-Hartman , rust-for-linux@vger.kernel.org, Linux Kbuild mailing list , Linux Doc Mailing List , linux-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 16, 2021 at 1:24 PM Peter Zijlstra wrote: > > IMO RAII is over-valued, but just in case you care, the below seems to > work just fine. No fancy new language needed, works today. Similarly you > can create refcount_t guards, or with a little more work full blown > smart_ptr crud. Please note that even smart pointers (as in C++'s `std::unique_ptr` etc.) do not guarantee memory safety. Yes, they help a lot writing sound code (in particular exception-safe C++ code), but they do not bring the same guarantees. That's why using C language extensions (the existing ones, that is) to recreate RAII/guards, smart pointers, etc. would only bring you to a point closer to C++, but not to Rust. Cheers, Miguel