Skip to content

testsuite: Add the alloc crate to the testsuite - #4693

Merged
P-E-P merged 2 commits into
Rust-GCC:masterfrom
nsvke:alloc-testsuite
Aug 23, 2026
Merged

testsuite: Add the alloc crate to the testsuite#4693
P-E-P merged 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. A few temporary source-level workarounds were required to bypass current compiler limitations.

Currently, the entire crate successfully compiles until the name resolution phase

@powerboat9

Copy link
Copy Markdown
Collaborator

Could you stick a copy of the 1.49 alloc crate in libgrust/rustc-lib/?

@nsvke
nsvke force-pushed the alloc-testsuite branch 3 times, most recently from ffadbe6 to c49ab80 Compare August 10, 2026 09:38
nsvke added 2 commits August 16, 2026 11:09
This commit imports liballoc 1.49.0.

libgrust/ChangeLog:

	* rustc-lib/version-info:
	* rustc-lib/alloc/Cargo.toml: New file.
	* rustc-lib/alloc/benches/binary_heap.rs: New file.
	* rustc-lib/alloc/benches/btree/map.rs: New file.
	* rustc-lib/alloc/benches/btree/mod.rs: New file.
	* rustc-lib/alloc/benches/btree/set.rs: New file.
	* rustc-lib/alloc/benches/lib.rs: New file.
	* rustc-lib/alloc/benches/linked_list.rs: New file.
	* rustc-lib/alloc/benches/slice.rs: New file.
	* rustc-lib/alloc/benches/str.rs: New file.
	* rustc-lib/alloc/benches/string.rs: New file.
	* rustc-lib/alloc/benches/vec.rs: New file.
	* rustc-lib/alloc/benches/vec_deque.rs: New file.
	* rustc-lib/alloc/benches/vec_deque_append.rs: New file.
	* rustc-lib/alloc/src/alloc.rs: New file.
	* rustc-lib/alloc/src/alloc/tests.rs: New file.
	* rustc-lib/alloc/src/borrow.rs: New file.
	* rustc-lib/alloc/src/boxed.rs: New file.
	* rustc-lib/alloc/src/collections/binary_heap.rs: New file.
	* rustc-lib/alloc/src/collections/btree/append.rs: New file.
	* rustc-lib/alloc/src/collections/btree/borrow.rs: New file.
	* rustc-lib/alloc/src/collections/btree/borrow/tests.rs: New file.
	* rustc-lib/alloc/src/collections/btree/map.rs: New file.
	* rustc-lib/alloc/src/collections/btree/map/entry.rs: New file.
	* rustc-lib/alloc/src/collections/btree/map/tests.rs: New file.
	* rustc-lib/alloc/src/collections/btree/mem.rs: New file.
	* rustc-lib/alloc/src/collections/btree/merge_iter.rs: New file.
	* rustc-lib/alloc/src/collections/btree/mod.rs: New file.
	* rustc-lib/alloc/src/collections/btree/navigate.rs: New file.
	* rustc-lib/alloc/src/collections/btree/node.rs: New file.
	* rustc-lib/alloc/src/collections/btree/node/tests.rs: New file.
	* rustc-lib/alloc/src/collections/btree/remove.rs: New file.
	* rustc-lib/alloc/src/collections/btree/search.rs: New file.
	* rustc-lib/alloc/src/collections/btree/set.rs: New file.
	* rustc-lib/alloc/src/collections/btree/set/tests.rs: New file.
	* rustc-lib/alloc/src/collections/btree/split.rs: New file.
	* rustc-lib/alloc/src/collections/linked_list.rs: New file.
	* rustc-lib/alloc/src/collections/linked_list/tests.rs: New file.
	* rustc-lib/alloc/src/collections/mod.rs: New file.
	* rustc-lib/alloc/src/collections/vec_deque.rs: New file.
	* rustc-lib/alloc/src/collections/vec_deque/drain.rs: New file.
	* rustc-lib/alloc/src/collections/vec_deque/tests.rs: New file.
	* rustc-lib/alloc/src/fmt.rs: New file.
	* rustc-lib/alloc/src/lib.rs: New file.
	* rustc-lib/alloc/src/macros.rs: New file.
	* rustc-lib/alloc/src/prelude/mod.rs: New file.
	* rustc-lib/alloc/src/prelude/v1.rs: New file.
	* rustc-lib/alloc/src/raw_vec.rs: New file.
	* rustc-lib/alloc/src/raw_vec/tests.rs: New file.
	* rustc-lib/alloc/src/rc.rs: New file.
	* rustc-lib/alloc/src/rc/tests.rs: New file.
	* rustc-lib/alloc/src/slice.rs: New file.
	* rustc-lib/alloc/src/str.rs: New file.
	* rustc-lib/alloc/src/string.rs: New file.
	* rustc-lib/alloc/src/sync.rs: New file.
	* rustc-lib/alloc/src/sync/tests.rs: New file.
	* rustc-lib/alloc/src/task.rs: New file.
	* rustc-lib/alloc/src/tests.rs: New file.
	* rustc-lib/alloc/src/vec.rs: New file.
	* rustc-lib/alloc/tests/arc.rs: New file.
	* rustc-lib/alloc/tests/binary_heap.rs: New file.
	* rustc-lib/alloc/tests/borrow.rs: New file.
	* rustc-lib/alloc/tests/boxed.rs: New file.
	* rustc-lib/alloc/tests/btree_set_hash.rs: New file.
	* rustc-lib/alloc/tests/cow_str.rs: New file.
	* rustc-lib/alloc/tests/fmt.rs: New file.
	* rustc-lib/alloc/tests/heap.rs: New file.
	* rustc-lib/alloc/tests/lib.rs: New file.
	* rustc-lib/alloc/tests/linked_list.rs: New file.
	* rustc-lib/alloc/tests/rc.rs: New file.
	* rustc-lib/alloc/tests/slice.rs: New file.
	* rustc-lib/alloc/tests/str.rs: New file.
	* rustc-lib/alloc/tests/string.rs: New file.
	* rustc-lib/alloc/tests/vec.rs: New file.
	* rustc-lib/alloc/tests/vec_deque.rs: New file.

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 the `ForceResult` enum due to issue Rust-GCC#4687 in
  collections/btree/node.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>
@nsvke
nsvke marked this pull request as ready for review August 16, 2026 08:13
@nsvke

nsvke commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@CohenArthur @P-E-P

$srcdir/$subdir/alloc/* \
]]

dg-runtest $srcdir/$subdir/alloc/src/lib.rs "-frust-edition=2015 -frust-crate=alloc -frust-compile-until=nameresolution -frust-cfg=target_has_atomic=\"ptr\" -w" ""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we compile this using edition 2018 ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but the 2018 edition causes unexpected errors. I'll handle this, but I don't have time right now. I am temporarily using 2015 to protect it from regressions.

@P-E-P
P-E-P added this pull request to the merge queue Aug 23, 2026
Merged via the queue into Rust-GCC:master with commit 46cdf51 Aug 23, 2026
13 checks passed
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.

3 participants