From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AKy350Zwy3SN/fIkTr6C7zReQ8h7vX5gGAnQPobGl54VErt62VXBmVppTMsc5qli7n3y1/KfkWJ/9w== 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> Reply-To: arthur.cohen@embecosm.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 List-Id: 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 -- 2.40.0