diff --git a/gcc/rust/checks/errors/rust-feature-gate.cc b/gcc/rust/checks/errors/rust-feature-gate.cc index ca7b92065a87..ee3da8ad7459 100644 --- a/gcc/rust/checks/errors/rust-feature-gate.cc +++ b/gcc/rust/checks/errors/rust-feature-gate.cc @@ -79,8 +79,8 @@ FeatureGate::gate (Feature::Name name, Location loc, " 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 index 000000000000..172c7a42e2df --- /dev/null +++ b/gcc/testsuite/rust/compile/changed_intrinsics.rs @@ -0,0 +1,9 @@ +extern "rust-intrinsic" { // { dg-error "intrinsics are subject to change." "" { target *-*-* } } + fn foo(); +} + +fn main() { + unsafe { + foo(); + } +}