Skip to content

testsuite: Add the alloc crate to the testsuite#4693

Draft
nsvke wants to merge 2 commits into
Rust-GCC:masterfrom
nsvke:alloc-testsuite
Draft

testsuite: Add the alloc crate to the testsuite#4693
nsvke wants to merge 2 commits into
Rust-GCC:masterfrom
nsvke:alloc-testsuite

Conversation

@nsvke

@nsvke nsvke commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

This patch adds the alloc crate to the testsuite. To achieve a clean compilation baseline, several lang items and an attribute had to be registered as temporary stubs. Additionally, a few temporary source-level workarounds were required to bypass current compiler limitations.

Currently, the entire crate successfully compiles up to the name resolution phase using the -frust-compile-until=nameresolution flag.

Please note that this is a Draft PR intended for review and feedback only. We will address the stubbed items and transition to proper implementations in subsequent iterations.

nsvke added 2 commits July 8, 2026 14:57
These lang items and an attribute are currently registered as stubs only.
This is a temporary patch.

gcc/rust/ChangeLog:

	* checks/errors/rust-builtin-attribute-checker.cc
	(attribute_checking_handlers): Add rustc_conversion_suggestion
	attribute.
	* util/rust-attribute-values.h (class Attributes): Add
	RUSTC_CONVERSION_SUGGESTION constexpr.
	* util/rust-attributes.cc (__definitions): Add new
	BuiltinAttrDefinition for rustc_conversion_suggestion.
	* util/rust-lang-item.cc (Rust::LangItems::lang_items): Add
	missing lang items to BiMap.
	* util/rust-lang-item.h (class LangItem): Add missing lang
	items to enum class Kind.

Signed-off-by: Enes Cevik <enes@nsvke.com>
This patch adds the alloc to the testsuite with some temporary
modifications:
- Comment out unsupported features in lib.rs.
- Comment out unsupported #[rustfmt::skip] attribute in boxed.rs.
- Comment out the `ForceResult` enum due to issue Rust-GCC#4687 in
  collections/btree/node.rs.
- Add temporary `use` statements due to issue Rust-GCC#4689 in
  collections/btree/append.rs and collections/btree/map.rs

gcc/testsuite/ChangeLog:

	* rust/alloc/alloc.exp: New test.
	* rust/alloc/alloc/src/alloc.rs: New test.
	* rust/alloc/alloc/src/alloc/tests.rs: New test.
	* rust/alloc/alloc/src/borrow.rs: New test.
	* rust/alloc/alloc/src/boxed.rs: New test.
	* rust/alloc/alloc/src/collections/binary_heap.rs: New test.
	* rust/alloc/alloc/src/collections/btree/append.rs: New test.
	* rust/alloc/alloc/src/collections/btree/borrow.rs: New test.
	* rust/alloc/alloc/src/collections/btree/borrow/tests.rs: New test.
	* rust/alloc/alloc/src/collections/btree/map.rs: New test.
	* rust/alloc/alloc/src/collections/btree/map/entry.rs: New test.
	* rust/alloc/alloc/src/collections/btree/map/tests.rs: New test.
	* rust/alloc/alloc/src/collections/btree/mem.rs: New test.
	* rust/alloc/alloc/src/collections/btree/merge_iter.rs: New test.
	* rust/alloc/alloc/src/collections/btree/mod.rs: New test.
	* rust/alloc/alloc/src/collections/btree/navigate.rs: New test.
	* rust/alloc/alloc/src/collections/btree/node.rs: New test.
	* rust/alloc/alloc/src/collections/btree/node/tests.rs: New test.
	* rust/alloc/alloc/src/collections/btree/remove.rs: New test.
	* rust/alloc/alloc/src/collections/btree/search.rs: New test.
	* rust/alloc/alloc/src/collections/btree/set.rs: New test.
	* rust/alloc/alloc/src/collections/btree/set/tests.rs: New test.
	* rust/alloc/alloc/src/collections/btree/split.rs: New test.
	* rust/alloc/alloc/src/collections/linked_list.rs: New test.
	* rust/alloc/alloc/src/collections/linked_list/tests.rs: New test.
	* rust/alloc/alloc/src/collections/mod.rs: New test.
	* rust/alloc/alloc/src/collections/vec_deque.rs: New test.
	* rust/alloc/alloc/src/collections/vec_deque/drain.rs: New test.
	* rust/alloc/alloc/src/collections/vec_deque/tests.rs: New test.
	* rust/alloc/alloc/src/fmt.rs: New test.
	* rust/alloc/alloc/src/lib.rs: New test.
	* rust/alloc/alloc/src/macros.rs: New test.
	* rust/alloc/alloc/src/prelude/mod.rs: New test.
	* rust/alloc/alloc/src/prelude/v1.rs: New test.
	* rust/alloc/alloc/src/raw_vec.rs: New test.
	* rust/alloc/alloc/src/raw_vec/tests.rs: New test.
	* rust/alloc/alloc/src/rc.rs: New test.
	* rust/alloc/alloc/src/rc/tests.rs: New test.
	* rust/alloc/alloc/src/slice.rs: New test.
	* rust/alloc/alloc/src/str.rs: New test.
	* rust/alloc/alloc/src/string.rs: New test.
	* rust/alloc/alloc/src/sync.rs: New test.
	* rust/alloc/alloc/src/sync/tests.rs: New test.
	* rust/alloc/alloc/src/task.rs: New test.
	* rust/alloc/alloc/src/tests.rs: New test.
	* rust/alloc/alloc/src/vec.rs: New test.
	* rust/alloc/core.rs: New test.
	* rust/alloc/prelude.rs: New test.

Signed-off-by: Enes Cevik <enes@nsvke.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant