From patchwork Wed Apr 5 14:04:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 79739 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp371332vqo; Wed, 5 Apr 2023 08:01:11 -0700 (PDT) X-Google-Smtp-Source: AKy350aE4SuC2niN5w9pme+0AKWQUduHMe4fwvnzSCBYqjhqdXehEtj9gtZKGIWUjqTtVf+nwPus X-Received: by 2002:a17:907:bb81:b0:931:c2f0:9437 with SMTP id xo1-20020a170907bb8100b00931c2f09437mr3178206ejc.8.1680706870972; Wed, 05 Apr 2023 08:01:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680706870; cv=none; d=google.com; s=arc-20160816; b=C3QZIohcMawFs4ATiey9ugqb2G4TV2RDYDPStTklXcWefQ2GjnlTSBPdPDsR6xijYA 6HqyCZyniHKvv8RkAdj821OhUOMCobDFwHrscYarNIhH0dAriYWtEpAXg4Ng58ejUTpE oR5Yqpj679EYgPBnxOtfYUWAVCng1guEGmQ+LYMV/0McnbJm3eMLQXxz4j4C3wfUINzB juDL22LndBnMfDM+mHhPjW9oBZ0dv/cqESyuUSomoKslHRekETQZt13/iXY17ySqMGZE GbVOaVIT2ab68gG2x5x3Oyka4iPwqvJcREAO+LGrN+THkHVzsXc61RLWnRI/j8o855Uu 9i9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dmarc-filter :delivered-to; bh=woLOcpjWfTGhRDubWXEPX+6mcHR+gOlqu5nxJymYiHQ=; b=Q9T2Ljo/hTFHHgbV+/9nxm60Y/Zs+ApxnOCEPJtxg+8FqafpDf7qe1Lo2bvWXMYkbu eLgV6z+Jihr5mTuojV7ha862iEIXM9d93fF8AqpnMlh9m5ANFQgnSI0sJ1W7OX7hvNSH 7apZgJ2dlE7b7ry/SSAF23bsFICFYd/xk8eRkIiyBIm29GaOx0Ezri/OyOqML+1hyNBi J/fObOeIqeT7HUQMVlE1Nsj/2VH9yc37Sff6AtdEXqDrNDQ6tv8/PPKTRdxOTi+pbrnQ ZltiOUibq/Tg198iBJEnsSF1EqsaF0Hh1HBLXvEhLXiXGSxWhK20vV85/P4ufihHvyPW YRKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=CkhoIs6O; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id g18-20020a170906395200b0092127059e12si2068eje.57.2023.04.05.08.01.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 08:01:10 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=CkhoIs6O; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D8FF13836BBE for ; Wed, 5 Apr 2023 14:23:01 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id 7B47B3882026 for ; Wed, 5 Apr 2023 14:06:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7B47B3882026 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-wm1-x32d.google.com with SMTP id j1-20020a05600c1c0100b003f04da00d07so2155865wms.1 for ; Wed, 05 Apr 2023 07:06:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1680703589; 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=woLOcpjWfTGhRDubWXEPX+6mcHR+gOlqu5nxJymYiHQ=; b=CkhoIs6OwPDHc35FAuKg7qriwbMhGTcIzecAnbmGGpcQ65uRDM8RmavYph7BiWRWAH i0e/giFkACoRNxbkSBUh0/7ouiLdKBJnAkfqBjaACqH/IbmF53eJypqbJsSBHAOKkUQ/ 4UbmJY895iNtLQNy8RaT5U6MbwJrjup8C7mDWCHhfvPCFKcF4k+z2ovrJmagH56QaOGQ 0bDwxu/JkckLUUwnQoEUmQtkLuzp/v2QKDQV0fH1vshum6KQd+SyG24dhU9LVfSkZ+4o XsH4XTLtDHH2umAdZvYk5efLb3Hwda/a8ErLRK2IwQ+wIasqIEaxR7/bc2qPWc9j1laY P8VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680703589; 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=woLOcpjWfTGhRDubWXEPX+6mcHR+gOlqu5nxJymYiHQ=; b=dd/KbprYSpH9H4o6zfnKx7MQvgJqoqRYAqKDPM/7wlOgvygdaCy5Zd9sXmSyhGYed5 0yz31TGz71him6YbFKRXuRItuEMoWEUUetO+bxtbS5SnLwdadNO/9c92FDer/0rTeWT5 Rq2T6HvD5UQ1dIOSH+/b6bLVLYBY6biquZ3P/D6rb/Ahn0DA1PYfyAN3W5lrHsV6yjYH KOa61phKPiyFXcHYfauioR4572MMB6LtmtM2aPHrpoS3XZR/QHICLHjXlxftfp0pXT2V 7Krkuzlm/tT79V8+N5mp0mGO3GHuBojomtHTTHH/AZI3+mpdmBrmK5FdI+tzYgEDr7ye GBEw== X-Gm-Message-State: AAQBX9fB3uoike+lnRMFQZp8Q8PorDx+R1qdjCpeEmlKPvJ9pSg3qzzY Sy60Y7SkV9mh7+RkKYuTz4LOMe03MkLTPzYKPw== X-Received: by 2002:a7b:c8c3:0:b0:3f0:5074:efa7 with SMTP id f3-20020a7bc8c3000000b003f05074efa7mr4867981wml.14.1680703588891; Wed, 05 Apr 2023 07:06:28 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id ay8-20020a05600c1e0800b003edddae1068sm2330150wmb.9.2023.04.05.07.06.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:06:28 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Owen Avery Subject: [committed 87/88] gccrs: Address unsafe with/without block handling ambiguity Date: Wed, 5 Apr 2023 16:04:11 +0200 Message-Id: <20230405140411.3016563-88-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405140411.3016563-1-arthur.cohen@embecosm.com> References: <20230405140411.3016563-1-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762348888269976296?= X-GMAIL-MSGID: =?utf-8?q?1762348888269976296?= From: Owen Avery gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_expr_stmt): Remove hypothetical unsafe + expr_stmt_without_block handling. Signed-off-by: Owen Avery --- gcc/rust/parse/rust-parse-impl.h | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 6a98bcce654..1e5b2dc85ed 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -7188,18 +7188,9 @@ Parser::parse_expr_stmt (AST::AttrVec outer_attrs, } } case UNSAFE: { - /* FIXME: are there any expressions without blocks that can have - * unsafe as their first token? Or is unsafe the only one? */ - // safe side for now - if (lexer.peek_token (1)->get_id () == LEFT_CURLY) - { - return parse_expr_stmt_with_block (std::move (outer_attrs)); - } - else - { - return parse_expr_stmt_without_block (std::move (outer_attrs), - restrictions); - } + // unsafe block + // https://doc.rust-lang.org/reference/unsafe-keyword.html + return parse_expr_stmt_with_block (std::move (outer_attrs)); } default: // not a parse expr with block, so must be expr without block