]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: [E0658] Use of unstable feature
authorMuhammad Mahad <mahadtxt@gmail.com>
Tue, 11 Jul 2023 09:50:39 +0000 (14:50 +0500)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:49:37 +0000 (18:49 +0100)
gcc/rust/ChangeLog:

* checks/errors/rust-feature-gate.cc (FeatureGate::gate):
called error function.

gcc/testsuite/ChangeLog:

* rust/compile/changed_intrinsics.rs: New test.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
gcc/rust/checks/errors/rust-feature-gate.cc
gcc/testsuite/rust/compile/changed_intrinsics.rs [new file with mode: 0644]

index 2177a5b3a0c1dd9169e91b89abc5400d5379a4c4..187fec0dedb0e5397f49886d41d19aa5c256ca45 100644 (file)
@@ -79,8 +79,8 @@ FeatureGate::gate (Feature::Name name, Location loc,
              "<https://github.com/rust-lang/rust/issues/%u> 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 ());
+         rust_error_at (loc, ErrorCode ("E0658"), fmt_str, error_msg.c_str (),
+                        issue, issue, feature.as_string ().c_str ());
        }
       else
        {
diff --git a/gcc/testsuite/rust/compile/changed_intrinsics.rs b/gcc/testsuite/rust/compile/changed_intrinsics.rs
new file mode 100644 (file)
index 0000000..172c7a4
--- /dev/null
@@ -0,0 +1,9 @@
+extern "rust-intrinsic" { // { dg-error "intrinsics are subject to change." "" { target *-*-* }  }
+    fn foo(); 
+}
+
+fn main() {
+    unsafe {
+        foo();
+    }
+}