Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No fields in initializer - Internal compiler error #2389

Closed
MahadMuhammad opened this issue Jul 6, 2023 · 2 comments · Fixed by #2793
Closed

No fields in initializer - Internal compiler error #2389

MahadMuhammad opened this issue Jul 6, 2023 · 2 comments · Fixed by #2793
Assignees

Comments

@MahadMuhammad
Copy link
Contributor

No fields in initializer - Internal compiler error - E0063


I tried the modified code from E0063:

  • No field in initializer
// https://doc.rust-lang.org/error_codes/E0063.html
struct Foo {
    x: i32,
    y: i32,
}

fn main() {
    let x = Foo { }; // error: No Field
}

I expected to see this happen:

  • Emit error message, similiar to rustc .i.e.,
    • emit the name of initializer & field
  • Error message emitted by rustc:
missing fields `x`, `y` in initializer of `Foo`

Instead, this happened:

  • Internal Compile Error.
  • This is the output of gccrs:
➜  gccrs-build gcc/crab1 /home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/missing_constructor_fields.rs
crab1: internal compiler error: in visit, at rust/backend/rust-compile-expr.cc:405
0x7bd9e5 Rust::Compile::CompileExpr::visit(Rust::HIR::StructExprStruct&)
	../../gccrs/gcc/rust/backend/rust-compile-expr.cc:405
0xc63414 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr*, Rust::Compile::Context*)
	../../gccrs/gcc/rust/backend/rust-compile-expr.cc:45
0xc62286 Rust::Compile::CompileStmt::visit(Rust::HIR::LetStmt&)
	../../gccrs/gcc/rust/backend/rust-compile-stmt.cc:63
0xc62421 Rust::Compile::CompileStmt::Compile(Rust::HIR::Stmt*, Rust::Compile::Context*)
	../../gccrs/gcc/rust/backend/rust-compile-stmt.cc:34
0xc8a79b Rust::Compile::HIRCompileBase::compile_function_body(tree_node*, Rust::HIR::BlockExpr&, Rust::TyTy::BaseType*)
	../../gccrs/gcc/rust/backend/rust-compile-base.cc:476
0xc8c84e Rust::Compile::HIRCompileBase::compile_function(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Rust::HIR::SelfParam&, std::vector<Rust::HIR::FunctionParam, std::allocator<Rust::HIR::FunctionParam> >&, Rust::HIR::FunctionQualifiers const&, Rust::HIR::Visibility&, std::vector<Rust::AST::Attribute, std::allocator<Rust::AST::Attribute> >&, Location, Rust::HIR::BlockExpr*, Rust::Resolver::CanonicalPath const*, Rust::TyTy::FnType*)
	../../gccrs/gcc/rust/backend/rust-compile-base.cc:643
0xc6176e Rust::Compile::CompileItem::visit(Rust::HIR::Function&)
	../../gccrs/gcc/rust/backend/rust-compile-item.cc:181
0xa73659 Rust::Compile::CompileItem::compile(Rust::HIR::Item*, Rust::Compile::Context*, Rust::TyTy::BaseType*, bool, Location)
	../../gccrs/gcc/rust/backend/rust-compile-item.h:38
0xa73659 Rust::Compile::CompileCrate::go()
	../../gccrs/gcc/rust/backend/rust-compile.cc:47
0xa736a8 Rust::Compile::CompileCrate::Compile(Rust::HIR::Crate&, Rust::Compile::Context*)
	../../gccrs/gcc/rust/backend/rust-compile.cc:40
0xa6ec6a Rust::Session::compile_crate(char const*)
	../../gccrs/gcc/rust/rust-session-manager.cc:653
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.

Meta

  • What version of Rust GCC were you using, git sha 5437803.
  • gccrs (Compiler-Explorer-Build-gcc-2f91d511200bf85558c9013b09a458c06edd1e02-binutils-2.40) 13.0.1 20230417 (experimental)

@philberty
Copy link
Member

I'm going to open this up for good-first-PR its a fairly nice one to sink your teeth into.

@philberty philberty removed their assignment Dec 12, 2023
@robertgoss
Copy link
Contributor

Hi I would like to pick this up if that is ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants