Rust-GCC / Rust-GCC/gccrs

ICE in get_ast_crate_by_node_id_raw, at rust/util/rust-hir-map.cc

Open
#4,614 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
2.9k
Forks
231
Avg merge
19h 55m
Merged PRs (30d)
67

Description

auto-reduced (treereduce-rust):

//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use
use crate::{
    self, {self},
};

original:

#![feature(no_core)]
#![no_core]
use crate::{
    self, {self},
};

Version information:

696cb485cfa9969c952d6765889d82ed548ca15c

Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/696cb485cfa9969c952d6765889d82ed548ca15c/gcc/rust/util/rust-hir-map.cc#L256-L268

Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use

Program output

crab1: error: failed to locate crate ‘core’
crab1: error: failed to locate crate ‘std’
crab1: error: unknown crate ‘core’
crab1: error: unknown crate ‘std’
crab1: internal compiler error: in get_ast_crate_by_node_id_raw, at rust/util/rust-hir-map.cc:262
0x32c0107 internal_error(char const*, ...)
	../../gcc/diagnostic-global-context.cc:787
0xc7e0b1 fancy_abort(char const*, int, char const*)
	../../gcc/diagnostics/context.cc:1813
0x91b01f Rust::Analysis::Mappings::get_ast_crate_by_node_id_raw(unsigned int)
	../../gcc/rust/util/rust-hir-map.cc:262
0x91b01f Rust::Analysis::Mappings::get_ast_crate_by_node_id_raw(unsigned int)
	../../gcc/rust/util/rust-hir-map.cc:259
0xf91c1e Rust::Analysis::Mappings::insert_glob_container(unsigned int, Rust::AST::GlobContainer*)
	../../gcc/rust/util/rust-hir-map.cc:1166
0xffd866 Rust::Resolver2_0::Early::finalize_rebind_import(Rust::Resolver2_0::Early::ImportPair const&)
	../../gcc/rust/resolve/rust-early-name-resolver-2.0.cc:560
0x1002b64 Rust::Resolver2_0::Early::visit(Rust::AST::UseDeclaration&)
	../../gcc/rust/resolve/rust-early-name-resolver-2.0.cc:598
0xe7f21f void Rust::AST::DefaultASTVisitor::visit<Rust::AST::Item>(std::unique_ptr<Rust::AST::Item, std::default_delete<Rust::AST::Item> >&)
	../../gcc/rust/ast/rust-ast-visitor.h:421
0xe7f21f Rust::AST::DefaultASTVisitor::visit(Rust::AST::Crate&)
	../../gcc/rust/ast/rust-ast-visitor.cc:39
0xfedeb8 operator()
	../../gcc/rust/resolve/rust-default-resolver.cc:39
0xfedeb8 scope_inner<Rust::Resolver2_0::CanonicalPathCtx::scope_crate<Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Crate&)::<lambda()>&>(Rust::NodeId, std::string, Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Crate&)::<lambda()>&)::<lambda()>, Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Crate&)::<lambda()>&>
	../../gcc/rust/resolve/rust-name-resolution-context.h:456
0xfedeb8 scope_crate<Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Crate&)::<lambda()>&>
	../../gcc/rust/resolve/rust-name-resolution-context.h:431
0xfedeb8 Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Crate&)
	../../gcc/rust/resolve/rust-default-resolver.cc:48
0xfedeb8 Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Crate&)
	../../gcc/rust/resolve/rust-default-resolver.cc:32
0xffe3b0 Rust::Resolver2_0::Early::go(Rust::AST::Crate&)
	../../gcc/rust/resolve/rust-early-name-resolver-2.0.cc:80
0xeb7f28 Rust::Session::expansion(Rust::AST::Crate&, Rust::Resolver2_0::NameResolutionContext&)
	../../gcc/rust/rust-session-manager.cc:1077
0xec6747 Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:737
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 /tmp/icemaker_global_tempdir.mvX4OLoQFu8L/rustc_testrunner_tmpdir_reporting.mc7y53golyga/mvce.rs -o/tmp/icemaker_global_tempdir.mvX4OLoQFu8L/rustc_testrunner_tmpdir_reporting.mc7y53golyga/binaryname -frust-incomplete-and-experimental-compiler-do-not-use
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reduced Rust reproducer and the stack trace through rust/resolve/rust-early-name-resolver-2.0.cc and rust/util/rust-hir-map.cc, especially get_ast_crate_by_node_id_raw and insert_glob_container. Run crab1 with the reported flag to confirm the failure. Done means the reproducer no longer triggers an internal compiler error while preserving appropriate diagnostics for the missing crates.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.