-
Notifications
You must be signed in to change notification settings - Fork 197
Closed
Labels
Description
No fields in initializer - Internal compiler error - E0063
- Fixing this issue, help [E0063] constructor is missing fields #2387 to emit more user friendly error code and error emission similiar to rustc.
- You can view the same on
compiler-explorer
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
- emit the name of
- 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)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done