From patchwork Wed Apr 5 14:03:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 79725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp365829vqo; Wed, 5 Apr 2023 07:52:22 -0700 (PDT) X-Google-Smtp-Source: AKy350bFeEKwN8bX/F/Sb/pc0EI86j7v6b//yCEjHrkarkxTG9PTlhGP+mzRwvoNtAv4HW3nN6HZ X-Received: by 2002:a05:6402:442:b0:501:dc02:1956 with SMTP id p2-20020a056402044200b00501dc021956mr2122632edw.29.1680706341989; Wed, 05 Apr 2023 07:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680706341; cv=none; d=google.com; s=arc-20160816; b=MrFeC93HFSmL0D8/lGS1OqGCfc3llBgmvDRuzxwIUFgmN/Y0nYKU8HNn/MMgdAZeXZ F4zsYTDYwOboQNQR2XYTgsTbqhcMZKHhNGYEwgwvqXMEm+R8e70hwGUB4XOj1ZmqfB0C cPqJZD4ylgY1YdiIUp61DMGDsB8Tg/ltHqRvKTNRt1nCm5wui9kejvPPd17ZZRH3F+IO pdsprl/n7e6HiEV1GChe/X2lAR2VTOR9kekIb/qE7AwpMICUwgCQmru/D3b36+4YZHLw ali8L7257ieCKkc5F5A9CQIK/WBU8qBmhQK8laE3mK9foi+NhkV2h56pwVtCZDKwae0q ZogQ== 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=LPBWNpCpv+85wCt5oQoD8EZthjcKjmhIHvBdxXmvHsg=; b=j2dVDDpTAw//xhuc/eIjb+WePAgauPX8spTCIu4hGXJNezMlPbUEUtQ9hLM0UGDHRA HKAjTJs0sUBUyYMk3TCKv3E2tV7oyF9OnRa2NHjiOgc310PvVEOdXLR0e6Knsh79xyqC WwuP2UC75WP9R1yE43sNi02A2dAoxQl1F5B0cQ6FBBUNfsvQH7uZOhyEIRKItmmOC9Vo IHn6iBmlVLbf8u8pbDfWctfJJ2nvjQbcgyUfi+BHzAAp4Dr7Hl3UdyNqencfBTA1Zfhe wqQkaT/7nCCp7J08/MuwESQVX5kKbrnds2ZHUkR+G8gAabBOeq/mGNgZwdmi448YAY9b Xvgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=E47mG3K0; 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 n11-20020aa7c44b000000b0050229538ebcsi989111edr.509.2023.04.05.07.52.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:52:21 -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=E47mG3K0; 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 348BA392E47F for ; Wed, 5 Apr 2023 14:19:14 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id E6A75385695E for ; Wed, 5 Apr 2023 14:06:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E6A75385695E 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-x331.google.com with SMTP id i5-20020a05600c354500b003edd24054e0so23810801wmq.4 for ; Wed, 05 Apr 2023 07:06:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1680703574; 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=LPBWNpCpv+85wCt5oQoD8EZthjcKjmhIHvBdxXmvHsg=; b=E47mG3K0WSO0hALwtUbtjJ7hX/CDyDXLef90+m2IYc1qTAvmf6g5yjWmWMjI1yAVKa aArp6pUHfO3kvi+A9+807GxjJtQculAVp+h1105sajNnc8sTfTmXS0f1BkQaOLP6vbAw il22+TdeJ/gJYqSTJwb8n2QVW1vbWZ+N3nr+DCIi6ahsVLkp4vZmKYDNniTsx51OB0gC EhQObCSaCv7rGLRSVRxraVvjnviZ3KF8S1m4XWWh9NDBF44QZCSEgHzuIj2RfVnXE5Q5 uBsRXKXt4DqHKou75zo25R94S/MjMSzWpC25ysNRnTJhYjmhZSP2cBd5wRXsMI359yuO 3gSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680703574; 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=LPBWNpCpv+85wCt5oQoD8EZthjcKjmhIHvBdxXmvHsg=; b=6J0tTYYY7Q7J6eWAPhp9F0G4cFuu+x749mO0+DbcXkATKLFz7uuive18bUubr1kNLc +vgFHWz696XljNiVxo5SRvea2AaEC4uig3U+PZ2ZgNizLpxgEcV7RnWjZ3bU92T6MwPc uSWIqQ54jyEFeU0gHyQA0uBO2drdo7ZceeC/gn9GB0ZkQJwPXC1siiPg5/wiQOsCmi0g mMTrh+AcrBTT1iRnFzuAgo1oESo0WNv/79tbsczue6TMTf7T6MteqCmhi9OOFFeC09eU 6jYd3PNgprVSGV21LfREh/43vKLDpLTYRp4ZIbepGeRNntdxi7kmgOwiQ8/2tNKz5z/A 7aeA== X-Gm-Message-State: AAQBX9ecexH6+OjbmWkxBxNQ8+TqMUiIBtjTmkCYhCmHLzJ/vIebO8zg 11+X7HNBIJMJfrbC+XIduYQk8v5CiINCznmAvg== X-Received: by 2002:a05:600c:212:b0:3f0:4428:9445 with SMTP id 18-20020a05600c021200b003f044289445mr4997101wmi.14.1680703573851; Wed, 05 Apr 2023 07:06:13 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:06:13 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, mxlol233 Subject: [committed 65/88] gccrs: Add feature gate for "rust-intrinsic". Date: Wed, 5 Apr 2023 16:03:49 +0200 Message-Id: <20230405140411.3016563-66-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.5 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, T_FILL_THIS_FORM_SHORT 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?1762348333448348131?= X-GMAIL-MSGID: =?utf-8?q?1762348333448348131?= From: mxlol233 This commit implemented a feature gate to check `intrinsics`. gcc/rust/ChangeLog: * checks/errors/rust-feature-gate.cc: Add implementation for `void FeatureGate::visit (AST::ExternBlock &block)`. Add `valid_feature` construction process in `FeatureGate::check`. * checks/errors/rust-feature-gate.h: Add declaration for `void FeatureGate::visit (AST::ExternBlock &block)`. Add private variable `valid_feature`. * checks/errors/rust-feature.h: Change `issue` to `m_issue`. gcc/testsuite/ChangeLog: * rust/compile/const-issue1440.rs: Add crate feature: `intrinsics`. * rust/compile/feature_intrinsics.rs: New file. * rust/compile/issue-1031.rs: Add crate feature: `intrinsics`. * rust/compile/issue-1130.rs: Add crate feature: `intrinsics`. * rust/compile/issue-1131.rs: Add crate feature: `intrinsics`. * rust/compile/issue-1237.rs: Add crate feature: `intrinsics`. * rust/compile/issue-1289.rs: Add crate feature: `intrinsics`. * rust/compile/rust-const-blog-issue.rs: Add crate feature: `intrinsics`. * rust/compile/torture/intrinsics-3.rs: Add crate feature: `intrinsics`. * rust/compile/torture/intrinsics-4.rs: Add crate feature: `intrinsics`. * rust/compile/torture/intrinsics-5.rs: Add crate feature: `intrinsics`. * rust/compile/torture/intrinsics-6.rs: Add crate feature: `intrinsics`. * rust/compile/torture/intrinsics-7.rs: Add crate feature: `intrinsics`. * rust/compile/torture/issue-1024.rs: Add crate feature: `intrinsics`. * rust/compile/torture/issue-1075.rs: Add crate feature: `intrinsics`. * rust/compile/torture/issue-1432.rs: Add crate feature: `intrinsics`. * rust/compile/unsafe10.rs: Add crate feature: `intrinsics`. * rust/execute/torture/atomic_load.rs: Add crate feature: `intrinsics`. * rust/execute/torture/atomic_store.rs: Add crate feature: `intrinsics`. * rust/execute/torture/copy_nonoverlapping1.rs: Add crate feature: `intrinsics`. * rust/execute/torture/issue-1120.rs: Add crate feature: `intrinsics`. * rust/execute/torture/issue-1133.rs: Add crate feature: `intrinsics`. * rust/execute/torture/issue-1232.rs: Add crate feature: `intrinsics`. * rust/execute/torture/slice-magic.rs: Add crate feature: `intrinsics`. * rust/execute/torture/slice-magic2.rs: Add crate feature: `intrinsics`. * rust/execute/torture/str-layout1.rs: Add crate feature: `intrinsics`. * rust/execute/torture/transmute1.rs: Add crate feature: `intrinsics`. * rust/execute/torture/wrapping_op1.rs: Add crate feature: `intrinsics`. * rust/execute/torture/wrapping_op2.rs: Add crate feature: `intrinsics`. Signed-off-by: Xiao Ma --- gcc/rust/checks/errors/rust-feature-gate.cc | 61 ++++++++++++++++--- gcc/rust/checks/errors/rust-feature-gate.h | 7 ++- gcc/rust/checks/errors/rust-feature.h | 5 +- gcc/testsuite/rust/compile/const-issue1440.rs | 1 + .../rust/compile/feature_intrinsics.rs | 7 +++ gcc/testsuite/rust/compile/issue-1031.rs | 2 + gcc/testsuite/rust/compile/issue-1130.rs | 2 + gcc/testsuite/rust/compile/issue-1131.rs | 2 + gcc/testsuite/rust/compile/issue-1237.rs | 2 + gcc/testsuite/rust/compile/issue-1289.rs | 2 + .../rust/compile/rust-const-blog-issue.rs | 2 + .../rust/compile/torture/intrinsics-3.rs | 2 + .../rust/compile/torture/intrinsics-4.rs | 2 + .../rust/compile/torture/intrinsics-5.rs | 2 + .../rust/compile/torture/intrinsics-6.rs | 2 + .../rust/compile/torture/intrinsics-7.rs | 2 + .../rust/compile/torture/issue-1024.rs | 2 + .../rust/compile/torture/issue-1075.rs | 2 + .../rust/compile/torture/issue-1432.rs | 1 + gcc/testsuite/rust/compile/unsafe10.rs | 2 + .../rust/execute/torture/atomic_load.rs | 2 + .../rust/execute/torture/atomic_store.rs | 2 + .../execute/torture/copy_nonoverlapping1.rs | 2 + .../rust/execute/torture/issue-1120.rs | 2 + .../rust/execute/torture/issue-1133.rs | 2 + .../rust/execute/torture/issue-1232.rs | 2 + .../rust/execute/torture/slice-magic.rs | 2 + .../rust/execute/torture/slice-magic2.rs | 2 + .../rust/execute/torture/str-layout1.rs | 2 + .../rust/execute/torture/transmute1.rs | 1 + .../rust/execute/torture/wrapping_op1.rs | 2 + .../rust/execute/torture/wrapping_op2.rs | 2 + 32 files changed, 122 insertions(+), 11 deletions(-) create mode 100644 gcc/testsuite/rust/compile/feature_intrinsics.rs diff --git a/gcc/rust/checks/errors/rust-feature-gate.cc b/gcc/rust/checks/errors/rust-feature-gate.cc index 31ce3679ee1..bd01b52c7ff 100644 --- a/gcc/rust/checks/errors/rust-feature-gate.cc +++ b/gcc/rust/checks/errors/rust-feature-gate.cc @@ -17,14 +17,15 @@ // . #include "rust-feature-gate.h" -#include "rust-feature.h" +#include "rust-abi.h" namespace Rust { void FeatureGate::check (AST::Crate &crate) { - std::vector valid_features; + valid_features.clear (); + for (const auto &attr : crate.inner_attrs) { if (attr.get_path ().as_string () == "feature") @@ -39,20 +40,22 @@ FeatureGate::check (AST::Crate &crate) option.parse_to_meta_item ()); for (const auto &item : meta_item->get_items ()) { - const auto &name = item->as_string (); - auto tname = Feature::as_name (name); + const auto &name_str = item->as_string (); + auto tname = Feature::as_name (name_str); if (!tname.is_none ()) - valid_features.push_back (Feature::create (tname.get ())); + { + auto name = tname.get (); + valid_features.insert (name); + } + else rust_error_at (item->get_locus (), "unknown feature '%s'", - name.c_str ()); + name_str.c_str ()); } } } } - valid_features.shrink_to_fit (); - // TODO (mxlol233): add the real feature gate stuff. auto &items = crate.items; for (auto it = items.begin (); it != items.end (); it++) { @@ -60,4 +63,46 @@ FeatureGate::check (AST::Crate &crate) item->accept_vis (*this); } } + +void +FeatureGate::gate (Feature::Name name, Location loc, + const std::string &error_msg) +{ + if (!valid_features.count (name)) + { + auto feature = Feature::create (name); + auto issue = feature.issue (); + if (issue > 0) + { + const char *fmt_str + = "%s. see issue %ld " + " for more " + "information. add `#![feature(%s)]` to the crate attributes to " + "enable."; + rust_error_at (loc, fmt_str, error_msg.c_str (), issue, issue, + feature.as_string ().c_str ()); + } + else + { + const char *fmt_str + = "%s. add `#![feature(%s)]` to the crate attributes to enable."; + rust_error_at (loc, fmt_str, error_msg.c_str (), + feature.as_string ().c_str ()); + } + } +} + +void +FeatureGate::visit (AST::ExternBlock &block) +{ + if (block.has_abi ()) + { + const auto abi = block.get_abi (); + + if (get_abi_from_string (abi) == ABI::INTRINSIC) + gate (Feature::Name::INTRINSICS, block.get_locus (), + "intrinsics are subject to change"); + } +} + } // namespace Rust \ No newline at end of file diff --git a/gcc/rust/checks/errors/rust-feature-gate.h b/gcc/rust/checks/errors/rust-feature-gate.h index dc95c6b3879..6768c4c2498 100644 --- a/gcc/rust/checks/errors/rust-feature-gate.h +++ b/gcc/rust/checks/errors/rust-feature-gate.h @@ -21,6 +21,7 @@ #include "rust-ast-visitor.h" #include "rust-ast-full.h" +#include "rust-feature.h" namespace Rust { @@ -136,7 +137,7 @@ public: void visit (AST::TraitImpl &impl) override {} void visit (AST::ExternalStaticItem &item) override {} void visit (AST::ExternalFunctionItem &item) override {} - void visit (AST::ExternBlock &block) override {} + void visit (AST::ExternBlock &block) override; void visit (AST::MacroMatchFragment &match) override {} void visit (AST::MacroMatchRepetition &match) override {} void visit (AST::MacroMatcher &matcher) override {} @@ -186,6 +187,10 @@ public: void visit (AST::SliceType &type) override {} void visit (AST::InferredType &type) override {} void visit (AST::BareFunctionType &type) override {} + +private: + void gate (Feature::Name name, Location loc, const std::string &error_msg); + std::set valid_features; }; } // namespace Rust #endif \ No newline at end of file diff --git a/gcc/rust/checks/errors/rust-feature.h b/gcc/rust/checks/errors/rust-feature.h index 1425e26cd9a..7bd76c093f2 100644 --- a/gcc/rust/checks/errors/rust-feature.h +++ b/gcc/rust/checks/errors/rust-feature.h @@ -47,6 +47,7 @@ public: Name name () { return m_name; } const std::string &description () { return m_description; } State state () { return m_state; } + uint64_t issue () { return m_issue; } static Optional as_name (const std::string &name); static Feature create (Name name); @@ -57,7 +58,7 @@ private: const Optional &edition, const char *description) : m_state (state), m_name (name), m_name_str (name_str), - m_rustc_since (rustc_since), issue (issue_number), edition (edition), + m_rustc_since (rustc_since), m_issue (issue_number), edition (edition), m_description (description) {} @@ -65,7 +66,7 @@ private: Name m_name; std::string m_name_str; std::string m_rustc_since; - uint64_t issue; + uint64_t m_issue; Optional edition; std::string m_description; diff --git a/gcc/testsuite/rust/compile/const-issue1440.rs b/gcc/testsuite/rust/compile/const-issue1440.rs index 9b974b96bbb..9ad76a96b2a 100644 --- a/gcc/testsuite/rust/compile/const-issue1440.rs +++ b/gcc/testsuite/rust/compile/const-issue1440.rs @@ -1,4 +1,5 @@ // { dg-additional-options "-w" } +#![feature(intrinsics)] mod intrinsics { extern "rust-intrinsic" { diff --git a/gcc/testsuite/rust/compile/feature_intrinsics.rs b/gcc/testsuite/rust/compile/feature_intrinsics.rs new file mode 100644 index 00000000000..5eb7ffed864 --- /dev/null +++ b/gcc/testsuite/rust/compile/feature_intrinsics.rs @@ -0,0 +1,7 @@ + +extern "rust-intrinsic" { //{ dg-error "intrinsics are subject to change." "" { target *-*-* } } + pub fn sqrtf32(x: f32) -> f32; +} + +fn main() { +} diff --git a/gcc/testsuite/rust/compile/issue-1031.rs b/gcc/testsuite/rust/compile/issue-1031.rs index 5ba8f7a267b..a9049de96fb 100644 --- a/gcc/testsuite/rust/compile/issue-1031.rs +++ b/gcc/testsuite/rust/compile/issue-1031.rs @@ -1,3 +1,5 @@ +#![feature(intrinsics)] + extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] pub fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/compile/issue-1130.rs b/gcc/testsuite/rust/compile/issue-1130.rs index 92200c7cd5f..6d265cb6044 100644 --- a/gcc/testsuite/rust/compile/issue-1130.rs +++ b/gcc/testsuite/rust/compile/issue-1130.rs @@ -1,4 +1,6 @@ // { dg-additional-options "-w" } +#![feature(intrinsics)] + mod mem { extern "rust-intrinsic" { fn size_of() -> usize; diff --git a/gcc/testsuite/rust/compile/issue-1131.rs b/gcc/testsuite/rust/compile/issue-1131.rs index fd158abc700..5cb9caf81f0 100644 --- a/gcc/testsuite/rust/compile/issue-1131.rs +++ b/gcc/testsuite/rust/compile/issue-1131.rs @@ -1,3 +1,5 @@ +#![feature(intrinsics)] + extern "rust-intrinsic" { fn size_of() -> usize; fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/compile/issue-1237.rs b/gcc/testsuite/rust/compile/issue-1237.rs index 542be897949..54a51df156f 100644 --- a/gcc/testsuite/rust/compile/issue-1237.rs +++ b/gcc/testsuite/rust/compile/issue-1237.rs @@ -1,4 +1,6 @@ // { dg-additional-options "-w" } +#![feature(intrinsics)] + mod intrinsics { extern "rust-intrinsic" { pub fn offset(ptr: *const T, count: isize) -> *const T; diff --git a/gcc/testsuite/rust/compile/issue-1289.rs b/gcc/testsuite/rust/compile/issue-1289.rs index eb41af0a75b..3d7716a1d8c 100644 --- a/gcc/testsuite/rust/compile/issue-1289.rs +++ b/gcc/testsuite/rust/compile/issue-1289.rs @@ -1,3 +1,5 @@ +#![feature(intrinsics)] + extern "C" { fn printf(s: *const i8, ...); } diff --git a/gcc/testsuite/rust/compile/rust-const-blog-issue.rs b/gcc/testsuite/rust/compile/rust-const-blog-issue.rs index a5ea2ebacb9..679a2ae8c2b 100644 --- a/gcc/testsuite/rust/compile/rust-const-blog-issue.rs +++ b/gcc/testsuite/rust/compile/rust-const-blog-issue.rs @@ -1,4 +1,6 @@ // { dg-excess-errors "accessing value of" } +#![feature(intrinsics)] + mod mem { extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_transmute", since = "1.46.0")] diff --git a/gcc/testsuite/rust/compile/torture/intrinsics-3.rs b/gcc/testsuite/rust/compile/torture/intrinsics-3.rs index 5c131bd8aa2..1601ab6d5b7 100644 --- a/gcc/testsuite/rust/compile/torture/intrinsics-3.rs +++ b/gcc/testsuite/rust/compile/torture/intrinsics-3.rs @@ -1,3 +1,5 @@ +#![feature(intrinsics)] + extern "rust-intrinsic" { fn not_an_intrinsic(); } diff --git a/gcc/testsuite/rust/compile/torture/intrinsics-4.rs b/gcc/testsuite/rust/compile/torture/intrinsics-4.rs index 4e09f1089b0..1f6c0d6608a 100644 --- a/gcc/testsuite/rust/compile/torture/intrinsics-4.rs +++ b/gcc/testsuite/rust/compile/torture/intrinsics-4.rs @@ -1,3 +1,5 @@ +#![feature(intrinsics)] + #[lang = "sized"] pub trait Sized {} diff --git a/gcc/testsuite/rust/compile/torture/intrinsics-5.rs b/gcc/testsuite/rust/compile/torture/intrinsics-5.rs index ffad0bd3a85..7a62cca280c 100644 --- a/gcc/testsuite/rust/compile/torture/intrinsics-5.rs +++ b/gcc/testsuite/rust/compile/torture/intrinsics-5.rs @@ -1,3 +1,5 @@ +#![feature(intrinsics)] + #[lang = "sized"] pub trait Sized {} diff --git a/gcc/testsuite/rust/compile/torture/intrinsics-6.rs b/gcc/testsuite/rust/compile/torture/intrinsics-6.rs index 143b62a2b27..4e510e11087 100644 --- a/gcc/testsuite/rust/compile/torture/intrinsics-6.rs +++ b/gcc/testsuite/rust/compile/torture/intrinsics-6.rs @@ -1,3 +1,5 @@ +#![feature(intrinsics)] + extern "rust-intrinsic" { pub fn unchecked_add(x: T, y: T) -> T; pub fn unchecked_sub(x: T, y: T) -> T; diff --git a/gcc/testsuite/rust/compile/torture/intrinsics-7.rs b/gcc/testsuite/rust/compile/torture/intrinsics-7.rs index 8e8c5fe0cdf..da85fff5cd6 100644 --- a/gcc/testsuite/rust/compile/torture/intrinsics-7.rs +++ b/gcc/testsuite/rust/compile/torture/intrinsics-7.rs @@ -1,3 +1,5 @@ +#![feature(intrinsics)] + extern "rust-intrinsic" { pub fn unchecked_add(x: T, y: T) -> T; // { dg-error "unchecked operation intrinsics can only be used with basic integer types .got .NotAdd.." "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/torture/issue-1024.rs b/gcc/testsuite/rust/compile/torture/issue-1024.rs index 109540934a8..a8503cebf53 100644 --- a/gcc/testsuite/rust/compile/torture/issue-1024.rs +++ b/gcc/testsuite/rust/compile/torture/issue-1024.rs @@ -1,3 +1,5 @@ +#![feature(intrinsics)] + extern "rust-intrinsic" { pub fn size_of() -> usize; } diff --git a/gcc/testsuite/rust/compile/torture/issue-1075.rs b/gcc/testsuite/rust/compile/torture/issue-1075.rs index 7c0a0434262..201a241d45d 100644 --- a/gcc/testsuite/rust/compile/torture/issue-1075.rs +++ b/gcc/testsuite/rust/compile/torture/issue-1075.rs @@ -1,4 +1,6 @@ // { dg-additional-options "-w" } +#![feature(intrinsics)] + extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] pub fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/compile/torture/issue-1432.rs b/gcc/testsuite/rust/compile/torture/issue-1432.rs index 083a369d16f..822ca41c5ad 100644 --- a/gcc/testsuite/rust/compile/torture/issue-1432.rs +++ b/gcc/testsuite/rust/compile/torture/issue-1432.rs @@ -1,4 +1,5 @@ // { dg-additional-options "-w" } +#![feature(intrinsics)] mod intrinsics { extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_int_wrapping", since = "1.40.0")] diff --git a/gcc/testsuite/rust/compile/unsafe10.rs b/gcc/testsuite/rust/compile/unsafe10.rs index 6b6be06b908..927e69728c9 100644 --- a/gcc/testsuite/rust/compile/unsafe10.rs +++ b/gcc/testsuite/rust/compile/unsafe10.rs @@ -1,3 +1,5 @@ +#![feature(intrinsics)] + extern "rust-intrinsic" { pub fn rotate_left(l: T, r: T) -> T; } diff --git a/gcc/testsuite/rust/execute/torture/atomic_load.rs b/gcc/testsuite/rust/execute/torture/atomic_load.rs index 6e7383aa7e9..b66c4641424 100644 --- a/gcc/testsuite/rust/execute/torture/atomic_load.rs +++ b/gcc/testsuite/rust/execute/torture/atomic_load.rs @@ -1,3 +1,5 @@ +#![feature(intrinsics)] + #[lang = "sized"] pub trait Sized {} diff --git a/gcc/testsuite/rust/execute/torture/atomic_store.rs b/gcc/testsuite/rust/execute/torture/atomic_store.rs index 46960a7a186..dcbb2a90f19 100644 --- a/gcc/testsuite/rust/execute/torture/atomic_store.rs +++ b/gcc/testsuite/rust/execute/torture/atomic_store.rs @@ -1,3 +1,5 @@ +#![feature(intrinsics)] + #[lang = "sized"] pub trait Sized {} diff --git a/gcc/testsuite/rust/execute/torture/copy_nonoverlapping1.rs b/gcc/testsuite/rust/execute/torture/copy_nonoverlapping1.rs index 2ae7a0869e3..39afd3424a4 100644 --- a/gcc/testsuite/rust/execute/torture/copy_nonoverlapping1.rs +++ b/gcc/testsuite/rust/execute/torture/copy_nonoverlapping1.rs @@ -1,3 +1,5 @@ +#![feature(intrinsics)] + extern "rust-intrinsic" { pub fn copy_nonoverlapping(src: *const T, dst: *mut T, count: usize); } diff --git a/gcc/testsuite/rust/execute/torture/issue-1120.rs b/gcc/testsuite/rust/execute/torture/issue-1120.rs index 242c94b5cb6..59792b29a29 100644 --- a/gcc/testsuite/rust/execute/torture/issue-1120.rs +++ b/gcc/testsuite/rust/execute/torture/issue-1120.rs @@ -1,4 +1,6 @@ // { dg-additional-options "-w" } +#![feature(intrinsics)] + extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] pub fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/execute/torture/issue-1133.rs b/gcc/testsuite/rust/execute/torture/issue-1133.rs index f2080a6e072..8679bb93224 100644 --- a/gcc/testsuite/rust/execute/torture/issue-1133.rs +++ b/gcc/testsuite/rust/execute/torture/issue-1133.rs @@ -1,4 +1,6 @@ // { dg-additional-options "-w" } +#![feature(intrinsics)] + extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] pub fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/execute/torture/issue-1232.rs b/gcc/testsuite/rust/execute/torture/issue-1232.rs index 9215efdba6c..ce53da2d033 100644 --- a/gcc/testsuite/rust/execute/torture/issue-1232.rs +++ b/gcc/testsuite/rust/execute/torture/issue-1232.rs @@ -1,5 +1,7 @@ // { dg-additional-options "-w" } // { dg-output "slice_access=3\r*\n" } +#![feature(intrinsics)] + extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/execute/torture/slice-magic.rs b/gcc/testsuite/rust/execute/torture/slice-magic.rs index d1132989ddb..b52aa3df510 100644 --- a/gcc/testsuite/rust/execute/torture/slice-magic.rs +++ b/gcc/testsuite/rust/execute/torture/slice-magic.rs @@ -1,4 +1,6 @@ // { dg-additional-options "-w" } +#![feature(intrinsics)] + extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] pub fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/execute/torture/slice-magic2.rs b/gcc/testsuite/rust/execute/torture/slice-magic2.rs index 64a566185fa..cdc39f3dcca 100644 --- a/gcc/testsuite/rust/execute/torture/slice-magic2.rs +++ b/gcc/testsuite/rust/execute/torture/slice-magic2.rs @@ -1,4 +1,6 @@ // { dg-additional-options "-w" } +#![feature(intrinsics)] + extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")] pub fn offset(dst: *const T, offset: isize) -> *const T; diff --git a/gcc/testsuite/rust/execute/torture/str-layout1.rs b/gcc/testsuite/rust/execute/torture/str-layout1.rs index 39c1e38d77b..c9bcf1631e2 100644 --- a/gcc/testsuite/rust/execute/torture/str-layout1.rs +++ b/gcc/testsuite/rust/execute/torture/str-layout1.rs @@ -1,5 +1,7 @@ // { dg-additional-options "-w" } // { dg-output "t1sz=5 t2sz=10\r*" } +#![feature(intrinsics)] + mod mem { extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_transmute", since = "1.46.0")] diff --git a/gcc/testsuite/rust/execute/torture/transmute1.rs b/gcc/testsuite/rust/execute/torture/transmute1.rs index b9ec38ca618..40dcfdee0b3 100644 --- a/gcc/testsuite/rust/execute/torture/transmute1.rs +++ b/gcc/testsuite/rust/execute/torture/transmute1.rs @@ -1,4 +1,5 @@ // { dg-additional-options "-w" } +#![feature(intrinsics)] extern "rust-intrinsic" { fn transmute(value: T) -> U; diff --git a/gcc/testsuite/rust/execute/torture/wrapping_op1.rs b/gcc/testsuite/rust/execute/torture/wrapping_op1.rs index 64b37085ab7..ab4afd7ddde 100644 --- a/gcc/testsuite/rust/execute/torture/wrapping_op1.rs +++ b/gcc/testsuite/rust/execute/torture/wrapping_op1.rs @@ -1,3 +1,5 @@ +#![feature(intrinsics)] + extern "rust-intrinsic" { pub fn wrapping_add(l: T, r: T) -> T; } diff --git a/gcc/testsuite/rust/execute/torture/wrapping_op2.rs b/gcc/testsuite/rust/execute/torture/wrapping_op2.rs index f9990157894..b24ebce56f1 100644 --- a/gcc/testsuite/rust/execute/torture/wrapping_op2.rs +++ b/gcc/testsuite/rust/execute/torture/wrapping_op2.rs @@ -1,3 +1,5 @@ +#![feature(intrinsics)] + extern "rust-intrinsic" { pub fn wrapping_add(l: T, r: T) -> T; pub fn wrapping_sub(l: T, r: T) -> T;