diff options
author | Philip Herron <herron.philip@googlemail.com> | 2025-04-02 16:16:47 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2025-04-02 17:49:58 +0000 |
commit | 8cd24f83386f0e7c20c80f1517d8236515767f51 (patch) | |
tree | 726df234dc1cbb732d1bc89f45de524eb7977ba5 /gcc/rust/ast/rust-expr.h | |
parent | 20c8539a23e0a0462e3763c3983ffb3ca9b7e709 (diff) | |
download | gcc-8cd24f83386f0e7c20c80f1517d8236515767f51.zip gcc-8cd24f83386f0e7c20c80f1517d8236515767f51.tar.gz gcc-8cd24f83386f0e7c20c80f1517d8236515767f51.tar.bz2 |
gccrs: Fix ICE when there are 2 functions named main
We need to setup the main_identifier_node for MAIN_DECL_P checks in the
middle-end. But it is valid to have a main function/method on impl blocks.
So we need to flag if this is a "root" item or not, which is one that is
jsut an HIR::Function on part of the Crate::items as oppposed to a
HIR::Function which is part of an HIR::ImplBlock as part of the HIR::Crate.
Some small cleanups have been added here too.
Fixes Rust-GCC#3648
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc: new flag is_root_item
* backend/rust-compile-base.h: update prototype
* backend/rust-compile-implitem.cc (CompileTraitItem::visit): update call
* backend/rust-compile-implitem.h: remove old debug internal error
* backend/rust-compile-item.cc (CompileItem::visit): update call
* backend/rust-compile-item.h: remove old debug
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): update calls
* backend/rust-compile.cc: likewise
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait):
remove assertion and error
gcc/testsuite/ChangeLog:
* rust/compile/issue-3648.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust/ast/rust-expr.h')
0 files changed, 0 insertions, 0 deletions