Skip to content

NR2: ICE: in visit_attributes, at rust/resolve/rust-early-name-resolver-2.0.cc:351 #3661

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use -frust-name-resolution-2.0
// #42164

pub macro m($inner_str:expr) {
    #[m = $inner_str]
    struct S;
}

fn main() {
    m!(stringify!(foo));
}

original:

// run-pass
// #42164

#![feature(allow)]
#![feature(decl_macro)]

pub macro m($inner_str:expr) {
    #[m = $inner_str]
    struct S;
}

macro_rules! define_f {
    ($name:expr) => {
        #[export_name = $name]
        fn f() {}
    }
}

fn main() {
    define_f!(concat!("exported_", "f"));
    m!(stringify!(foo));
}

Version information:

7651217

Possibly related line of code:

"could not resolve attribute macro invocation"));
return;
}
auto pm_def = mappings.lookup_attribute_proc_macro_def (
definition->get_node_id ());
rust_assert (pm_def.has_value ());
mappings.insert_attribute_proc_macro_invocation (attr.get_path (),
pm_def.value ());
}
}
}

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

Program output

crab1: internal compiler error: in visit_attributes, at rust/resolve/rust-early-name-resolver-2.0.cc:351
0x88d9e3 Rust::Resolver2_0::Early::visit_attributes(std::vector<Rust::AST::Attribute, std::allocator<Rust::AST::Attribute> >&)
	../../gcc/rust/resolve/rust-early-name-resolver-2.0.cc:351
0xeb05c6 Rust::Resolver2_0::Early::visit(Rust::AST::StructStruct&)
	../../gcc/rust/resolve/rust-early-name-resolver-2.0.cc:369
0xca803f void Rust::AST::DefaultASTVisitor::visit<Rust::AST::Stmt>(std::unique_ptr<Rust::AST::Stmt, std::default_delete<Rust::AST::Stmt> >&)
	../../gcc/rust/ast/rust-ast-visitor.h:406
0xca803f Rust::AST::DefaultASTVisitor::visit(Rust::AST::BlockExpr&)
	../../gcc/rust/ast/rust-ast-visitor.cc:452
0xe9a313 std::function<void ()>::operator()() const
	/usr/include/c++/14.2.1/bits/std_function.h:591
0xe9a313 Rust::Resolver2_0::NameResolutionContext::scoped(Rust::Resolver2_0::Rib::Kind, unsigned int, std::function<void ()>, tl::optional<Rust::Identifier>)
	../../gcc/rust/resolve/rust-name-resolution-context.cc:122
0xe9e04d Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::BlockExpr&)
	../../gcc/rust/resolve/rust-default-resolver.cc:35
0xeadd91 Rust::Resolver2_0::Early::visit(Rust::AST::BlockExpr&)
	../../gcc/rust/resolve/rust-early-name-resolver-2.0.cc:218
0xe9a313 std::function<void ()>::operator()() const
	/usr/include/c++/14.2.1/bits/std_function.h:591
0xe9a313 Rust::Resolver2_0::NameResolutionContext::scoped(Rust::Resolver2_0::Rib::Kind, unsigned int, std::function<void ()>, tl::optional<Rust::Identifier>)
	../../gcc/rust/resolve/rust-name-resolution-context.cc:122
0xe9e133 Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Function&)
	../../gcc/rust/resolve/rust-default-resolver.cc:53
0xeadf0f Rust::Resolver2_0::Early::go(Rust::AST::Crate&)
	../../gcc/rust/resolve/rust-early-name-resolver-2.0.cc:66
0xcd2487 Rust::Session::expansion(Rust::AST::Crate&, Rust::Resolver2_0::NameResolutionContext&)
	../../gcc/rust/rust-session-manager.cc:949
0xce8931 Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:619
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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions