Skip to content

Commit

Permalink
Allow enabling lang_items and no_core features
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
powerboat9 authored and philberty committed Dec 11, 2023
1 parent 3589329 commit 1b6adb1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gcc/rust/checks/errors/rust-feature.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 2 additions & 0 deletions gcc/rust/checks/errors/rust-feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class Feature
DECL_MACRO,
AUTO_TRAITS,
EXTERN_TYPES,
LANG_ITEMS,
NO_CORE,
};

const std::string &as_string () { return m_name_str; }
Expand Down
6 changes: 6 additions & 0 deletions gcc/testsuite/rust/compile/sized-stub.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#![feature(lang_items)]
#![feature(no_core)]
#![no_core]

#[lang = "sized"]
trait Sized {}

0 comments on commit 1b6adb1

Please sign in to comment.