]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Allow enabling lang_items and no_core features
authorOwen Avery <powerboat9.gamer@gmail.com>
Sat, 9 Dec 2023 06:22:02 +0000 (01:22 -0500)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 30 Jan 2024 11:36:49 +0000 (12:36 +0100)
gcc/rust/ChangeLog:

* checks/errors/rust-feature.cc
(Feature::name_hash_map):
Add entries for Name::LANG_ITEMS and Name::NO_CORE.
* checks/errors/rust-feature.h
(Feature::Name::LANG_ITEMS): New.
(Feature::Name::NO_CORE): New.

gcc/testsuite/ChangeLog:

* rust/compile/sized-stub.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/checks/errors/rust-feature.cc
gcc/rust/checks/errors/rust-feature.h
gcc/testsuite/rust/compile/sized-stub.rs [new file with mode: 0644]

index 88649f14e6038af723acd5e59b5b3f41179057c6..c12710ae2e17cdf83374f458a3920c24409352cc 100644 (file)
@@ -56,6 +56,8 @@ const std::map<std::string, Feature::Name> Feature::name_hash_map = {
   // later Rust versions
   {"optin_builtin_traits", Feature::Name::AUTO_TRAITS},
   {"extern_types", Feature::Name::EXTERN_TYPES},
+  {"lang_items", Feature::Name::LANG_ITEMS},
+  {"no_core", Feature::Name::NO_CORE},
 }; // namespace Rust
 
 tl::optional<Feature::Name>
index 4ff059c6167586397670198dc9b16d707b3a7132..e6bc2362e39e72c92c619343f7c3751db1bfe6f5 100644 (file)
@@ -43,6 +43,8 @@ public:
     DECL_MACRO,
     AUTO_TRAITS,
     EXTERN_TYPES,
+    LANG_ITEMS,
+    NO_CORE,
   };
 
   const std::string &as_string () { return m_name_str; }
diff --git a/gcc/testsuite/rust/compile/sized-stub.rs b/gcc/testsuite/rust/compile/sized-stub.rs
new file mode 100644 (file)
index 0000000..4e89b1f
--- /dev/null
@@ -0,0 +1,6 @@
+#![feature(lang_items)]
+#![feature(no_core)]
+#![no_core]
+
+#[lang = "sized"]
+trait Sized {}