Extern prelude handling - #4758
Draft
P-E-P wants to merge 8 commits into
Draft
Conversation
We usually test components independently, this means we did not test for lang item declaration within external crate. This commit introduces a new test directory to test external crate boundary. gcc/testsuite/ChangeLog: * rust/minicore/extern_lang_items.rs: New test. * rust/minicore/extern_lang_items_core/lib.rs: New test. * rust/minicore/minicore.exp: New test. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Macros are already emitted by the AST dump within metadata files, we no longer require a separate export pass from within the metadata exporter. gcc/rust/ChangeLog: * metadata/rust-export-metadata.cc (PublicInterface::gather_export_data): Do not emit macros separately anymore. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Add a few crates from the linux kernel to make sure core crate interactions does not break in the future. gcc/testsuite/ChangeLog: * rust/minicore/build_error.rs: New test. * rust/minicore/build_error_core/lib.rs: New test. * rust/minicore/compiler_builtins.rs: New test. * rust/minicore/compiler_builtins_core/lib.rs: New test. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Return the injected crate's node id. gcc/rust/ChangeLog: * ast/rust-ast.cc (Crate::inject_extern_crate): Return the injected crate's node id. * ast/rust-ast.h: Update the function's prototype. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Kernel and core related tests as well as their core crate needs to be compiled with a matching rust edition. In order to enforce that we control the edition from the testsuite instead of relying on a per crate edition change. Moreover, the kernel and core 1.49 is meant to be compiled with rust edition 2018, using this edition will make things easier for us. gcc/testsuite/ChangeLog: * rust/minicore/minicore.exp: Enforce crate edition at test top level. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Node streaming started from the root and did not walk through the different preludes within the forever stack. This enables a more complete representation of the forever stack. gcc/rust/ChangeLog: * resolve/rust-forever-stack.hxx: Stream extern and lang prelude nodes. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
This data structure is complex, when using the debug dump within a debugger we often need to know what is the current state and where new nodes will be pushed within the forever stack. gcc/rust/ChangeLog: * resolve/rust-forever-stack.hxx: Debug the forever stack cursor position. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
We did not assign any node id to neither extern and lang prelude nodes and this was confusing and could lead to unexpected behaviors (duplicate ids). gcc/rust/ChangeLog: * resolve/rust-forever-stack.h: Assign a node id to extern and lang nodes. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
P-E-P
force-pushed
the
extern_prelude_2
branch
2 times, most recently
from
August 20, 2026 11:00
7142fb2 to
b8dd134
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.